sync with 0.7.8cvs10
authorPaul Mangan <paul@claws-mail.org>
Fri, 28 Jun 2002 08:08:36 +0000 (08:08 +0000)
committerPaul Mangan <paul@claws-mail.org>
Fri, 28 Jun 2002 08:08:36 +0000 (08:08 +0000)
13 files changed:
ChangeLog
ChangeLog.claws
ChangeLog.jp
configure.in
src/Makefile.am
src/compose.c
src/gtksctree.c
src/gtksctree.h
src/prefs_account.c
src/prefs_account.h
src/send.c
src/smtp.c
src/smtp.h

index fea85968b1803c02b7c587660846a036d73c48c2..5a11ec38e87ccaa0d6707d0eef53c3dab3bcdc50 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2002-06-28
+
+       * src/gtksctree.[ch]: changed GtkSCTree::anchor_row from gint to
+         GtkCTreeNode* so that it won't become invalid after the row move.
+         Removed dependency to gtkutils.c.
+
+2002-06-28
+
+       * configure.in
+         src/Makefile.am
+         src/compose.c: changed "host_alias" to "target_alias" so that it
+         shows the correct system name on cross-compiling (thanks to
+         Patrice Mandin).
+
+2002-06-27
+
+       * src/prefs_account.[ch]: added the option menu to force an
+         authentication method for SMTP AUTH.
+       * src/send.c
+         src/smtp.[ch]: smtp_from(), smtp_auth(): added an argument to
+         specify the authentication method for SMTP AUTH.
+         smtp_ehlo(): allow AUTH responses that don't comply with the RFC.
+
 2002-06-25
 
        * src/prefs_common.[ch]
index 98d899bad53ed64457042eeee336582b170bf838..9d768e0dd4e193d60c800b57195094f23b745939 100644 (file)
@@ -1,3 +1,8 @@
+2002-06-28 [paul]      0.7.8claws30
+
+       * sync with 0.7.8cvs10
+               see ChangeLog 2002-06-27 and 2002-06-28
+
 2002-06-26 [paul]      0.7.8claws29
 
        * src/addrgather.c
index 3d95873dd54d33b65561024481ca8d38be5e1950..8d06e7a3f71794ca0d3db41de3af1719ddcf658d 100644 (file)
@@ -1,3 +1,25 @@
+2002-06-28
+
+       * src/gtksctree.[ch]: ¹Ô¤Î°ÜÆ°¸å¤Ë̵¸ú¤Ë¤Ê¤é¤Ê¤¤¤è¤¦¤Ë
+         GtkSCTree::anchor_row ¤ò gint ¤«¤é GtkCTreeNode* ¤ËÊѹ¹¡£
+         gtkutils.c ¤Ë°Í¸¤·¤Ê¤¤¤è¤¦¤Ë¤·¤¿¡£
+
+2002-06-28
+
+       * configure.in
+         src/Makefile.am
+         src/compose.c: ¥¯¥í¥¹¥³¥ó¥Ñ¥¤¥ë»þ¤ËÀµ¤·¤¤¥·¥¹¥Æ¥à̾¤òɽ¼¨¤¹¤ë¤è¤¦¤Ë
+         "host_alias" ¤ò "target_alias" ¤ËÊѹ¹(Patrice Mandin ¤µ¤ó thanks)¡£
+
+2002-06-27
+
+       * src/prefs_account.[ch]: SMTP AUTH ¤Îǧ¾ÚÊý¼°¤ò¶¯À©»ØÄꤹ¤ë
+         ¥ª¥×¥·¥ç¥ó¥á¥Ë¥å¡¼¤òÄɲá£
+       * src/send.c
+         src/smtp.[ch]: smtp_from(), smtp_auth(): SMTP AUTH ¤Îǧ¾ÚÊý¼°¤ò
+         »ØÄꤹ¤ë°ú¿ô¤òÄɲá£
+         smtp_ehlo(): RFC ¤Ë½àµò¤·¤Ê¤¤ AUTH ±þÅú¤òµö²Ä¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+
 2002-06-25
 
        * src/prefs_common.[ch]
