diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/inc.c | 47 | ||||
-rw-r--r-- | src/inc.h | 3 | ||||
-rw-r--r-- | src/prefs_account_dialog.c | 12 | ||||
-rw-r--r-- | src/send_message.c | 10 |
4 files changed, 61 insertions, 11 deletions
@@ -361,6 +361,45 @@ void inc_all_account_mail(MainWindow *mainwin, gboolean autocheck) inc_autocheck_timer_set(); } +gint inc_pop_before_smtp(PrefsAccount *account) +{ + MainWindow *mainwin; + IncProgressDialog *inc_dialog; + IncSession *session; + + if (inc_lock_count) return -1; + + mainwin = main_window_get(); + + if (!main_window_toggle_online_if_offline(mainwin)) + return -1; + + inc_autocheck_timer_remove(); + main_window_lock(mainwin); + + session = inc_session_new(account); + if (!session) return -1; + POP3_SESSION(session->session)->auth_only = TRUE; + + inc_dialog = inc_progress_dialog_create(FALSE); + gtk_window_set_title(GTK_WINDOW(inc_dialog->dialog->window), + _("Authenticating with POP3")); + inc_dialog->queue_list = g_list_append(inc_dialog->queue_list, session); + inc_dialog->mainwin = mainwin; + inc_progress_dialog_set_list(inc_dialog); + inc_dialog->show_dialog = TRUE; + + main_window_set_toolbar_sensitive(mainwin); + main_window_set_menu_sensitive(mainwin); + + inc_start(inc_dialog); + + main_window_unlock(mainwin); + inc_autocheck_timer_set(); + + return 0; +} + static IncProgressDialog *inc_progress_dialog_create(gboolean autocheck) { IncProgressDialog *dialog; @@ -694,8 +733,12 @@ static IncState inc_pop3_session_do(IncSession *session) debug_print(_("getting new messages of account %s...\n"), pop3_session->ac_prefs->account_name); - buf = g_strdup_printf(_("%s: Retrieving new messages"), - pop3_session->ac_prefs->recv_server); + if (pop3_session->auth_only) + buf = g_strdup_printf(_("%s: Authenticating with POP3"), + pop3_session->ac_prefs->recv_server); + else + buf = g_strdup_printf(_("%s: Retrieving new messages"), + pop3_session->ac_prefs->recv_server); gtk_window_set_title(GTK_WINDOW(inc_dialog->dialog->window), buf); g_free(buf); @@ -86,7 +86,8 @@ gint inc_account_mail (MainWindow *mainwin, PrefsAccount *account); void inc_all_account_mail (MainWindow *mainwin, gboolean autocheck); -void inc_progress_update (Pop3Session *session); + +gint inc_pop_before_smtp (PrefsAccount *account); gboolean inc_is_active (void); diff --git a/src/prefs_account_dialog.c b/src/prefs_account_dialog.c index 5198bb07..4e7d9b48 100644 --- a/src/prefs_account_dialog.c +++ b/src/prefs_account_dialog.c @@ -114,7 +114,7 @@ static struct Send { GtkWidget *smtp_auth_type_optmenu; GtkWidget *smtp_uid_entry; GtkWidget *smtp_pass_entry; - /* GtkWidget *pop_bfr_smtp_chkbtn; */ + GtkWidget *pop_bfr_smtp_chkbtn; } p_send; static struct Compose { @@ -287,7 +287,8 @@ static PrefsUIData ui_data[] = { {"smtp_password", &p_send.smtp_pass_entry, prefs_set_data_from_entry, prefs_set_entry}, - /* {"pop_before_smtp", NULL, NULL, NULL}, */ + {"pop_before_smtp", &p_send.pop_bfr_smtp_chkbtn, + prefs_set_data_from_toggle, prefs_set_toggle}, /* Compose */ {"signature_type", &compose.sigfile_radiobtn, @@ -1039,7 +1040,7 @@ static void prefs_account_send_create(void) GtkWidget *smtp_uid_entry; GtkWidget *smtp_pass_entry; GtkWidget *vbox_spc; - /* GtkWidget *pop_bfr_smtp_chkbtn; */ + GtkWidget *pop_bfr_smtp_chkbtn; vbox1 = gtk_vbox_new (FALSE, VSPACING); gtk_widget_show (vbox1); @@ -1167,11 +1168,8 @@ static void prefs_account_send_create(void) SET_TOGGLE_SENSITIVITY (smtp_auth_chkbtn, vbox4); -#if 0 PACK_CHECK_BUTTON (vbox3, pop_bfr_smtp_chkbtn, _("Authenticate with POP3 before sending")); - gtk_widget_set_sensitive(pop_bfr_smtp_chkbtn, FALSE); -#endif p_send.date_chkbtn = date_chkbtn; p_send.msgid_chkbtn = msgid_chkbtn; @@ -1181,7 +1179,7 @@ static void prefs_account_send_create(void) p_send.smtp_auth_type_optmenu = optmenu; p_send.smtp_uid_entry = smtp_uid_entry; p_send.smtp_pass_entry = smtp_pass_entry; - /* p_send.pop_bfr_smtp_chkbtn = pop_bfr_smtp_chkbtn; */ + p_send.pop_bfr_smtp_chkbtn = pop_bfr_smtp_chkbtn; } static void prefs_account_compose_create(void) diff --git a/src/send_message.c b/src/send_message.c index b490efbb..90782384 100644 --- a/src/send_message.c +++ b/src/send_message.c @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2005 Hiroyuki Yamamoto + * Copyright (C) 1999-2006 Hiroyuki Yamamoto * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -53,6 +53,7 @@ #include "manage_window.h" #include "socket.h" #include "utils.h" +#include "inc.h" #define SMTP_PORT 25 #if USE_SSL @@ -545,6 +546,13 @@ static gint send_message_smtp(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp) port = ac_prefs->set_smtpport ? ac_prefs->smtpport : SMTP_PORT; #endif + if (ac_prefs->pop_before_smtp && ac_prefs->protocol == A_POP3) { + if (inc_pop_before_smtp(ac_prefs) < 0) { + session_destroy(session); + return -1; + } + } + dialog = send_progress_dialog_create(); dialog->session = session; |