2005-10-03 [colin] 1.9.15cvs1
[claws.git] / src / imap.c
index 5270bd6beaabd1bc5e07594cfb0893972f3d67ae..9a59040844c456db6101d1bd24ce6f1a117e7fea 100644 (file)
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -29,6 +29,7 @@
 #include <string.h>
 #include "imap.h"
 #include "imap_gtk.h"
+#include "inc.h"
 
 #ifdef HAVE_LIBETPAN
 
@@ -606,8 +607,15 @@ static gint imap_auth(IMAPSession *session, const gchar *user, const gchar *pass
                }
                
                if (time(NULL) - last_login_err > 10) {
-                       alertpanel_error(_("Connection to %s failed: login refused.%s"),
+                       if (!prefs_common.no_recv_err_panel) {
+                               alertpanel_error(_("Connection to %s failed: "
+                                       "login refused.%s"),
                                        SESSION(session)->server, ext_info);
+                       } else {
+                               log_error(_("Connection to %s failed: "
+                                       "login refused.%s\n"),
+                                       SESSION(session)->server, ext_info);
+                       }
                }
                last_login_err = time(NULL);
        }
@@ -655,7 +663,7 @@ static IMAPSession *imap_session_get(Folder *folder)
        g_return_val_if_fail(FOLDER_CLASS(folder) == &imap_class, NULL);
        g_return_val_if_fail(folder->account != NULL, NULL);
        
-       if (prefs_common.work_offline && !imap_gtk_should_override()) {
+       if (prefs_common.work_offline && !inc_offline_should_override()) {
                return NULL;
        }
 
@@ -722,6 +730,20 @@ static IMAPSession *imap_session_new(Folder * folder,
                : account->ssl_imap == SSL_TUNNEL ? IMAPS_PORT : IMAP4_PORT;
        ssl_type = account->ssl_imap;   
 #else
+       if (account->ssl_imap != SSL_NONE) {
+               if (alertpanel_full(_("Insecure connection"),
+                       _("This connection is configured to be secured "
+                         "using SSL, but SSL is not available in this "
+                         "build of Sylpheed-Claws. \n\n"
+                         "Do you want to continue connecting to this "
+                         "server? The communication would not be "
+                         "secure."),
+                         _("Con_tinue connecting"), 
+                         GTK_STOCK_CANCEL, NULL,
+                         FALSE, NULL, ALERT_WARNING,
+                         G_ALERTALTERNATE) != G_ALERTDEFAULT)
+                       return NULL;
+       }
        port = account->set_imapport ? account->imapport
                : IMAP4_PORT;
 #endif
@@ -762,7 +784,7 @@ static IMAPSession *imap_session_new(Folder * folder,
                        alertpanel_error(_("Can't connect to IMAP4 server: %s:%d"),
                                         account->recv_server, port);
                } else {
-                       log_error(_("Can't connect to IMAP4 server: %s:%d"),
+                       log_error(_("Can't connect to IMAP4 server: %s:%d\n"),
                                         account->recv_server, port);
                } 
                
@@ -1967,7 +1989,7 @@ static GSList *imap_get_uncached_messages(IMAPSession *session,
                data->numlist = newlist;
                data->cur += count;
                
-               if (prefs_common.work_offline && !imap_gtk_should_override()) {
+               if (prefs_common.work_offline && !inc_offline_should_override()) {
                        g_free(data);
                        return NULL;
                }
@@ -2472,7 +2494,7 @@ static gint imap_cmd_fetch(IMAPSession *session, guint32 uid,
        data->headers = headers;
        data->body = body;
 
-       if (prefs_common.work_offline && !imap_gtk_should_override()) {
+       if (prefs_common.work_offline && !inc_offline_should_override()) {
                g_free(data);
                return -1;
        }
@@ -2557,7 +2579,7 @@ static gint imap_cmd_expunge(IMAPSession *session)
 {
        int r;
        
-       if (prefs_common.work_offline && !imap_gtk_should_override()) {
+       if (prefs_common.work_offline && !inc_offline_should_override()) {
                return -1;
        }
 
@@ -2886,7 +2908,7 @@ static gint get_list_of_uids(Folder *folder, IMAPFolderItem *item, GSList **msgn
        data->item = item;
        data->msgnum_list = msgnum_list;
 
-       if (prefs_common.work_offline && !imap_gtk_should_override()) {
+       if (prefs_common.work_offline && !inc_offline_should_override()) {
                g_free(data);
                return -1;
        }
@@ -2907,8 +2929,6 @@ gint imap_get_num_list(Folder *folder, FolderItem *_item, GSList **msgnum_list,
        gboolean selected_folder;
        
        debug_print("get_num_list\n");
-       statusbar_print_all("Scanning %s...\n", FOLDER_ITEM(item)->path 
-                               ? FOLDER_ITEM(item)->path:"");
        
        g_return_val_if_fail(folder != NULL, -1);
        g_return_val_if_fail(item != NULL, -1);
@@ -2919,6 +2939,9 @@ gint imap_get_num_list(Folder *folder, FolderItem *_item, GSList **msgnum_list,
        session = imap_session_get(folder);
        g_return_val_if_fail(session != NULL, -1);
 
+       statusbar_print_all("Scanning %s...\n", FOLDER_ITEM(item)->path 
+                               ? FOLDER_ITEM(item)->path:"");
+
        selected_folder = (session->mbox != NULL) &&
                          (!strcmp(session->mbox, item->item.path));
        if (selected_folder) {
@@ -3549,7 +3572,7 @@ static gint imap_get_flags(Folder *folder, FolderItem *item,
        data->msginfo_list = msginfo_list;
        data->msgflags = msgflags;
 
-       if (prefs_common.work_offline && !imap_gtk_should_override()) {
+       if (prefs_common.work_offline && !inc_offline_should_override()) {
                g_free(data);
                return -1;
        }