From 55ec8a74657618d36c6b7018ff4519a3838fea6a Mon Sep 17 00:00:00 2001 From: Luke Fitzgerald Date: Wed, 4 Aug 2010 16:14:25 -0700 Subject: [PATCH] Always remove messages from waiting queue and requeue messages if one fails --- plugins/Msn/msnmanager.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/Msn/msnmanager.php b/plugins/Msn/msnmanager.php index 1eac596df2..42eb18b9c4 100644 --- a/plugins/Msn/msnmanager.php +++ b/plugins/Msn/msnmanager.php @@ -170,15 +170,17 @@ class MsnManager extends ImManager { * @param array $data Data */ public function handle_session_ready($data) { + $sessionFailed = false; $wm = Msn_waiting_message::top($data['to']); while ($wm != NULL) { - if ($this->conn->sendMessage($wm->screenname, $wm->message, $ignore)) { - $wm->delete(); - } else { - // Requeue the message in the regular queue + if ($sessionFailed) { + $this->plugin->send_message($wm->screenname, $wm->message); + $sessionFailed = true; + } elseif (!$this->conn->sendMessage($wm->screenname, $wm->message, $ignore)) { $this->plugin->send_message($wm->screenname, $wm->message); } + $wm->delete(); $wm = Msn_waiting_message::top($data['to']); } } -- 2.39.5