2012-11-27 [wwp] 3.9.0cvs21
authorTristan Chabredier <wwp@claws-mail.org>
Tue, 27 Nov 2012 08:47:06 +0000 (08:47 +0000)
committerTristan Chabredier <wwp@claws-mail.org>
Tue, 27 Nov 2012 08:47:06 +0000 (08:47 +0000)
* doc/man/claws-mail.1
* src/main.c
* src/send_message.c
* src/send_message.h
Add --cancel-sending command-line switch.

ChangeLog
PATCHSETS
configure.ac
doc/man/claws-mail.1
src/main.c
src/send_message.c
src/send_message.h

index 2d24b28..42802b0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-11-27 [wwp]       3.9.0cvs21
+
+       * doc/man/claws-mail.1
+       * src/main.c
+       * src/send_message.c
+       * src/send_message.h
+               Add --cancel-sending command-line switch.
+
 2012-11-23 [colin]     3.9.0cvs20
 
        * src/jpilot.c
index 97d817f..17abf09 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.1.4.124 -r 1.1.4.125 src/etpan/imap-thread.c;  ) > 3.9.0cvs18.patchset
 ( cvs diff -u -r 1.100.2.87 -r 1.100.2.88 AUTHORS;  cvs diff -u -r 1.1.2.83 -r 1.1.2.84 src/gtk/authors.h;  ) > 3.9.0cvs19.patchset
 ( cvs diff -u -r 1.18.2.37 -r 1.18.2.38 src/jpilot.c;  cvs diff -u -r 1.115.2.262 -r 1.115.2.263 src/main.c;  cvs diff -u -r 1.274.2.355 -r 1.274.2.356 src/mainwindow.c;  cvs diff -u -r 1.75.2.79 -r 1.75.2.80 src/matcher.c;  cvs diff -u -r 1.204.2.212 -r 1.204.2.213 src/prefs_common.c;  cvs diff -u -r 1.103.2.141 -r 1.103.2.142 src/prefs_common.h;  cvs diff -u -r 1.150.2.131 -r 1.150.2.132 src/procmsg.c;  cvs diff -u -r 1.13.2.51 -r 1.13.2.52 src/common/socket.c;  cvs diff -u -r 1.13.2.27 -r 1.13.2.28 src/common/socket.h;  cvs diff -u -r 1.9.2.57 -r 1.9.2.58 src/common/ssl.c;  cvs diff -u -r 1.4.2.46 -r 1.4.2.47 src/common/ssl_certificate.c;  cvs diff -u -r 1.1.4.20 -r 1.1.4.21 src/common/ssl_certificate.h;  cvs diff -u -r 1.1.4.125 -r 1.1.4.126 src/etpan/imap-thread.c;  cvs diff -u -r 1.1.2.22 -r 1.1.2.23 src/etpan/nntp-thread.c;  ) > 3.9.0cvs20.patchset
+( cvs diff -u -r 1.1.2.13 -r 1.1.2.14 doc/man/claws-mail.1;  cvs diff -u -r 1.115.2.263 -r 1.115.2.264 src/main.c;  cvs diff -u -r 1.17.2.65 -r 1.17.2.66 src/send_message.c;  cvs diff -u -r 1.1.4.12 -r 1.1.4.13 src/send_message.h;  ) > 3.9.0cvs21.patchset
index 78cbae5..a84f2b1 100644 (file)
@@ -12,7 +12,7 @@ MINOR_VERSION=9
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=20
+EXTRA_VERSION=21
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 3f909c8..c05cfd8 100644 (file)
@@ -107,6 +107,8 @@ This list is not complete.
 .br 
 \fB \-\-cancel\-receiving\fR
 .br 
+\fB \-\-cancel\-sending\fR
+.br 
 \fB \-\-send\fR
 .br 
 \fB \-\-status\fR
@@ -276,6 +278,9 @@ receive new messages from all accounts
 \fB\-\-cancel\-receiving\fR
 cancel receiving of messages
 .TP 
+\fB\-\-cancel\-sending\fR
+cancel sending of messages
+.TP 
 \fB\-\-send\fR
 .br 
 send all queued messages
