Messages with new lines split at plugin stage for reliability

This commit is contained in:
Luke Fitzgerald 2010-08-04 09:10:57 -07:00
parent 2250273942
commit 65a741cce2
2 changed files with 6 additions and 7 deletions

View File

@ -165,8 +165,11 @@ class IrcPlugin extends ImPlugin {
* @return boolean success value * @return boolean success value
*/ */
public function send_message($screenname, $body) { public function send_message($screenname, $body) {
$this->fake_irc->doPrivmsg($screenname, $body); $lines = explode("\n", $body);
$this->enqueue_outgoing_raw(array('type' => 'message', 'data' => $this->fake_irc->would_be_sent)); foreach ($lines as $line) {
$this->fake_irc->doPrivmsg($screenname, $line);
$this->enqueue_outgoing_raw(array('type' => 'message', 'data' => $this->fake_irc->would_be_sent));
}
return true; return true;
} }

View File

@ -240,12 +240,8 @@ class IrcManager extends ImManager {
$this->regchecksLookup[$usernick] = $screenname; $this->regchecksLookup[$usernick] = $screenname;
} }
$args = $data['data']['args'];
$lines = explode("\n", $args[1]);
try { try {
foreach ($lines as $line) { $this->conn->send($data['data']['command'], $data['data']['args']);
$this->conn->send($data['data']['command'], array($args[0], $line));
}
} catch (Phergie_Driver_Exception $e) { } catch (Phergie_Driver_Exception $e) {
$this->conn->reconnect(); $this->conn->reconnect();
return false; return false;