forked from GNUsocial/gnu-social
Implemented error checking in sendOtherNetworkMessage
This commit is contained in:
parent
242e8905cd
commit
47bc0ae4c4
@ -1497,9 +1497,12 @@ class MSN {
|
|||||||
private function sendOtherNetworkMessage($to, $message, $network) {
|
private function sendOtherNetworkMessage($to, $message, $network) {
|
||||||
$message = $this->getMessage($message, $network);
|
$message = $this->getMessage($message, $network);
|
||||||
$len = strlen($message);
|
$len = strlen($message);
|
||||||
// TODO Introduce error checking for message sending
|
if ($this->ns_writeln("UUM $this->id $to $network 1 $len") === false) {
|
||||||
$this->ns_writeln("UUM $this->id $to $network 1 $len");
|
return false;
|
||||||
$this->ns_writedata($Message);
|
}
|
||||||
|
if ($this->ns_writedata($Message)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$this->debug_message("*** Sent to $to (network: $network):\n$Message");
|
$this->debug_message("*** Sent to $to (network: $network):\n$Message");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2497,24 +2500,30 @@ X-OIM-Sequence-Num: 1
|
|||||||
* Also increments id
|
* Also increments id
|
||||||
*
|
*
|
||||||
* @param string $data Line to write to socket
|
* @param string $data Line to write to socket
|
||||||
* @return void
|
* @return mixed Bytes written or false on failure
|
||||||
*/
|
*/
|
||||||
private function ns_writeln($data) {
|
private function ns_writeln($data) {
|
||||||
@fwrite($this->NSfp, $data."\r\n");
|
$result = @fwrite($this->NSfp, $data."\r\n");
|
||||||
|
if ($result !== false) {
|
||||||
$this->debug_message("NS: >>> $data");
|
$this->debug_message("NS: >>> $data");
|
||||||
$this->id++;
|
$this->id++;
|
||||||
}
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write data to NS socket
|
* Write data to NS socket
|
||||||
*
|
*
|
||||||
* @param string $data Data to write to socket
|
* @param string $data Data to write to socket
|
||||||
* @return void
|
* @return mixed Bytes written or false on failure
|
||||||
*/
|
*/
|
||||||
private function ns_writedata($data) {
|
private function ns_writedata($data) {
|
||||||
@fwrite($this->NSfp, $data);
|
$result = @fwrite($this->NSfp, $data);
|
||||||
|
if ($result !== false) {
|
||||||
$this->debug_message("NS: >>> $data");
|
$this->debug_message("NS: >>> $data");
|
||||||
}
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read data of specified size from given SB socket
|
* Read data of specified size from given SB socket
|
||||||
|
Loading…
x
Reference in New Issue
Block a user