@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

If PhabricatorIRCBot encounters a 'nick used' error, try adding a number

Summary: Someone stole my bot's name, so the bot couldn't (re)connect. This tries adding some text to the name if it encounters a 433 'nick in use' error

Test Plan: Started a ton of bots: F154744

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9123

authored by

Eric Stern and committed by
epriestley
358b59ff 6a45b7e6

+8
+8
src/infrastructure/daemon/bot/adapter/PhabricatorIRCProtocolAdapter.php
··· 8 8 private $writeBuffer; 9 9 private $readBuffer; 10 10 11 + private $nickIncrement = 0; 12 + 11 13 public function getServiceType() { 12 14 return 'IRC'; 13 15 } ··· 183 185 private function handleIRCProtocol(array $matches) { 184 186 $data = $matches['data']; 185 187 switch ($matches['command']) { 188 + case '433': // Nickname already in use 189 + // If we receive this error, try appending "-1", "-2", etc. to the nick 190 + $this->nickIncrement++; 191 + $nick = $this->getConfig('nick', 'phabot').'-'.$this->nickIncrement; 192 + $this->write("NICK {$nick}"); 193 + return true; 186 194 case '422': // Error - no MOTD 187 195 case '376': // End of MOTD 188 196 $nickpass = $this->getConfig('nickpass');