index 32014ef786b9e56922ec95db5809ff340b6a9341..5302c19fb16e68f5de1f40b781d0d2a5a423dff6 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=7
 MICRO_VERSION=8
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws29
+EXTRA_VERSION=claws30
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index c41e7268daa4c8bb2b901e7ddac63b57e7ee27fa..4aca5c18b55da71b8ca4a72322976c6f31c7541e 100644 (file)
@@ -235,7 +235,7 @@ CPPFLAGS = \
        -DLOCALEDIR=\""$(localedir)"\" \
        -DMANUALDIR=\""$(manualdir)"\" \
        -DFAQDIR=\""$(faqdir)"\" \
-       -DHOST_ALIAS=\""$(host_alias)"\" \
+       -DTARGET_ALIAS=\""$(target_alias)"\" \
        -DSYSCONFDIR=\""$(sysconfdir)"\"
 
 YFLAGS = -d
index bc3602370ee429c7688ba5accd78ed075bb939ca..2534af32d0fa8489209f48fd7d4ae128274436dd 100644 (file)
@@ -3870,14 +3870,14 @@ static gint compose_write_headers(Compose *compose, FILE *fp,
                fprintf(fp, "X-Mailer: %s (GTK+ %d.%d.%d; %s)\n",
                        prog_version,
                        gtk_major_version, gtk_minor_version, gtk_micro_version,
-                       HOST_ALIAS);
+                       TARGET_ALIAS);
                        /* utsbuf.sysname, utsbuf.release, utsbuf.machine); */
        }
        if (g_slist_length(compose->newsgroup_list) && !IS_IN_CUSTOM_HEADER("X-Newsreader")) {
                fprintf(fp, "X-Newsreader: %s (GTK+ %d.%d.%d; %s)\n",
                        prog_version,
                        gtk_major_version, gtk_minor_version, gtk_micro_version,
-                       HOST_ALIAS);
+                       TARGET_ALIAS);
                        /* utsbuf.sysname, utsbuf.release, utsbuf.machine); */
        }
 
index e1713ba99e675ad146ff9fd90ba2c44086c53a79..b5ed823c2e3b1e196b377dd027de7074115243e3 100644 (file)
@@ -2,8 +2,6 @@
  * This program is based on gtkflist.c
  */
 
-#include "utils.h"
-#include "gtkutils.h"
 #include "gtksctree.h"
 
 
