Allow more precise description of the read/unread messages through a
[banana.git] / banana / spool.inc.php
index b1fcfb7..0c8affd 100644 (file)
@@ -302,6 +302,22 @@ class BananaSpool
             }
         }
         $this->unreadnb += count($newpostsids);
+
+        if (function_exists('hook_listReadMessages')) {
+            $msgs = hook_listReadMessages($this->group);
+            if (!is_array($msgs)) {
+                return;
+            }
+            foreach ($msgs as $msg) {
+                if (!is_numeric($msg)) {
+                    if (!isset($this->ids[$msg])) {
+                        continue;
+                    }
+                    $msg = $this->ids[$msg];
+                }
+                $this->markAsRead($msg);
+            }
+        }
     }
 
     public function setMode($mode)