0.8.11claws70
authorChristoph Hohmann <reboot@gmx.ch>
Wed, 2 Apr 2003 15:33:25 +0000 (15:33 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Wed, 2 Apr 2003 15:33:25 +0000 (15:33 +0000)
* src/folder.[ch]
* src/imap.[ch]
* src/mbox_folder.[ch]
* src/mh.[ch]
* src/news.[ch]
        o Make all virtual folder functions private
        o remove unused folder code

* src/common/socket.[ch]
* src/summaryview.c
        fix warnings

15 files changed:
ChangeLog.claws
configure.ac
src/common/socket.c
src/common/socket.h
src/folder.c
src/folder.h
src/imap.c
src/imap.h
src/mbox_folder.c
src/mbox_folder.h
src/mh.c
src/mh.h
src/news.c
src/news.h
src/summaryview.c

index b07dbcc..b234ff6 100644 (file)
@@ -1,3 +1,17 @@
+2003-04-02 [christoph] 0.8.11claws70
+
+       * src/folder.[ch]
+       * src/imap.[ch]
+       * src/mbox_folder.[ch]
+       * src/mh.[ch]
+       * src/news.[ch]
+               o Make all virtual folder functions private
+               o remove unused folder code
+
+       * src/common/socket.[ch]
+       * src/summaryview.c
+               fix warnings
+
 2003-03-30 [alfons]    0.8.11claws69
 
        * src/send_message.c
index cf398e4..4bee9a8 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=11
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws69
+EXTRA_VERSION=claws70
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index ddaa802..77faa0d 100644 (file)
@@ -451,24 +451,6 @@ gint sock_printf(SockInfo *sock, const gchar *format, ...)
        return sock_write_all(sock, buf, strlen(buf));
 }
 
-gint sock_read(SockInfo *sock, gchar *buf, gint len)
-{
-       gint ret;
-
-       g_return_val_if_fail(sock != NULL, -1);
-
-#if USE_OPENSSL
-       if (sock->ssl)
-               ret = ssl_read(sock->ssl, buf, len);
-       else
-#endif
-               ret = fd_read(sock->sock, buf, len);
-       
-       if (ret < 0)
-               sock->state = CONN_DISCONNECTED;
-       return ret;
-}
-
 gint fd_read(gint fd, gchar *buf, gint len)
 {
        if (fd_check_io(fd, G_IO_IN) < 0)
@@ -484,7 +466,7 @@ gint ssl_read(SSL *ssl, gchar *buf, gint len)
 }
 #endif
 
-gint sock_write(SockInfo *sock, const gchar *buf, gint len)
+gint sock_read(SockInfo *sock, gchar *buf, gint len)
 {
        gint ret;
 
@@ -492,11 +474,11 @@ gint sock_write(SockInfo *sock, const gchar *buf, gint len)
 
 #if USE_OPENSSL
        if (sock->ssl)
-               ret = ssl_write(sock->ssl, buf, len);
+               ret = ssl_read(sock->ssl, buf, len);
        else
 #endif
-               ret = fd_write(sock->sock, buf, len);
-
+               ret = fd_read(sock->sock, buf, len);
+       
        if (ret < 0)
                sock->state = CONN_DISCONNECTED;
        return ret;
@@ -517,7 +499,7 @@ gint ssl_write(SSL *ssl, const gchar *buf, gint len)
 }
 #endif
 
-gint sock_write_all(SockInfo *sock, const gchar *buf, gint len)
+gint sock_write(SockInfo *sock, const gchar *buf, gint len)
 {
        gint ret;
 
@@ -525,10 +507,10 @@ gint sock_write_all(SockInfo *sock, const gchar *buf, gint len)
 
 #if USE_OPENSSL
        if (sock->ssl)
-               ret = ssl_write_all(sock->ssl, buf, len);
+               ret = ssl_write(sock->ssl, buf, len);
        else
 #endif
-               ret = fd_write_all(sock->sock, buf, len);
+               ret = fd_write(sock->sock, buf, len);
 
        if (ret < 0)
                sock->state = CONN_DISCONNECTED;
@@ -574,6 +556,24 @@ gint ssl_write_all(SSL *ssl, const gchar *buf, gint len)
 }
 #endif
 
+gint sock_write_all(SockInfo *sock, const gchar *buf, gint len)
+{
+       gint ret;
+
+       g_return_val_if_fail(sock != NULL, -1);
+
+#if USE_OPENSSL
+       if (sock->ssl)
+               ret = ssl_write_all(sock->ssl, buf, len);
+       else
+#endif
+               ret = fd_write_all(sock->sock, buf, len);
+
+       if (ret < 0)
+               sock->state = CONN_DISCONNECTED;
+       return ret;
+}
+
 gint fd_recv(gint fd, gchar *buf, gint len, gint flags)
 {
        if (fd_check_io(fd, G_IO_IN) < 0)
@@ -646,75 +646,71 @@ gint sock_gets(SockInfo *sock, gchar *buf, gint len)
        return ret;
 }
 
-gchar *fd_getline(gint fd)
+gint fd_getline(gint fd, gchar **str)
 {
        gchar buf[BUFFSIZE];
-       gchar *str = NULL;
        gint len;
        gulong size = 1;
 
        while ((len = fd_gets(fd, buf, sizeof(buf))) > 0) {
                size += len;
-               if (!str)
-                       str = g_strdup(buf);
+               if (!*str)
+                       *str = g_strdup(buf);
                else {
-                       str = g_realloc(str, size);
-                       strcat(str, buf);
+                       *str = g_realloc(*str, size);
+                       strcat(*str, buf);
                }
                if (buf[len - 1] == '\n')
                        break;
        }
-       if (len == -1) {
-               log_error("Read from socket fd%d failed: %s\n",
-                         fd, strerror(errno));
-               if (str)
-                       g_free(str);
-               return NULL;
-       }
+       if (len == -1 && *str)
+               g_free(*str);
 
-       return str;
+       return len;
 }
 
 #if USE_OPENSSL
-gchar *ssl_getline(SSL *ssl)
+gint ssl_getline(SSL *ssl, gchar **str)
 {
        gchar buf[BUFFSIZE];
-       gchar *str = NULL;
        gint len;
        gulong size = 1;
 
        while ((len = ssl_gets(ssl, buf, sizeof(buf))) > 0) {
                size += len;
-               if (!str)
-                       str = g_strdup(buf);
+               if (!*str)
+                       *str = g_strdup(buf);
                else {
-                       str = g_realloc(str, size);
-                       strcat(str, buf);
+                       *str = g_realloc(*str, size);
+                       strcat(*str, buf);
                }
                if (buf[len - 1] == '\n')
                        break;
        }
+       if (len == -1 && *str)
+               g_free(*str);
 
-       return str;
+       return len;
 }
 #endif
 
 gchar *sock_getline(SockInfo *sock)
 {
        gint ret;
+       gchar *str = NULL;
 
        g_return_val_if_fail(sock != NULL, NULL);
 
 #if USE_OPENSSL
        if (sock->ssl)
-               ret = ssl_getline(sock->ssl);
+               ret = ssl_getline(sock->ssl, &str);
        else
 #endif
-               ret = fd_getline(sock->sock);
+               ret = fd_getline(sock->sock, &str);
 
        if (ret < 0)
                sock->state = CONN_DISCONNECTED;
-       return ret;
+       return str;
 }
 
 gint sock_puts(SockInfo *sock, const gchar *buf)
