From 9192a0ecf8e606b97543606d1a3acee10c3dc622 Mon Sep 17 00:00:00 2001 From: Richard Date: Mon, 22 Aug 2011 22:39:38 -0300 Subject: [PATCH] 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. --- src/infrastructure/daemon/irc/bot/PhabricatorIRCBot.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/infrastructure/daemon/irc/bot/PhabricatorIRCBot.php b/src/infrastructure/daemon/irc/bot/PhabricatorIRCBot.php index 8fef888303..8ba5df7fa1 100644 --- a/src/infrastructure/daemon/irc/bot/PhabricatorIRCBot.php +++ b/src/infrastructure/daemon/irc/bot/PhabricatorIRCBot.php @@ -57,7 +57,7 @@ final class PhabricatorIRCBot extends PhabricatorDaemon { $nick = idx($config, 'nick', 'phabot'); $user = idx($config, 'user', $nick); $ssl = idx($config, 'ssl', false); - $nickpass = idx($config, 'nickpass'); + $nickpass = idx($config, 'nickpass'); if (!preg_match('/^[A-Za-z0-9_`[{}^|\]\\-]+$/', $nick)) { throw new Exception( @@ -94,7 +94,11 @@ final class PhabricatorIRCBot extends PhabricatorDaemon { $errno = 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) { throw new Exception("Failed to connect, #{$errno}: {$error}"); }