+
+/* Receive the status of the folder and do something with it */
+function newmail_folder_status($statusarr) {
+ global $newmail_media_enable,$newmail_popup,$newmail_changetitle,$trash_folder,
+ $sent_folder,$totalNewArr, $newmail_unseen_notify, $unseen_notify, $newmail_recent;
+
+ /* if $newmail_unseen_notify is set to zero, plugin follows $unseen_notify */
+ if ($newmail_unseen_notify == 0)
+ $newmail_unseen_notify = $unseen_notify;
+
+ $mailbox=$statusarr['MAILBOX'];
+
+ if (($newmail_media_enable == 'on' ||
+ $newmail_popup == 'on' ||
+ $newmail_changetitle == 'on') &&
+ /**
+ * make sure that $newmail_unseen_notify is set to supported value,
+ * currently (1.5.2cvs) SMPREF_UNSEEN_NORMAL has highest integer value
+ * in SMPREF_UNSEEN constants
+ */
+ ($newmail_unseen_notify > SMPREF_UNSEEN_NONE && $newmail_unseen_notify <= SMPREF_UNSEEN_NORMAL)) {
+
+ // Skip folders for Sent and Trash
+ // TODO: make this optional
+ if ($statusarr['MAILBOX'] == $sent_folder || $statusarr['MAILBOX'] == $trash_folder) {
+ return 0;
+ }
+
+ if ((($mailbox == 'INBOX') && ($newmail_unseen_notify == SMPREF_UNSEEN_INBOX)) ||
+ ($newmail_unseen_notify == SMPREF_UNSEEN_SPECIAL && isSpecialMailbox($mailbox)) ||
+ ($newmail_unseen_notify == SMPREF_UNSEEN_NORMAL && ! isSpecialMailbox($mailbox)) ||
+ ($newmail_unseen_notify == SMPREF_UNSEEN_ALL)) {
+ if (($newmail_recent == 'on') && (!empty($statusarr['RECENT']))) {
+ $totalNewArr[$mailbox] = $statusarr['RECENT'];
+ } elseif ($newmail_recent != 'on' && !empty($statusarr['UNSEEN'])) {
+ $totalNewArr[$mailbox] = $statusarr['UNSEEN'];
+ }
+ }
+ }
+}
+