sync with 0.8.6cvs3
authorPaul Mangan <paul@claws-mail.org>
Mon, 25 Nov 2002 18:10:26 +0000 (18:10 +0000)
committerPaul Mangan <paul@claws-mail.org>
Mon, 25 Nov 2002 18:10:26 +0000 (18:10 +0000)
src/send.c
src/smtp.c
src/smtp.h
src/textview.c

index d33bd3057db72c4a3b56d67444ae2808cf959926..1ce2082cf76156e8ef752f3a2e707c9e70660fd7 100644 (file)
@@ -61,14 +61,26 @@ struct _SendProgressDialog
        GList *queue_list;
        gboolean cancelled;
 };
+#if 0
+static gint send_message_local         (const gchar            *command,
+                                        FILE                   *fp);
 
+static gint send_message_smtp          (PrefsAccount           *ac_prefs,
+                                        GSList                 *to_list,
+                                        FILE                   *fp);
+#endif
+static gint send_message_data          (SendProgressDialog     *dialog,
+                                        SockInfo               *sock,
+                                        FILE                   *fp,
+                                        gint                    size);
 
-static gint send_message_data  (SendProgressDialog *dialog, SockInfo *sock,
-                                FILE *fp, gint size);
+static SendProgressDialog *send_progress_dialog_create (void);
+static void send_progress_dialog_destroy       (SendProgressDialog *dialog);
+static void send_cancel                                (GtkWidget          *widget,
+                                                gpointer            data);
 
-static SendProgressDialog *send_progress_dialog_create(void);
-static void send_progress_dialog_destroy(SendProgressDialog *dialog);
-static void send_cancel(GtkWidget *widget, gpointer data);
+static void send_progress_dialog_update                (Session            *session,
+                                                SMTPPhase           phase);
 
 
 gint send_message(const gchar *file, PrefsAccount *ac_prefs, GSList *to_list)
@@ -271,9 +283,9 @@ gint send_message_local(const gchar *command, FILE *fp)
 
 #define EXIT_IF_CANCELLED() \
 { \
+       GTK_EVENTS_FLUSH(); \
        if (dialog->cancelled) { \
-               if (session) \
-                       session_destroy(session); \
+               session_destroy(session); \
                send_progress_dialog_destroy(dialog); \
                return -1; \
        } \
@@ -284,8 +296,7 @@ gint send_message_local(const gchar *command, FILE *fp)
        EXIT_IF_CANCELLED(); \
        if (!(f)) { \
                log_warning("Error occurred while %s\n", s); \
-               if (session) \
-                       session_destroy(session); \
+               session_destroy(session); \
                send_progress_dialog_destroy(dialog); \
                return -1; \
        } \
@@ -309,7 +320,8 @@ gint send_message_local(const gchar *command, FILE *fp)
                                ac_prefs->tmp_smtp_pass = NULL; \
                        } \
                } \
-               if (smtp_quit(session->sock) != SM_OK) \
+               if (session->sock && \
+                   smtp_quit(SMTP_SESSION(session)) != SM_OK) \
                        log_warning(_("Error occurred while sending QUIT\n")); \
                session_destroy(session); \
                send_progress_dialog_destroy(dialog); \
@@ -396,58 +408,38 @@ gint send_message_smtp(PrefsAccount *ac_prefs, GSList *to_list,
                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);
-       progress_dialog_set_label(dialog->dialog, buf);
-       gtk_clist_set_text(clist, 0, 2, _("Connecting"));
-       GTK_EVENTS_FLUSH();
+       session = smtp_session_new();
+       session->data = dialog;
+       session->ui_func = (SessionUIFunc)send_progress_dialog_update;
 
 #if USE_SSL