@@ -144,7 +142,7 @@ gtk_sctree_class_init (GtkSCTreeClass *klass)
 static void
 gtk_sctree_init (GtkSCTree *sctree)
 {
-       sctree->anchor_row = -1;
+       sctree->anchor_row = NULL;
 
        /* GtkCTree does not specify pointer motion by default */
        gtk_widget_add_events (GTK_WIDGET (sctree), GDK_POINTER_MOTION_MASK);
@@ -165,17 +163,22 @@ row_is_selected(GtkSCTree *sctree, gint row)
 static void
 select_range (GtkSCTree *sctree, gint row)
 {
+       gint prev_row;
        gint min, max;
        gint i;
 
-       if (sctree->anchor_row == -1)
-               sctree->anchor_row = row;
+       if (sctree->anchor_row == NULL) {
+               prev_row = row;
+               sctree->anchor_row = gtk_ctree_node_nth(GTK_CTREE(sctree), row);
+       } else
+               prev_row = g_list_position(GTK_CLIST(sctree)->row_list,
+                                          (GList *)sctree->anchor_row);
 
-       if (row < sctree->anchor_row) {
+       if (row < prev_row) {
                min = row;
-               max = sctree->anchor_row;
+               max = prev_row;
        } else {
-               min = sctree->anchor_row;
+               min = prev_row;
                max = row;
        }
        for (i = min; i <= max; i++)
@@ -198,11 +201,16 @@ select_row (GtkSCTree *sctree, gint row, gint col, guint state)
                   (GTK_CLIST(sctree)->selection_mode != GTK_SELECTION_BROWSE);
 
        gtk_clist_freeze (GTK_CLIST (sctree));
-       gtkut_clist_set_focus_row(GTK_CLIST(sctree), row);
+       GTK_CLIST(sctree)->focus_row = row;
+       GTK_CLIST_CLASS(GTK_OBJECT(sctree)->klass)->refresh(GTK_CLIST(sctree));
        if (!additive)
                gtk_clist_unselect_all (GTK_CLIST (sctree));
 
        if (!range) {
+               GtkCTreeNode *node;
+
+               node = gtk_ctree_node_nth (GTK_CTREE(sctree), row);
+
                /*No need to manage overlapped list*/
                if (additive) {
                        if (row_is_selected(sctree, row))
@@ -210,17 +218,13 @@ select_row (GtkSCTree *sctree, gint row, gint col, guint state)
                        else
                                gtk_signal_emit_by_name
                                        (GTK_OBJECT (sctree),
-                                        "tree_select_row",
-                                        gtk_ctree_node_nth (GTK_CTREE(sctree), row),
-                                        col);
+                                        "tree_select_row", node, col);
                } else {
                        gtk_signal_emit_by_name
                                (GTK_OBJECT (sctree),
-                                "tree_select_row",
-                                gtk_ctree_node_nth (GTK_CTREE(sctree), row),
-                                col);
+                                "tree_select_row", node, col);
                }
-               sctree->anchor_row = row;
+               sctree->anchor_row = node;
        } else
                select_range (sctree, row);
        gtk_clist_thaw (GTK_CLIST (sctree));
@@ -487,7 +491,7 @@ gtk_sctree_clear (GtkCList *clist)
        g_return_if_fail (GTK_IS_SCTREE (clist));
 
        sctree = GTK_SCTREE (clist);
-       sctree->anchor_row = -1;
+       sctree->anchor_row = NULL;
 
        if (((GtkCListClass *)parent_class)->clear)
                (* ((GtkCListClass *)parent_class)->clear) (clist);
@@ -499,14 +503,12 @@ gtk_sctree_clear (GtkCList *clist)
 static void 
 gtk_sctree_collapse (GtkCTree *ctree, GtkCTreeNode *node)
 {
-       GtkSCTree *sctree;
-
        g_return_if_fail (ctree != NULL);
        g_return_if_fail (GTK_IS_SCTREE (ctree));
 
         (* parent_class->tree_collapse) (ctree, node);
-       sctree = GTK_SCTREE (ctree);
-       sctree->anchor_row = GTK_CLIST(ctree)->focus_row;
+       GTK_SCTREE(ctree)->anchor_row =
+               gtk_ctree_node_nth(ctree, GTK_CLIST(ctree)->focus_row);
 }
 
 GtkWidget *gtk_sctree_new_with_titles (gint columns, 
@@ -526,13 +528,13 @@ void  gtk_sctree_select (GtkSCTree *sctree,
                         GtkCTreeNode *node)
 {
        select_row(sctree, 
-                  gtkut_ctree_get_nth_from_node(GTK_CTREE(sctree),node),
+                  g_list_position(GTK_CLIST(sctree)->row_list, (GList *)node),
                   -1, 0);
 }
 
 void  gtk_sctree_unselect_all (GtkSCTree *sctree)
 {
        gtk_clist_unselect_all(GTK_CLIST(sctree));
-       sctree->anchor_row = -1;
+       sctree->anchor_row = NULL;
 }
 
index 977c89f91e011aaa1dee468b29c56a35c99e8d98..94f600a44ee60f0f4a1a385aa1f1710c547c7ed4 100644 (file)
@@ -23,7 +23,7 @@ struct _GtkSCTree {
        GtkCTree ctree;
 
        /* The anchor row for range selections */
-       gint anchor_row;
+       GtkCTreeNode *anchor_row;
 
        /* Mouse button and position saved on button press */
        gint dnd_press_button;
index 13123856ca01d310cbad56c8238daafdd512a257..716f8d74d28ed9f570241965fa79ed189c9c37f9 100644 (file)
@@ -107,11 +107,9 @@ static struct Send {
        GtkWidget *customhdr_chkbtn;
 
        GtkWidget *smtp_auth_chkbtn;
+       GtkWidget *smtp_auth_type_optmenu;
        GtkWidget *smtp_uid_entry;
        GtkWidget *smtp_pass_entry;
-       GtkWidget *smtp_auth_enable_login_chkbtn;       /* CLAWS: smtp auth options */
-       GtkWidget *smtp_auth_enable_cram_md5_chkbtn;
-       GtkWidget *smtp_auth_enable_digest_md5_chkbtn;
        GtkWidget *pop_bfr_smtp_chkbtn;
 } send;
 
@@ -196,6 +194,11 @@ static void prefs_account_fix_size                 (void);
 static void prefs_account_protocol_set_data_from_optmenu(PrefParam *pparam);
 static void prefs_account_protocol_set_optmenu         (PrefParam *pparam);
 static void prefs_account_protocol_activated           (GtkMenuItem *menuitem);
+
+static void prefs_account_smtp_auth_type_set_data_from_optmenu
+                                                       (PrefParam *pparam);
+static void prefs_account_smtp_auth_type_set_optmenu   (PrefParam *pparam);
+
 #if USE_GPGME || USE_SSL
 static void prefs_account_enum_set_data_from_radiobtn  (PrefParam *pparam);
 static void prefs_account_enum_set_radiobtn            (PrefParam *pparam);
@@ -319,19 +322,15 @@ static PrefParam param[] = {
         &send.smtp_auth_chkbtn,
         prefs_set_data_from_toggle, prefs_set_toggle},
 
+       {"smtp_auth_method", "0", &tmp_ac_prefs.smtp_auth_type, P_ENUM,
+        &send.smtp_auth_type_optmenu,
+        prefs_account_smtp_auth_type_set_data_from_optmenu,
+        prefs_account_smtp_auth_type_set_optmenu},
+
        {"smtp_user_id", NULL, &tmp_ac_prefs.smtp_userid, P_STRING,
         &send.smtp_uid_entry, prefs_set_data_from_entry, prefs_set_entry},
        {"smtp_password", NULL, &tmp_ac_prefs.smtp_passwd, P_STRING,
         &send.smtp_pass_entry, prefs_set_data_from_entry, prefs_set_entry},
-       {"smtp_auth_enable_digest_md5", "TRUE", &tmp_ac_prefs.smtp_auth_enable_digest_md5, P_BOOL,
-        &send.smtp_auth_enable_digest_md5_chkbtn,
-        prefs_set_data_from_toggle, prefs_set_toggle},
-       {"smtp_auth_enable_cram_md5", "TRUE", &tmp_ac_prefs.smtp_auth_enable_cram_md5, P_BOOL,
-        &send.smtp_auth_enable_cram_md5_chkbtn,
-        prefs_set_data_from_toggle, prefs_set_toggle},
-       {"smtp_auth_enable_login", "TRUE", &tmp_ac_prefs.smtp_auth_enable_login, P_BOOL,
-        &send.smtp_auth_enable_login_chkbtn,
-        prefs_set_data_from_toggle, prefs_set_toggle},
 
        {"pop_before_smtp", "FALSE", &tmp_ac_prefs.pop_before_smtp, P_BOOL,
         &send.pop_bfr_smtp_chkbtn,
@@ -1219,6 +1218,9 @@ static void prefs_account_send_create(void)
        GtkWidget *customhdr_edit_btn;
        GtkWidget *vbox3;
        GtkWidget *smtp_auth_chkbtn;
+       GtkWidget *optmenu;
+       GtkWidget *optmenu_menu;
+       GtkWidget *menuitem;
        GtkWidget *vbox4;
        GtkWidget *hbox_spc;
        GtkWidget *label;
@@ -1226,9 +1228,6 @@ static void prefs_account_send_create(void)
        GtkWidget *smtp_pass_entry;
        GtkWidget *vbox_spc;
        GtkWidget *pop_bfr_smtp_chkbtn;
-       GtkWidget *smtp_auth_enable_login_chkbtn;       /* CLAWS: SMTP AUTH */
-       GtkWidget *smtp_auth_enable_cram_md5_chkbtn;
-       GtkWidget *smtp_auth_enable_digest_md5_chkbtn;
 
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
        gtk_widget_show (vbox1);
@@ -1285,6 +1284,35 @@ static void prefs_account_send_create(void)
        gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0);
        gtk_widget_set_usize (hbox_spc, 12, -1);
 
+       label = gtk_label_new (_("Authentication method"));
+       gtk_widget_show (label);
+       gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+
+       optmenu = gtk_option_menu_new ();
+       gtk_widget_show (optmenu);
+       gtk_box_pack_start (GTK_BOX (hbox), optmenu, FALSE, FALSE, 0);
+
+       optmenu_menu = gtk_menu_new ();
+
+       MENUITEM_ADD (optmenu_menu, menuitem, _("Automatic"), 0);
+       MENUITEM_ADD (optmenu_menu, menuitem, "LOGIN", SMTPAUTH_LOGIN);
+       MENUITEM_ADD (optmenu_menu, menuitem, "CRAM-MD5", SMTPAUTH_CRAM_MD5);
+       MENUITEM_ADD (optmenu_menu, menuitem, "DIGEST-MD5", SMTPAUTH_DIGEST_MD5);
+       gtk_widget_set_sensitive (menuitem, FALSE);
+
+       gtk_option_menu_set_menu (GTK_OPTION_MENU (optmenu), optmenu_menu);
+
+       PACK_VSPACER(vbox4, vbox_spc, VSPACING_NARROW_2);
+
+       hbox = gtk_hbox_new (FALSE, 8);
+       gtk_widget_show (hbox);
+       gtk_box_pack_start (GTK_BOX (vbox4), hbox, FALSE, FALSE, 0);
+
+       hbox_spc = gtk_hbox_new (FALSE, 0);
+       gtk_widget_show (hbox_spc);
+       gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0);
+       gtk_widget_set_usize (hbox_spc, 12, -1);
+
        label = gtk_label_new (_("User ID"));
        gtk_widget_show (label);
        gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
@@ -1324,15 +1352,6 @@ static void prefs_account_send_create(void)
 
        SET_TOGGLE_SENSITIVITY (smtp_auth_chkbtn, vbox4);
 
-       PACK_CHECK_BUTTON (vbox4, smtp_auth_enable_login_chkbtn,
-               _("LOGIN Authentication"));
-
-       PACK_CHECK_BUTTON (vbox4, smtp_auth_enable_cram_md5_chkbtn,
-               _("CRAM-MD5 Authentication"));
-
-       PACK_CHECK_BUTTON (vbox4, smtp_auth_enable_digest_md5_chkbtn,
-               _("DIGEST-MD5 Authentication"));        
-
        PACK_CHECK_BUTTON (vbox3, pop_bfr_smtp_chkbtn,
                _("Authenticate with POP3 before sending"));
        gtk_widget_set_sensitive(pop_bfr_smtp_chkbtn, FALSE);
@@ -1341,15 +1360,11 @@ static void prefs_account_send_create(void)
        send.msgid_chkbtn     = msgid_chkbtn;
        send.customhdr_chkbtn = customhdr_chkbtn;
 
-       send.smtp_auth_chkbtn    = smtp_auth_chkbtn;
-       send.smtp_uid_entry      = smtp_uid_entry;
-       send.smtp_pass_entry     = smtp_pass_entry;
-       send.pop_bfr_smtp_chkbtn = pop_bfr_smtp_chkbtn;
-       
-       /* CLAWS: SMTP AUTH */
-       send.smtp_auth_enable_login_chkbtn      = smtp_auth_enable_login_chkbtn;
-       send.smtp_auth_enable_cram_md5_chkbtn   = smtp_auth_enable_cram_md5_chkbtn;
-       send.smtp_auth_enable_digest_md5_chkbtn = smtp_auth_enable_digest_md5_chkbtn;
+       send.smtp_auth_chkbtn       = smtp_auth_chkbtn;
+       send.smtp_auth_type_optmenu = optmenu;
+       send.smtp_uid_entry         = smtp_uid_entry;
+       send.smtp_pass_entry        = smtp_pass_entry;
+       send.pop_bfr_smtp_chkbtn    = pop_bfr_smtp_chkbtn;
 }
 
 static void prefs_account_compose_create(void)
@@ -2166,6 +2181,44 @@ static void prefs_account_protocol_set_optmenu(PrefParam *pparam)
        gtk_menu_item_activate(GTK_MENU_ITEM(menuitem));
 }
 
