2006-06-29 [colin] 2.3.1cvs41
authorColin Leroy <colin@colino.net>
Thu, 29 Jun 2006 17:20:04 +0000 (17:20 +0000)
committerColin Leroy <colin@colino.net>
Thu, 29 Jun 2006 17:20:04 +0000 (17:20 +0000)
* src/imap.c
* src/imap.h
* src/mainwindow.c
Disconnect from IMAP servers when going
offline. Fixes bug #978 (going to offline-mode
won't close connections)

ChangeLog
PATCHSETS
configure.ac
src/imap.c
src/imap.h
src/mainwindow.c

index bc50085..c0b6059 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-06-29 [colin]     2.3.1cvs41
+
+       * src/imap.c
+       * src/imap.h
+       * src/mainwindow.c
+               Disconnect from IMAP servers when going
+               offline. Fixes bug #978 (going to offline-mode 
+               won't close connections)
+
 2006-06-29 [colin]     2.3.1cvs40
 
        * src/main.c
index 190f8d4..2aeb292 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.274.2.119 -r 1.274.2.120 src/mainwindow.c;  ) > 2.3.1cvs38.patchset
 ( cvs diff -u -r 1.382.2.288 -r 1.382.2.289 src/compose.c;  cvs diff -u -r 1.1.2.20 -r 1.1.2.21 src/plugins/pgpcore/sgpgme.c;  ) > 2.3.1cvs39.patchset
 ( cvs diff -u -r 1.115.2.92 -r 1.115.2.93 src/main.c;  cvs diff -u -r 1.1.2.21 -r 1.1.2.22 src/plugins/pgpcore/sgpgme.c;  ) > 2.3.1cvs40.patchset
+( cvs diff -u -r 1.179.2.124 -r 1.179.2.125 src/imap.c;  cvs diff -u -r 1.34.2.6 -r 1.34.2.7 src/imap.h;  cvs diff -u -r 1.274.2.120 -r 1.274.2.121 src/mainwindow.c;  ) > 2.3.1cvs41.patchset
index 7e87aa6..53a8756 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=3
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=40
+EXTRA_VERSION=41
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 4cee841..c48e34e 100644 (file)
@@ -68,6 +68,7 @@
 #include "statusbar.h"
 #include "msgcache.h"
 #include "imap-thread.h"
+#include "account.h"
 
 typedef struct _IMAPFolder     IMAPFolder;
 typedef struct _IMAPSession    IMAPSession;
@@ -4252,6 +4253,24 @@ void imap_folder_ref(Folder *folder)
        ((IMAPFolder *)folder)->refcnt++;
 }
 
+void imap_disconnect_all(void)
+{
+       GList *list;
+       for (list = account_get_list(); list != NULL; list = list->next) {
+               PrefsAccount *account = list->data;
+               if (account->protocol == A_IMAP4) {
+                       RemoteFolder *folder = (RemoteFolder *)account->folder;
+                       if (folder && folder->session) {
+                               printf("disconnecting\n");
+                               IMAPSession *session = (IMAPSession *)folder->session;
+                               imap_threaded_disconnect(FOLDER(folder));
+                               session_destroy(session);
+                               folder->session = NULL;
+                       }
+               }
+       }
+}
+
 void imap_folder_unref(Folder *folder)
 {
        if (((IMAPFolder *)folder)->refcnt > 0)
@@ -4313,6 +4332,11 @@ FolderClass *imap_get_class(void)
 
        return &imap_class;
 }
+
+void imap_disconnect_all(void)
+{
+}
+
 #endif
 
 void imap_synchronise(FolderItem *item) 
index c4c80c5..9ee7a87 100644 (file)
@@ -34,5 +34,5 @@ guint imap_folder_get_refcnt(Folder *folder);
 void imap_folder_ref(Folder *folder);
 void imap_folder_unref(Folder *folder);
 gchar imap_get_path_separator_for_item (FolderItem *item);
-
+void imap_disconnect_all(void);
 #endif /* __IMAP_H__ */
index 0fe8cd8..1250448 100644 (file)
@@ -3143,6 +3143,7 @@ static void online_switch_clicked (GtkButton *btn, gpointer data)
                menuitem->active = TRUE;
                prefs_common.work_offline = TRUE;
                inc_autocheck_timer_remove();           
+               imap_disconnect_all();
        } else {
                /*go online */
                gtk_widget_hide (mainwin->offline_switch);