Add pop before smtp
authorColin Leroy <colin@colino.net>
Sun, 15 Sep 2002 10:48:35 +0000 (10:48 +0000)
committerColin Leroy <colin@colino.net>
Sun, 15 Sep 2002 10:48:35 +0000 (10:48 +0000)
ChangeLog.claws
configure.in
src/inc.c
src/inc.h
src/pop.c
src/prefs_account.c
src/prefs_account.h
src/send.c

index 0b25bc8..c80a8a2 100644 (file)
@@ -1,3 +1,18 @@
+2002-09-15 [colin]     0.8.2claws48
+
+       * src/inc.[ch]
+               add inc_pop_before_smtp()
+               allow MainWindow to be undefined in 
+               inc_account_mail() and inc_start()
+       * src/pop.c
+         src/prefs_account.h
+               add STYPE_POP_BEFORE_SMTP session type
+       * src/prefs_account.c
+               activated pop before smtp option
+       * src/send.c
+               do pop before smtp if the relevant option 
+               is set
+
 2002-09-15 [paul]      0.8.2claws47
 
        * sync with 0.8.3
 2002-09-15 [paul]      0.8.2claws47
 
        * sync with 0.8.3
index 88575b5..e32259c 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=8
 MICRO_VERSION=2
 INTERFACE_AGE=0
 BINARY_AGE=0
 MICRO_VERSION=2
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws47
+EXTRA_VERSION=claws48
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index ce006be..562ccee 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -226,6 +226,12 @@ void inc_selective_download(MainWindow *mainwin, PrefsAccount *acc, gint session
        }
 }
 
        }
 }
 
