mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 05:20:56 +01:00
Added the ability to support Irc Bots that need to login into private IRC Servers. Requires the following to be added to the config.json file
"user":"authenticationusername", "pass":"thisuserspassowrd", This will allow people with internal irc servers to use this if they control access from ldap for irc.
This commit is contained in:
parent
8690c66191
commit
fbef90c4c6
1 changed files with 6 additions and 2 deletions
|
@ -53,8 +53,9 @@ final class PhabricatorIRCBot extends PhabricatorDaemon {
|
||||||
$port = idx($config, 'port', 6667);
|
$port = idx($config, 'port', 6667);
|
||||||
$join = idx($config, 'join', array());
|
$join = idx($config, 'join', array());
|
||||||
$handlers = idx($config, 'handlers', array());
|
$handlers = idx($config, 'handlers', array());
|
||||||
|
$pass = idx($config, 'pass');
|
||||||
$nick = idx($config, 'nick', 'phabot');
|
$nick = idx($config, 'nick', 'phabot');
|
||||||
|
$user = idx($config, 'user', $nick);
|
||||||
|
|
||||||
if (!preg_match('/^[A-Za-z0-9_`[{}^|\]\\-]+$/', $nick)) {
|
if (!preg_match('/^[A-Za-z0-9_`[{}^|\]\\-]+$/', $nick)) {
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
|
@ -101,8 +102,11 @@ final class PhabricatorIRCBot extends PhabricatorDaemon {
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->socket = $socket;
|
$this->socket = $socket;
|
||||||
|
$this->writeCommand('USER', "{$user} 0 * :{$user}");
|
||||||
|
if ($pass) {
|
||||||
|
$this->writeCommand('PASS', "{$pass}");
|
||||||
|
}
|
||||||
|
|
||||||
$this->writeCommand('USER', "{$nick} 0 * :{$nick}");
|
|
||||||
$this->writeCommand('NICK', "{$nick}");
|
$this->writeCommand('NICK', "{$nick}");
|
||||||
foreach ($join as $channel) {
|
foreach ($join as $channel) {
|
||||||
$this->writeCommand('JOIN', "{$channel}");
|
$this->writeCommand('JOIN', "{$channel}");
|
||||||
|
|
Loading…
Reference in a new issue