瀏覽代碼

Fixed a problem with sqimap_unseen_messages where some versions of UW
Imap will send 2 lines of response on a STATUS mailbox (UNSEEN) when
the last EXAMINE was on the same mailbox. This kept the INBOX from
displaying the number of unread messages. This seems like valid behaviour
to me, but UW IMAP doesn't like it depending on how it's been compiled.

indiri69 23 年之前
父節點
當前提交
95949406b0
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      functions/imap_general.php

+ 7 - 1
functions/imap_general.php

@@ -429,7 +429,13 @@ function sqimap_find_displayable_name ($string) {
 function sqimap_unseen_messages ($imap_stream, $mailbox) {
     //fputs ($imap_stream, sqimap_session_id() . " SEARCH UNSEEN NOT DELETED\r\n");
     $read_ary = sqimap_run_command ($imap_stream, "STATUS \"$mailbox\" (UNSEEN)", true, $result, $message);
-    ereg("UNSEEN ([0-9]+)", $read_ary[0], $regs);
+    $i = 0;
+    while (isset($read_ary[$i])) {
+        if (ereg("UNSEEN ([0-9]+)", $read_ary[$i], $regs)) {
+            break;
+        }
+        $i++;
+    }
     return $regs[1];
 }