mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-30 10:42:41 +01:00
Added the ability for SSL to be fined in the irc_config.json file, if not there we assume that its false and continue on our way. if "ssl":true is in the config then we are going to use ssl:// to make the connection use openssl.
This commit is contained in:
parent
2d677d3992
commit
9192a0ecf8
1 changed files with 6 additions and 2 deletions
|
@ -57,7 +57,7 @@ final class PhabricatorIRCBot extends PhabricatorDaemon {
|
||||||
$nick = idx($config, 'nick', 'phabot');
|
$nick = idx($config, 'nick', 'phabot');
|
||||||
$user = idx($config, 'user', $nick);
|
$user = idx($config, 'user', $nick);
|
||||||
$ssl = idx($config, 'ssl', false);
|
$ssl = idx($config, 'ssl', false);
|
||||||
$nickpass = idx($config, 'nickpass');
|
$nickpass = idx($config, 'nickpass');
|
||||||
|
|
||||||
if (!preg_match('/^[A-Za-z0-9_`[{}^|\]\\-]+$/', $nick)) {
|
if (!preg_match('/^[A-Za-z0-9_`[{}^|\]\\-]+$/', $nick)) {
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
|
@ -94,7 +94,11 @@ final class PhabricatorIRCBot extends PhabricatorDaemon {
|
||||||
|
|
||||||
$errno = null;
|
$errno = null;
|
||||||
$error = null;
|
$error = null;
|
||||||
$socket = fsockopen($server, $port, $errno, $error);
|
if (!$ssl) {
|
||||||
|
$socket = fsockopen($server, $port, $errno, $error);
|
||||||
|
} else {
|
||||||
|
$socket = fsockopen('ssl://'.$server, $port, $errno, $error);
|
||||||
|
}
|
||||||
if (!$socket) {
|
if (!$socket) {
|
||||||
throw new Exception("Failed to connect, #{$errno}: {$error}");
|
throw new Exception("Failed to connect, #{$errno}: {$error}");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue