[Commits] prefs_filtering.c 1.59.2.87 1.59.2.88

pawel at claws-mail.org pawel at claws-mail.org
Thu Nov 24 17:52:12 CET 2011


Update of /home/claws-mail/claws/src
In directory claws-mail:/tmp/cvs-serv31059/src

Modified Files:
      Tag: gtk2
	prefs_filtering.c 
Log Message:
2011-11-24 [pawel]	3.7.10cvs103

	* src/prefs_filtering.c
		Complete cvs102, forgot to commit this

Index: prefs_filtering.c
===================================================================
RCS file: /home/claws-mail/claws/src/prefs_filtering.c,v
retrieving revision 1.59.2.87
retrieving revision 1.59.2.88
diff -u -d -r1.59.2.87 -r1.59.2.88
--- prefs_filtering.c	22 Nov 2011 19:37:32 -0000	1.59.2.87
+++ prefs_filtering.c	24 Nov 2011 16:52:10 -0000	1.59.2.88
@@ -646,97 +646,13 @@
 static void rename_path(GSList * filters,
 			const gchar * old_path, const gchar * new_path)
 {
-	gchar *base;
-	gchar *prefix;
-	gchar *suffix;
-	gchar *dest_path;
-	gchar *old_path_with_sep;
-	gint destlen;
-	gint prefixlen;
-	gint oldpathlen;
-        GSList * action_cur;
         GSList * cur;
-	const gchar *separator=G_DIR_SEPARATOR_S;
-	gboolean matched = FALSE;
-#ifdef G_OS_WIN32
-again:
-#endif
-	oldpathlen = strlen(old_path);
-	old_path_with_sep = g_strconcat(old_path,separator,NULL);
 
 	for (cur = filters; cur != NULL; cur = cur->next) {
 		FilteringProp   *filtering = (FilteringProp *)cur->data;
-                
-                for(action_cur = filtering->action_list ; action_cur != NULL ;
-                    action_cur = action_cur->next) {
-
-                        FilteringAction *action = action_cur->data;
-                        
-                        if (action->type == MATCHACTION_SET_TAG ||
-			    action->type == MATCHACTION_UNSET_TAG)
-				continue;
-                        if (!action->destination) 
-				continue;
-                        
-                        destlen = strlen(action->destination);
-                        
-                        if (destlen > oldpathlen) {
-                                prefixlen = destlen - oldpathlen;
-                                suffix = action->destination + prefixlen;
-                                
-                                if (!strncmp(old_path, suffix, oldpathlen)) {
-                                        prefix = g_malloc0(prefixlen + 1);
-                                        strncpy2(prefix, action->destination, prefixlen);
-                                        
-                                        base = suffix + oldpathlen;
-                                        while (*base == G_DIR_SEPARATOR) base++;
-                                        if (*base == '\0')
-                                                dest_path = g_strconcat(prefix,
-                                                    separator,
-                                                    new_path, NULL);
-                                        else
-                                                dest_path = g_strconcat(prefix,
-                                                    separator,
-                                                    new_path,
-                                                    separator,
-                                                    base, NULL);
-                                        
-                                        g_free(prefix);
-                                        g_free(action->destination);
-                                        action->destination = dest_path;
-					matched = TRUE;
-                                } else { /* for non-leaf folders */
-                                        /* compare with trailing slash */
-                                        if (!strncmp(old_path_with_sep, action->destination, oldpathlen+1)) {
-                                                
-                                                suffix = action->destination + oldpathlen + 1;
-                                                dest_path = g_strconcat(new_path,
-                                                    separator,
-                                                    suffix, NULL);
-                                                g_free(action->destination);
-                                                action->destination = dest_path;
-						matched = TRUE;
-                                        }
-                                }
-                        } else {
-                                /* folder-moving a leaf */
-                                if (!strcmp(old_path, action->destination)) {
-                                        dest_path = g_strdup(new_path);
-                                        g_free(action->destination);
-                                        action->destination = dest_path;
-					matched = TRUE;
-                                }
-                        }
-                }
+		filtering_action_list_rename_path(filtering->action_list,
+						  old_path, new_path);
         }
-	
-	g_free(old_path_with_sep);
-#ifdef G_OS_WIN32
-	if (!strcmp(separator, G_DIR_SEPARATOR_S) && !matched) {
-		separator = "/";
-		goto again;
-	}
-#endif
 }
 
 static gboolean prefs_filtering_rename_path_func(GNode *node, gpointer data)



More information about the Commits mailing list