diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-08-07 10:24:05 +0200 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-08-08 11:05:56 +0200 |
commit | e845663d154a94d76131dd3ab3534037a3bb516e (patch) | |
tree | 05ef786a1f8e745d0722dcc202efff29abd58813 /util | |
parent | 548451d9e4ef003dd64714d31850f04911eb7277 (diff) | |
download | telepathy-mission-control-e845663d154a94d76131dd3ab3534037a3bb516e.tar.gz |
mc-tool: add 'dump' command
Useful to quickly check all the accounts in one shot.
https://bugs.freedesktop.org/show_bug.cgi?id=53202
Diffstat (limited to 'util')
-rw-r--r-- | util/mc-tool.c | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/util/mc-tool.c b/util/mc-tool.c index 68d7e661..7d46147d 100644 --- a/util/mc-tool.c +++ b/util/mc-tool.c @@ -45,6 +45,7 @@ show_help (gchar * err) printf ("Usage:\n" " %1$s list\n" " %1$s summary\n" + " %1$s dump\n" " %1$s add <manager>/<protocol> <display name> [<param> ...]\n" " %1$s update <account name> [<param>|clear:key] ...\n" " %1$s display <account name> <display name>\n" @@ -805,6 +806,30 @@ command_show (TpAccount *account) } static gboolean +command_dump (TpAccountManager *manager) +{ + GList *accounts, *l; + + accounts = tp_account_manager_get_valid_accounts (manager); + if (accounts == NULL) { + return FALSE; + } + command.common.ret = 0; + + for (l = accounts; l != NULL; l = l->next) { + TpAccount *account = TP_ACCOUNT (l->data); + + command_show (account); + + if (l->next != NULL) + printf ("\n------------------------------------------------------------\n\n"); + } + + g_list_free (accounts); + return FALSE; /* stop mainloop */ +} + +static gboolean command_connection (TpAccount *account) { TpConnection *conn; @@ -1088,6 +1113,14 @@ parse (int argc, char **argv) command.ready.manager = command_summary; } + else if (strcmp (argv[1], "dump") == 0) + { + /* Dump all accounts */ + if (argc != 2) + show_help ("Invalid dump command."); + + command.ready.manager = command_dump; + } else if (strcmp (argv[1], "remove") == 0 || strcmp (argv[1], "delete") == 0) { @@ -1366,6 +1399,8 @@ main (int argc, char **argv) TpAccount *a = NULL; TpDBusDaemon *dbus = NULL; GError *error = NULL; + const GQuark features[] = { TP_ACCOUNT_FEATURE_CORE, + TP_ACCOUNT_FEATURE_ADDRESSING, TP_ACCOUNT_FEATURE_STORAGE, 0 }; g_type_init (); @@ -1383,12 +1418,16 @@ main (int argc, char **argv) } if (command.common.account == NULL) { + TpSimpleClientFactory *factory; + am = tp_account_manager_new (dbus); + factory = tp_proxy_get_factory (am); + + tp_simple_client_factory_add_account_features (factory, features); + tp_proxy_prepare_async (am, NULL, manager_ready, NULL); } else { - const GQuark features[] = { TP_ACCOUNT_FEATURE_CORE, - TP_ACCOUNT_FEATURE_ADDRESSING, TP_ACCOUNT_FEATURE_STORAGE, 0 }; command.common.account = ensure_prefix (command.common.account); a = tp_account_new (dbus, command.common.account, &error); |