2006-05-03 [colin] 2.1.1cvs45
authorColin Leroy <colin@colino.net>
Wed, 3 May 2006 17:05:48 +0000 (17:05 +0000)
committerColin Leroy <colin@colino.net>
Wed, 3 May 2006 17:05:48 +0000 (17:05 +0000)
* src/imap.c
* src/imap.h
* src/imap_gtk.c
Fix preventing renaming with namespace
separator.

ChangeLog
PATCHSETS
configure.ac
src/imap.c
src/imap.h
src/imap_gtk.c

index a0fcbc4..acc7bf7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-05-03 [colin]     2.1.1cvs45
+
+       * src/imap.c
+       * src/imap.h
+       * src/imap_gtk.c
+               Fix preventing renaming with namespace 
+               separator.
+
 2006-05-01 [colin]     2.1.1cvs44
 
        * src/action.c
index 93ee683..f24d3e8 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.1.2.6 -r 1.1.2.7 src/prefs_compose_writing.c;  cvs diff -u -r 1.1.2.8 -r 1.1.2.9 src/prefs_quote.c;  ) > 2.1.1cvs42.patchset
 ( cvs diff -u -r 1.1.2.9 -r 1.1.2.10 src/prefs_receive.c;  cvs diff -u -r 1.23.2.28 -r 1.23.2.29 src/plugins/spamassassin/spamassassin_gtk.c;  cvs diff -u -r 1.9.2.18 -r 1.9.2.19 src/plugins/clamav/clamav_plugin_gtk.c;  ) > 2.1.1cvs43.patchset
 ( cvs diff -u -r 1.12.2.33 -r 1.12.2.34 src/action.c;  ) > 2.1.1cvs44.patchset
+( cvs diff -u -r 1.179.2.110 -r 1.179.2.111 src/imap.c;  cvs diff -u -r 1.34.2.5 -r 1.34.2.6 src/imap.h;  cvs diff -u -r 1.1.2.29 -r 1.1.2.30 src/imap_gtk.c;  ) > 2.1.1cvs45.patchset
index 7533045..d2636f2 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=1
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=44
+EXTRA_VERSION=45
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 9f3c546..ccd7761 100644 (file)
@@ -2248,6 +2248,24 @@ static IMAPNameSpace *imap_find_namespace(IMAPFolder *folder,
        return NULL;
 }
 
+gchar imap_get_path_separator_for_item(FolderItem *item)
+{
+       Folder *folder = NULL;
+       IMAPFolder *imap_folder = NULL;
+       if (!item)
+               return '/';
+       folder = item->folder;
+       
+       if (!folder)
+               return '/';
+       
+       imap_folder = IMAP_FOLDER(folder);
+       
+       if (!imap_folder)
+               return '/';
+       
+       return imap_get_path_separator(imap_folder, item->path);
+}
 
 static gchar imap_get_path_separator(IMAPFolder *folder, const gchar *path)
 {
@@ -4259,6 +4277,11 @@ static gint      imap_rename_folder      (Folder         *folder,
        return -1;
 }
 
+gchar imap_get_path_separator_for_item(FolderItem *item)
+{
+       return '/';
+}
+
 FolderClass *imap_get_class(void)
 {
        if (imap_class.idstr == NULL) {
index c9b3221..c4c80c5 100644 (file)
@@ -33,5 +33,6 @@ FolderClass *imap_get_class           (void);
 guint imap_folder_get_refcnt(Folder *folder);
 void imap_folder_ref(Folder *folder);
 void imap_folder_unref(Folder *folder);
+gchar imap_get_path_separator_for_item (FolderItem *item);
 
 #endif /* __IMAP_H__ */
index 80e79d3..3538fc0 100644 (file)
@@ -121,7 +121,8 @@ static void new_folder_cb(FolderView *folderview, guint action,
        gchar *new_folder;
        gchar *name;
        gchar *p;
-
+       gchar separator = '/';
+       
        if (!folderview->selected) return;
 
        item = gtk_ctree_node_get_row_data(ctree, folderview->selected);
@@ -138,10 +139,18 @@ static void new_folder_cb(FolderView *folderview, guint action,
        if (!new_folder) return;
        AUTORELEASE_STR(new_folder, {g_free(new_folder); return;});
 
-       p = strchr(new_folder, G_DIR_SEPARATOR);
+       separator = imap_get_path_separator_for_item(item);
+
+       p = strchr(new_folder, separator);
+       if (p && *(p + 1) != '\0') {
+               alertpanel_error(_("'%c' can't be included in folder name."),
+                                separator);
+               return;
+       }
+       p = strchr(new_folder, '/');
        if (p && *(p + 1) != '\0') {
                alertpanel_error(_("'%c' can't be included in folder name."),
-                                G_DIR_SEPARATOR);
+                                '/');
                return;
        }
 
@@ -173,6 +182,7 @@ static void rename_folder_cb(FolderView *folderview, guint action,
        gchar *old_id;
        gchar *new_id;
        gchar *base;
+       gchar separator = '/';
 
        item = folderview_get_selected_item(folderview);
        g_return_if_fail(item != NULL);
@@ -189,14 +199,18 @@ static void rename_folder_cb(FolderView *folderview, guint action,
        if (!new_folder) return;
        AUTORELEASE_STR(new_folder, {g_free(new_folder); return;});
 
-/*
-       TODO: check new name for IMAP namespace separator
-       if (strchr(new_folder, G_DIR_SEPARATOR) != NULL) {
+       separator = imap_get_path_separator_for_item(item);
+       if (strchr(new_folder, separator) != NULL) {
+               alertpanel_error(_("`%c' can't be included in folder name."),
+                                separator);
+               return;
+       }
+       if (strchr(new_folder, '/') != NULL) {
                alertpanel_error(_("`%c' can't be included in folder name."),
-                                G_DIR_SEPARATOR);
+                                '/');
                return;
        }
-*/
+
        if (folder_find_child_item_by_name(folder_item_parent(item), new_folder)) {
                name = trim_string(new_folder, 32);
                alertpanel_error(_("The folder '%s' already exists."), name);