+static void prefs_account_smtp_auth_type_set_data_from_optmenu(PrefParam *pparam)
+{
+       GtkWidget *menu;
+       GtkWidget *menuitem;
+
+       menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(*pparam->widget));
+       menuitem = gtk_menu_get_active(GTK_MENU(menu));
+       *((RecvProtocol *)pparam->data) = GPOINTER_TO_INT
+               (gtk_object_get_user_data(GTK_OBJECT(menuitem)));
+}
+
+static void prefs_account_smtp_auth_type_set_optmenu(PrefParam *pparam)
+{
+       SMTPAuthType type = *((SMTPAuthType *)pparam->data);
+       GtkOptionMenu *optmenu = GTK_OPTION_MENU(*pparam->widget);
+       GtkWidget *menu;
+       GtkWidget *menuitem;
+
+       switch (type) {
+       case SMTPAUTH_LOGIN:
+               gtk_option_menu_set_history(optmenu, 1);
+               break;
+       case SMTPAUTH_CRAM_MD5:
+               gtk_option_menu_set_history(optmenu, 2);
+               break;
+       case SMTPAUTH_DIGEST_MD5:
+               gtk_option_menu_set_history(optmenu, 3);
+               break;
+       case 0:
+       default:
+               gtk_option_menu_set_history(optmenu, 0);
+       }
+
+       menu = gtk_option_menu_get_menu(optmenu);
+       menuitem = gtk_menu_get_active(GTK_MENU(menu));
+       gtk_menu_item_activate(GTK_MENU_ITEM(menuitem));
+}
+
 static void prefs_account_protocol_activated(GtkMenuItem *menuitem)
 {
        RecvProtocol protocol;
index 1f6f0f9796e2178be14fdb94adab505bb6012f1f..22a02a7abff61715a3918f43ca082dcd9c542314 100644 (file)
@@ -118,14 +118,10 @@ struct _PrefsAccount
        gboolean gen_msgid;
        gboolean add_customhdr;
        gboolean use_smtp_auth;
+       SMTPAuthType smtp_auth_type;
        gchar *smtp_userid;
        gchar *smtp_passwd;
 
-       /* CLAWS: SMTP AUTH */
-       gboolean smtp_auth_enable_login;
-       gboolean smtp_auth_enable_cram_md5;
-       gboolean smtp_auth_enable_digest_md5;
-
        /* Temporarily preserved password */
        gchar *tmp_smtp_pass;
 
index 28308dc2aba316c244bae07295b0307c4a8ada37..9ef291a6b045889b82744e8a369885896c972048 100644 (file)
@@ -371,20 +371,12 @@ gint send_message_smtp(PrefsAccount *ac_prefs, GSList *to_list,
 #if USE_SSL
        SEND_EXIT_IF_ERROR((session = smtp_session_new
                                (ac_prefs->smtp_server, port, domain,
-                                user, pass, ac_prefs->ssl_smtp,
-                                0 
-                                | (ac_prefs->smtp_auth_enable_login ? SMTPAUTH_LOGIN : 0) 
-                                | (ac_prefs->smtp_auth_enable_cram_md5 ? SMTPAUTH_CRAM_MD5 : 0) 
-                                | (ac_prefs->smtp_auth_enable_digest_md5 ? SMTPAUTH_DIGEST_MD5 : 0))),
+                                user, pass, ac_prefs->ssl_smtp)),
                           "connecting to server");
 #else
        SEND_EXIT_IF_ERROR((session = smtp_session_new
                                (ac_prefs->smtp_server, port, domain,
-                                user, pass,
-                                0
-                                | (ac_prefs->smtp_auth_enable_login ? SMTPAUTH_LOGIN : 0) 
-                                | (ac_prefs->smtp_auth_enable_cram_md5 ? SMTPAUTH_CRAM_MD5 : 0) 
-                                | (ac_prefs->smtp_auth_enable_digest_md5 ? SMTPAUTH_DIGEST_MD5 : 0))),
+                                user, pass)),
                           "connecting to server");
 #endif
 
