summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2012-02-13 12:47:07 +0000
committerWill Thompson <will.thompson@collabora.co.uk>2013-06-23 16:06:03 +0100
commit9ffab2b80a0395dd681dc740dc29ddf20f0ff841 (patch)
tree83af2447fa31ef55a63f1940e666a4a70a089113
parentc53a7c69b9b6615a73a392879458f6a4314ca1a8 (diff)
downloadtelepathy-gabble-9ffab2b80a0395dd681dc740dc29ddf20f0ff841.tar.gz
console UI: list possible account identifiers
-rwxr-xr-xplugins/telepathy-gabble-xmpp-console23
1 files changed, 19 insertions, 4 deletions
diff --git a/plugins/telepathy-gabble-xmpp-console b/plugins/telepathy-gabble-xmpp-console
index 731929ba1..7e473d468 100755
--- a/plugins/telepathy-gabble-xmpp-console
+++ b/plugins/telepathy-gabble-xmpp-console
@@ -357,20 +357,35 @@ plugin installed.""" % locals()
GABBLE_PREFIX = 'org.freedesktop.Telepathy.Connection.gabble.jabber.'
AM_BUS_NAME = 'org.freedesktop.Telepathy.AccountManager'
+AM_PATH = '/org/freedesktop/Telepathy/AccountManager'
+AM_IFACE = 'org.freedesktop.Telepathy.AccountManager'
ACCOUNT_PREFIX = '/org/freedesktop/Telepathy/Account'
ACCOUNT_IFACE = 'org.freedesktop.Telepathy.Account'
-def usage():
+def usage(bus):
+ am_proxy = Gio.DBusProxy.new_sync(bus, 0, None,
+ AM_BUS_NAME, AM_PATH, AM_IFACE, None)
+ valid_accounts = am_proxy.get_cached_property('ValidAccounts').get_objv()
+ xmpp_accounts = sorted(
+ path[len(ACCOUNT_PREFIX + '/'):]
+ for path in valid_accounts
+ if path.startswith(ACCOUNT_PREFIX + '/gabble/')
+ )
+
print """
Usage:
%(arg0)s gabble/jabber/blahblah
%(arg0)s %(prefix)sblahblah
-List account identifiers using `mc-tool list | grep gabble`.
+Here are some account identifiers:
+
+ %(accounts)s
+
List connection bus names using `qdbus | grep gabble`.
""" % { 'arg0': sys.argv[0],
'prefix': GABBLE_PREFIX,
+ 'accounts': '\n '.join(xmpp_accounts),
}
raise SystemExit(1)
@@ -378,7 +393,7 @@ if __name__ == '__main__':
bus = Gio.bus_get_sync(Gio.BusType.SESSION, None)
if len(sys.argv) != 2:
- usage()
+ usage(bus)
thing = sys.argv[1]
@@ -395,7 +410,7 @@ if __name__ == '__main__':
thing = nameify(path)
if not re.match('^%s[a-zA-Z0-9_]+$' % GABBLE_PREFIX, thing):
- usage()
+ usage(bus)
win = Window(bus, thing)
win.show_all()