From 0bebd7c909f14344a6b3ccaed71ef98e08ff7fd1 Mon Sep 17 00:00:00 2001 From: lkehresman Date: Fri, 7 Jan 2000 22:22:57 +0000 Subject: [PATCH] Added subscription stuff so you only view folders that you're subscribed to. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@135 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/imap.php | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/functions/imap.php b/functions/imap.php index 2780f4b0..667d9c4b 100644 --- a/functions/imap.php +++ b/functions/imap.php @@ -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++) { -- 2.25.1