+void inc_pop_before_smtp(PrefsAccount *acc)
+{
+       acc->session = STYPE_POP_BEFORE_SMTP;
+       inc_account_mail(acc, NULL);
+}
+
 static gint inc_account_mail(PrefsAccount *account, MainWindow *mainwin)
 {
        IncProgressDialog *inc_dialog;
 static gint inc_account_mail(PrefsAccount *account, MainWindow *mainwin)
 {
        IncProgressDialog *inc_dialog;
@@ -254,9 +260,11 @@ static gint inc_account_mail(PrefsAccount *account, MainWindow *mainwin)
                text[2] = _("Standby");
                gtk_clist_append(GTK_CLIST(inc_dialog->dialog->clist), text);
                
                text[2] = _("Standby");
                gtk_clist_append(GTK_CLIST(inc_dialog->dialog->clist), text);
                
-               toolbar_set_sensitive(mainwin);
-               main_window_set_menu_sensitive(mainwin);
-               
+               if (mainwin) {
+                       toolbar_set_sensitive(mainwin);
+                       main_window_set_menu_sensitive(mainwin);
+               }
+                       
                return inc_start(inc_dialog);
 
        case A_LOCAL:
                return inc_start(inc_dialog);
 
        case A_LOCAL:
@@ -399,8 +407,9 @@ static void inc_progress_dialog_clear(IncProgressDialog *inc_dialog)
 {
        progress_dialog_set_value(inc_dialog->dialog, 0.0);
        progress_dialog_set_label(inc_dialog->dialog, "");
 {
        progress_dialog_set_value(inc_dialog->dialog, 0.0);
        progress_dialog_set_label(inc_dialog->dialog, "");
-       gtk_progress_bar_update
-               (GTK_PROGRESS_BAR(inc_dialog->mainwin->progressbar), 0.0);
+       if (inc_dialog->mainwin)
+               gtk_progress_bar_update
+                       (GTK_PROGRESS_BAR(inc_dialog->mainwin->progressbar), 0.0);
 }
 
 static void inc_progress_dialog_destroy(IncProgressDialog *inc_dialog)
 }
 
 static void inc_progress_dialog_destroy(IncProgressDialog *inc_dialog)
@@ -408,9 +417,9 @@ static void inc_progress_dialog_destroy(IncProgressDialog *inc_dialog)
        g_return_if_fail(inc_dialog != NULL);
 
        inc_dialog_list = g_list_remove(inc_dialog_list, inc_dialog);
        g_return_if_fail(inc_dialog != NULL);
 
        inc_dialog_list = g_list_remove(inc_dialog_list, inc_dialog);
-
-       gtk_progress_bar_update
-               (GTK_PROGRESS_BAR(inc_dialog->mainwin->progressbar), 0.0);
+       if (inc_dialog->mainwin)
+               gtk_progress_bar_update
+                       (GTK_PROGRESS_BAR(inc_dialog->mainwin->progressbar), 0.0);
        progress_dialog_destroy(inc_dialog->dialog);
 
        g_free(inc_dialog);
        progress_dialog_destroy(inc_dialog->dialog);
 
        g_free(inc_dialog);
@@ -478,7 +487,7 @@ static gint inc_start(IncProgressDialog *inc_dialog)
                                (pop3_state->ac_prefs->recv_server,
                                 pop3_state->user);
 
                                (pop3_state->ac_prefs->recv_server,
                                 pop3_state->user);
 
-                       if (inc_dialog->show_dialog)
+                       if (inc_dialog->mainwin && inc_dialog->show_dialog)
                                manage_window_focus_in
                                        (inc_dialog->mainwin->window,
                                         NULL, NULL);
                                manage_window_focus_in
                                        (inc_dialog->mainwin->window,
                                         NULL, NULL);
@@ -858,9 +867,10 @@ static gboolean inc_pop3_recv_func(SockInfo *sock, gint count, gint read_bytes,
 
        progress_dialog_set_percentage
                (dialog, (gfloat)cur_total / (gfloat)state->total_bytes);
 
        progress_dialog_set_percentage
                (dialog, (gfloat)cur_total / (gfloat)state->total_bytes);
-       gtk_progress_bar_update
-               (GTK_PROGRESS_BAR(inc_dialog->mainwin->progressbar),
-                (gfloat)cur_total / (gfloat)state->total_bytes);
+       if (inc_dialog->mainwin)
+               gtk_progress_bar_update
+                       (GTK_PROGRESS_BAR(inc_dialog->mainwin->progressbar),
+                        (gfloat)cur_total / (gfloat)state->total_bytes);
        GTK_EVENTS_FLUSH();
 
        if (session->inc_state == INC_CANCEL)
        GTK_EVENTS_FLUSH();
 
        if (session->inc_state == INC_CANCEL)
@@ -910,10 +920,11 @@ void inc_progress_update(Pop3State *state, Pop3Phase phase)
                        (dialog,
                         (gfloat)(state->cur_msg) /
                         (gfloat)(state->count));
                        (dialog,
                         (gfloat)(state->cur_msg) /
                         (gfloat)(state->count));
-               gtk_progress_bar_update 
-                       (GTK_PROGRESS_BAR(inc_dialog->mainwin->progressbar),
-                        (gfloat)(state->cur_msg) /
-                        (gfloat)(state->count));
+               if (inc_dialog->mainwin)
+                       gtk_progress_bar_update 
+                               (GTK_PROGRESS_BAR(inc_dialog->mainwin->progressbar),
+                                (gfloat)(state->cur_msg) /
+                                (gfloat)(state->count));
                break;
        case POP3_RETR_SEND:
                Xstrdup_a(total_size, to_human_readable(state->total_bytes), return);
                break;
        case POP3_RETR_SEND:
                Xstrdup_a(total_size, to_human_readable(state->total_bytes), return);
@@ -927,10 +938,11 @@ void inc_progress_update(Pop3State *state, Pop3Phase phase)
                        (dialog,
                         (gfloat)(state->cur_total_bytes) /
                         (gfloat)(state->total_bytes));
                        (dialog,
                         (gfloat)(state->cur_total_bytes) /
                         (gfloat)(state->total_bytes));
-               gtk_progress_bar_update
-                       (GTK_PROGRESS_BAR(inc_dialog->mainwin->progressbar),
-                        (gfloat)(state->cur_total_bytes) /
-                        (gfloat)(state->total_bytes));
+               if (inc_dialog->mainwin)
+                       gtk_progress_bar_update
+                               (GTK_PROGRESS_BAR(inc_dialog->mainwin->progressbar),
+                                (gfloat)(state->cur_total_bytes) /
+                                (gfloat)(state->total_bytes));
                break;
        case POP3_DELETE_SEND:
                if (state->msg[state->cur_msg].recv_time < state->current_time) {
                break;
        case POP3_DELETE_SEND:
                if (state->msg[state->cur_msg].recv_time < state->current_time) {
index f900931..0c444b7 100644 (file)
--- a/src/inc.h
+++ b/src/inc.h
@@ -77,13 +77,15 @@ void inc_mail                       (MainWindow     *mainwin,
 void inc_all_account_mail      (MainWindow     *mainwin,
                                 gboolean notify);
 void inc_selective_download     (MainWindow    *mainwin, 
 void inc_all_account_mail      (MainWindow     *mainwin,
                                 gboolean notify);
 void inc_selective_download     (MainWindow    *mainwin, 
-                                PrefsAccount *acc,
-                                gint         session);
+                                PrefsAccount   *acc,
+                                gint            session);
 void inc_progress_update       (Pop3State      *state,
                                 Pop3Phase       phase);
 gint inc_drop_message          (const gchar    *file,
                                 Pop3State      *state);
 
 void inc_progress_update       (Pop3State      *state,
                                 Pop3Phase       phase);
 gint inc_drop_message          (const gchar    *file,
                                 Pop3State      *state);
 
+void inc_pop_before_smtp       (PrefsAccount   *acc);
+
 gboolean inc_is_active         (void);
 
 void inc_cancel_all            (void);
 gboolean inc_is_active         (void);
 
 void inc_cancel_all            (void);
index 1eafedf..76e5ff0 100644 (file)
--- a/src/pop.c
+++ b/src/pop.c
@@ -693,6 +693,9 @@ gboolean pop3_sd_state(Pop3State *state, gint cur_state, guint *next_state)
        switch (cur_state) { 
        case POP3_GETRANGE_UIDL_RECV:
                switch (session) {
        switch (cur_state) { 
        case POP3_GETRANGE_UIDL_RECV:
                switch (session) {
+               case STYPE_POP_BEFORE_SMTP:
+                       goto_state = POP3_LOGOUT_SEND;
+                       break;
                case STYPE_DOWNLOAD:
                case STYPE_DELETE:
                case STYPE_PREVIEW_ALL:
                case STYPE_DOWNLOAD:
                case STYPE_DELETE:
                case STYPE_PREVIEW_ALL:
index 20f5edb..26e384c 100644 (file)
@@ -1360,7 +1360,6 @@ static void prefs_account_send_create(void)
 
        PACK_CHECK_BUTTON (vbox3, pop_bfr_smtp_chkbtn,
                _("Authenticate with POP3 before sending"));
 
        PACK_CHECK_BUTTON (vbox3, pop_bfr_smtp_chkbtn,
                _("Authenticate with POP3 before sending"));
-       gtk_widget_set_sensitive(pop_bfr_smtp_chkbtn, FALSE);
 
        p_send.date_chkbtn      = date_chkbtn;
        p_send.msgid_chkbtn     = msgid_chkbtn;
 
        p_send.date_chkbtn      = date_chkbtn;
        p_send.msgid_chkbtn     = msgid_chkbtn;
index 4467ead..9a0dc87 100644 (file)
@@ -45,6 +45,8 @@ typedef enum {
 } RecvProtocol;
 
 typedef enum {
 } RecvProtocol;
 
 typedef enum {
+       /* just login (pop before smtp) */
+       STYPE_POP_BEFORE_SMTP,
        /* login and retrieve messages, as before */
        STYPE_NORMAL,
        /* send TOP to server and retrieve all available Headers */
        /* login and retrieve messages, as before */
        STYPE_NORMAL,
        /* send TOP to server and retrieve all available Headers */
index d19a241..167bdd0 100644 (file)
@@ -359,6 +359,16 @@ gint send_message_smtp(PrefsAccount *ac_prefs, GSList *to_list,
        clist = GTK_CLIST(dialog->dialog->clist);
        gtk_clist_append(clist, (gchar **)text);
 
        clist = GTK_CLIST(dialog->dialog->clist);
        gtk_clist_append(clist, (gchar **)text);
 
+       if (ac_prefs->pop_before_smtp
+           && (ac_prefs->protocol == A_APOP || ac_prefs->protocol == A_POP3)) {
+               g_snprintf(buf, sizeof(buf), _("Doing POP before SMTP..."));
+               log_message("%s\n", buf);
+               progress_dialog_set_label(dialog->dialog, buf);
+               gtk_clist_set_text(clist, 0, 2, _("POP before SMTP"));
+               GTK_EVENTS_FLUSH();
+               inc_pop_before_smtp(ac_prefs);
+       }
+       
        g_snprintf(buf, sizeof(buf), _("Connecting to SMTP server: %s ..."),
                   ac_prefs->smtp_server);
        log_message("%s\n", buf);
        g_snprintf(buf, sizeof(buf), _("Connecting to SMTP server: %s ..."),
                   ac_prefs->smtp_server);
        log_message("%s\n", buf);