-       SEND_EXIT_IF_ERROR((session = smtp_session_new
-                               (ac_prefs->smtp_server, port, domain,
-                                user, pass, ac_prefs->ssl_smtp)),
-                          "connecting to server");
+       SEND_EXIT_IF_NOTOK
+               (smtp_connect(SMTP_SESSION(session), ac_prefs->smtp_server,
+                             port, domain, 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)),
-                          "connecting to server");
+       SEND_EXIT_IF_NOTOK
+               (smtp_connect(SMTP_SESSION(session), ac_prefs->smtp_server,
+                             port, domain, user, pass),
+                "connecting to server");
 #endif
 
        if (user) {
-               progress_dialog_set_label(dialog->dialog,
-                                         _("Authenticating..."));
-               gtk_clist_set_text(clist, 0, 2, _("Authenticating"));
-               GTK_EVENTS_FLUSH();
-
                SEND_EXIT_IF_NOTOK(smtp_auth(SMTP_SESSION(session),
                                             ac_prefs->smtp_auth_type),
                                   "authenticating");
        }
 
-       progress_dialog_set_label(dialog->dialog, _("Sending MAIL FROM..."));
-       statusbar_puts_all(_("Sending MAIL FROM..."));
-       gtk_clist_set_text(clist, 0, 2, _("Sending"));
-       GTK_EVENTS_FLUSH();
-
        SEND_EXIT_IF_NOTOK
                (smtp_from(SMTP_SESSION(session), ac_prefs->address),
                 "sending MAIL FROM");
 
-       progress_dialog_set_label(dialog->dialog, _("Sending RCPT TO..."));
-       statusbar_puts_all(_("Sending RCPT TO..."));
-       GTK_EVENTS_FLUSH();
-
        for (cur = to_list; cur != NULL; cur = cur->next)
