$errors, __FILE__, __LINE__, PEAR_LOG_DEBUG);
}
-/* Display IMAP alerts. */
-if ($notify) {
- foreach ($GLOBALS['imp_imap']->ob->alerts() as $alert) {
- $notification->push($alert, 'horde.warning');
- }
-}
-
// Send the final result.
Horde::sendHTTPResponse(Horde::prepareResponse($result, $notify ? $GLOBALS['imp_notify'] : null), 'json');
$viewmode = self::getViewMode();
if ($viewmode == 'mimp') {
- $GLOBALS['imp_notify'] = $GLOBALS['notification']->attach('status', null, 'Horde_Notification_Listener_Mobile');
+ $GLOBALS['imp_notify'] = $GLOBALS['notification']->attach('status', null, 'IMP_Notification_Listener_StatusMobile');
} else {
$GLOBALS['imp_notify'] = $GLOBALS['notification']->attach('status', array('viewmode' => $viewmode), 'IMP_Notification_Listener_Status');
if ($viewmode == 'imp') {
*/
static public function status()
{
- global $notification;
-
- /* Display IMAP alerts. */
- foreach ($GLOBALS['imp_imap']->ob->alerts() as $alert) {
- $notification->push($alert, 'horde.warning');
- }
-
+ $notification = Horde_Notification::singleton();
$notification->notify(array('listeners' => array('status', 'audio')));
}
$options['store'] = true;
}
+ /* Display IMAP alerts. */
+ foreach ($GLOBALS['imp_imap']->ob->alerts() as $alert) {
+ $this->push($alert, 'horde.warning');
+ }
+
parent::notify($messageStack, $options);
/* Preferences display. */
--- /dev/null
+<?php
+/**
+ * The IMP_Notification_Listener_StatusMobile:: class extends the
+ * Horde_Notification_Listener_Mobile:: class to display IMAP alert
+ * notifications.
+ *
+ * Copyright 1999-2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author Michael Slusarz <slusarz@horde.org>
+ * @package Horde_Notification
+ */
+class IMP_Notification_Listener_StatusMobile extends Horde_Notification_Listener_Mobile
+{
+ /**
+ * Returns all status message if there are any on the 'status' message
+ * stack.
+ *
+ * @param array &$messageStack The stack of messages.
+ * @param array $options An array of options.
+ */
+ public function notify(&$messageStack, $options = array())
+ {
+ /* Display IMAP alerts. */
+ foreach ($GLOBALS['imp_imap']->ob->alerts() as $alert) {
+ $this->push($alert, 'horde.warning');
+ }
+
+ parent::notify($messageStack, $options);
+ }
+
+}