+ DBusMessage *reply;
+ dbus_uint32_t serial = 0;
+
+ /* operations queue; */
+ op_queue_str = modest_mail_operation_queue_to_string
+ (modest_runtime_get_mail_operation_queue ());
+
+ str = g_strdup_printf ("\noperation queue\n"
+ "===============\n"
+ "status: %s\n"
+ "%s\n",
+ tny_device_is_online (modest_runtime_get_device ()) ? "online" : "offline",
+ op_queue_str);
+ g_free (op_queue_str);
+
+ g_printerr (str);
+
+ reply = dbus_message_new_method_return (message);
+ if (reply) {
+ dbus_message_append_args (reply,
+ DBUS_TYPE_STRING, &str,
+ DBUS_TYPE_INVALID);
+ dbus_connection_send (con, reply, &serial);
+ dbus_connection_flush (con);
+ dbus_message_unref (reply);
+ }
+
+ g_free (str);
+ return OSSO_OK;
+}
+
+
+
+static gint
+on_dbus_method_dump_accounts (DBusConnection *con, DBusMessage *message)
+{
+ gchar *str;
+
+ DBusMessage *reply;
+ dbus_uint32_t serial = 0;
+
+ GSList *account_names, *cursor;
+
+ str = g_strdup ("\naccounts\n========\n");
+
+ cursor = account_names = modest_account_mgr_account_names
+ (modest_runtime_get_account_mgr(), TRUE); /* only enabled accounts */
+
+ while (cursor) {
+ TnyAccount *acc;
+ gchar *tmp, *accname = (gchar*)cursor->data;
+
+ tmp = g_strdup_printf ("%s[%s]\n", str, accname);
+ g_free (str);
+ str = tmp;
+
+ /* store */
+ acc = modest_tny_account_store_get_server_account (
+ modest_runtime_get_account_store(), accname,
+ TNY_ACCOUNT_TYPE_STORE);
+ if (TNY_IS_ACCOUNT(acc)) {
+ gchar *tmp, *url = tny_account_get_url_string (acc);
+ tmp = g_strdup_printf ("%sstore : '%s': %s\n",
+ str, tny_account_get_id (acc), url);
+ g_free (str);
+ str = tmp;
+ g_free (url);
+ g_object_unref (acc);
+ }
+
+ /* transport */
+ acc = modest_tny_account_store_get_server_account (
+ modest_runtime_get_account_store(), accname,
+ TNY_ACCOUNT_TYPE_TRANSPORT);
+ if (TNY_IS_ACCOUNT(acc)) {
+ gchar *tmp, *url = tny_account_get_url_string (acc);
+ tmp = g_strdup_printf ("%stransport: '%s': %s\n",
+ str, tny_account_get_id (acc), url);
+ g_free (str);
+ str = tmp;
+ g_free (url);
+ g_object_unref (acc);
+ }
+
+ cursor = g_slist_next (cursor);
+ }
+
+ modest_account_mgr_free_account_names (account_names);
+
+ g_printerr (str);
+
+ reply = dbus_message_new_method_return (message);
+ if (reply) {
+ dbus_message_append_args (reply,
+ DBUS_TYPE_STRING, &str,
+ DBUS_TYPE_INVALID);
+ dbus_connection_send (con, reply, &serial);
+ dbus_connection_flush (con);
+ dbus_message_unref (reply);
+ }
+
+ g_free (str);
+ return OSSO_OK;