-               SEND_EXIT_IF_NOTOK(smtp_rcpt(session->sock, (gchar *)cur->data),
+               SEND_EXIT_IF_NOTOK(smtp_rcpt(SMTP_SESSION(session),
+                                  (gchar *)cur->data),
                                   "sending RCPT TO");
 
-       progress_dialog_set_label(dialog->dialog, _("Sending DATA..."));
-       statusbar_puts_all(_("Sending DATA..."));
-       GTK_EVENTS_FLUSH();
-
-       SEND_EXIT_IF_NOTOK(smtp_data(session->sock), "sending DATA");
+       SEND_EXIT_IF_NOTOK(smtp_data(SMTP_SESSION(session)), "sending DATA");
 
        /* send main part */
        SEND_EXIT_IF_ERROR
@@ -458,8 +450,8 @@ gint send_message_smtp(PrefsAccount *ac_prefs, GSList *to_list,
        statusbar_puts_all(_("Quitting..."));
        GTK_EVENTS_FLUSH();
 
-       SEND_EXIT_IF_NOTOK(smtp_eom(session->sock), "terminating data");
-       SEND_EXIT_IF_NOTOK(smtp_quit(session->sock), "sending QUIT");
+       SEND_EXIT_IF_NOTOK(smtp_eom(SMTP_SESSION(session)), "terminating data");
+       SEND_EXIT_IF_NOTOK(smtp_quit(SMTP_SESSION(session)), "sending QUIT");
 
        statusbar_pop_all();
 
@@ -614,3 +606,55 @@ static void send_cancel(GtkWidget *widget, gpointer data)
 
        dialog->cancelled = TRUE;
 }
+
+static void send_progress_dialog_update(Session *session, SMTPPhase phase)
+{
+       gchar buf[BUFFSIZE];
+       gchar *state_str = NULL;
+       SendProgressDialog *dialog = (SendProgressDialog *)session->data;
+
+       switch (phase) {
+       case SMTP_CONNECT:
+               g_snprintf(buf, sizeof(buf),
+                          _("Connecting to SMTP server: %s ..."),
+                          session->server);
+               state_str = _("Connecting");
+               log_message("%s\n", buf);
+               break;
+       case SMTP_HELO:
+               g_snprintf(buf, sizeof(buf), _("Sending HELO..."));
+               state_str = _("Authenticating");
+               break;
+       case SMTP_EHLO:
+               g_snprintf(buf, sizeof(buf), _("Sending EHLO..."));
+               state_str = _("Authenticating");
+               break;
+       case SMTP_AUTH:
+               g_snprintf(buf, sizeof(buf), _("Authenticating..."));
+               state_str = _("Authenticating");
+               break;
+       case SMTP_FROM:
+               g_snprintf(buf, sizeof(buf), _("Sending MAIL FROM..."));
+               state_str = _("Sending");
+               break;
+       case SMTP_RCPT:
+               g_snprintf(buf, sizeof(buf), _("Sending RCPT TO..."));
+               state_str = _("Sending");
+               break;
+       case SMTP_DATA:
+       case SMTP_EOM:
+               g_snprintf(buf, sizeof(buf), _("Sending DATA..."));
+               state_str = _("Sending");
+               break;
+       case SMTP_QUIT:
+               g_snprintf(buf, sizeof(buf), _("Quitting..."));
+               state_str = _("Quitting");
+               break;
+       default:
+               return;
+       }
+
+       progress_dialog_set_label(dialog->dialog, buf);
+       gtk_clist_set_text(GTK_CLIST(dialog->dialog->clist), 0, 2, state_str);
+       GTK_EVENTS_FLUSH();
+}
index 9e4ffc4f77d6c8649492fcf0b8920f2ad4b81782..deb47a7bfe199c079b67b07ffc849cf7b4b82eb3 100644 (file)
 
 static gint verbose = 1;
 
-static gint smtp_starttls(SockInfo *sock);
-static gint smtp_auth_cram_md5(SockInfo *sock, gchar *buf, gint len);
-static gint smtp_auth_login(SockInfo *sock, gchar *buf, gint len);
+#define UI_UPDATE(session, phase) \
+{ \
+       if (SESSION(session)->ui_func) \
+               SESSION(session)->ui_func(SESSION(session), phase); \
+}
+
+static gint smtp_starttls(SMTPSession *session);
+static gint smtp_auth_cram_md5(SMTPSession *session, gchar *buf, gint len);
+static gint smtp_auth_login(SMTPSession *session, gchar *buf, gint len);
+
 static gint smtp_ok(SockInfo *sock, gchar *buf, gint len);
 
+Session *smtp_session_new(void)
+{
+       SMTPSession *session;
+
+       session = g_new0(SMTPSession, 1);
+       SESSION(session)->type             = SESSION_SMTP;
+       SESSION(session)->server           = NULL;
+       SESSION(session)->sock             = NULL;
+       SESSION(session)->connected        = FALSE;
+       SESSION(session)->phase            = SESSION_READY;
+       SESSION(session)->last_access_time = 0;
+       SESSION(session)->data             = NULL;
+
+       SESSION(session)->destroy          = smtp_session_destroy;
+       SESSION(session)->ui_func          = NULL;
+
+       session->avail_auth_type           = 0;
+       session->user                      = NULL;
+       session->pass                      = NULL;
+
+       return SESSION(session);
+}
+
+void smtp_session_destroy(Session *session)
+{
+       sock_close(session->sock);
+       session->sock = NULL;
+
+       g_free(SMTP_SESSION(session)->user);
+       g_free(SMTP_SESSION(session)->pass);
+}
+
 #if USE_SSL
-Session *smtp_session_new(const gchar *server, gushort port,
-                         const gchar *domain,
-                         const gchar *user, const gchar *pass,
-                         SSLType ssl_type)
+gint smtp_connect(SMTPSession *session, const gchar *server, gushort port,
+                 const gchar *domain, const gchar *user, const gchar *pass,
+                 SSLType ssl_type)
 #else
-Session *smtp_session_new(const gchar *server, gushort port,
-                         const gchar *domain,
-                         const gchar *user, const gchar *pass)
+gint smtp_connect(SMTPSession *session, const gchar *server, gushort port,
+                 const gchar *domain, const gchar *user, const gchar *pass)
 #endif
 {
-       SMTPSession *session;
        SockInfo *sock;
        gboolean use_esmtp;
        SMTPAuthType avail_auth_type = 0;
        gint val;
 
-       g_return_val_if_fail(server != NULL, NULL);
+       g_return_val_if_fail(session != NULL, SM_ERROR);
+       g_return_val_if_fail(server != NULL, SM_ERROR);
 
 #if USE_SSL
        use_esmtp = user != NULL || ssl_type == SSL_STARTTLS;
@@ -64,17 +101,23 @@ Session *smtp_session_new(const gchar *server, gushort port,
        use_esmtp = user != NULL;
 #endif
 
+       SESSION(session)->server = g_strdup(server);
+       session->user = user ? g_strdup(user) : NULL;
+       session->pass = pass ? g_strdup(pass) : user ? g_strdup("") : NULL;
+
+       UI_UPDATE(session, SMTP_CONNECT);
+
        if ((sock = sock_connect(server, port)) == NULL) {
                log_warning(_("Can't connect to SMTP server: %s:%d\n"),
                            server, port);
-               return NULL;
+               return SM_ERROR;
        }
 
 #if USE_SSL
        if (ssl_type == SSL_TUNNEL && !ssl_init_socket(sock)) {
                log_warning(_("SSL connection failed"));
                sock_close(sock);
-               return NULL;
+               return SM_ERROR;
        }
 #endif
 
@@ -82,69 +125,45 @@ Session *smtp_session_new(const gchar *server, gushort port,
                log_warning(_("Error occurred while connecting to %s:%d\n"),
                            server, port);
                sock_close(sock);
-               return NULL;
+               return SM_ERROR;
        }
 
+       SESSION(session)->sock = sock;
+       SESSION(session)->connected = TRUE;
+
        if (!domain)
                domain = get_domain_name();
 
        if (use_esmtp)
-               val = smtp_ehlo(sock, domain, &avail_auth_type);
+               val = smtp_ehlo(session, domain, &avail_auth_type);
        else
-               val = smtp_helo(sock, domain);
+               val = smtp_helo(session, domain);
        if (val != SM_OK) {
                log_warning(_("Error occurred while sending HELO\n"));
-               sock_close(sock);
-               return NULL;
+               return val;
        }
 
 #if USE_SSL
        if (ssl_type == SSL_STARTTLS) {
-               val = smtp_starttls(sock);
+               val = smtp_starttls(session);
                if (val != SM_OK) {
                        log_warning(_("Error occurred while sending STARTTLS\n"));
-                       sock_close(sock);
-                       return NULL;
+                       return val;
                }
                if (!ssl_init_socket_with_method(sock, SSL_METHOD_TLSv1)) {
-                       sock_close(sock);
-                       return NULL;
+                       return SM_ERROR;
                }
-               val = smtp_ehlo(sock, domain, &avail_auth_type);
+               val = smtp_ehlo(session, domain, &avail_auth_type);
                if (val != SM_OK) {
                        log_warning(_("Error occurred while sending EHLO\n"));
-                       sock_close(sock);
-                       return NULL;
+                       return val;
                }
        }
 #endif
 
-       session = g_new(SMTPSession, 1);
-       SESSION(session)->type             = SESSION_SMTP;
-       SESSION(session)->server           = g_strdup(server);
-       SESSION(session)->sock             = sock;
-       SESSION(session)->connected        = TRUE;
-       SESSION(session)->phase            = SESSION_READY;
-       SESSION(session)->last_access_time = 0;
-       SESSION(session)->data             = NULL;
+       session->avail_auth_type = avail_auth_type;
 
-       SESSION(session)->destroy          = smtp_session_destroy;
-
-       session->avail_auth_type           = avail_auth_type;
-       session->user                      = user ? g_strdup(user) : NULL;
-       session->pass                      = pass ? g_strdup(pass) :
-                                            user ? g_strdup("") : NULL;
-
-       return SESSION(session);
-}
-
-void smtp_session_destroy(Session *session)
-{
-       sock_close(session->sock);
-       session->sock = NULL;
-
-       g_free(SMTP_SESSION(session)->user);
-       g_free(SMTP_SESSION(session)->pass);
+       return 0;
 }
 
 gint smtp_from(SMTPSession *session, const gchar *from)
@@ -154,6 +173,8 @@ gint smtp_from(SMTPSession *session, const gchar *from)
        g_return_val_if_fail(session != NULL, SM_ERROR);
        g_return_val_if_fail(from != NULL, SM_ERROR);
 
+       UI_UPDATE(session, SMTP_FROM);
+
        if (strchr(from, '<'))
                g_snprintf(buf, sizeof(buf), "MAIL FROM: %s", from);
        else
@@ -178,17 +199,19 @@ gint smtp_auth(SMTPSession *session, SMTPAuthType forced_auth_type)
        g_return_val_if_fail(session != NULL, SM_ERROR);
        g_return_val_if_fail(session->user != NULL, SM_ERROR);
 
+       UI_UPDATE(session, SMTP_AUTH);
+
        sock = SESSION(session)->sock;
 
        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)
+           smtp_auth_cram_md5(session, buf, sizeof(buf)) == SM_OK)
                authtype = SMTPAUTH_CRAM_MD5;
        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)
