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 fea8596..5a11ec3 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 98d899b..9d768e0 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 3d95873..8d06e7a 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 32014ef..5302c19 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 c41e726..4aca5c1 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 bc36023..2534af3 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 e1713ba..b5ed823 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 977c89f..94f600a 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 1312385..716f8d7 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 1f6f0f9..22a02a7 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 28308dc..9ef291a 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 82067c8..bf7eda4 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 9f35e2b..e1a8196 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);