Found this stuff when trying to figure out why I couldn't name a folder
[squirrelmail.git] / src / folders_rename_do.php
index 99324ca09170d7b97012bc2bef304c18edb9a7dd..da76944a50bc8551e0af976208f2afcb028c6d7a 100644 (file)
    else
       $newone = "$new_name";
 
-   fputs ($imapConnection, ". RENAME \"$orig\" \"$newone\"\r\n");
-   $data = sqimap_read_data($imapConnection, ".", true, $a, $b);
+   $cmd = "a024 RENAME \"" . quoteIMAP($orig) . "\" \"" .
+      quoteIMAP($newone) . "\"\r\n";
+   echo htmlspecialchars($cmd) . "<br>\n";
+   fputs ($imapConnection, $cmd);
+   $data = sqimap_read_data($imapConnection, "a024", true, $a, $b);
 
    // Renaming a folder doesn't renames the folder but leaves you unsubscribed
    //    at least on Cyrus IMAP servers.
@@ -46,7 +49,8 @@
    sqimap_unsubscribe($imapConnection, $orig);
    sqimap_subscribe($imapConnection, $newone);
 
-       fputs ($imapConnection, "a001 LIST \"\" \"$newone*\"\r\n");
+   fputs ($imapConnection, "a001 LIST \"\" \"" . quoteIMAP($newone) .
+      "*\"\r\n");
    $data = sqimap_read_data($imapConnection, "a001", true, $a, $b);
    for ($i=0; $i < count($data); $i++)
    {