[imp] Renaming folders and bad subscription

Lancaster, David dml at unb.ca
Tue Aug 26 10:01:58 PDT 2003


Never got any response to my inquiry on the 20th about folders being incorrectly
subscribed after renaming their parent, so I ended up hacking this together in the
current stable release.

If this isn't redundant code, perhaps it could be rolled in?
Thanks.

D.

--- Folder.php.orig     2003-08-26 12:05:43.000000000 -0300
+++ Folder.php  2003-08-26 12:22:58.000000000 -0300
@@ -372,6 +372,17 @@
             if ($subscribe && in_array($server . $old, $subscribed_folders)) {
                 imap_unsubscribe($stream, $server . $old);
                 imap_subscribe($stream, $server . $new);
+               #dml Aug 26/2003 handle nested folder subscription
+               if (is_array($subscribed_folders)) {
+                   foreach ($subscribed_folders as $folder) {
+                       if (strstr($folder, "$server$old/")){
+                           $newFolderName= str_replace("$server$old/", "$server$new/",
$folder);
+                           imap_unsubscribe($stream, $folder);
+                           imap_subscribe($stream, $newFolderName);
+                       }
+                   }
+               }
+
             }
             Horde::raiseMessage(sprintf(_("The folder \"%s\" was successfully renamed
to \"%s\"."), IMP::displayFolder($old), IMP::displayFolder($new)), HORDE_SUCCESS);
             return true;


More information about the imp mailing list