private function sendMessageViaSB($to, $message) {\r
$socket = $this->switchBoardSessionLookup[$to];\r
if (self::socketcheck($socket)) {\r
- $this->endSBSession($socket);\r
return false;\r
}\r
\r
\r
$aMessage = $this->getMessage($Message);\r
// CheckEmotion...\r
- $MsnObjDefine=$this->GetMsnObjDefine($aMessage);\r
+ $MsnObjDefine = $this->GetMsnObjDefine($aMessage);\r
if ($MsnObjDefine !== '') {\r
$SendString = "MIME-Version: 1.0\r\nContent-Type: text/x-mms-emoticon\r\n\r\n$MsnObjDefine";\r
$len = strlen($SendString);\r
- // TODO handle failure during write to socket\r
- $this->sb_writeln($socket, $id, "MSG $id N $len");\r
- $this->sb_writedata($socket, $SendString);\r
+\r
+ if ($this->sb_writeln($socket, $id, "MSG $id N $len") === false ||\r
+ $this->sb_writedata($socket, $SendString) === false) {\r
+ return false;\r
+ }\r
}\r
$len = strlen($aMessage);\r
- // TODO handle failure during write to socket\r
- $this->sb_writeln($socket, $id, "MSG $id N $len");\r
- $this->sb_writedata($socket, $aMessage);\r
\r
- // Don't close the SB session, we might as well leave it open\r
+ if ($this->sb_writeln($socket, $id, "MSG $id N $len") === false ||\r
+ $this->sb_writedata($socket, $aMessage) === false) {\r
+ return false;\r
+ }\r
\r
+ // Don't close the SB session, we might as well leave it open\r
return true;\r
}\r
\r
$str = '<ml l="1"><d n="'.$u_domain.'"><c n="'.$u_name.'" l="'.$l.'" t="'.$network.'" /></d></ml>';\r
$len = strlen($str);\r
// NS: >>> ADL {id} {size}\r
- //TODO introduce error checking\r
$this->ns_writeln("ADL $this->id $len");\r
$this->ns_writedata($str);\r
}\r
\r
/**\r
* Update the time till the next ping\r
+ * \r
* @param $data Time till next ping\r
+ * @return void\r
*/\r
private function update_ping_time($data) {\r
$pingInterval = $data;\r
common_log(LOG_NOTICE, 'MSN reconnecting');\r
}\r
\r
+ /**\r
+ * Send a message using the daemon\r
+ * \r
+ * @param $data Message\r
+ * @return boolean true on success\r
+ */\r
function send_raw_message($data) {\r
$this->connect();\r
if (!$this->conn) {\r