index 76e219d..d5bbd79 100644 (file)
@@ -94,7 +94,7 @@ gint fd_read          (gint sock, gchar *buf, gint len);
 gint fd_write          (gint sock, const gchar *buf, gint len);
 gint fd_write_all      (gint sock, const gchar *buf, gint len);
 gint fd_gets           (gint sock, gchar *buf, gint len);
-gchar *fd_getline      (gint sock);
+gint fd_getline                (gint sock, gchar **str);
 gint fd_close          (gint sock);
 
 /* Functions for SSL */
index 84d41e3..2e2d6a1 100644 (file)
@@ -2048,7 +2048,6 @@ gint folder_item_remove_msg(FolderItem *item, gint num)
                remove_msginfo_from_cache(item, msginfo);
                procmsg_msginfo_free(msginfo);
        }
-       item->total--;
        folder_item_update(item, F_ITEM_UPDATE_MSGCNT | F_ITEM_UPDATE_CONTENT);
 
        return ret;
@@ -2065,13 +2064,6 @@ gint folder_item_remove_msgs(FolderItem *item, GSList *msglist)
 
        if (!item->cache) folder_item_read_cache(item);
 
-       if (folder->class->remove_msgs) {
-               ret = folder->class->remove_msgs(folder, item, msglist);
-               if (ret == 0)
-                       folder_item_scan(item);
-               return ret;
-       }
-
        while (msglist != NULL) {
                MsgInfo *msginfo = (MsgInfo *)msglist->data;
 
index 9c9b062..3f3b8e6 100644 (file)
@@ -203,24 +203,12 @@ struct _FolderClass
                                                 FolderItem     *dest,
                                                 const gchar    *file,
                                                gboolean         remove_source);
-       gint            (*move_msg)             (Folder         *folder,
-                                                FolderItem     *dest,
-                                                MsgInfo        *msginfo);
-       gint            (*move_msgs_with_dest)  (Folder         *folder,
-                                                FolderItem     *dest,
-                                                GSList         *msglist);
        gint            (*copy_msg)             (Folder         *folder,
                                                 FolderItem     *dest,
                                                 MsgInfo        *msginfo);
-       gint            (*copy_msgs_with_dest)  (Folder         *folder,
-                                                FolderItem     *dest,
-                                                GSList         *msglist);
        gint            (*remove_msg)           (Folder         *folder,
                                                 FolderItem     *item,
                                                 gint            num);
-       gint            (*remove_msgs)          (Folder         *folder,
-                                                FolderItem     *item,
-                                                GSList         *msglist);
        gint            (*remove_all_msg)       (Folder         *folder,
                                                 FolderItem     *item);
        gboolean        (*is_msg_changed)       (Folder         *folder,
index bcf8411..75fd826 100644 (file)
@@ -78,7 +78,40 @@ struct _IMAPFolderItem
        GSList *uid_list;
 };
 
-static GList *session_list = NULL;
+static Folder *imap_folder_new(const gchar * name, const gchar * path);
+static void imap_folder_destroy(Folder * folder);
+
+static Session *imap_session_new(const PrefsAccount * account);
+static void imap_session_authenticate(IMAPSession * session,
+                                     const PrefsAccount * account);
+static void imap_session_destroy(Session * session);
+
+static gchar *imap_fetch_msg(Folder * folder, FolderItem * item, gint uid);
+static gint imap_add_msg(Folder * folder,
+                        FolderItem * dest,
+                        const gchar * file, gboolean remove_source);
+
+static gint imap_copy_msg(Folder * folder,
+                         FolderItem * dest, MsgInfo * msginfo);
+
+static gint imap_remove_msg(Folder * folder, FolderItem * item, gint uid);
+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_scan_folder(Folder * folder, FolderItem * item);
+static void imap_scan_tree(Folder * folder);
+
+static gint imap_create_tree(Folder * folder);
+
+static FolderItem *imap_create_folder(Folder * folder,
+                                     FolderItem * parent,
+                                     const gchar * name);
+static gint imap_rename_folder(Folder * folder,
+                              FolderItem * item, const gchar * name);
+static gint imap_remove_folder(Folder * folder, FolderItem * item);
+
 
 static gint imap_cmd_count = 0;
 
@@ -109,12 +142,6 @@ static gint imap_do_copy           (Folder         *folder,
                                         FolderItem     *dest,
                                         MsgInfo        *msginfo,
                                         gboolean        remove_source);
