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
*/
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']);
}
}