2007-10-12 [colin] 3.0.2cvs65
authorColin Leroy <colin@colino.net>
Fri, 12 Oct 2007 17:03:55 +0000 (17:03 +0000)
committerColin Leroy <colin@colino.net>
Fri, 12 Oct 2007 17:03:55 +0000 (17:03 +0000)
* src/account.c
* src/addritem.c
* src/addritem.h
* src/filtering.c
* src/filtering.h
* src/folder.c
* src/folder.h
* src/common/utils.c
* src/common/utils.h
Remove unused code, staticalise some functions

12 files changed:
ChangeLog
PATCHSETS
configure.ac
src/account.c
src/addritem.c
src/addritem.h
src/common/utils.c
src/common/utils.h
src/filtering.c
src/filtering.h
src/folder.c
src/folder.h

index 8581757..81e9c0b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2007-10-12 [colin]     3.0.2cvs65
+
+       * src/account.c
+       * src/addritem.c
+       * src/addritem.h
+       * src/filtering.c
+       * src/filtering.h
+       * src/folder.c
+       * src/folder.h
+       * src/common/utils.c
+       * src/common/utils.h
+               Remove unused code, staticalise some functions
+
 2007-10-12 [paul]      3.0.2cvs64
 
        * src/account.c
index 3adb066..d5d1200 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.1.2.5 -r 1.1.2.6 src/addrduplicates.c;  cvs diff -u -r 1.60.2.102 -r 1.60.2.103 src/addressbook.c;  cvs diff -u -r 1.382.2.416 -r 1.382.2.417 src/compose.c;  cvs diff -u -r 1.1.4.26 -r 1.1.4.27 src/expldifdlg.c;  cvs diff -u -r 1.274.2.214 -r 1.274.2.215 src/mainwindow.c;  cvs diff -u -r 1.94.2.159 -r 1.94.2.160 src/messageview.c;  cvs diff -u -r 1.56.2.57 -r 1.56.2.58 src/pop.c;  cvs diff -u -r 1.16.2.28 -r 1.16.2.29 src/prefs_customheader.c;  cvs diff -u -r 1.1.2.19 -r 1.1.2.20 src/prefs_send.c;  cvs diff -u -r 1.3.2.51 -r 1.3.2.52 src/prefs_themes.c;  cvs diff -u -r 1.13.2.33 -r 1.13.2.34 src/common/plugin.c;  cvs diff -u -r 1.5.2.49 -r 1.5.2.50 src/gtk/pluginwindow.c;  cvs diff -u -r 1.1.2.80 -r 1.1.2.81 src/gtk/quicksearch.c;  ) > 3.0.2cvs62.patchset
 ( cvs diff -u -r 1.14.2.40 -r 1.14.2.41 src/editaddress.c;  ) > 3.0.2cvs63.patchset
 ( cvs diff -u -r 1.61.2.72 -r 1.61.2.73 src/account.c;  cvs diff -u -r 1.207.2.186 -r 1.207.2.187 src/folderview.c;  cvs diff -u -r 1.115.2.169 -r 1.115.2.170 src/main.c;  cvs diff -u -r 1.274.2.215 -r 1.274.2.216 src/mainwindow.c;  cvs diff -u -r 1.94.2.160 -r 1.94.2.161 src/messageview.c;  cvs diff -u -r 1.15.2.52 -r 1.15.2.53 src/summary_search.c;  cvs diff -u -r 1.395.2.330 -r 1.395.2.331 src/summaryview.c;  cvs diff -u -r 1.43.2.88 -r 1.43.2.89 src/toolbar.c;  cvs diff -u -r 1.1.2.61 -r 1.1.2.62 src/wizard.c;  cvs diff -u -r 1.36.2.117 -r 1.36.2.118 src/common/utils.c;  cvs diff -u -r 1.12.2.43 -r 1.12.2.44 src/gtk/prefswindow.c;  ) > 3.0.2cvs64.patchset
