Removed SessionMsgType enum and its use, since it is useless.
[claws.git] / src / pop.c
index ea382b17c58d85d9fd8c0b87d20c356c59e50ecc..ee2db434e10ab270cedede0015e3e6c24d11a8e8 100644 (file)
--- a/src/pop.c
+++ b/src/pop.c
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2011 Hiroyuki Yamamoto and the Claws Mail team
+ * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team
  *
  * 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
@@ -19,6 +19,7 @@
 
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
+#include "claws-features.h"
 #endif
 
 #include <glib.h>
@@ -509,7 +510,7 @@ static void pop3_gen_send(Pop3Session *session, const gchar *format, ...)
        else
                log_print(LOG_PROTOCOL, "POP3> %s\n", buf);
 
-       session_send_msg(SESSION(session), SESSION_MSG_NORMAL, buf);
+       session_send_msg(SESSION(session), buf);
 }
 
 Session *pop3_session_new(PrefsAccount *account)
@@ -518,6 +519,8 @@ Session *pop3_session_new(PrefsAccount *account)
 
        cm_return_val_if_fail(account != NULL, NULL);
 
+       account->receive_in_progress = TRUE;
+
        session = g_new0(Pop3Session, 1);
 
        session_init(SESSION(session), account, FALSE);
@@ -527,9 +530,15 @@ Session *pop3_session_new(PrefsAccount *account)
        SESSION(session)->recv_msg = pop3_session_recv_msg;
        SESSION(session)->recv_data_finished = pop3_session_recv_data_finished;
        SESSION(session)->send_data_finished = NULL;
-
+       SESSION(session)->ssl_cert_auto_accept = account->ssl_certs_auto_accept;
        SESSION(session)->destroy = pop3_session_destroy;
 
+#ifdef USE_GNUTLS
+       if (account->set_gnutls_priority && account->gnutls_priority &&
+                       strlen(account->gnutls_priority) != 0)
+               SESSION(session)->gnutls_priority = g_strdup(account->gnutls_priority);
+#endif
+
        session->state = POP3_READY;
        session->ac_prefs = account;
        session->pop_before_smtp = FALSE;
@@ -566,6 +575,8 @@ static void pop3_session_destroy(Session *session)
        g_free(pop3_session->user);
        g_free(pop3_session->pass);
        g_free(pop3_session->error_msg);
+
+       pop3_session->ac_prefs->receive_in_progress = FALSE;
 }
 
 static void pop3_get_uidl_table(PrefsAccount *ac_prefs, Pop3Session *session)
@@ -651,7 +662,7 @@ static void pop3_get_uidl_table(PrefsAccount *ac_prefs, Pop3Session *session)
 #define TRY(func) \
 if (!(func)) \
 { \
-       g_warning("failed to write\n"); \
+       g_warning("failed to write"); \
        goto err_write;                 \
 } \
 
@@ -754,7 +765,7 @@ static gint pop3_write_msg_to_file(const gchar *file, const gchar *data,
                if ((cur > prev && fwrite(prev, 1, cur - prev, fp) < 1) ||
                    fputc('\n', fp) == EOF) {
                        FILE_OP_ERROR(file, "fwrite");
-                       g_warning("can't write to file: %s\n", file);
+                       g_warning("can't write to file: %s", file);
                        fclose(fp);
                        claws_unlink(file);
                        return -1;
@@ -780,7 +791,7 @@ static gint pop3_write_msg_to_file(const gchar *file, const gchar *data,
        if (prev - data < len &&
            fwrite(prev, 1, len - (prev - data), fp) < 1) {
                FILE_OP_ERROR(file, "fwrite");
-               g_warning("can't write to file: %s\n", file);
+               g_warning("can't write to file: %s", file);
                fclose(fp);
                claws_unlink(file);
                return -1;
@@ -788,7 +799,7 @@ static gint pop3_write_msg_to_file(const gchar *file, const gchar *data,
        if (data[len - 1] != '\r' && data[len - 1] != '\n') {
                if (fputc('\n', fp) == EOF) {
                        FILE_OP_ERROR(file, "fputc");
-                       g_warning("can't write to file: %s\n", file);
+                       g_warning("can't write to file: %s", file);
                        fclose(fp);
                        claws_unlink(file);
                        return -1;