+                smtp_auth_login(session, buf, sizeof(buf)) == SM_OK)
                authtype = SMTPAUTH_LOGIN;
        else {
                log_warning(_("SMTP AUTH not available\n"));
@@ -262,11 +285,16 @@ gint smtp_auth(SMTPSession *session, SMTPAuthType forced_auth_type)
        return smtp_ok(sock, NULL, 0);
 }
 
-gint smtp_ehlo(SockInfo *sock, const gchar *hostname,
+gint smtp_ehlo(SMTPSession *session, const gchar *hostname,
               SMTPAuthType *avail_auth_type)
 {
+       SockInfo *sock;
        gchar buf[MSGBUFSIZE];
 
+       UI_UPDATE(session, SMTP_EHLO);
+
+       sock = SESSION(session)->sock;
+
        *avail_auth_type = 0;
 
        sock_printf(sock, "EHLO %s\r\n", hostname);
@@ -306,8 +334,14 @@ gint smtp_ehlo(SockInfo *sock, const gchar *hostname,
        return SM_UNRECOVERABLE;
 }
 
-static gint smtp_starttls(SockInfo *sock)
+static gint smtp_starttls(SMTPSession *session)
 {
+       SockInfo *sock;
+
+       UI_UPDATE(session, SMTP_STARTTLS);
+
+       sock = SESSION(session)->sock;
+
        sock_printf(sock, "STARTTLS\r\n");
        if (verbose)
                log_print("ESMTP> STARTTLS\n");
@@ -315,8 +349,14 @@ static gint smtp_starttls(SockInfo *sock)
        return smtp_ok(sock, NULL, 0);
 }
 
-static gint smtp_auth_cram_md5(SockInfo *sock, gchar *buf, gint len)
+static gint smtp_auth_cram_md5(SMTPSession *session, gchar *buf, gint len)
 {
+       SockInfo *sock;
+
+       UI_UPDATE(session, SMTP_AUTH);
+
+       sock = SESSION(session)->sock;
+
        sock_printf(sock, "AUTH CRAM-MD5\r\n");
        if (verbose)
                log_print("ESMTP> AUTH CRAM-MD5\n");
@@ -324,8 +364,14 @@ static gint smtp_auth_cram_md5(SockInfo *sock, gchar *buf, gint len)
        return smtp_ok(sock, buf, len);
 }
 
-static gint smtp_auth_login(SockInfo *sock, gchar *buf, gint len)
+static gint smtp_auth_login(SMTPSession *session, gchar *buf, gint len)
 {
+       SockInfo *sock;
+
+       UI_UPDATE(session, SMTP_AUTH);
+
+       sock = SESSION(session)->sock;
+
        sock_printf(sock, "AUTH LOGIN\r\n");
        if (verbose)
                log_print("ESMTP> AUTH LOGIN\n");
@@ -333,8 +379,14 @@ static gint smtp_auth_login(SockInfo *sock, gchar *buf, gint len)
        return smtp_ok(sock, buf, len);
 }
 
-gint smtp_helo(SockInfo *sock, const gchar *hostname)
+gint smtp_helo(SMTPSession *session, const gchar *hostname)
 {
+       SockInfo *sock;
+
+       UI_UPDATE(session, SMTP_HELO);
+
+       sock = SESSION(session)->sock;
+
        sock_printf(sock, "HELO %s\r\n", hostname);
        if (verbose)
                log_print("SMTP> HELO %s\n", hostname);
@@ -342,10 +394,15 @@ gint smtp_helo(SockInfo *sock, const gchar *hostname)
        return smtp_ok(sock, NULL, 0);
 }
 
-gint smtp_rcpt(SockInfo *sock, const gchar *to)
+gint smtp_rcpt(SMTPSession *session, const gchar *to)
 {
+       SockInfo *sock;
        gchar buf[MSGBUFSIZE];
 
+       UI_UPDATE(session, SMTP_RCPT);
+
+       sock = SESSION(session)->sock;
+
        if (strchr(to, '<'))
                g_snprintf(buf, sizeof(buf), "RCPT TO: %s", to);
        else
@@ -358,8 +415,14 @@ gint smtp_rcpt(SockInfo *sock, const gchar *to)
        return smtp_ok(sock, NULL, 0);
 }
 
-gint smtp_data(SockInfo *sock)
+gint smtp_data(SMTPSession *session)
 {
+       SockInfo *sock;
+
+       UI_UPDATE(session, SMTP_DATA);
+
+       sock = SESSION(session)->sock;
+
        sock_printf(sock, "DATA\r\n");
        if (verbose)
                log_print("SMTP> DATA\n");
@@ -367,8 +430,14 @@ gint smtp_data(SockInfo *sock)
        return smtp_ok(sock, NULL, 0);
 }
 
-gint smtp_rset(SockInfo *sock)
+gint smtp_rset(SMTPSession *session)
 {
+       SockInfo *sock;
+
+       UI_UPDATE(session, SMTP_RSET);
+
+       sock = SESSION(session)->sock;
+
        sock_printf(sock, "RSET\r\n");
        if (verbose)
                log_print("SMTP> RSET\n");
@@ -376,8 +445,14 @@ gint smtp_rset(SockInfo *sock)
        return smtp_ok(sock, NULL, 0);
 }
 
-gint smtp_quit(SockInfo *sock)
+gint smtp_quit(SMTPSession *session)
 {
+       SockInfo *sock;
+
+       UI_UPDATE(session, SMTP_QUIT);
+
+       sock = SESSION(session)->sock;
+
        sock_printf(sock, "QUIT\r\n");
        if (verbose)
                log_print("SMTP> QUIT\n");
@@ -385,8 +460,14 @@ gint smtp_quit(SockInfo *sock)
        return smtp_ok(sock, NULL, 0);
 }
 
-gint smtp_eom(SockInfo *sock)
+gint smtp_eom(SMTPSession *session)
 {
+       SockInfo *sock;
+
+       UI_UPDATE(session, SMTP_EOM);
+
+       sock = SESSION(session)->sock;
+
        sock_printf(sock, ".\r\n");
        if (verbose)
                log_print("SMTP> . (EOM)\n");
index 7a76080d0557afb843aa0c6aa8cfe73f9275853f..316e212b0cd061a95f280a6658b0bff878686304 100644 (file)
@@ -54,6 +54,23 @@ typedef enum
        SMTPAUTH_DIGEST_MD5 = 1 << 2
 } SMTPAuthType;
 
+typedef enum
+{
+       SMTP_CONNECT,
+       SMTP_HELO,
+       SMTP_EHLO,
+       SMTP_STARTTLS,
+       SMTP_FROM,
+       SMTP_AUTH,
+       SMTP_RCPT,
+       SMTP_DATA,
+       SMTP_RSET,
+       SMTP_QUIT,
+       SMTP_EOM,
+
+       N_SMTP_PHASE
+} SMTPPhase;
+
 struct _SMTPSession
 {
        Session session;
@@ -63,38 +80,42 @@ struct _SMTPSession
        gchar *pass;
 };
 
+Session *smtp_session_new      (void);
+void smtp_session_destroy      (Session        *session);
+
 #if USE_SSL
-Session *smtp_session_new      (const gchar    *server,
+gint smtp_connect              (SMTPSession    *session,
+                                const gchar    *server,
                                 gushort         port,
                                 const gchar    *domain,
                                 const gchar    *user,
                                 const gchar    *pass,
                                 SSLType         ssl_type);
 #else
-Session *smtp_session_new      (const gchar    *server,
+gint smtp_connect              (SMTPSession    *session,
+                                const gchar    *server,
                                 gushort         port,
                                 const gchar    *domain,
                                 const gchar    *user,
                                 const gchar    *pass);
 #endif
-void smtp_session_destroy      (Session        *session);
 
 gint smtp_from                 (SMTPSession    *session,
                                 const gchar    *from);
 gint smtp_auth                 (SMTPSession    *session,
                                 SMTPAuthType    forced_auth_type);
 
-gint smtp_ehlo                 (SockInfo       *sock,
+gint smtp_ehlo                 (SMTPSession    *session,
                                 const gchar    *hostname,
                                 SMTPAuthType   *avail_auth_type);
 
-gint smtp_helo                 (SockInfo       *sock,
+gint smtp_helo                 (SMTPSession    *session,
                                 const gchar    *hostname);
-gint smtp_rcpt                 (SockInfo       *sock,
+gint smtp_rcpt                 (SMTPSession    *session,
                                 const gchar    *to);
-gint smtp_data                 (SockInfo       *sock);
-gint smtp_rset                 (SockInfo       *sock);
-gint smtp_quit                 (SockInfo       *sock);
-gint smtp_eom                  (SockInfo       *sock);
+gint smtp_data                 (SMTPSession    *session);
+gint smtp_rset                 (SMTPSession    *session);
+gint smtp_quit                 (SMTPSession    *session);
+gint smtp_eom                  (SMTPSession    *session);
 
 #endif /* __SMTP_H__ */
index 41054fa2c2994112fb9145e9a179868fa0f78eae..5f1827d299fee01a0376d1d41556e7c5b04032a0 100644 (file)
@@ -954,8 +954,8 @@ static void textview_make_clickable_parts(TextView *textview,
        static struct table parser[] = {
                {"http://",  strcasestr, get_uri_part,   make_uri_string},
                {"https://", strcasestr, get_uri_part,   make_uri_string},
-               {"www.",     strcasestr, get_uri_part,   make_uri_string},
                {"ftp://",   strcasestr, get_uri_part,   make_uri_string},
+               {"www.",     strcasestr, get_uri_part,   make_uri_string},
                {"mailto:",  strcasestr, get_uri_part,   make_uri_string},
                {"@",        strcasestr, get_email_part, make_email_string}
        };
@@ -1192,7 +1192,7 @@ void textview_set_font(TextView *textview, const gchar *codeset)
        /* In multi-byte mode, GtkSText can't display 8bit characters
           correctly, so it must be single-byte mode. */
        if (MB_CUR_MAX > 1) {
-               if (codeset && conv_get_current_charset() != C_UTF_8) {
+               if (codeset) {
                        if (!g_strncasecmp(codeset, "ISO-8859-", 9) ||
                            !g_strcasecmp(codeset, "BALTIC"))
                                use_fontset = FALSE;