X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=functions%2Fimap.php;h=a1876c77c8cbf4557009f8e96f10b65016a9215e;hp=2780f4b00263121bf0ab207ac435ec94d0950b49;hb=5e3fe35753f3f5deb4766caa47e3ccdf82719153;hpb=f3d17401a7a558f09baac5c349324c9cf372c705
diff --git a/functions/imap.php b/functions/imap.php
index 2780f4b0..a1876c77 100644
--- a/functions/imap.php
+++ b/functions/imap.php
@@ -100,7 +100,7 @@
$serverInfo = fgets($imapConnection, 256);
// login
- fputs($imapConnection, "a001 LOGIN $username $key\n");
+ fputs($imapConnection, "a001 LOGIN \"$username\" \"$key\"\n");
$read = fgets($imapConnection, 1024);
if ($debug_login == true) {
echo "SERVER SAYS: $read
";
@@ -160,6 +160,8 @@
echo "ERROR: Bad or malformed request.
Server responded: $message
";
exit;
}
+ fputs($imapConnection, "1 SUBSCRIBE \"$folder\"\n");
+ $data = imapReadData($imapConnection, "1", true, $response, $message);
}
function removeFolder($imapConnection, $folder) {
@@ -180,9 +182,9 @@
function getFolderList($imapConnection, &$boxes) {
require ("../config/config.php");
- fputs($imapConnection, "1 list \"\" *\n");
+ /** First we get the inbox **/
+ fputs($imapConnection, "1 LIST \"\" INBOX\n");
$str = imapReadData($imapConnection, "1", true, $response, $message);
-
$dm = findMailboxDelimeter($imapConnection);
$g = 0;
for ($i = 0;$i < count($str); $i++) {
@@ -204,6 +206,29 @@
}
}
+ /** Next, we get all subscribed folders **/
+ fputs($imapConnection, "1 LSUB \"\" *\n");
+ $str = imapReadData($imapConnection, "1", true, $response, $message);
+ $dm = findMailboxDelimeter($imapConnection);
+ for ($i = 0;$i < count($str); $i++) {
+ $mailbox = chop($str[$i]);
+ if (substr(findMailboxName($mailbox), 0, 1) != ".") {
+ $boxes[$g]["RAW"] = $mailbox;
+
+ $mailbox = findMailboxName($mailbox);
+ $periodCount = countCharInString($mailbox, $dm);
+
+ // indent the correct number of spaces.
+ for ($j = 0;$j < $periodCount;$j++)
+ $boxes[$g]["FORMATTED"] = $boxes[$g]["FORMATTED"] . " ";
+
+ $boxes[$g]["FORMATTED"] = $boxes[$g]["FORMATTED"] . readShortMailboxName($mailbox, $dm);
+ $boxes[$g]["UNFORMATTED"] = $mailbox;
+ $boxes[$g]["ID"] = $g;
+ $g++;
+ }
+ }
+
$original = $boxes;
for ($i = 0; $i < count($original); $i++) {
@@ -267,7 +292,10 @@
} else {
setMessageFlag($imapConnection, $a, $b, "Deleted");
}
+ if ($auto_expunge == true)
+ expungeBox($imapConnection, $mailbox);
}
+
function stripComments($line) {
if (strpos($line, ";")) {
$line = substr($line, 0, strpos($line, ";"));