From 65a741cce2a02057e858ab4bbf8b5e8ae8c4a73e Mon Sep 17 00:00:00 2001 From: Luke Fitzgerald Date: Wed, 4 Aug 2010 09:10:57 -0700 Subject: [PATCH] Messages with new lines split at plugin stage for reliability --- plugins/Irc/IrcPlugin.php | 7 +++++-- plugins/Irc/ircmanager.php | 6 +----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/plugins/Irc/IrcPlugin.php b/plugins/Irc/IrcPlugin.php index dec6d7e832..855aa3305e 100644 --- a/plugins/Irc/IrcPlugin.php +++ b/plugins/Irc/IrcPlugin.php @@ -165,8 +165,11 @@ class IrcPlugin extends ImPlugin { * @return boolean success value */ public function send_message($screenname, $body) { - $this->fake_irc->doPrivmsg($screenname, $body); - $this->enqueue_outgoing_raw(array('type' => 'message', 'data' => $this->fake_irc->would_be_sent)); + $lines = explode("\n", $body); + 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; } diff --git a/plugins/Irc/ircmanager.php b/plugins/Irc/ircmanager.php index 8d9cac885b..51996bef99 100644 --- a/plugins/Irc/ircmanager.php +++ b/plugins/Irc/ircmanager.php @@ -240,12 +240,8 @@ class IrcManager extends ImManager { $this->regchecksLookup[$usernick] = $screenname; } - $args = $data['data']['args']; - $lines = explode("\n", $args[1]); try { - foreach ($lines as $line) { - $this->conn->send($data['data']['command'], array($args[0], $line)); - } + $this->conn->send($data['data']['command'], $data['data']['args']); } catch (Phergie_Driver_Exception $e) { $this->conn->reconnect(); return false;