+( cvs diff -u -r 1.61.2.73 -r 1.61.2.74 src/account.c;  cvs diff -u -r 1.13.2.15 -r 1.13.2.16 src/addritem.c;  cvs diff -u -r 1.12.2.13 -r 1.12.2.14 src/addritem.h;  cvs diff -u -r 1.60.2.38 -r 1.60.2.39 src/filtering.c;  cvs diff -u -r 1.21.2.14 -r 1.21.2.15 src/filtering.h;  cvs diff -u -r 1.213.2.165 -r 1.213.2.166 src/folder.c;  cvs diff -u -r 1.87.2.49 -r 1.87.2.50 src/folder.h;  cvs diff -u -r 1.36.2.118 -r 1.36.2.119 src/common/utils.c;  cvs diff -u -r 1.20.2.52 -r 1.20.2.53 src/common/utils.h;  ) > 3.0.2cvs65.patchset
index 6e2596d..bbb3683 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=0
 MICRO_VERSION=2
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=64
+EXTRA_VERSION=65
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index a519644..6ec5a36 100644 (file)
@@ -179,7 +179,7 @@ static void account_row_changed_while_drag_drop     (GtkTreeModel *model,
                                                 gpointer      arg3,
                                                 GtkTreeView  *list_view);
 
-void account_flush_state(void)
+static void account_flush_state(void)
 {
        account_set_menu();
        main_window_reflect_prefs_all();
index c60798c..a6b820f 100644 (file)
@@ -603,26 +603,6 @@ void addritem_person_remove_attribute(     ItemPerson *person, const gchar *attrib )
        }
 }
 
