aboutsummaryrefslogtreecommitdiff
path: root/src/filter.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-07-01 07:08:47 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-07-01 07:08:47 +0000
commit0839e124a6910f5d134ec3b229466cd470b0c7ea (patch)
tree317bb69b15ac02089dd7f9d95a033bc4c2598a82 /src/filter.c
parent0e676a1296e611abea9bcb6ce673cd8f55aa5691 (diff)
fixed a bug in syncing folder path.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@388 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/filter.c')
-rw-r--r--src/filter.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/filter.c b/src/filter.c
index 217c55da..b17134fa 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -1092,6 +1092,8 @@ void filter_rule_rename_dest_path(FilterRule *rule, const gchar *old_path,
gchar *dest_path;
gint oldpathlen;
+ oldpathlen = strlen(old_path);
+
for (cur = rule->action_list; cur != NULL; cur = cur->next) {
action = (FilterAction *)cur->data;
@@ -1099,10 +1101,11 @@ void filter_rule_rename_dest_path(FilterRule *rule, const gchar *old_path,
action->type != FLT_ACTION_COPY)
continue;
- oldpathlen = strlen(old_path);
if (action->str_value &&
!strncmp(old_path, action->str_value, oldpathlen)) {
base = action->str_value + oldpathlen;
+ if (*base != G_DIR_SEPARATOR && *base != '\0')
+ continue;
while (*base == G_DIR_SEPARATOR) base++;
if (*base == '\0')
dest_path = g_strdup(new_path);
@@ -1121,6 +1124,9 @@ void filter_rule_delete_action_by_dest_path(FilterRule *rule, const gchar *path)
FilterAction *action;
GSList *cur;
GSList *next;
+ gint pathlen;
+
+ pathlen = strlen(path);
for (cur = rule->action_list; cur != NULL; cur = next) {
action = (FilterAction *)cur->data;
@@ -1131,7 +1137,9 @@ void filter_rule_delete_action_by_dest_path(FilterRule *rule, const gchar *path)
continue;
if (action->str_value &&
- !strncmp(path, action->str_value, strlen(path))) {
+ !strncmp(path, action->str_value, pathlen) &&
+ (action->str_value[pathlen] == G_DIR_SEPARATOR ||
+ action->str_value[pathlen] == '\0')) {
rule->action_list = g_slist_remove
(rule->action_list, action);
filter_action_free(action);