X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fimap_mailbox.php;h=c5a147c81a71a3ef0eba7502695e15d2705df88b;hb=76a352dd54cf1cfb4fe0a081ccedecb41c4f439c;hp=39e17d968ffe50a799dfebff12ea2c26e0212573;hpb=591000ec59a6ae1088df08a48e65bb6652fc63a7;p=squirrelmail.git diff --git a/functions/imap_mailbox.php b/functions/imap_mailbox.php index 39e17d96..c5a147c8 100755 --- a/functions/imap_mailbox.php +++ b/functions/imap_mailbox.php @@ -12,6 +12,7 @@ sqimap_mailbox_select ($imap_stream, $mailbox); fputs ($imap_stream, "a001 EXPUNGE\r\n"); $read = sqimap_read_data($imap_stream, "a001", true, $response, $message); + sqimap_mailbox_close ($imap_stream); } @@ -19,23 +20,41 @@ ** Checks whether or not the specified mailbox exists ******************************************************************************/ function sqimap_mailbox_exists ($imap_stream, $mailbox) { - $boxes = sqimap_mailbox_list ($imap_stream); - $found = false; - for ($i = 0; $i < count ($boxes); $i++) { - if ($boxes[$i]["unformatted"] == $mailbox) - $found = true; + fputs ($imap_stream, "a001 LIST \"\" \"$mailbox\"\r\n"); + $mbx = sqimap_read_data($imap_stream, "a001", true, $response, $message); + if ($mailbox) { + return !!(ereg ("$mailbox", $mbx[0])); // To force into true/false } - return $found; } + /****************************************************************************** + ** Closes an open mailbox + ******************************************************************************/ + function sqimap_mailbox_close ($imap_stream) { + fputs ($imap_stream, "a001 CLOSE\r\n"); + $tmp = sqimap_read_data($imap_stream, "a001", false, $response, $message); + } - /****************************************************************************** ** Selects a mailbox ******************************************************************************/ - function sqimap_mailbox_select ($imap_stream, $mailbox, $hide) { + function sqimap_mailbox_select ($imap_stream, $mailbox, $hide=true, $recent=false) { + global $auto_expunge; + fputs ($imap_stream, "a001 SELECT \"$mailbox\"\r\n"); $read = sqimap_read_data($imap_stream, "a001", true, $response, $message); + if ($recent) { + for ($i=0; $i