[dev] New messages popup on Horde summary screen

Tero Matinlassi tero.matinlassi@edu.vantaa.fi
Thu, 13 Jun 2002 14:30:55 +0300


The new messages popup on Horde summary screen shows "n new messages" 
even I don't have a single new/unread message on a folder. Looking the 
code, I noticed that it's really showing the recent message count for a 
folder, not the new/unread (unseen) message count. So I changed it like 
this (sorry about wrapping lines..):

Index: api.php
===================================================================
RCS file: /repository/imp/lib/api.php,v
retrieving revision 1.12.2.8
diff -u -r1.12.2.8 api.php
--- api.php     10 Jun 2002 21:55:42 -0000      1.12.2.8
+++ api.php     13 Jun 2002 11:20:03 -0000
@@ -38,6 +38,7 @@

     $html .= '</td></tr><tr><td class="text"><table border="0" 
cellpadding="0" cellspacing="0">';

+    $newmsgs = array();
     if (IMP::authenticate(OP_HALFOPEN, true) === true) {
         $folders = @unserialize($prefs->getValue('nav_poll'));
         if (!isset($folders) || !is_array($folders)) {
@@ -46,13 +47,12 @@
         ksort($folders);

         $serverstring = IMP::serverString();
-        $newmsgs = array();
         foreach ($folders as $folder => $true) {
             if ($folder == 'INBOX' || !strstr($GLOBALS['imp']
['protocol'], 'pop3')) {
-                $sts = imap_status($GLOBALS['imp']['stream'], 
$serverstring . $folder, SA_UNSEEN | SA_RECENT);
+                $sts = imap_status($GLOBALS['imp']['stream'], 
$serverstring . $folder, SA_UNSEEN);
                 if ($sts) {
-                    if (!empty($sts->recent)) {
-                        $newmsgs[$folder] = $sts->recent;
+                    if (!empty($sts->unseen)) {
+                        $newmsgs[$folder] = $sts->unseen;
                     }
                     $html .= '<tr><td class="text">';
                     if (!empty($sts->unseen)) {


Now it only shows popup if I really have new messages. Seems like 
imap_status() differs from imap_headerinfo() so that in the latter one 
one should check for Recent == 'N' || Unseen == 'U' but the first one 
counts these both as unseen. Anybody to confirm this? I'm using PHP 
version 4.1.2.

-Tero

-- 
Tero Matinlassi
Postipalvelimen ylläpito
Mail server administration