index 823d3f2..27ff821 100644 (file)
@@ -206,6 +206,7 @@ static struct RemoteCmd {
        gboolean receive;
        gboolean receive_all;
        gboolean cancel_receiving;
+       gboolean cancel_sending;
        gboolean compose;
        const gchar *compose_mailto;
        GList *attach_files;
@@ -385,6 +386,11 @@ static gboolean defer_check_all(void *data)
        inc_all_account_mail(static_mainwindow, autochk, 
                        prefs_common.newmail_notify_manu);
 
+       /* Accounts using a specific timer need to be checked separately
+        * at startup
+        */
+       inc_all_account_spec_timer_check_mail();
+       
        if (sc_starting) {
                sc_starting = FALSE;
                main_window_set_menu_sensitive(static_mainwindow);
@@ -1135,7 +1141,8 @@ int main(int argc, char *argv[])
 #endif
 
        if (cmd.status || cmd.status_full || cmd.search ||
-               cmd.statistics || cmd.reset_statistics || cmd.cancel_receiving) {
+               cmd.statistics || cmd.reset_statistics || 
+               cmd.cancel_receiving || cmd.cancel_sending) {
                puts("0 Claws Mail not running.");
                lock_socket_remove();
                return 0;
@@ -1941,6 +1948,8 @@ static void parse_cmd_opt(int argc, char *argv[])
                        cmd.receive = TRUE;
                } else if (!strncmp(argv[i], "--cancel-receiving", 18)) {
                        cmd.cancel_receiving = TRUE;
+               } else if (!strncmp(argv[i], "--cancel-sending", 16)) {
+                       cmd.cancel_sending = TRUE;
                } else if (!strncmp(argv[i], "--compose-from-file", 19)) {
                        const gchar *p = (i+1 < argc)?argv[i+1]:NULL;
 
@@ -2064,6 +2073,7 @@ static void parse_cmd_opt(int argc, char *argv[])
                        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", _("  --cancel-sending       cancel sending of messages"));
                        g_print("%s\n", _("  --search folder type request [recursive]\n"
                                          "                         searches mail\n"
                                          "                         folder ex.: \"#mh/Mailbox/inbox\" or \"Mail\"\n"
@@ -2394,6 +2404,8 @@ static gint prohibit_duplicate_launch(void)
                fd_write_all(uxsock, "receive\n", 8);
        } else if (cmd.cancel_receiving) {
                fd_write_all(uxsock, "cancel_receiving\n", 17);
+       } else if (cmd.cancel_sending) {
+               fd_write_all(uxsock, "cancel_sending\n", 15);
        } else if (cmd.compose && cmd.attach_files) {
                gchar *str, *compose_str;
 
@@ -2582,6 +2594,8 @@ static void lock_socket_input_cb(gpointer data,
        } else if (!strncmp(buf, "cancel_receiving", 16)) {
                inc_cancel_all();
                imap_cancel_all();
+       } else if (!strncmp(buf, "cancel_sending", 14)) {
+               send_cancel();
        } else if (!strncmp(buf, "compose_attach", 14)) {
                GList *files = NULL, *curr;
                AttachInfo *ainfo;
index 3e858d0..1d24625 100644 (file)
@@ -64,6 +64,8 @@ struct _SendProgressDialog
        gboolean cancelled;
 };
 
+static SendProgressDialog *send_dialog = NULL;
+
 static gint send_recv_message          (Session                *session,
                                         const gchar            *msg,
                                         gpointer                data);
@@ -86,6 +88,12 @@ static void send_cancel_button_cb    (GtkWidget      *widget,
 static void send_put_error             (Session        *session);
 
 
+void send_cancel(void)
+{
+       if (send_dialog)
+               send_cancel_button_cb(NULL, send_dialog);
+}
+
 gint send_message(const gchar *file, PrefsAccount *ac_prefs, GSList *to_list)
 {
        FILE *fp;
@@ -200,7 +208,6 @@ gint send_message_smtp_full(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp, g
        Session *session;
        SMTPSession *smtp_session;
        gushort port = 0;
-       SendProgressDialog *dialog;
        gchar buf[BUFFSIZE];
        gint ret = 0;
        gboolean was_inited = FALSE;
@@ -307,11 +314,11 @@ gint send_message_smtp_full(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp, g
                port = ac_prefs->set_smtpport ? ac_prefs->smtpport : SMTP_PORT;
 #endif
 
-               dialog = send_progress_dialog_create();
-               dialog->session = session;
-               smtp_session->dialog = dialog;
+               send_dialog = send_progress_dialog_create();
+               send_dialog->session = session;
+               smtp_session->dialog = send_dialog;
 
-               progress_dialog_list_set(dialog->dialog, 0, NULL, 
+               progress_dialog_list_set(send_dialog->dialog, 0, NULL, 
                                         ac_prefs->smtp_server, 
                                         _("Connecting"));
 
@@ -320,21 +327,21 @@ gint send_message_smtp_full(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp, g
                    && (time(NULL) - ac_prefs->last_pop_login_time) > (60 * ac_prefs->pop_before_smtp_timeout)) {
                        g_snprintf(buf, sizeof(buf), _("Doing POP before SMTP..."));
                        log_message(LOG_PROTOCOL, "%s\n", buf);
-                       progress_dialog_set_label(dialog->dialog, buf);
-                       progress_dialog_list_set_status(dialog->dialog, 0, _("POP before SMTP"));
+                       progress_dialog_set_label(send_dialog->dialog, buf);
+                       progress_dialog_list_set_status(send_dialog->dialog, 0, _("POP before SMTP"));
                        GTK_EVENTS_FLUSH();
                        inc_pop_before_smtp(ac_prefs);
                }
 
                g_snprintf(buf, sizeof(buf), _("Account '%s': Connecting to SMTP server: %s:%d..."),
                                ac_prefs->account_name, ac_prefs->smtp_server, port);
-               progress_dialog_set_label(dialog->dialog, buf);
+               progress_dialog_set_label(send_dialog->dialog, buf);
                log_message(LOG_PROTOCOL, "%s\n", buf);
 
-               session_set_recv_message_notify(session, send_recv_message, dialog);
+               session_set_recv_message_notify(session, send_recv_message, send_dialog);
                session_set_send_data_progressive_notify
-                       (session, send_send_data_progressive, dialog);
-               session_set_send_data_notify(session, send_send_data_finished, dialog);
+                       (session, send_send_data_progressive, send_dialog);
+               session_set_send_data_notify(session, send_send_data_finished, send_dialog);
 
        } else {
                /* everything is ready to start at MAIL FROM:, just
@@ -344,7 +351,7 @@ gint send_message_smtp_full(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp, g
                ac_prefs->session = NULL;
                smtp_session = SMTP_SESSION(session);
                smtp_session->state = SMTP_HELO;
-               dialog = (SendProgressDialog *)smtp_session->dialog;
+               send_dialog = (SendProgressDialog *)smtp_session->dialog;
                was_inited = TRUE;
        }
 
@@ -360,7 +367,7 @@ gint send_message_smtp_full(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp, g
        /* connect if necessary */
        if (!was_inited && session_connect(session, ac_prefs->smtp_server, port) < 0) {
                session_destroy(session);
-               send_progress_dialog_destroy(dialog);
+               send_progress_dialog_destroy(send_dialog);
                ac_prefs->session = NULL;
                return -1;
        }
@@ -372,7 +379,7 @@ gint send_message_smtp_full(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp, g
                smtp_from(smtp_session);
        }
 
-       while (session_is_running(session) && dialog->cancelled == FALSE
+       while (session_is_running(session) && send_dialog->cancelled == FALSE
                && SMTP_SESSION(session)->state != SMTP_MAIL_SENT_OK)
                gtk_main_iteration();
 
@@ -396,13 +403,13 @@ gint send_message_smtp_full(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp, g
                   SMTP_SESSION(session)->state == SMTP_ERROR ||
                   SMTP_SESSION(session)->error_val != SM_OK)
                ret = -1;
-       else if (dialog->cancelled == TRUE)
+       else if (send_dialog->cancelled == TRUE)
                ret = -1;
 
        if (ret == -1) {
-               manage_window_focus_in(dialog->dialog->window, NULL, NULL);
+               manage_window_focus_in(send_dialog->dialog->window, NULL, NULL);
                send_put_error(session);
-               manage_window_focus_out(dialog->dialog->window, NULL, NULL);
+               manage_window_focus_out(send_dialog->dialog->window, NULL, NULL);
        }
 
        /* if we should close the connection, let's do it.
@@ -412,11 +419,11 @@ gint send_message_smtp_full(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp, g
        if (!keep_session || ret != 0) {
                if (session_is_connected(session))
                        smtp_quit(smtp_session);
-               while (session_is_connected(session) && !dialog->cancelled)
+               while (session_is_connected(session) && !send_dialog->cancelled)
                        gtk_main_iteration();
                session_destroy(session);
                ac_prefs->session = NULL;
-               send_progress_dialog_destroy(dialog);
+               send_progress_dialog_destroy(send_dialog);
        } else {
                g_free(smtp_session->from);
                g_free(smtp_session->send_data);
@@ -599,6 +606,7 @@ static void send_progress_dialog_destroy(SendProgressDialog *dialog)
                progress_dialog_destroy(dialog->dialog);
        }
        g_free(dialog);
+       dialog = NULL;
 }
 
 static void send_showlog_button_cb(GtkWidget *widget, gpointer data)
index 87dfc40..826d54e 100644 (file)
@@ -41,5 +41,6 @@ gint send_message_smtp_full   (PrefsAccount *ac_prefs,
                                 GSList *to_list, 
                                 FILE *fp, 
                                 gboolean keep_session);
+void send_cancel       (void);
 
 #endif /* __SEND_H__ */