2009-03-03 Colin Leroy <colin@colino.net>
[gpg4win.git] / patches / claws-mail-3.7.0 / 07-bug_1865.patch
1 #! /bin/sh
2 patch -p0 -f $* < $0
3 exit $?
4
5 Index: src/prefs_filtering.c
6 ===================================================================
7 RCS file: /srv/cvs/claws-mail/claws/src/prefs_filtering.c,v
8 retrieving revision 1.59.2.78
9 diff -u -p -u -r1.59.2.78 prefs_filtering.c
10 --- src/prefs_filtering.c       23 Feb 2009 16:55:43 -0000      1.59.2.78
11 +++ src/prefs_filtering.c       3 Mar 2009 14:14:22 -0000
12 @@ -653,9 +653,13 @@ static void rename_path(GSList * filters
13         gint oldpathlen;
14          GSList * action_cur;
15          GSList * cur;
16 -
17 +       const gchar *separator=G_DIR_SEPARATOR_S;
18 +       gboolean matched = FALSE;
19 +#ifdef G_OS_WIN32
20 +again:
21 +#endif
22         oldpathlen = strlen(old_path);
23 -       old_path_with_sep = g_strconcat(old_path,G_DIR_SEPARATOR_S,NULL);
24 +       old_path_with_sep = g_strconcat(old_path,separator,NULL);
25  
26         for (cur = filters; cur != NULL; cur = cur->next) {
27                 FilteringProp   *filtering = (FilteringProp *)cur->data;
28 @@ -685,28 +689,30 @@ static void rename_path(GSList * filters
29                                          while (*base == G_DIR_SEPARATOR) base++;
30                                          if (*base == '\0')
31                                                  dest_path = g_strconcat(prefix,
32 -                                                    G_DIR_SEPARATOR_S,
33 +                                                    separator,
34                                                      new_path, NULL);
35                                          else
36                                                  dest_path = g_strconcat(prefix,
37 -                                                    G_DIR_SEPARATOR_S,
38 +                                                    separator,
39                                                      new_path,
40 -                                                    G_DIR_SEPARATOR_S,
41 +                                                    separator,
42                                                      base, NULL);
43                                          
44                                          g_free(prefix);
45                                          g_free(action->destination);
46                                          action->destination = dest_path;
47 +                                       matched = TRUE;
48                                  } else { /* for non-leaf folders */
49                                          /* compare with trailing slash */
50                                          if (!strncmp(old_path_with_sep, action->destination, oldpathlen+1)) {
51                                                  
52                                                  suffix = action->destination + oldpathlen + 1;
53                                                  dest_path = g_strconcat(new_path,
54 -                                                    G_DIR_SEPARATOR_S,
55 +                                                    separator,
56                                                      suffix, NULL);
57                                                  g_free(action->destination);
58                                                  action->destination = dest_path;
59 +                                               matched = TRUE;
60                                          }
61                                  }
62                          } else {
63 @@ -715,10 +721,19 @@ static void rename_path(GSList * filters
64                                          dest_path = g_strdup(new_path);
65                                          g_free(action->destination);
66                                          action->destination = dest_path;
67 +                                       matched = TRUE;
68                                  }
69                          }
70                  }
71          }
72 +       
73 +       g_free(old_path_with_sep);
74 +#ifdef G_OS_WIN32
75 +       if (!strcmp(separator, G_DIR_SEPARATOR_S) && !matched) {
76 +               separator = "/";
77 +               goto again;
78 +       }
79 +#endif
80  }
81  
82  static gboolean prefs_filtering_rename_path_func(GNode *node, gpointer data)