+ account_name =
+ g_strdup(modest_window_get_active_account(MODEST_WINDOW(win)));
+ if (!account_name)
+ account_name = modest_account_mgr_get_default_account (modest_runtime_get_account_mgr());
+ if (!account_name) {
+ g_printerr ("modest: cannot get account\n");
+ return;
+ }
+
+ tny_account =
+ modest_tny_account_store_get_tny_account_by_account (modest_runtime_get_account_store(),
+ account_name,
+ TNY_ACCOUNT_TYPE_TRANSPORT);
+ if (!tny_account) {
+ g_printerr ("modest: cannot get tny transport account for %s\n", account_name);
+ return;
+ }
+ send_queue = modest_tny_send_queue_new (TNY_CAMEL_TRANSPORT_ACCOUNT(tny_account));
+ if (!send_queue) {
+ g_object_unref (G_OBJECT(tny_account));
+ g_printerr ("modest: cannot get send queue for %s\n", account_name);
+ return;
+ }
+ //modest_tny_send_queue_flush (send_queue);
+
+ g_object_unref (G_OBJECT(send_queue));
+ g_object_unref (G_OBJECT(tny_account));
+
+ tny_account =
+ modest_tny_account_store_get_tny_account_by_account (modest_runtime_get_account_store(),
+ account_name,
+ TNY_ACCOUNT_TYPE_STORE);
+ if (!tny_account) {
+ g_printerr ("modest: cannot get tny store account for %s\n", account_name);
+ return;
+ }
+
+ mail_op = modest_mail_operation_new ();
+ modest_mail_operation_update_account (mail_op, TNY_STORE_ACCOUNT(tny_account));
+
+ g_object_unref (G_OBJECT(tny_account));
+ /* g_object_unref (G_OBJECT(mail_op)); FIXME: this is still in use... */