-/**
- * find out if a user attribute already exists in the specified person.
- * \param  person Person.
- * \param  attrib Attribute to remove.
- * \return <i>TRUE</i> if attribute exists
- */
-gboolean addritem_person_has_attribute(        ItemPerson *person, const gchar *attrib ) {
-       g_return_val_if_fail( person != NULL || attrib != NULL, FALSE );
-       GList *attrib_list = NULL;
-
-       attrib_list = person->listAttrib;
-       while (attrib_list) {
-               UserAttribute *user_attrib = attrib_list->data;
-               if (strcmp(user_attrib->name, attrib) == 0) {
-                       return TRUE;
-               }
-               attrib_list = g_list_next(attrib_list);
-       }
-       return FALSE;
-}
 
 /**
  * Create new address book group object.
index 3981b8a..0da086e 100644 (file)
@@ -163,7 +163,6 @@ ItemEMail *addritem_person_remove_email             ( ItemPerson *person, ItemEMail *email
 
 void addritem_person_add_attribute             ( ItemPerson *person, UserAttribute *attrib );
 void addritem_person_remove_attribute  ( ItemPerson *person, const gchar *attrib );
-gboolean addritem_person_has_attribute ( ItemPerson *person, const gchar *attrib );
 
 ItemFolder *addritem_create_item_folder        ( void );
 ItemFolder *addritem_copy_item_folder  ( ItemFolder *item );
index 8ebddbf..f86c8f7 100644 (file)
@@ -757,7 +757,7 @@ void extract_parenthesis(gchar *str, gchar op, gchar cl)
        *destp = '\0';
 }
 
-void extract_parenthesis_with_skip_quote(gchar *str, gchar quote_chr,
+static void extract_parenthesis_with_skip_quote(gchar *str, gchar quote_chr,
                                         gchar op, gchar cl)
 {
        register gchar *srcp, *destp;
@@ -788,24 +788,6 @@ void extract_parenthesis_with_skip_quote(gchar *str, gchar quote_chr,
        *destp = '\0';
 }
 
-void eliminate_quote(gchar *str, gchar quote_chr)
-{
-       register gchar *srcp, *destp;
-
-       srcp = destp = str;
-
-       while ((destp = strchr(destp, quote_chr))) {
-               if ((srcp = strchr(destp + 1, quote_chr))) {
-                       srcp++;
-                       while (g_ascii_isspace(*srcp)) srcp++;
-                       memmove(destp, srcp, strlen(srcp) + 1);
-               } else {
-                       *destp = '\0';
-                       break;
-               }
-       }
-}
-
 void extract_quote(gchar *str, gchar quote_chr)
 {
        register gchar *p;
@@ -2341,18 +2323,6 @@ gboolean dirent_is_regular_file(struct dirent *d)
        return g_file_test(d->d_name, G_FILE_TEST_IS_REGULAR);
 }
 
-gboolean dirent_is_directory(struct dirent *d)
-{
-#if !defined(G_OS_WIN32) && !defined(MAEMO) && defined(HAVE_DIRENT_D_TYPE)
-       if (d->d_type == DT_DIR)
-               return TRUE;
-       else if (d->d_type != DT_UNKNOWN)
-               return FALSE;
-#endif
-
-       return g_file_test(d->d_name, G_FILE_TEST_IS_DIR);
-}
-
 gint change_dir(const gchar *dir)
 {
        gchar *prevdir = NULL;
index f434740..a8dc070 100644 (file)
@@ -291,13 +291,6 @@ void extract_parenthesis           (gchar          *str,
                                         gchar           op,
                                         gchar           cl);
 
-void extract_parenthesis_with_skip_quote       (gchar          *str,
-                                                gchar           quote_chr,
-                                                gchar           op,
-                                                gchar           cl);
-
-void eliminate_quote                   (gchar          *str,
-                                        gchar           quote_chr);
 void extract_quote                     (gchar          *str,
                                         gchar           quote_chr);
 void eliminate_address_comment         (gchar          *str);
@@ -412,7 +405,6 @@ gboolean is_relative_filename   (const gchar *file);
 gboolean is_dir_exist          (const gchar    *dir);
 gboolean is_file_entry_exist   (const gchar    *file);
 gboolean dirent_is_regular_file        (struct dirent  *d);
-gboolean dirent_is_directory   (struct dirent  *d);
 
 #define is_file_exist(file)            file_exist(file, FALSE)
 #define is_file_or_fifo_exist(file)    file_exist(file, TRUE)
index 16362ce..9477abe 100644 (file)
@@ -180,13 +180,6 @@ void filteringprop_free(FilteringProp * prop)
        g_free(prop);
 }
 
-void filtering_move_and_copy_msg(MsgInfo *msginfo)
-{
-       GSList *list = g_slist_append(NULL, msginfo);
-       filtering_move_and_copy_msgs(list);
-       g_slist_free(list);
-}
-
 /* move and copy messages by batches to be faster on IMAP */
 void filtering_move_and_copy_msgs(GSList *msgs)
 {
index 3e5e3c8..c0b072c 100644 (file)
@@ -101,7 +101,6 @@ void prefs_filtering_free(GSList *prefs_filtering);
 
 FilteringProp * filteringprop_copy(FilteringProp *src);
 void filtering_move_and_copy_msgs(GSList *msglist);
-void filtering_move_and_copy_msg(MsgInfo *msginfo);
 extern GSList * filtering_rules;
 extern GSList * pre_global_processing;
 extern GSList * post_global_processing;
index a7d5cce..6aeb2a2 100644 (file)
@@ -1687,25 +1687,6 @@ gchar *folder_item_get_path(FolderItem *item)
        return folder->klass->item_get_path(folder, item);
 }
 
