[Commits] main.c 1.115.2.263 1.115.2.264 send_message.c 1.17.2.65 1.17.2.66 send_message.h 1.1.4.12 1.1.4.13
wwp at claws-mail.org
wwp at claws-mail.org
Tue Nov 27 09:47:07 CET 2012
Update of /home/claws-mail/claws/src
In directory srv:/tmp/cvs-serv14669/src
Modified Files:
Tag: gtk2
main.c send_message.c send_message.h
Log Message:
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.
Index: send_message.c
===================================================================
RCS file: /home/claws-mail/claws/src/send_message.c,v
retrieving revision 1.17.2.65
retrieving revision 1.17.2.66
diff -u -d -r1.17.2.65 -r1.17.2.66
--- send_message.c 19 Sep 2012 09:45:32 -0000 1.17.2.65
+++ send_message.c 27 Nov 2012 08:47:05 -0000 1.17.2.66
@@ -64,6 +64,8 @@
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_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 @@
Session *session;
SMTPSession *smtp_session;
gushort port = 0;
- SendProgressDialog *dialog;
gchar buf[BUFFSIZE];
gint ret = 0;
gboolean was_inited = FALSE;
@@ -307,11 +314,11 @@
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 @@
&& (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 @@
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 @@
/* 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 @@
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 @@
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 @@
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 @@
progress_dialog_destroy(dialog->dialog);
}
g_free(dialog);
+ dialog = NULL;
}
static void send_showlog_button_cb(GtkWidget *widget, gpointer data)
Index: send_message.h
===================================================================
RCS file: /home/claws-mail/claws/src/send_message.h,v
retrieving revision 1.1.4.12
retrieving revision 1.1.4.13
diff -u -d -r1.1.4.12 -r1.1.4.13
--- send_message.h 27 May 2012 17:30:59 -0000 1.1.4.12
+++ send_message.h 27 Nov 2012 08:47:05 -0000 1.1.4.13
@@ -41,5 +41,6 @@
GSList *to_list,
FILE *fp,
gboolean keep_session);
+void send_cancel (void);
#endif /* __SEND_H__ */
Index: main.c
===================================================================
RCS file: /home/claws-mail/claws/src/main.c,v
retrieving revision 1.115.2.263
retrieving revision 1.115.2.264
diff -u -d -r1.115.2.263 -r1.115.2.264
--- main.c 23 Nov 2012 19:29:15 -0000 1.115.2.263
+++ main.c 27 Nov 2012 08:47:05 -0000 1.115.2.264
@@ -206,6 +206,7 @@
gboolean receive;
gboolean receive_all;
gboolean cancel_receiving;
+ gboolean cancel_sending;
gboolean compose;
const gchar *compose_mailto;
GList *attach_files;
@@ -385,6 +386,11 @@
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 @@
#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 @@
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 @@
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 @@
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 @@
} 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;
More information about the Commits
mailing list