From 5dedd52c0c33bff5ded4fa00728e2f5e1f48758c Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Wed, 5 Aug 2009 13:21:20 -0600 Subject: [PATCH] Catch login alerts that would otherwise be lost --- imp/lib/Imap.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/imp/lib/Imap.php b/imp/lib/Imap.php index 655a5cc76..215dce2ad 100644 --- a/imp/lib/Imap.php +++ b/imp/lib/Imap.php @@ -58,13 +58,23 @@ class IMP_Imap */ public function __destruct() { - /* Only need to serialize object once a second. When we do serialize, - * make sure we login in order to ensure we have done the necessary - * initialization. */ + /* Only need to serialize object once a session. When we do + * serialize, make sure we login in order to ensure we have done the + * necessary initialization. */ if ($this->ob && isset($_SESSION['imp']) && !isset($_SESSION['imp']['imap_ob'])) { $this->ob->login(); + + /* First login may occur on a non-viewable page. However, + * any login alerts received should be displayed to the user at + * some point. We need to do an explicit grab of the alarms + * right now. */ + $notification = Horde_Notification::singleton(); + foreach ($GLOBALS['imp_imap']->ob->alerts() as $alert) { + $notification->push($alert, 'horde.warning'); + } + $_SESSION['imp']['imap_ob'] = serialize($this->ob); } } -- 2.11.0