-void folder_item_set_default_flags(FolderItem *dest, MsgFlags *flags)
-{
-       if (!(folder_has_parent_of_type(dest, F_OUTBOX) ||
-             folder_has_parent_of_type(dest, F_QUEUE)  ||
-             folder_has_parent_of_type(dest, F_DRAFT) ||
-             folder_has_parent_of_type(dest, F_TRASH))) {
-               flags->perm_flags = MSG_NEW|MSG_UNREAD;
-       } else {
-               flags->perm_flags = 0;
-       }
-       if (FOLDER_TYPE(dest->folder) == F_MH) {
-               if (folder_has_parent_of_type(dest, F_QUEUE)) {
-                       MSG_SET_TMP_FLAGS(*flags, MSG_QUEUED);
-               } else if (folder_has_parent_of_type(dest, F_DRAFT)) {
-                       MSG_SET_TMP_FLAGS(*flags, MSG_DRAFT);
-               }
-       }
-}
-
 static gint folder_sort_cache_list_by_msgnum(gconstpointer a, gconstpointer b)
 {
        MsgInfo *msginfo_a = (MsgInfo *) a;
@@ -1722,7 +1703,87 @@ static gint folder_sort_folder_list(gconstpointer a, gconstpointer b)
        return (gint_a - gint_b);
 }
 
-void folder_item_process_open (FolderItem *item,
+static gint syncronize_flags(FolderItem *item, MsgInfoList *msglist)
+{
+       GRelation *relation;
+       gint ret = 0;
+       GSList *cur;
+
+       if(msglist == NULL)
+               return 0;
+       if(item->folder->klass->get_flags == NULL)
+               return 0;
+       if (item->no_select)
+               return 0;
+
+       relation = g_relation_new(2);
+       g_relation_index(relation, 0, g_direct_hash, g_direct_equal);
+       if ((ret = item->folder->klass->get_flags(
+           item->folder, item, msglist, relation)) == 0) {
+               GTuples *tuples;
+               MsgInfo *msginfo;
+               MsgPermFlags permflags = 0;
+               gboolean skip;
+
+               folder_item_update_freeze();
+               folder_item_set_batch(item, TRUE);
+               for (cur = msglist; cur != NULL; cur = g_slist_next(cur)) {
+                       msginfo = (MsgInfo *) cur->data;
+               
+                       tuples = g_relation_select(relation, msginfo, 0);
+                       skip = tuples->len < 1;
+                       if (!skip)
+                               permflags = GPOINTER_TO_INT(g_tuples_index(tuples, 0, 1));
+                       g_tuples_destroy(tuples);
+                       if (skip)
+                               continue;
+                       
+                       if (msginfo->flags.perm_flags != permflags) {
+                               procmsg_msginfo_change_flags(msginfo,
+                                       permflags & ~msginfo->flags.perm_flags, 0,
+                                       ~permflags & msginfo->flags.perm_flags, 0);
+                       }
+               }
+               folder_item_set_batch(item, FALSE);
+               folder_item_update_thaw();
+       }
+       g_relation_destroy(relation);   
+
+       return ret;
+}
+
+static gint folder_item_syncronize_flags(FolderItem *item)
+{
+       MsgInfoList *msglist = NULL;
+       GSList *cur;
+       gint ret = 0;
+       
+       g_return_val_if_fail(item != NULL, -1);
+       g_return_val_if_fail(item->folder != NULL, -1);
+       g_return_val_if_fail(item->folder->klass != NULL, -1);
+       if (item->no_select)
+               return -1;
+
+       item->scanning = TRUE;
+
+       if (item->cache == NULL)
+               folder_item_read_cache(item);
+       
+       msglist = msgcache_get_msg_list(item->cache);
+       
+       ret = syncronize_flags(item, msglist);
+
+       for (cur = msglist; cur != NULL; cur = g_slist_next(cur))
+               procmsg_msginfo_free((MsgInfo *) cur->data);
+       
+       g_slist_free(msglist);
+
+       item->scanning = FALSE;
+
+       return ret;
+}
+
+static void folder_item_process_open (FolderItem *item,
                                 void (*before_proc_func)(gpointer data),
                                 void (*after_proc_func)(gpointer data),
                                 gpointer data)
@@ -1853,55 +1914,6 @@ static MsgInfo *get_msginfo(FolderItem *item, guint num)
        return msginfo;
 }
 
