Always remove messages from waiting queue and requeue messages if one fails

This commit is contained in:
Luke Fitzgerald 2010-08-04 16:14:25 -07:00
parent 68ec3f855d
commit 55ec8a7465

View File

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