-#if 0
-static gint imap_do_copy_msgs_with_dest        (Folder         *folder,
-                                        FolderItem     *dest, 
-                                        GSList         *msglist,
-                                        gboolean        remove_source);
-#endif
 
 static GSList *imap_get_uncached_messages      (IMAPSession    *session,
                                                 FolderItem     *item,
@@ -141,7 +168,7 @@ static SockInfo *imap_open_tunnel(const gchar *server,
 #endif
 
 #if USE_OPENSSL
-static SockInfo *imap_init_sock(SockInfo *sock, SSLType         ssl_type);
+static SockInfo *imap_init_sock(SockInfo *sock, SSLType        ssl_type);
 #else
 static SockInfo *imap_init_sock(SockInfo *sock);
 #endif
@@ -235,10 +262,6 @@ static gint imap_cmd_delete        (SockInfo       *sock,
 static gint imap_cmd_envelope  (SockInfo       *sock,
                                 guint32         first_uid,
                                 guint32         last_uid);
-#if 0
-static gint imap_cmd_search    (SockInfo       *sock,
-                                GSList         *numlist);
-#endif
 static gint imap_cmd_fetch     (SockInfo       *sock,
                                 guint32         uid,
                                 const gchar    *filename);
@@ -284,18 +307,18 @@ static gchar *imap_locale_to_modified_utf7        (const gchar    *from);
 
 static gboolean imap_rename_folder_func                (GNode          *node,
                                                 gpointer        data);
-gint imap_get_num_list                         (Folder         *folder,
+static gint imap_get_num_list                  (Folder         *folder,
                                                 FolderItem     *item,
                                                 GSList        **list);
-GSList *imap_get_msginfos                      (Folder         *folder,
+static GSList *imap_get_msginfos               (Folder         *folder,
                                                 FolderItem     *item,
                                                 GSList         *msgnum_list);
-MsgInfo *imap_get_msginfo                      (Folder         *folder,
+static MsgInfo *imap_get_msginfo               (Folder         *folder,
                                                 FolderItem     *item,
                                                 gint            num);
-gboolean imap_check_msgnum_validity            (Folder         *folder,
+static gboolean imap_check_msgnum_validity     (Folder         *folder,
                                                 FolderItem     *item);
-void imap_change_flags                         (Folder         *folder,
+static void imap_change_flags                  (Folder         *folder,
                                                 FolderItem     *item,
                                                 MsgInfo        *msginfo,
                                                 MsgPermFlags   newflags);
@@ -329,12 +352,8 @@ FolderClass imap_class =
        imap_get_msginfos,
        imap_fetch_msg,
        imap_add_msg,
-       imap_move_msg,
-       NULL,
        imap_copy_msg,
-       NULL,
        imap_remove_msg,
-       imap_remove_msgs,
        imap_remove_all_msg,
        imap_is_msg_changed,
        imap_change_flags,
@@ -575,8 +594,6 @@ Session *imap_session_new(const PrefsAccount *account)
        session->mbox = NULL;
        session->authenticated = is_preauth;
 
-       session_list = g_list_append(session_list, session);
-
        return SESSION(session);
 }
 
@@ -612,18 +629,6 @@ void imap_session_destroy(Session *session)
        g_free(IMAP_SESSION(session)->mbox);
 
        g_strfreev(IMAP_SESSION(session)->capability);
-
-       session_list = g_list_remove(session_list, session);
-}
-
-void imap_session_destroy_all(void)
-{
-       while (session_list != NULL) {
-               IMAPSession *session = (IMAPSession *)session_list->data;
-
-               imap_cmd_logout(SESSION(session)->sock);
-               session_destroy(SESSION(session));
-       }
 }
 
 gchar *imap_fetch_msg(Folder *folder, FolderItem *item, gint uid)
@@ -773,122 +778,6 @@ static gint imap_do_copy(Folder *folder, FolderItem *dest, MsgInfo *msginfo,
                return -1;
 }
 
-#if 0
-static gint imap_do_copy_msgs_with_dest(Folder *folder, FolderItem *dest, 
-                                       GSList *msglist,
-                                       gboolean remove_source)
-{
-       gchar *destdir;
-       GSList *cur;
-       MsgInfo *msginfo;
-       IMAPSession *session;
-       gint ok = IMAP_SUCCESS;
-
-       g_return_val_if_fail(folder != NULL, -1);
-       g_return_val_if_fail(dest != NULL, -1);
-       g_return_val_if_fail(msglist != NULL, -1);
-
-       session = imap_session_get(folder);
-       if (!session) return -1;
-
-       destdir = imap_get_real_path(IMAP_FOLDER(folder), dest->path);
-
-       for (cur = msglist; cur != NULL; cur = cur->next) {
-               msginfo = (MsgInfo *)cur->data;
-
-               if (msginfo->folder == dest) {
-                       g_warning("the src folder is identical to the dest.\n");
-                       continue;
-               }
-
-               /* ensure source folder selected */
-               ok = imap_select(session, IMAP_FOLDER(folder), 
-                                msginfo->folder->path, NULL, NULL, NULL, NULL);
-        
-               if (remove_source)
-                       debug_print("Moving message %s%c%d to %s ...\n",
-                                   msginfo->folder->path, G_DIR_SEPARATOR,
-                                   msginfo->msgnum, destdir);
-               else
-                       debug_print("Copying message %s%c%d to %s ...\n",
-                                   msginfo->folder->path, G_DIR_SEPARATOR,
-                                   msginfo->msgnum, destdir);
-
-               ok = imap_cmd_copy(session, msginfo, destdir);
-
-               if (ok == IMAP_SUCCESS && remove_source) {
-                       imap_set_message_flags
-                               (session, msginfo->msgnum, msginfo->msgnum,
-                                IMAP_FLAG_DELETED, TRUE);
-               }
-       }
-
-       if (remove_source)
-               ok = imap_cmd_expunge(SESSION(session)->sock);
-
-       g_free(destdir);
-
-       if (ok == IMAP_SUCCESS)
-               return 0;
-       else
-               return -1;
-}
-#endif
-
-gint imap_move_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
-{
-       gchar *srcfile;
-       gint ret = 0;
-
-       g_return_val_if_fail(folder != NULL, -1);
-       g_return_val_if_fail(dest != NULL, -1);
-       g_return_val_if_fail(msginfo != NULL, -1);
-       g_return_val_if_fail(msginfo->folder != NULL, -1);
-
-       if (folder == msginfo->folder->folder)
-               return imap_do_copy(folder, dest, msginfo, TRUE);
-
-       srcfile = procmsg_get_message_file(msginfo);
-       if (!srcfile) return -1;
-
-       ret = imap_add_msg(folder, dest, srcfile, FALSE);
-       g_free(srcfile);
-
-       if (ret != -1) {
-               if(folder_item_remove_msg(msginfo->folder, msginfo->msgnum)) {
-                       ret = -1;
-               }
-       }
-               
-       return ret;
-}
-
-#if 0
-gint imap_move_msgs_with_dest(Folder *folder, FolderItem *dest, 
-                             GSList *msglist)
-{
-       MsgInfo *msginfo;
-       GSList *cur;
-       gint ret = 0;
-
-       g_return_val_if_fail(folder != NULL, -1);
-       g_return_val_if_fail(dest != NULL, -1);
-       g_return_val_if_fail(msglist != NULL, -1);
-
-       msginfo = (MsgInfo *)msglist->data;
-       if (folder == msginfo->folder->folder)
-               return imap_do_copy_msgs_with_dest(folder, dest, msglist, TRUE);
-
-       for (cur = msglist; cur != NULL; cur = cur->next) {
-               msginfo = (MsgInfo *)cur->data;
-               ret = imap_move_msg(folder, dest, msginfo);
-               if (ret == -1) break;
-       }
-
-       return ret;
-}
-#endif
-
 gint imap_copy_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
 {
        gchar *srcfile;
@@ -912,33 +801,6 @@ gint imap_copy_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
        return ret;
 }
 
-#if 0
-gint imap_copy_msgs_with_dest(Folder *folder, FolderItem *dest, 
-                             GSList *msglist)
-{
-       MsgInfo *msginfo;
-       GSList *cur;
-       gint ret = 0;
-
-       g_return_val_if_fail(folder != NULL, -1);
-       g_return_val_if_fail(dest != NULL, -1);
-       g_return_val_if_fail(msglist != NULL, -1);
-
-       msginfo = (MsgInfo *)msglist->data;
-       if (folder == msginfo->folder->folder)
-               return imap_do_copy_msgs_with_dest
-                       (folder, dest, msglist, FALSE);
-
-       for (cur = msglist; cur != NULL; cur = cur->next) {
-               msginfo = (MsgInfo *)cur->data;
-               ret = imap_copy_msg(folder, dest, msginfo);
-               if (ret == -1) break;
-       }
-
-       return ret;
-}
-#endif
-
 gint imap_remove_msg(Folder *folder, FolderItem *item, gint uid)
 {
        gint ok;
@@ -979,59 +841,6 @@ gint imap_remove_msg(Folder *folder, FolderItem *item, gint uid)
        return IMAP_SUCCESS;
 }
 
-gint imap_remove_msgs(Folder *folder, FolderItem *item, GSList *msglist)
-{
-       gint ok;
-       IMAPSession *session;
-       gchar *dir;
-       MsgInfo *msginfo;
-       GSList *cur;
-       guint32 uid;
-
-       g_return_val_if_fail(folder != NULL, -1);
-       g_return_val_if_fail(FOLDER_CLASS(folder) == &imap_class, -1);
-       g_return_val_if_fail(item != NULL, -1);
-       g_return_val_if_fail(msglist != NULL, -1);
-
-       session = imap_session_get(folder);
-       if (!session) return -1;
-
-       ok = imap_select(session, IMAP_FOLDER(folder), item->path,
-                        NULL, NULL, NULL, NULL);
-       if (ok != IMAP_SUCCESS)
-               return ok;
-
-       for (cur = msglist; cur != NULL; cur = cur->next) {
-               msginfo = (MsgInfo *)cur->data;
-               uid = msginfo->msgnum;
-               ok = imap_set_message_flags
-                       (IMAP_SESSION(REMOTE_FOLDER(folder)->session),
-                        uid, uid, IMAP_FLAG_DELETED, TRUE);
-               if (ok != IMAP_SUCCESS) {
-                       log_warning(_("can't set deleted flags: %d\n"), uid);
-                       return ok;
-               }
-       }
-
-       ok = imap_cmd_expunge(SESSION(session)->sock);
-       if (ok != IMAP_SUCCESS) {
-               log_warning(_("can't expunge\n"));
-               return ok;
-       }
-
-       dir = folder_item_get_path(item);
-       if (is_dir_exist(dir)) {
-               for (cur = msglist; cur != NULL; cur = cur->next) {
-                       msginfo = (MsgInfo *)cur->data;
-                       uid = msginfo->msgnum;
-                       remove_numbered_files(dir, uid, uid);
-               }
-       }
-       g_free(dir);
-       return IMAP_SUCCESS;
-}
-
 gint imap_remove_all_msg(Folder *folder, FolderItem *item)
 {
         gint exists, recent, unseen;
@@ -2198,74 +2007,6 @@ static MsgInfo *imap_parse_envelope(SockInfo *sock, FolderItem *item,
        return msginfo;
 }
 
-gint imap_msg_set_perm_flags(MsgInfo *msginfo, MsgPermFlags flags)
-{
-       Folder *folder;
-       IMAPSession *session;
-       IMAPFlags iflags = 0;
-       gint ok = IMAP_SUCCESS;
-
-       g_return_val_if_fail(msginfo != NULL, -1);
-       g_return_val_if_fail(msginfo->folder != NULL, -1);
-       g_return_val_if_fail(msginfo->folder->folder != NULL, -1);
-
-       folder = msginfo->folder->folder;
-       g_return_val_if_fail(FOLDER_CLASS(folder) == &imap_class, -1);
-
-       session = imap_session_get(folder);
-       if (!session) return -1;
-
-       if ((ok = imap_select(session, IMAP_FOLDER(folder), msginfo->folder->path,
-           NULL, NULL, NULL, NULL)) != IMAP_SUCCESS)
-               return ok;
-
-       if (flags & MSG_MARKED)  iflags |= IMAP_FLAG_FLAGGED;
-       if (flags & MSG_REPLIED) iflags |= IMAP_FLAG_ANSWERED;
-       if (iflags) {
-               ok = imap_set_message_flags(session, msginfo->msgnum,
-                                           msginfo->msgnum, iflags, TRUE);
-               if (ok != IMAP_SUCCESS) return ok;
-       }
-
-       if (flags & MSG_UNREAD)
-               ok = imap_set_message_flags(session, msginfo->msgnum,
-                                           msginfo->msgnum, IMAP_FLAG_SEEN,
-                                           FALSE);
-       return ok;
-}
-
-gint imap_msg_unset_perm_flags(MsgInfo *msginfo, MsgPermFlags flags)
-{
-       Folder *folder;
-       IMAPSession *session;
-       IMAPFlags iflags = 0;
-       gint ok = IMAP_SUCCESS;
-
-       g_return_val_if_fail(msginfo != NULL, -1);
-       g_return_val_if_fail(msginfo->folder != NULL, -1);
-       g_return_val_if_fail(msginfo->folder->folder != NULL, -1);
-
-       folder = msginfo->folder->folder;
-       g_return_val_if_fail(FOLDER_CLASS(folder) == &imap_class, -1);
-
-       session = imap_session_get(folder);
-       if (!session) return -1;
-
-       if (flags & MSG_MARKED)  iflags |= IMAP_FLAG_FLAGGED;
-       if (flags & MSG_REPLIED) iflags |= IMAP_FLAG_ANSWERED;
-       if (iflags) {
-               ok = imap_set_message_flags(session, msginfo->msgnum,
-                                           msginfo->msgnum, iflags, FALSE);
-               if (ok != IMAP_SUCCESS) return ok;
-       }
-
-       if (flags & MSG_UNREAD)
-               ok = imap_set_message_flags(session, msginfo->msgnum,
-                                           msginfo->msgnum, IMAP_FLAG_SEEN,
-                                           TRUE);
-       return ok;
-}
-
 static gint imap_set_message_flags(IMAPSession *session,
                                   guint32 first_uid,
                                   guint32 last_uid,
@@ -3650,3 +3391,4 @@ void imap_change_flags(Folder *folder, FolderItem *item, MsgInfo *msginfo, MsgPe
 
        return;
 }
+
index f8c0412..a982d43 100644 (file)
@@ -96,71 +96,5 @@ typedef enum
 #define IMAP_IS_DRAFT(flags)   ((flags & IMAP_FLAG_DRAFT) != 0)
 
 FolderClass *imap_get_class            ();
-Folder *imap_folder_new                (const gchar    *name,
-                                        const gchar    *path);
-void    imap_folder_destroy            (Folder         *folder);
-
-Session *imap_session_new              (const PrefsAccount *account);
-void imap_session_authenticate         (IMAPSession        *session,
-                                        const PrefsAccount *account);
-void imap_session_destroy              (Session        *session);
-void imap_session_destroy_all          (void);
-
-GSList *imap_get_msg_list              (Folder         *folder,
-                                        FolderItem     *item,
-                                        gboolean        use_cache);
-gchar *imap_fetch_msg                  (Folder         *folder,
-                                        FolderItem     *item,
-                                        gint            uid);
-gint imap_add_msg                      (Folder         *folder,
-                                        FolderItem     *dest,
-                                        const gchar    *file,
-                                        gboolean        remove_source);
-
-gint imap_move_msg                     (Folder         *folder,
-                                        FolderItem     *dest,
-                                        MsgInfo        *msginfo);
-gint imap_move_msgs_with_dest          (Folder         *folder,
-                                        FolderItem     *dest,
-                                        GSList         *msglist);
-gint imap_copy_msg                     (Folder         *folder,
-                                        FolderItem     *dest,
-                                        MsgInfo        *msginfo);
-gint imap_copy_msgs_with_dest          (Folder         *folder,
-                                        FolderItem     *dest,
-                                        GSList         *msglist);
-
-gint imap_remove_msg                   (Folder         *folder,
-                                        FolderItem     *item,
-                                        gint            uid);
-gint imap_remove_msgs                  (Folder         *folder,
-                                        FolderItem     *item,
-                                        GSList         *msglist);
-gint imap_remove_all_msg               (Folder         *folder,
-                                        FolderItem     *item);
-
-gboolean imap_is_msg_changed           (Folder         *folder,
-                                        FolderItem     *item,
-                                        MsgInfo        *msginfo);
-
-gint imap_scan_folder                  (Folder         *folder,
-                                        FolderItem     *item);
-void imap_scan_tree                    (Folder         *folder);
-
-gint imap_create_tree                  (Folder         *folder);
-
-FolderItem *imap_create_folder         (Folder         *folder,
-                                        FolderItem     *parent,
-                                        const gchar    *name);
-gint imap_rename_folder                        (Folder         *folder,
-                                        FolderItem     *item,
-                                        const gchar    *name);
-gint imap_remove_folder                        (Folder         *folder,
-                                        FolderItem     *item);
-
-gint imap_msg_set_perm_flags           (MsgInfo        *msginfo,
-                                        MsgPermFlags    flags);
-gint imap_msg_unset_perm_flags         (MsgInfo        *msginfo,
-                                        MsgPermFlags    flags);
 
 #endif /* __IMAP_H__ */
index 58aa60c..c942506 100644 (file)
 
 #define MSGBUFSIZE     8192
 
+static Folder *mbox_folder_new(const gchar * name, const gchar * path);
+static void mbox_folder_destroy(Folder * folder);
+
+static gchar *mbox_fetch_msg(Folder * folder, FolderItem * item, gint num);
+
+static void mbox_scan_folder(Folder * folder, FolderItem * item);
+static gint mbox_add_msg(Folder * folder, FolderItem * dest,
+                        const gchar * file, gboolean remove_source);
+
+static gint mbox_remove_all_msg(Folder * folder, FolderItem * item);
+static gint mbox_remove_msg(Folder * folder, FolderItem * item, gint num);
+static void mbox_change_flags(Folder * folder, FolderItem * item,
+                             MsgInfo * info, MsgPermFlags newflags);
+static gint mbox_copy_msg(Folder * folder, FolderItem * dest,
+                         MsgInfo * msginfo);
+static gint mbox_create_tree(Folder * folder);
+static FolderItem *mbox_create_folder(Folder * folder, FolderItem * parent,
+                                     const gchar * name);
+static gint mbox_rename_folder(Folder * folder, FolderItem * item,
+                              const gchar * name);
+static gint mbox_remove_folder(Folder * folder, FolderItem * item);
+
 static void    mbox_folder_init                (Folder         *folder,
                                                 const gchar    *name,
                                                 const gchar    *path);
 
 static gboolean mbox_write_data(FILE * mbox_fp, FILE * new_fp,
                                gchar * new_filename, gint size);
-static gboolean mbox_rewrite(gchar * mbox);
 static gboolean mbox_purge_deleted(gchar * mbox);
 static gchar * mbox_get_new_path(FolderItem * parent, gchar * name);
 static gchar * mbox_get_folderitem_name(gchar * name);
 
-MsgInfo *mbox_get_msginfo(Folder *folder, FolderItem *item, gint num);
-gint mbox_get_num_list(Folder *folder, FolderItem *item, GSList **list);
-gboolean mbox_check_msgnum_validity(Folder *folder, FolderItem *item);
+static MsgInfo *mbox_get_msginfo(Folder *folder, FolderItem *item, gint num);
+static gint mbox_get_num_list(Folder *folder, FolderItem *item, GSList **list);
+static gboolean mbox_check_msgnum_validity(Folder *folder, FolderItem *item);
 
 FolderClass mbox_class =
 {
@@ -79,15 +100,11 @@ FolderClass mbox_class =
        NULL,
        mbox_fetch_msg,
        mbox_add_msg,
-       NULL,
-       NULL,
        mbox_copy_msg,
-       NULL,
        mbox_remove_msg,
-       NULL,
        mbox_remove_all_msg,
        NULL,
-       NULL,
+       mbox_change_flags,
 };
 
 FolderClass *mbox_get_class()
@@ -1178,85 +1195,6 @@ struct _message * mbox_cache_get_msg(gchar * filename, gint num)
 /*                                                        */
 /**********************************************************/
 
-
-GSList *mbox_get_msg_list(Folder *folder, FolderItem *item, gboolean use_cache)
-{
-       GSList *mlist;
-       MsgInfo * msginfo;
-       GList * l;
-       FILE * fp;
-       gchar * mbox_path;
-
-#ifdef MEASURE_TIME
-       struct timeval tv_before, tv_after, tv_result;
-
-       gettimeofday(&tv_before, NULL);
-#endif
-
-       mlist = NULL;
-
-       mbox_path = mbox_folder_get_path(item);
-
-       if (mbox_path == NULL)
-               return NULL;
-
-       mbox_purge_deleted(mbox_path);
-
-       fp = fopen(mbox_path, "rb");
-       
-       if (fp == NULL) {
-               g_free(mbox_path);
-               return NULL;
-       }
-
-       mbox_lockread_file(fp, mbox_path);
-
-       mbox_cache_synchronize_from_file(fp, mbox_path, TRUE);
-
-       item->last_num = mbox_cache_get_count(mbox_path);
-
-       for(l = mbox_cache_get_msg_list(mbox_path) ; l != NULL ;
-           l = g_list_next(l)) {
-               struct _message * msg;
-
-               msg = (struct _message *) l->data;
-
-               if (MSG_IS_INVALID(msg->flags) || !MSG_IS_REALLY_DELETED(msg->flags)) {
-                       fseek(fp, msg->header, SEEK_SET);
-
-                       msginfo = mbox_parse_msg(fp, msg, item);
-
-                       if (!MSG_IS_INVALID(msg->flags))
-                               msginfo->flags = msg->flags;
-                       else {
-                               msg->old_flags = msginfo->flags;
-                               msg->flags = msginfo->flags;
-                       }
-
-                       mlist = g_slist_append(mlist, msginfo);
-               }
-               else {
-                       MSG_SET_PERM_FLAGS(msg->flags, MSG_REALLY_DELETED);
-               }
-       }
-
-       mbox_unlock_file(fp, mbox_path);
-
-       g_free(mbox_path);
-
-       fclose(fp);
-
-#ifdef MEASURE_TIME
-       gettimeofday(&tv_after, NULL);
-
-       timersub(&tv_after, &tv_before, &tv_result);
-       g_print("mbox_get_msg_list: %s: elapsed time: %ld.%06ld sec\n",
-               mbox_path, tv_result.tv_sec, tv_result.tv_usec);
-#endif
-
-       return mlist;
-}
-
 static gboolean mbox_extract_msg(FolderItem * item, gint msgnum,
                                 gchar * dest_filename)
 {
@@ -1693,41 +1631,6 @@ gint mbox_copy_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
        return num;
 }
 
-void mbox_finished_copy(Folder *folder, FolderItem *dest)
-{
-       gchar * mbox_path;
-       GSList * l;
-       mboxcache * cache;
-       
-       mbox_path = mbox_folder_get_path(dest);
-       if (mbox_path == NULL)
-               return;
-
-       mbox_cache_synchronize(mbox_path, TRUE);
-
-       for(l = copy_flags_data ; l != NULL ; l = g_slist_next(l)) {
-               CopyFlagsInfo * flags_info = l->data;
-               struct _message * msg;
-
-               msg = mbox_cache_get_msg(mbox_path, flags_info->num);
-               if (msg != NULL)
-                       msg->flags = flags_info->flags;
-               g_free(flags_info);
-       }
-
-       if (copy_flags_data != NULL) {
-               cache = mbox_cache_get_mbox(mbox_path);
-               cache->modification = TRUE;
-       }
-
-       g_slist_free(copy_flags_data);
-       copy_flags_data = NULL;
-
-       mbox_rewrite(mbox_path);
-
-       g_free(mbox_path);
-}
-
 void mbox_scan_folder(Folder *folder, FolderItem *item)
 {
        gchar *mbox_path;
@@ -1916,19 +1819,7 @@ static gboolean mbox_write_message(FILE * mbox_fp, FILE * new_fp,
        return mbox_write_data(mbox_fp, new_fp, new_filename, size);
 }
 
-void mbox_update_mark(Folder * folder, FolderItem * item)
-{
-       gchar * mbox_path;
-
-       mbox_path = mbox_folder_get_path(item);
-       if (mbox_path == NULL)
-               return;
-
-       mbox_rewrite(mbox_path);
-       g_free(mbox_path);
-}
-
-void mbox_change_flags(Folder * folder, FolderItem * item, MsgInfo * info)
+void mbox_change_flags(Folder * folder, FolderItem * item, MsgInfo * info, MsgPermFlags newflags)
 {
        struct _message * msg;
        mboxcache * cache;
@@ -1938,6 +1829,8 @@ void mbox_change_flags(Folder * folder, FolderItem * item, MsgInfo * info)
        if (mbox_path == NULL)
                return;
 
+       info->flags.perm_flags = newflags;
+
        msg = mbox_cache_get_msg(mbox_path, info->msgnum);
 
        cache = mbox_cache_get_mbox(mbox_path);
@@ -1949,102 +1842,10 @@ void mbox_change_flags(Folder * folder, FolderItem * item, MsgInfo * info)
 
        msg->flags = info->flags;
 
-       cache->modification = TRUE;
-               
+       cache->modification = TRUE;             
 }
 
 
-static gboolean mbox_rewrite(gchar * mbox)
-{
-       FILE * mbox_fp;
-       FILE * new_fp;
-       gchar * new;
-       GList * l;
-       gboolean result;
-       GList * msg_list;
-       gint count;
-       mboxcache * cache;
-
-       msg_list = mbox_cache_get_msg_list(mbox);
-
-       cache = mbox_cache_get_mbox(mbox);
-       if (cache == NULL)
-               return FALSE;
-
-       if (!cache->modification) {
-               debug_print("no modification - %s\n", mbox);
-               return FALSE;
-       }
-
-       debug_print("save modification - %s\n", mbox);
-
-       mbox_fp = fopen(mbox, "rb+");
-       mbox_lockwrite_file(mbox_fp, mbox);
-
-       mbox_cache_synchronize_from_file(mbox_fp, mbox, TRUE);
-
-       new = g_strconcat(mbox, ".", itos((int) mbox), NULL);
-       new_fp = fopen(new, "wb");
-
-       if (change_file_mode_rw(new_fp, new) < 0) {
-               FILE_OP_ERROR(new, "chmod");
-               g_warning("can't change file mode\n");
-       }
-
-       mbox_lockwrite_file(new_fp, new);
-
-       result = TRUE;
-
-       count = 0;
-       msg_list = mbox_cache_get_msg_list(mbox);
-       for(l = msg_list ; l != NULL ; l = g_list_next(l)) {
-               struct _message * msg = (struct _message *) l->data;
-               if (!mbox_write_message(mbox_fp, new_fp, new, msg)) {
-                       result = FALSE;
-                       break;
-               }
-               count ++;
-       }
-
-       unlink(mbox);
-
-       if (rename(new, mbox) == -1) {
-               g_warning("can't rename %s to %s\n", new, mbox);
-               mbox_unlock_file(new_fp, new);
-               fclose(new_fp);
-               mbox_unlock_file(mbox_fp, mbox);
-               fclose(mbox_fp);
-               g_free(new);
-               return -1;
-       }
-
-       if (change_file_mode_rw(new_fp, mbox) < 0) {
-               FILE_OP_ERROR(new, "chmod");
-               g_warning("can't change file mode\n");
-       }
-
-       mbox_unlock_file(new_fp, new);
-
-       fclose(new_fp);
-
-       mbox_unlock_file(mbox_fp, mbox);
-
-       fclose(mbox_fp);
-
-       debug_print("%i messages written - %s\n", count, mbox);
-
-       cache = mbox_cache_get_mbox(mbox);
-
-       if (cache != NULL)
-               cache->mtime = -1;
-
-       mbox_cache_synchronize(mbox, FALSE);
-
-       g_free(new);
-       
-       return result;
-}
-
 static gboolean mbox_purge_deleted(gchar * mbox)
 {
        FILE * mbox_fp;
index 7f2a54a..dcea186 100644 (file)
@@ -41,34 +41,6 @@ struct _MBOXFolder
 };
 
 FolderClass *mbox_get_class    ();
-Folder *mbox_folder_new        (const gchar    *name,
-                                const gchar    *path);
-void     mbox_folder_destroy   (Folder         *folder);
-
-
-GSList *mbox_get_msg_list(Folder *folder, FolderItem *item, gboolean use_cache);
-gchar *mbox_fetch_msg(Folder *folder, FolderItem *item, gint num);
-
-void mbox_scan_folder(Folder *folder, FolderItem *item);
 gchar * mbox_get_virtual_path(FolderItem * item);
-gint mbox_add_msg(Folder *folder, FolderItem *dest, const gchar *file,
-                 gboolean remove_source);
-
-gint mbox_remove_all_msg(Folder *folder, FolderItem *item);
-gint mbox_remove_msg(Folder *folder, FolderItem *item, gint num);
-void mbox_update_mark(Folder * folder, FolderItem * item);
-gint mbox_move_msgs_with_dest(Folder *folder, FolderItem *dest,
-                             GSList *msglist);
-gint mbox_move_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo);
-void mbox_change_flags(Folder * folder, FolderItem * item, MsgInfo * info);
-gint mbox_copy_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo);
-gint mbox_copy_msgs_with_dest(Folder *folder, FolderItem *dest, GSList *msglist);
-gint mbox_create_tree(Folder *folder);
-FolderItem *mbox_create_folder(Folder *folder, FolderItem *parent,
-                              const gchar *name);
-gint mbox_rename_folder(Folder *folder, FolderItem *item, const gchar *name);
-gint mbox_remove_folder(Folder *folder, FolderItem *item);
-void mbox_finished_copy(Folder *folder, FolderItem *dest);
-
 
 #endif
index eeea14b..689059f 100644 (file)
--- a/src/mh.c
+++ b/src/mh.c
 #include "procheader.h"
 #include "utils.h"
 
-static void    mh_folder_init                  (Folder         *folder,
-                                                const gchar    *name,
-                                                const gchar    *path);
-
-GSList  *mh_get_msg_list       (Folder         *folder,
-                                FolderItem     *item,
-                                gboolean        use_cache);
-gchar   *mh_fetch_msg          (Folder         *folder,
-                                FolderItem     *item,
-                                gint            num);
-MsgInfo   *mh_get_msginfo      (Folder         *folder,
-                                FolderItem     *item,
-                                gint            num);
-gint     mh_add_msg            (Folder         *folder,
-                                FolderItem     *dest,
-                                const gchar    *file,
-                                gboolean        remove_source);
-gint     mh_move_msg           (Folder         *folder,
-                                FolderItem     *dest,
-                                MsgInfo        *msginfo);
-gint     mh_move_msgs_with_dest        (Folder         *folder,
-                                FolderItem     *dest,
-                                GSList         *msglist);
-gint     mh_copy_msg           (Folder         *folder,
-                                FolderItem     *dest,
-                                MsgInfo        *msginfo);
-gint     mh_copy_msgs_with_dest        (Folder         *folder,
-                                FolderItem     *dest,
-                                GSList         *msglist);
-gint     mh_remove_msg         (Folder         *folder,
-                                FolderItem     *item,
-                                gint            num);
-gint     mh_remove_all_msg     (Folder         *folder,
-                                FolderItem     *item);
-gboolean mh_is_msg_changed     (Folder         *folder,
-                                FolderItem     *item,
-                                MsgInfo        *msginfo);
-
-gint    mh_scan_folder         (Folder         *folder,
-                                FolderItem     *item);
-gint mh_get_num_list           (Folder         *folder,
-                                FolderItem     *item,
-                                GSList        **list);
-void    mh_scan_tree           (Folder         *folder);
-
-gint    mh_create_tree         (Folder         *folder);
-FolderItem *mh_create_folder   (Folder         *folder,
-                                FolderItem     *parent,
-                                const gchar    *name);
-gint    mh_rename_folder       (Folder         *folder,
-                                FolderItem     *item,
-                                const gchar    *name);
-gint    mh_remove_folder       (Folder         *folder,
-                                FolderItem     *item);
-
-gchar   *mh_get_new_msg_filename               (FolderItem     *dest);
-
-static MsgInfo *mh_parse_msg                   (const gchar    *file,
-                                                FolderItem     *item);
-static void    mh_scan_tree_recursive          (FolderItem     *item);
-
-static gboolean mh_rename_folder_func          (GNode          *node,
-                                                gpointer        data);
+static void mh_folder_init(Folder * folder,
+                          const gchar * name, const gchar * path);
+
+static Folder *mh_folder_new(const gchar * name, const gchar * path);
+static void mh_folder_destroy(Folder * folder);
+static gchar *mh_fetch_msg(Folder * folder, FolderItem * item, gint num);
+static MsgInfo *mh_get_msginfo(Folder * folder,
+                              FolderItem * item, gint num);
+static gint mh_add_msg(Folder * folder,
+                      FolderItem * dest,
+                      const gchar * file, gboolean remove_source);
+static gint mh_copy_msg(Folder * folder,
+                       FolderItem * dest, MsgInfo * msginfo);
+static gint mh_remove_msg(Folder * folder, FolderItem * item, gint num);
+static gint mh_remove_all_msg(Folder * folder, FolderItem * item);
+static gboolean mh_is_msg_changed(Folder * folder,
+                                 FolderItem * item, MsgInfo * msginfo);
+
+static gint mh_get_num_list(Folder * folder,
+                           FolderItem * item, GSList ** list);
+static void mh_scan_tree(Folder * folder);
+
+static gint mh_create_tree(Folder * folder);
+static FolderItem *mh_create_folder(Folder * folder,
+                                   FolderItem * parent,
+                                   const gchar * name);
+static gint mh_rename_folder(Folder * folder,
+                            FolderItem * item, const gchar * name);
+static gint mh_remove_folder(Folder * folder, FolderItem * item);
+
+static gchar *mh_get_new_msg_filename(FolderItem * dest);
+
+static MsgInfo *mh_parse_msg(const gchar * file, FolderItem * item);
+static void mh_scan_tree_recursive(FolderItem * item);
+
+static gboolean mh_rename_folder_func(GNode * node, gpointer data);
 
 
 FolderClass mh_class =
@@ -137,12 +110,8 @@ FolderClass mh_class =
        NULL,
        mh_fetch_msg,
        mh_add_msg,
-       mh_move_msg,
-       mh_move_msgs_with_dest,
        mh_copy_msg,
-       mh_copy_msgs_with_dest,
        mh_remove_msg,
-       NULL,
        mh_remove_all_msg,
        mh_is_msg_changed,
        NULL,
@@ -370,152 +339,6 @@ gint mh_add_msg(Folder *folder, FolderItem *dest, const gchar *file,
        return dest->last_num;
 }
 
-static gint mh_do_move(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
-{
-       gchar *srcfile;
-       gchar *destfile;
-       gint filemode = 0;
-       PrefsFolderItem *prefs;
-
-       g_return_val_if_fail(dest != NULL, -1);
-       g_return_val_if_fail(msginfo != NULL, -1);
-
-       if (msginfo->folder == dest) {
-               g_warning("the src folder is identical to the dest.\n");
-               return -1;
-       }
-
-       if (dest->last_num < 0) {
-               mh_get_last_num(folder, dest);
-               if (dest->last_num < 0) return -1;
-       }
-
-       prefs = dest->prefs;
-
-       destfile = mh_get_new_msg_filename(dest);
-       if (!destfile) return -1;
-
-       srcfile = procmsg_get_message_file(msginfo);
-       
-       debug_print("Moving message %s%c%d to %s ...\n",
-                   msginfo->folder->path, G_DIR_SEPARATOR,
-                   msginfo->msgnum, dest->path);
-
-       if (move_file(srcfile, destfile, FALSE) < 0) {
-               g_free(srcfile);
-               g_free(destfile);
-               return -1;
-       }
-
-       if (prefs && prefs->enable_folder_chmod && prefs->folder_chmod) {
-               if (chmod(destfile, prefs->folder_chmod) < 0)
-                       FILE_OP_ERROR(destfile, "chmod");
-
-               /* for mark file */
-               filemode = prefs->folder_chmod;
-               if (filemode & S_IRGRP) filemode |= S_IWGRP;
-               if (filemode & S_IROTH) filemode |= S_IWOTH;
-       }
-
-       g_free(srcfile);
-       g_free(destfile);
-       dest->last_num++;
-
-       return dest->last_num;
-}
-
-gint mh_move_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
-{
-       gchar *srcfile;
-       gint ret = 0;
-       g_return_val_if_fail(folder != NULL, -1);
-       g_return_val_if_fail(dest != NULL, -1);
-       g_return_val_if_fail(msginfo != NULL, -1);
-       g_return_val_if_fail(msginfo->folder != NULL, -1);
-       if (folder == msginfo->folder->folder)
-               return mh_do_move(folder, dest, msginfo);
-       srcfile = procmsg_get_message_file(msginfo);
-       if (!srcfile) return -1;
-       ret = mh_add_msg(folder, dest, srcfile, FALSE);
-       g_free(srcfile);
-       if (ret != -1)
-               ret = folder_item_remove_msg(msginfo->folder, msginfo->msgnum);
-       return ret;
-}
-
-static gint mh_do_move_msgs_with_dest(Folder *folder, FolderItem *dest,
-                                     GSList *msglist)
-{
-       gchar *srcfile;
-       gchar *destfile;
-       GSList *cur;
-       MsgInfo *msginfo;
-       PrefsFolderItem *prefs;
-
-       g_return_val_if_fail(dest != NULL, -1);
-       g_return_val_if_fail(msglist != NULL, -1);
-
-       if (dest->last_num < 0) {
-               mh_get_last_num(folder, dest);
-               if (dest->last_num < 0) return -1;
-       }
-
-       prefs = dest->prefs;
-
-       for (cur = msglist; cur != NULL; cur = cur->next) {
-               msginfo = (MsgInfo *)cur->data;
-
-               if (msginfo->folder == dest) {
-                       g_warning("the src folder is identical to the dest.\n");
-                       continue;
-               }
-               debug_print("Moving message %s%c%d to %s ...\n",
-                           msginfo->folder->path, G_DIR_SEPARATOR,
-                           msginfo->msgnum, dest->path);
-
-               destfile = mh_get_new_msg_filename(dest);
-               if (!destfile) return -1;
-               srcfile = procmsg_get_message_file(msginfo);
-
-               if (move_file(srcfile, destfile, FALSE) < 0) {
-                       g_free(srcfile);
-                       g_free(destfile);
-                       break;
-               }
-
-               g_free(srcfile);
-               g_free(destfile);
-               dest->last_num++;
-       }
-
-       return dest->last_num;
-}
-
-gint mh_move_msgs_with_dest(Folder *folder, FolderItem *dest, GSList *msglist)
-{
-       MsgInfo *msginfo;
-       GSList *cur;
-       gint ret = 0;
-
-       msginfo = (MsgInfo *)msglist->data;
-       if (folder == msginfo->folder->folder)
-               return mh_do_move_msgs_with_dest(folder, dest, msglist);
-
-       for (cur = msglist; cur != NULL; cur = cur->next) {
-               msginfo = (MsgInfo *)cur->data;
-               ret = mh_move_msg(folder, dest, msginfo);
-               if (ret == -1) break;
-       }
-
-       return ret;
-}
-
 gint mh_copy_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
 {
        gchar *srcfile;
@@ -582,94 +405,6 @@ gint mh_copy_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
        return dest->last_num;
 }
 
-/*
-gint mh_copy_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
-{
-       Folder * src_folder;
-       gchar * filename;
-       gint num;
-       gchar * destdir;
-       FILE * fp;
-
-       src_folder = msginfo->folder->folder;
-       
-       g_return_val_if_fail(src_folder->fetch_msg != NULL, -1);
-       
-       filename = src_folder->fetch_msg(src_folder,
-                                        msginfo->folder,
-                                        msginfo->msgnum);
-       if (filename == NULL)
-               return -1;
-
-       num = folder->add_msg(folder, dest, filename, FALSE);
-
-       destdir = folder_item_get_path(dest);
-
-       if (fp) {
-               MsgInfo newmsginfo;
-
-               newmsginfo.msgnum = dest->last_num;
-               newmsginfo.flags = msginfo->flags;
-               if (dest->stype == F_OUTBOX ||
-                   dest->stype == F_QUEUE  ||
-                   dest->stype == F_DRAFT  ||
-                   dest->stype == F_TRASH)
-                       MSG_UNSET_FLAGS(newmsginfo.flags,
-                                       MSG_NEW|MSG_UNREAD|MSG_DELETED);
-
-               procmsg_write_flags(&newmsginfo, fp);
-               fclose(fp);
-       }
-       
-       return num;
-}
-*/
-
-gint mh_copy_msgs_with_dest(Folder *folder, FolderItem *dest, GSList *msglist)
-{
-       gchar *srcfile;
-       gchar *destfile;
-       GSList *cur;
-       MsgInfo *msginfo;
-
-       g_return_val_if_fail(dest != NULL, -1);
-       g_return_val_if_fail(msglist != NULL, -1);
-
-       if (dest->last_num < 0) {
-               mh_get_last_num(folder, dest);
-               if (dest->last_num < 0) return -1;
-       }
-
-       for (cur = msglist; cur != NULL; cur = cur->next) {
-               msginfo = (MsgInfo *)cur->data;
-
-               if (msginfo->folder == dest) {
-                       g_warning("the src folder is identical to the dest.\n");
-                       continue;
-               }
-               debug_print("Copying message %s%c%d to %s ...\n",
-                           msginfo->folder->path, G_DIR_SEPARATOR,
-                           msginfo->msgnum, dest->path);
-
-               destfile = mh_get_new_msg_filename(dest);
-               if (!destfile) break;
-               srcfile = procmsg_get_message_file(msginfo);
-
-               if (copy_file(srcfile, destfile, TRUE) < 0) {
-                       FILE_OP_ERROR(srcfile, "copy");
-                       g_free(srcfile);
-                       g_free(destfile);
-                       break;
-               }
-
-               g_free(srcfile);
-               g_free(destfile);
-               dest->last_num++;
-       }
-
-       return dest->last_num;
-}
-
 gint mh_remove_msg(Folder *folder, FolderItem *item, gint num)
 {
        gchar *file;
@@ -716,70 +451,6 @@ gboolean mh_is_msg_changed(Folder *folder, FolderItem *item, MsgInfo *msginfo)
        return FALSE;
 }
 
-gint mh_scan_folder(Folder *folder, FolderItem *item)
-{
-       gchar *path;
-       DIR *dp;
-       struct dirent *d;
-       struct stat s;
-       gint max = 0;
-       gint num;
-
-       g_return_val_if_fail(item != NULL, -1);
-
-       debug_print("mh_scan_folder(): Scanning %s ...\n", item->path);
-
-       path = folder_item_get_path(item);
-       g_return_val_if_fail(path != NULL, -1);
-       if (change_dir(path) < 0) {
-               g_free(path);
-               return -1;
-       }
-       g_free(path);
-
-       if ((dp = opendir(".")) == NULL) {
-               FILE_OP_ERROR(item->path, "opendir");
-               return -1;
-       }
-
-       if (folder->ui_func)
-               folder->ui_func(folder, item, folder->ui_func_data);
-
-       while ((d = readdir(dp)) != NULL) {
-               if ((num = to_number(d->d_name)) >= 0 &&
-                   stat(d->d_name, &s) == 0 &&
-                   S_ISREG(s.st_mode)) {
-/*
-                       n_msg++;
-*/
-                       if (max < num)
-                               max = num;
-               }
-       }
-       closedir(dp);
-
-/*
-       if (n_msg == 0)
-               item->new = item->unread = item->total = 0;
-       else {
-               gint new, unread, total, min, max;
-
-               procmsg_get_mark_sum(".", &new, &unread, &total, &min, &max, 0);
-               if (n_msg > total) {
-                       new += n_msg - total;
-                       unread += n_msg - total;
-               }
-               item->new = new;
-               item->unread = unread;
-               item->total = n_msg;
-       }
-*/
-       debug_print("Last number in dir %s = %d\n", item->path, max);
-       item->last_num = max;
-
-       return 0;
-}
-
 void mh_scan_tree(Folder *folder)
 {
        FolderItem *item;
index 7f03f50..1053837 100644 (file)
--- a/src/mh.h
+++ b/src/mh.h
@@ -35,8 +35,5 @@ struct _MHFolder
 };
 
 FolderClass *mh_get_class      ();
-Folder *mh_folder_new          (const gchar    *name,
-                                const gchar    *path);
-void     mh_folder_destroy     (Folder         *folder);
 
 #endif /* __MH_H__ */
index 93d99c2..5ee623b 100644 (file)
 #define NNTPS_PORT     563
 #endif
 
+static Folder *news_folder_new(const gchar * name, const gchar * folder);
+static void news_folder_destroy(Folder * folder);
+
+static gchar *news_fetch_msg(Folder * folder, FolderItem * item, gint num);
+
+static gint news_scan_group(Folder * folder, FolderItem * item);
+
 static void news_folder_init            (Folder        *folder,
                                          const gchar   *name,
                                          const gchar   *path);
@@ -139,10 +146,6 @@ FolderClass news_class =
        NULL,
        NULL,
        NULL,
-       news_remove_msg,
-       NULL,
-       NULL,
-       NULL,
        NULL,
 };
 
index 71e9031..9b31be6 100644 (file)
@@ -46,28 +46,14 @@ struct _NewsGroupInfo
 };
 
 FolderClass *news_get_class            ();
-Folder *news_folder_new                (const gchar    *name,
-                                        const gchar    *folder);
-void    news_folder_destroy            (Folder         *folder);
+gint news_post                         (Folder         * folder,
+                                        const gchar    * file);
 
-GSList *news_get_article_list          (Folder         *folder,
-                                        FolderItem     *item,
-                                        gboolean        use_cache);
-gchar *news_fetch_msg                  (Folder         *folder,
-                                        FolderItem     *item,
-                                        gint            num);
+GSList *news_get_group_list            (Folder         * folder);
+void news_group_list_free              (GSList         * group_list);
+void news_remove_group_list_cache      (Folder         * folder);
 
-gint news_scan_group                   (Folder         *folder,
-                                        FolderItem     *item);
-
-GSList *news_get_group_list            (Folder         *folder);
-void news_group_list_free              (GSList         *group_list);
-void news_remove_group_list_cache      (Folder         *folder);
-
-gint news_post                         (Folder         *folder,
-                                        const gchar    *file);
-
-gint news_cancel_article               (Folder         *folder,
-                                        MsgInfo        *msginfo);
+gint news_cancel_article               (Folder         * folder,
+                                        MsgInfo        * msginfo);
 
 #endif /* __NEWS_H__ */
index 807f4db..d1c6140 100644 (file)
@@ -2294,7 +2294,6 @@ static void summary_set_ctree_from_list(SummaryView *summaryview,
 
 static gchar *summary_complete_address(const gchar *addr)
 {
-       gint count;
        gchar *res, *tmp, *email_addr;
 
        Xstrdup_a(email_addr, addr, return NULL);