-static gint syncronize_flags(FolderItem *item, MsgInfoList *msglist)
-{
-       GRelation *relation;
-       gint ret = 0;
-       GSList *cur;
-
-       if(msglist == NULL)
-               return 0;
-       if(item->folder->klass->get_flags == NULL)
-               return 0;
-       if (item->no_select)
-               return 0;
-
-       relation = g_relation_new(2);
-       g_relation_index(relation, 0, g_direct_hash, g_direct_equal);
-       if ((ret = item->folder->klass->get_flags(
-           item->folder, item, msglist, relation)) == 0) {
-               GTuples *tuples;
-               MsgInfo *msginfo;
-               MsgPermFlags permflags = 0;
-               gboolean skip;
-
-               folder_item_update_freeze();
-               folder_item_set_batch(item, TRUE);
-               for (cur = msglist; cur != NULL; cur = g_slist_next(cur)) {
-                       msginfo = (MsgInfo *) cur->data;
-               
-                       tuples = g_relation_select(relation, msginfo, 0);
-                       skip = tuples->len < 1;
-                       if (!skip)
-                               permflags = GPOINTER_TO_INT(g_tuples_index(tuples, 0, 1));
-                       g_tuples_destroy(tuples);
-                       if (skip)
-                               continue;
-                       
-                       if (msginfo->flags.perm_flags != permflags) {
-                               procmsg_msginfo_change_flags(msginfo,
-                                       permflags & ~msginfo->flags.perm_flags, 0,
-                                       ~permflags & msginfo->flags.perm_flags, 0);
-                       }
-               }
-               folder_item_set_batch(item, FALSE);
-               folder_item_update_thaw();
-       }
-       g_relation_destroy(relation);   
-
-       return ret;
-}
-
 gint folder_item_scan_full(FolderItem *item, gboolean filtering)
 {
        Folder *folder;
@@ -2239,17 +2251,6 @@ gint folder_item_scan(FolderItem *item)
        return folder_item_scan_full(item, TRUE);
 }
 
-static void folder_item_scan_foreach_func(gpointer key, gpointer val,
-                                         gpointer data)
-{
-       folder_item_scan(FOLDER_ITEM(key));
-}
-
-void folder_item_scan_foreach(GHashTable *table)
-{
-       g_hash_table_foreach(table, folder_item_scan_foreach_func, NULL);
-}
-
 static void folder_count_total_cache_memusage(FolderItem *item, gpointer data)
 {
        gint *memusage = (gint *)data;
@@ -2260,37 +2261,6 @@ static void folder_count_total_cache_memusage(FolderItem *item, gpointer data)
        *memusage += msgcache_get_memory_usage(item->cache);
 }
 
