2005-11-14 [wwp] 1.9.100cvs12
[claws.git] / src / folder.c
index 45227f8b02e6e013b6d7856f057bdd5c8a2d01c2..d88beaf188ace4e5fbdc7e19708a4ae346d0aae8 100644 (file)
@@ -1648,7 +1648,7 @@ gint folder_item_scan_full(FolderItem *item, gboolean filtering)
        g_return_val_if_fail(folder != NULL, -1);
        g_return_val_if_fail(folder->klass->get_num_list != NULL, -1);
 
-       debug_print("Scanning folder %s for cache changes.\n", item->path);
+       debug_print("Scanning folder %s for cache changes.\n", item->path ? item->path : "(null)");
 
        /* Get list of messages for folder and cache */
        if (folder->klass->get_num_list(item->folder, item, &folder_list, &old_uids_valid) < 0) {
@@ -2183,7 +2183,8 @@ void msginfo_set_mime_flags(GNode *node, gpointer data)
        MsgInfo *msginfo = data;
        MimeInfo *mimeinfo = node->data;
        
-       if (mimeinfo->disposition == DISPOSITIONTYPE_ATTACHMENT) {
+       if (mimeinfo->disposition == DISPOSITIONTYPE_ATTACHMENT
+        && (!mimeinfo->subtype ||  strcmp(mimeinfo->subtype, "pgp-signature"))) {
                procmsg_msginfo_set_flags(msginfo, 0, MSG_HAS_ATTACHMENT);
        } else if (mimeinfo->disposition == DISPOSITIONTYPE_UNKNOWN && 
                 mimeinfo->type != MIMETYPE_TEXT &&
@@ -2301,8 +2302,8 @@ gint folder_item_fetch_all_msg(FolderItem *item)
        g_return_val_if_fail(item != NULL, -1);
        g_return_val_if_fail(item->no_select == FALSE, -1);
 
-       debug_print("fetching all messages in %s ...\n", item->path);
-       statusbar_print_all(_("Fetching all messages in %s ...\n"), item->path);
+       debug_print("fetching all messages in %s ...\n", item->path ? item->path : "(null)");
+       statusbar_print_all(_("Fetching all messages in %s ...\n"), item->path ? item->path : "(null)");
 
        folder = item->folder;
 
@@ -2743,8 +2744,20 @@ static gint do_copy_msgs(FolderItem *dest, GSList *msglist, gboolean remove_sour
                        return -1;
                }
        } else {
-               for (l = msglist ; l != NULL ; l = g_slist_next(l)) {
-                       MsgInfo * msginfo = (MsgInfo *) l->data;
+               MsgInfo * msginfo;
+               l = msglist;
+
+               /* immediately stop if src and dest folders are identical */
+               if (l != NULL) {
+                       msginfo = (MsgInfo *) l->data;
+                       if (msginfo != NULL && msginfo->folder == dest) {
+                               g_relation_destroy(relation);
+                               return -1;
+                       }
+               }
+
+               for (; l != NULL ; l = g_slist_next(l)) {
+                       msginfo = (MsgInfo *) l->data;
 
                        num = folder->klass->copy_msg(folder, dest, msginfo);
                        if (num > 0)
@@ -3571,6 +3584,7 @@ static void folder_item_update_func(FolderItem *item, gpointer data)
        if (item->update_flags) {
                source.item = item;
                source.update_flags = item->update_flags;
+               source.msg = NULL;
                hooks_invoke(FOLDER_ITEM_UPDATE_HOOKLIST, &source);                             
                item->update_flags = 0;
        }
@@ -3668,7 +3682,8 @@ gboolean folder_has_parent_of_type(FolderItem *item,
                        && item != cur) {
                                debug_print("set item %s parent type to %d "
                                        "even if %s is F_INBOX\n",
-                                       item->path, 0, cur->path);
+                                       item->path ? item->path : "(null)",
+                                       0, cur->path);
                                item->parent_stype = F_NORMAL;
                                break;
                        }
@@ -3678,8 +3693,9 @@ gboolean folder_has_parent_of_type(FolderItem *item,
                                item->parent_stype = cur->parent_stype;
                                debug_print("set item %s parent type to %d "
                                        "from %s's parent type\n",
-                                       item->path, cur->parent_stype, 
-                                       cur->path);
+                                       item->path ? item->path : "(null)",
+                                       cur->parent_stype ? cur->parent_stype : 0, 
+                                       cur->path ? cur->path : "(null)");
                                break;
                        }
                        /* we found a parent that has a special type. That's 
@@ -3687,7 +3703,9 @@ gboolean folder_has_parent_of_type(FolderItem *item,
                        if (cur->stype != F_NORMAL) {
                                debug_print("set item %s parent type to %d "
                                        "from %s's type\n",
-                                       item->path, cur->stype, cur->path);
+                                       item->path ? item->path : "(null)",
+                                       cur->stype ? cur->stype : 0, 
+                                       cur->path ? cur->path : "(null)");
                                cur->parent_stype = cur->stype;
                                item->parent_stype = cur->stype;
                                break;
@@ -3699,7 +3717,7 @@ gboolean folder_has_parent_of_type(FolderItem *item,
                 * normal. */
                if (item->parent_stype == -1) {
                        debug_print("set item %s to 0 from default\n", 
-                               item->path);
+                               item->path ? item->path : "(null)");
                        item->parent_stype = F_NORMAL;
                }
        }