#!/usr/bin/env python import conic import dbus import gobject import dbus.glib accounts = { "account": ["connection1", "connection2"], } loop = gobject.MainLoop() bus = dbus.SessionBus() def state(account, new): accountd = bus.get_object('org.freedesktop.Telepathy.AccountManager', account) iface = dbus.Interface(accountd, 'org.freedesktop.DBus.Properties') iface.Set("org.freedesktop.Telepathy.Account", "Enabled", new) def connection_cb(connection, event): if event.get_status() == conic.STATUS_CONNECTED: iap_id = event.get_iap_id() for account in accounts: state(account, iap_id in accounts[account]) connection = conic.Connection() connection.connect("connection-event", connection_cb) connection.set_property("automatic-connection-events", True) loop.run()
/usr/bin/dbus-send --type=method_call --print-reply --dest=org.freedesktop.Telepathy.AccountManager /org/freedesktop/Telepathy/AccountManager org.freedesktop.DBus.Properties.Get string:org.freedesktop.Telepathy.AccountManager string:ValidAccounts
import conic iaps = conic.Connection().get_all_iaps() for iap in iaps: print "%s - %s" % (iap.get_name(), iap.get_id())
accounts = { "/org/freedesktop/Telepathy/Account/gabble/jabber/florenzi_40gmail_2ecom0": ["ffcd0203-51ae-4bde-9622-d0256937b11b"], }