-gint folder_item_syncronize_flags(FolderItem *item)
-{
-       MsgInfoList *msglist = NULL;
-       GSList *cur;
-       gint ret = 0;
-       
-       g_return_val_if_fail(item != NULL, -1);
-       g_return_val_if_fail(item->folder != NULL, -1);
-       g_return_val_if_fail(item->folder->klass != NULL, -1);
-       if (item->no_select)
-               return -1;
-
-       item->scanning = TRUE;
-
-       if (item->cache == NULL)
-               folder_item_read_cache(item);
-       
-       msglist = msgcache_get_msg_list(item->cache);
-       
-       ret = syncronize_flags(item, msglist);
-
-       for (cur = msglist; cur != NULL; cur = g_slist_next(cur))
-               procmsg_msginfo_free((MsgInfo *) cur->data);
-       
-       g_slist_free(msglist);
-
-       item->scanning = FALSE;
-
-       return ret;
-}
-
 static gint folder_cache_time_compare_func(gconstpointer a, gconstpointer b)
 {
        FolderItem *fa = (FolderItem *)a;
@@ -2696,63 +2666,6 @@ gchar *folder_item_fetch_msg_full(FolderItem *item, gint num, gboolean headers,
 }
 
 
-gint folder_item_fetch_all_msg(FolderItem *item)
-{
-       Folder *folder;
-       GSList *mlist;
-       GSList *cur;
-       gint num = 0;
-       gint ret = 0;
-       gint total = 0;
-
-       g_return_val_if_fail(item != NULL, -1);
-       if (item->no_select)
-               return -1;
-
-       debug_print("fetching all messages in %s ...\n", item->path ? item->path : "(null)");
-       statuswindow_print_all(_("Fetching all messages in %s ...\n"), item->path ? item->path : "(null)");
-
-       folder = item->folder;
-
-       if (folder->ui_func)
-               folder->ui_func(folder, item, folder->ui_func_data ?
-                               folder->ui_func_data : GINT_TO_POINTER(num));
-
-       mlist = folder_item_get_msg_list(item);
-
-       total = g_slist_length(mlist);
-
-       for (cur = mlist; cur != NULL; cur = cur->next) {
-               MsgInfo *msginfo = (MsgInfo *)cur->data;
-               gchar *msg;
-
-               statusbar_progress_all(num++,total, 10);
-
-               if (folder->ui_func)
-                       folder->ui_func(folder, item,
-                                       folder->ui_func_data ?
-                                       folder->ui_func_data :
-                                       GINT_TO_POINTER(num));
-               if (num % 50 == 0)
-                       GTK_EVENTS_FLUSH();
-
-               msg = folder_item_fetch_msg(item, msginfo->msgnum);
-               if (!msg) {
-                       g_warning("Can't fetch message %d. Aborting.\n",
-                                 msginfo->msgnum);
-                       ret = -1;
-                       break;
-               }
-               g_free(msg);
-       }
-       
-       statusbar_progress_all(0,0,0);
-       statuswindow_pop_all();
-       procmsg_msg_list_free(mlist);
-
-       return ret;
-}
-
 static gint folder_item_get_msg_num_by_file(FolderItem *dest, const gchar *file)
 {
        static HeaderEntry hentry[] = {{"Message-ID:",  NULL, TRUE},
index b64df5b..5f96029 100644 (file)
@@ -795,8 +795,6 @@ gint   folder_item_close            (FolderItem     *item);
 gint   folder_item_scan                        (FolderItem     *item);
 gint   folder_item_scan_full           (FolderItem     *item, 
                                         gboolean        filtering);
-gint   folder_item_syncronize_flags    (FolderItem     *item);
-void   folder_item_scan_foreach                (GHashTable     *table);
 MsgInfo *folder_item_get_msginfo       (FolderItem     *item,
                                         gint            num);
 MsgInfo *folder_item_get_msginfo_by_msgid(FolderItem   *item,
@@ -809,7 +807,6 @@ gchar *folder_item_fetch_msg_full   (FolderItem     *item,
                                         gint            num, 
                                         gboolean        get_headers,
                                         gboolean        get_body);
-gint   folder_item_fetch_all_msg       (FolderItem     *item);
 gint   folder_item_add_msg             (FolderItem     *dest,
                                         const gchar    *file,
                                         MsgFlags       *flags,
@@ -845,7 +842,6 @@ gchar * folder_item_get_identifier  (FolderItem * item);
 void folder_clean_cache_memory         (FolderItem *protected_item);
 void folder_clean_cache_memory_force   (void);
 void folder_item_write_cache           (FolderItem *item);
-void folder_item_set_default_flags     (FolderItem *dest, MsgFlags *flags);
 
 void folder_item_apply_processing      (FolderItem *item);
 
@@ -859,10 +855,6 @@ void folder_item_set_batch         (FolderItem *item, gboolean batch);
 gboolean folder_has_parent_of_type     (FolderItem *item, SpecialFolderItemType type);
 void folder_synchronise                        (Folder *folder);
 gboolean folder_want_synchronise       (Folder *folder);
-void folder_item_process_open          (FolderItem *item,
-                                        void (*before_proc_func)(gpointer data),
-                                        void (*after_proc_func)(gpointer data),
-                                        gpointer data);
 gboolean folder_subscribe              (const gchar *uri);
 gboolean folder_have_mailbox           (void);
 gboolean folder_item_free_cache                (FolderItem *item, gboolean force);