0.9.3claws57
authorChristoph Hohmann <reboot@gmx.ch>
Sat, 26 Jul 2003 19:07:16 +0000 (19:07 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Sat, 26 Jul 2003 19:07:16 +0000 (19:07 +0000)
* sync with 0.9.3cvs18
        see ChangeLog 2003-07-24

ChangeLog.claws
src/folder.c
src/folder.h
src/imap.c
src/mbox_folder.c
src/mh.c
src/news.c

index 9e16700165a39b42c5637af59891d4148e954a25..343843cc415991ac5e3a1a0e81d09d469a2675fd 100644 (file)
@@ -1,3 +1,8 @@
+2003-07-26 [christoph] 0.9.3claws57
+
+       * sync with 0.9.3cvs18
+               see ChangeLog 2003-07-24
+
 2003-07-26 [christoph] 0.9.3claws56
 
        * sync with 0.9.3cvs17
index 8d62acc47593835f2e94f55d62d412687234b395..10b2444ac6e71a33fe6dd0261b6fc877be463bb8 100644 (file)
@@ -1034,11 +1034,12 @@ gint folder_item_open(FolderItem *item)
        return 0;
 }
 
-void folder_item_close(FolderItem *item)
+gint folder_item_close(FolderItem *item)
 {
        GSList *mlist, *cur;
+       Folder *folder;
        
-       g_return_if_fail(item != NULL);
+       g_return_val_if_fail(item != NULL, -1);
 
        if (item->new_msgs) {
                folder_item_update_freeze();
@@ -1058,6 +1059,14 @@ void folder_item_close(FolderItem *item)
        folder_item_write_cache(item);
        
        folder_item_update(item, F_ITEM_UPDATE_MSGCNT);
+
+       item->opened = FALSE;
+       folder = item->folder;
+
+       if (folder->klass->close == NULL)
+               return 0;
+
+       return folder->klass->close(folder, item);
 }
 
 gint folder_item_scan_full(FolderItem *item, gboolean filtering)
index 29db16639d1ce0de6742ba70d5f1e3778b3054ed..21bdfb248556d1e53ec4695dda7dd7d22c200af0 100644 (file)
@@ -192,6 +192,8 @@ struct _FolderClass
                                                 const gchar    *name);
        gint            (*remove_folder)        (Folder         *folder,
                                                 FolderItem     *item);
+       gint            (*close)                (Folder         *folder,
+                                                FolderItem     *item);
        gint            (*get_num_list)         (Folder         *folder,
                                                 FolderItem     *item,
                                                 GSList        **list);
@@ -409,7 +411,7 @@ void folder_unref_account_all               (PrefsAccount   *account);
 gchar *folder_item_get_path            (FolderItem     *item);
 
 gint   folder_item_open                        (FolderItem     *item);
-void   folder_item_close               (FolderItem     *item);
+gint   folder_item_close               (FolderItem     *item);
 gint   folder_item_scan                        (FolderItem     *item);
 void   folder_item_scan_foreach                (GHashTable     *table);
 MsgInfo *folder_item_get_msginfo       (FolderItem     *item,
@@ -449,7 +451,7 @@ gboolean folder_item_is_msg_changed (FolderItem     *item,
                                         MsgInfo        *msginfo);
 gchar *folder_item_get_cache_file      (FolderItem     *item);
 gchar *folder_item_get_mark_file       (FolderItem     *item);
-gchar * folder_item_get_identifier(FolderItem * item);
+gchar * folder_item_get_identifier     (FolderItem * item);
 
 GHashTable *folder_persist_prefs_new   (Folder *folder);
 void folder_persist_prefs_free         (GHashTable *pptable);
index 093a09f2deb6b0147448ba48ae57e1bcd46ded51..2ab293edf418791ea6f813f9986f3202e176b66c 100644 (file)
@@ -177,6 +177,8 @@ static gint imap_remove_all_msg(Folder * folder, FolderItem * item);
 static gboolean imap_is_msg_changed(Folder * folder,
                                    FolderItem * item, MsgInfo * msginfo);
 
+static gint imap_close(Folder * folder, FolderItem * item);
+
 static void imap_scan_tree(Folder * folder);
 
 static gint imap_create_tree(Folder * folder);
@@ -358,6 +360,7 @@ static gint imap_cmd_store  (IMAPSession    *sock,
                                 IMAPSet         set,
                                 gchar          *sub_cmd);
 static gint imap_cmd_expunge   (IMAPSession    *sock);
+static gint imap_cmd_close     (IMAPSession    *session);
 
 static gint imap_cmd_ok                (IMAPSession    *session,
                                 GPtrArray      *argbuf);
@@ -425,6 +428,7 @@ FolderClass imap_class =
        imap_create_folder,
        imap_rename_folder,
        imap_remove_folder,
+       imap_close,
        imap_get_num_list,
        NULL,
        NULL,
@@ -1035,6 +1039,30 @@ gboolean imap_is_msg_changed(Folder *folder, FolderItem *item, MsgInfo *msginfo)
        return FALSE;
 }
 
+gint imap_close(Folder *folder, FolderItem *item)
+{
+       gint ok;
+       IMAPSession *session;
+
+       g_return_val_if_fail(folder != NULL, -1);
+
+       session = imap_session_get(folder);
+       if (!session) return -1;
+
+       if (session->mbox) {
+               ok = imap_cmd_close(session);
+               if (ok != IMAP_SUCCESS)
+                       log_warning(_("can't close folder\n"));
+
+               g_free(session->mbox);
+               session->mbox = NULL;
+
+               return ok;
+       }
+
+       return 0;
+}
+
 void imap_scan_tree(Folder *folder)
 {
        FolderItem *item;
@@ -2939,6 +2967,17 @@ static gint imap_cmd_expunge(IMAPSession *session)
        return IMAP_SUCCESS;
 }
 
+static gint imap_cmd_close(IMAPSession *session)
+{
+       gint ok;
+
+       imap_gen_send(session, "CLOSE");
+       if ((ok = imap_cmd_ok(session, NULL)) != IMAP_SUCCESS)
+               log_warning(_("error while imap command: CLOSE\n"));
+
+       return ok;
+}
+
 static gint imap_cmd_ok(IMAPSession *session, GPtrArray *argbuf)
 {
        gint ok = IMAP_SUCCESS;
index dc1f8f67dad0119ddb1f66cd017a3b68302d6cbf..8e96aa709737287f2da00a30aec42ffccc546836 100644 (file)
@@ -91,6 +91,7 @@ FolderClass mbox_class =
        mbox_create_folder,
        mbox_rename_folder,
        mbox_remove_folder,
+       NULL,
        mbox_get_num_list,
        NULL,
        NULL,
index 319b44919ba03ec1bb90331c1c4fbf5888b4c194..dcdb58988759fc5268432751ed7cfacd4924b2d7 100644 (file)
--- a/src/mh.c
+++ b/src/mh.c
@@ -103,6 +103,7 @@ FolderClass mh_class =
        mh_create_folder,
        mh_rename_folder,
        mh_remove_folder,
+       NULL,
        mh_get_num_list,
        NULL,
        NULL,
index 713a747ac41769c866dadc8317c01ac5b3fdf3f5..e68cd5286bbbf0b5373d32da0ab83da3335c0433 100644 (file)
@@ -130,6 +130,7 @@ FolderClass news_class =
        NULL,
        NULL,
        NULL,
+       NULL,
        news_get_num_list,
        NULL,
        NULL,