break;\r
}\r
$this->debug_message("*** MSG from $from_email: $sMsg");\r
- $this->callHandler('IMin', array('sender' => $from_email, 'message' => $sMsg, 'network' => $network, 'offline' => false));\r
+ $this->callHandler('IMin', array('sender' => $from_email, 'message' => $sMsg, 'network' => 1, 'offline' => false));\r
break;\r
case '217':\r
$this->debug_message('*** User '.$session['to'].' is offline. Trying OIM.');\r
if (is_numeric($code)) {\r
$this->error = "Error code: $code, please check the detail information from: http://msnpiki.msnfanatic.com/index.php/Reference:Error_List";\r
$this->debug_message("*** SB: $this->error");\r
- $sessionEnd=true;\r
}\r
break;\r
}\r
if (self::socketcheck($socket)) {\r
return false;\r
}\r
- \r
- $intsocket = (int) $socket;\r
- if (!$this->switchBoardSessions[$intsocket]['joined']) {\r
- // If our participant has not joined the session yet we can't message them!\r
- return false;\r
- }\r
\r
- $id = &$this->switchBoardSessions[$intsocket]['id'];\r
+ $id = &$this->switchBoardSessions[(int) $socket]['id'];\r
\r
$aMessage = $this->getMessage($message);\r
// CheckEmotion...\r
return false;\r
} else {\r
$socket = $this->switchBoardSessionLookup[$recipient];\r
- if ($this->switchBoardSessions[(int) $socket]['offline']) {\r
+ $intsocket = (int) $socket;\r
+ if ($this->switchBoardSessions[$intsocket]['offline']) {\r
$this->debug_message("*** Contact ($recipient) offline, sending OIM");\r
$this->endSBSession($socket);\r
return $this->sendMessage($recipient.'@Offline', $message);\r
} else {\r
+ if ($this->switchBoardSessions[$intsocket]['joined'] !== true) {\r
+ $this->debug_message("*** Recipient has not joined session, returning false");\r
+ return false;\r
+ }\r
+ \r
$this->debug_message("*** Attempting to send message to $recipient using existing SB session");\r
\r
if ($this->sendMessageViaSB($recipient, $message)) {\r
$this->debug_message('*** Message sent successfully');\r
return true;\r
- } else {\r
- $this->debug_message('*** Message sending failed, requesting new SB session');\r
- $this->reqSBSession($recipient);\r
- return false;\r
}\r
+ \r
+ return false;\r
}\r
}\r
} elseif ($network == 'Offline') {\r
'debug' => true\r
)\r
);\r
- $this->conn->registerHandler("IMIn", array($this, 'handle_msn_message'));\r
+ $this->conn->registerHandler('IMin', array($this, 'handle_msn_message'));\r
$this->conn->registerHandler('Pong', array($this, 'update_ping_time'));\r
$this->conn->registerHandler('ConnectFailed', array($this, 'handle_connect_failed'));\r
$this->conn->registerHandler('Reconnect', array($this, 'handle_reconnect'));\r
* @param $data Time till next ping\r
* @return void\r
*/\r
- private function update_ping_time($data) {\r
+ public function update_ping_time($data) {\r
$pingInterval = $data;\r
}\r
\r
* @param array $data Data\r
* @return boolean\r
*/\r
- private function handle_msn_message($data) {\r
+ public function handle_msn_message($data) {\r
$this->plugin->enqueue_incoming_raw($data);\r
return true;\r
}\r
* @param void $data Not used (there to keep callback happy)\r
* @return void\r
*/\r
- private function handle_connect_failed($data) {\r
+ public function handle_connect_failed($data) {\r
common_log(LOG_NOTICE, 'MSN connect failed, retrying');\r
}\r
\r
* @param void $data Not used (there to keep callback happy)\r
* @return void\r
*/\r
- private function handle_reconnect($data) {\r
+ public function handle_reconnect($data) {\r
common_log(LOG_NOTICE, 'MSN reconnecting');\r
}\r
\r
if (!$this->conn->sendMessage($data['to'], $data['message'])) {\r
return false;\r
}\r
-\r
+ \r
// Sending a command updates the time till next ping\r
$this->lastping = time();\r
$this->pingInterval = 50;\r