* @param array $data Data\r
*/\r
public function handle_session_ready($data) {\r
+ $sessionFailed = false;\r
$wm = Msn_waiting_message::top($data['to']);\r
while ($wm != NULL) {\r
- if ($this->conn->sendMessage($wm->screenname, $wm->message, $ignore)) {\r
- $wm->delete();\r
- } else {\r
- // Requeue the message in the regular queue\r
+ if ($sessionFailed) {\r
+ $this->plugin->send_message($wm->screenname, $wm->message);\r
+ $sessionFailed = true;\r
+ } elseif (!$this->conn->sendMessage($wm->screenname, $wm->message, $ignore)) {\r
$this->plugin->send_message($wm->screenname, $wm->message);\r
}\r
\r
+ $wm->delete();\r
$wm = Msn_waiting_message::top($data['to']);\r
}\r
}\r