2012-11-15 [wwp] 3.9.0cvs3
[claws.git] / src / main.c
index 443e4195483f1f867dd50ecb18834112855d942f..6e9b246c25035068a542ec723621e5dc2dcab089 100644 (file)
@@ -204,6 +204,7 @@ typedef enum
 static struct RemoteCmd {
        gboolean receive;
        gboolean receive_all;
+       gboolean cancel_receiving;
        gboolean compose;
        const gchar *compose_mailto;
        GList *attach_files;
@@ -1131,7 +1132,7 @@ int main(int argc, char *argv[])
 #endif
 
        if (cmd.status || cmd.status_full || cmd.search ||
-               cmd.statistics || cmd.reset_statistics) {
+               cmd.statistics || cmd.reset_statistics || cmd.cancel_receiving) {
                puts("0 Claws Mail not running.");
                lock_socket_remove();
                return 0;
@@ -1931,6 +1932,8 @@ static void parse_cmd_opt(int argc, char *argv[])
                        cmd.receive_all = TRUE;
                } else if (!strncmp(argv[i], "--receive", 9)) {
                        cmd.receive = TRUE;
+               } else if (!strncmp(argv[i], "--cancel-receiving", 18)) {
+                       cmd.cancel_receiving = TRUE;
                } else if (!strncmp(argv[i], "--compose-from-file", 19)) {
                        const gchar *p = (i+1 < argc)?argv[i+1]:NULL;
 
@@ -2053,6 +2056,7 @@ static void parse_cmd_opt(int argc, char *argv[])
                                          "                         attached"));
                        g_print("%s\n", _("  --receive              receive new messages"));
                        g_print("%s\n", _("  --receive-all          receive new messages of all accounts"));
+                       g_print("%s\n", _("  --cancel-receiving     cancel receiving of messages"));
                        g_print("%s\n", _("  --search folder type request [recursive]\n"
                                          "                         searches mail\n"
                                          "                         folder ex.: \"#mh/Mailbox/inbox\" or \"Mail\"\n"
@@ -2381,6 +2385,8 @@ static gint prohibit_duplicate_launch(void)
                fd_write_all(uxsock, "receive_all\n", 12);
        } else if (cmd.receive) {
                fd_write_all(uxsock, "receive\n", 8);
+       } else if (cmd.cancel_receiving) {
+               fd_write_all(uxsock, "cancel_receiving\n", 17);
        } else if (cmd.compose && cmd.attach_files) {
                gchar *str, *compose_str;
 
@@ -2566,6 +2572,9 @@ static void lock_socket_input_cb(gpointer data,
                                     prefs_common.newmail_notify_manu);
        } else if (!strncmp(buf, "receive", 7)) {
                inc_mail(mainwin, prefs_common.newmail_notify_manu);
+       } else if (!strncmp(buf, "cancel_receiving", 16)) {
+               inc_cancel_all();
+               imap_cancel_all();
        } else if (!strncmp(buf, "compose_attach", 14)) {
                GList *files = NULL, *curr;
                AttachInfo *ainfo;