@@ -393,7 +385,8 @@ gint send_message_smtp(PrefsAccount *ac_prefs, GSList *to_list,
        GTK_EVENTS_FLUSH();
 
        SEND_EXIT_IF_NOTOK
-               (smtp_from(SMTP_SESSION(session), ac_prefs->address),
+               (smtp_from(SMTP_SESSION(session), ac_prefs->address,
+                          ac_prefs->smtp_auth_type),
                 "sending MAIL FROM");
 
        progress_dialog_set_label(dialog->dialog, _("Sending RCPT TO..."));
index 82067c825bdd9610ace07abdb20640ccf5e1f829..bf7eda42ad2d3c46018ab2a0f633730efebb9590 100644 (file)
@@ -43,13 +43,11 @@ static gint smtp_ok(SockInfo *sock, gchar *buf, gint len);
 Session *smtp_session_new(const gchar *server, gushort port,
                          const gchar *domain,
                          const gchar *user, const gchar *pass,
-                         SSLType ssl_type,
-                         SMTPAuthType enable_auth_type)
+                         SSLType ssl_type)
 #else
 Session *smtp_session_new(const gchar *server, gushort port,
                          const gchar *domain,
-                         const gchar *user, const gchar *pass,
-                         SMTPAuthType enable_auth_type)
+                         const gchar *user, const gchar *pass)
 #endif
 {
        SMTPSession *session;
@@ -91,7 +89,7 @@ Session *smtp_session_new(const gchar *server, gushort port,
                domain = get_domain_name();
 
        if (use_esmtp)
-               val = smtp_ehlo(sock, domain, &avail_auth_type, enable_auth_type);
+               val = smtp_ehlo(sock, domain, &avail_auth_type);
        else
                val = smtp_helo(sock, domain);
        if (val != SM_OK) {
@@ -112,7 +110,7 @@ Session *smtp_session_new(const gchar *server, gushort port,
                        sock_close(sock);
                        return NULL;
                }
-               val = smtp_ehlo(sock, domain, &avail_auth_type, enable_auth_type);
+               val = smtp_ehlo(sock, domain, &avail_auth_type);
                if (val != SM_OK) {
                        log_warning(_("Error occurred while sending EHLO\n"));
                        sock_close(sock);
@@ -146,7 +144,8 @@ void smtp_session_destroy(SMTPSession *session)
        g_free(session->pass);
 }
 
-gint smtp_from(SMTPSession *session, const gchar *from)
+gint smtp_from(SMTPSession *session, const gchar *from,
+              SMTPAuthType forced_auth_type)
 {
        gchar buf[MSGBUFSIZE];
 
@@ -154,7 +153,7 @@ gint smtp_from(SMTPSession *session, const gchar *from)
        g_return_val_if_fail(from != NULL, SM_ERROR);
 
        if (session->user) {
-               if (smtp_auth(session) != SM_OK)
+               if (smtp_auth(session, forced_auth_type) != SM_OK)
                        return SM_AUTHFAIL;
        }
 
@@ -170,7 +169,7 @@ gint smtp_from(SMTPSession *session, const gchar *from)
        return smtp_ok(SESSION(session)->sock, NULL, 0);
 }
 
-gint smtp_auth(SMTPSession *session)
+gint smtp_auth(SMTPSession *session, SMTPAuthType forced_auth_type)
 {
        gchar buf[MSGBUFSIZE];
        SMTPAuthType authtype = 0;
@@ -184,10 +183,14 @@ gint smtp_auth(SMTPSession *session)
 
        sock = SESSION(session)->sock;
 
-       if ((session->avail_auth_type & SMTPAUTH_CRAM_MD5) != 0 &&
+       if ((forced_auth_type == SMTPAUTH_CRAM_MD5 ||
+            (forced_auth_type == 0 &&
+             (session->avail_auth_type & SMTPAUTH_CRAM_MD5) != 0)) &&
            smtp_auth_cram_md5(sock, buf, sizeof(buf)) == SM_OK)
                authtype = SMTPAUTH_CRAM_MD5;
-       else if ((session->avail_auth_type & SMTPAUTH_LOGIN) != 0 &&
+       else if ((forced_auth_type == SMTPAUTH_LOGIN ||
+                 (forced_auth_type == 0 &&
+                  (session->avail_auth_type & SMTPAUTH_LOGIN) != 0)) &&
                 smtp_auth_login(sock, buf, sizeof(buf)) == SM_OK)
                authtype = SMTPAUTH_LOGIN;
        else {
@@ -263,8 +266,7 @@ gint smtp_auth(SMTPSession *session)
 }
 
 gint smtp_ehlo(SockInfo *sock, const gchar *hostname,
-              SMTPAuthType *avail_auth_type,
-              SMTPAuthType  enable_auth_type)
+              SMTPAuthType *avail_auth_type)
 {
        gchar buf[MSGBUFSIZE];
 
@@ -285,15 +287,13 @@ gint smtp_ehlo(SockInfo *sock, const gchar *hostname,
                if (strncmp(buf, "250-", 4) == 0) {
                        gchar *p = buf;
                        p += 4;
-                       
-                       if (g_strncasecmp(p, "AUTH ", 5) == 0 ||
-                          (g_strncasecmp(p, "AUTH=", 5) == 0)) {       /* CLAWS: qmail */
+                       if (g_strncasecmp(p, "AUTH", 4) == 0) {
                                p += 5;
-                               if (strcasestr(p, "LOGIN") && (enable_auth_type & SMTPAUTH_LOGIN))
+                               if (strcasestr(p, "LOGIN"))
                                        *avail_auth_type |= SMTPAUTH_LOGIN;
-                               if (strcasestr(p, "CRAM-MD5") && (enable_auth_type & SMTPAUTH_CRAM_MD5))
+                               if (strcasestr(p, "CRAM-MD5"))
                                        *avail_auth_type |= SMTPAUTH_CRAM_MD5;
-                               if (strcasestr(p, "DIGEST-MD5") && (enable_auth_type & SMTPAUTH_DIGEST_MD5))
+                               if (strcasestr(p, "DIGEST-MD5"))
                                        *avail_auth_type |= SMTPAUTH_DIGEST_MD5;
                        }
                } else if ((buf[0] == '1' || buf[0] == '2' || buf[0] == '3') &&
index 9f35e2bb24229e4d43cd50d138fb2f6adf306136..e1a81965501ec0a45df02b17638cf5e0b59e48b4 100644 (file)
@@ -69,26 +69,25 @@ Session *smtp_session_new   (const gchar    *server,
                                 const gchar    *domain,
                                 const gchar    *user,
                                 const gchar    *pass,
-                                SSLType         ssl_type,
-                                SMTPAuthType    enable_auth_type);
+                                SSLType         ssl_type);
 #else
 Session *smtp_session_new      (const gchar    *server,
                                 gushort         port,
                                 const gchar    *domain,
                                 const gchar    *user,
-                                const gchar    *pass,
-                                SMTPAuthType    enable_auth_type);
+                                const gchar    *pass);
 #endif
 void smtp_session_destroy      (SMTPSession    *session);
 
 gint smtp_from                 (SMTPSession    *session,
-                                const gchar    *from);
-gint smtp_auth                 (SMTPSession    *session);
+                                const gchar    *from,
+                                SMTPAuthType    forced_auth_type);
+gint smtp_auth                 (SMTPSession    *session,
+                                SMTPAuthType    forced_auth_type);
 
 gint smtp_ehlo                 (SockInfo       *sock,
                                 const gchar    *hostname,
-                                SMTPAuthType   *avail_auth_type,
-                                SMTPAuthType    enable_auth_type);
+                                SMTPAuthType   *avail_auth_type);
 
 gint smtp_helo                 (SockInfo       *sock,
                                 const gchar    *hostname);