From da2fc57d77fbfabfdaf113b502e60ea823328bd7 Mon Sep 17 00:00:00 2001 From: KorvinSzanto Date: Thu, 30 Aug 2012 13:50:05 -0700 Subject: [PATCH] Fix irc server login Summary: Previously, the identification string was thrown at the server long before you were connected, I've moved this to the end of the motd raw, and now errthangz gud Test Plan: Register an account for your bot to use, give your bot the correct nick and password, then watch Reviewers: epriestley CC: aran Differential Revision: https://secure.phabricator.com/D3410 --- src/infrastructure/daemon/irc/PhabricatorIRCBot.php | 4 ---- .../daemon/irc/handler/PhabricatorIRCProtocolHandler.php | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/infrastructure/daemon/irc/PhabricatorIRCBot.php b/src/infrastructure/daemon/irc/PhabricatorIRCBot.php index 6356b8a40d..a05ab04fca 100644 --- a/src/infrastructure/daemon/irc/PhabricatorIRCBot.php +++ b/src/infrastructure/daemon/irc/PhabricatorIRCBot.php @@ -117,10 +117,6 @@ final class PhabricatorIRCBot extends PhabricatorDaemon { $this->writeCommand('PASS', "{$pass}"); } - if ($nickpass) { - $this->writeCommand("NickServ IDENTIFY ", "{$nickpass}"); - } - $this->writeCommand('NICK', "{$nick}"); $this->runSelectLoop(); } diff --git a/src/infrastructure/daemon/irc/handler/PhabricatorIRCProtocolHandler.php b/src/infrastructure/daemon/irc/handler/PhabricatorIRCProtocolHandler.php index 383bccab0f..52129e1c90 100644 --- a/src/infrastructure/daemon/irc/handler/PhabricatorIRCProtocolHandler.php +++ b/src/infrastructure/daemon/irc/handler/PhabricatorIRCProtocolHandler.php @@ -27,6 +27,10 @@ final class PhabricatorIRCProtocolHandler extends PhabricatorIRCHandler { switch ($message->getCommand()) { case '422': // Error - no MOTD case '376': // End of MOTD + $nickpass = $this->getConfig('nickpass'); + if ($nickpass) { + $this->write('PRIVMSG', "nickserv :IDENTIFY {$nickpass}"); + } $join = $this->getConfig('join'); if (!$join) { throw new Exception("Not configured to join any channels!");