diff --git a/evennia/commands/default/comms.py b/evennia/commands/default/comms.py index 730400aa77..2092400a26 100644 --- a/evennia/commands/default/comms.py +++ b/evennia/commands/default/comms.py @@ -755,7 +755,8 @@ class CmdIRC2Chan(MuxCommand): link an evennia channel to an external IRC channel Usage: - @irc2chan[/switches] = <[+]port> <#irchannel> + @irc2chan[/switches] = <#irchannel> + @irc2chan/ssl " @irc2chan/list @irc2chan/delete botname|#dbid @@ -774,8 +775,7 @@ class CmdIRC2Chan(MuxCommand): vice versa. The bot will automatically connect at server start, so this comman need only be given once. The /disconnect switch will permanently delete the bot. To only temporarily deactivate it, use the {w@services{n - command instead. To connect with SSL, add a plus sign (+) before the port - number. + command instead. """ key = "@irc2chan" @@ -821,7 +821,7 @@ class CmdIRC2Chan(MuxCommand): return if not self.args or not self.rhs: - string = "Usage: @irc2chan[/switches] = <[+]port> <#irchannel> " + string = "Usage: @irc2chan[/switches] = <#irchannel> " self.msg(string) return @@ -831,15 +831,13 @@ class CmdIRC2Chan(MuxCommand): irc_network, irc_port, irc_channel, irc_botname = \ [part.strip() for part in self.rhs.split(None, 3)] irc_channel = "#%s" % irc_channel - if "+" in irc_port: - irc_ssl = True - irc_port = irc_port[1:] except Exception: string = "IRC bot definition '%s' is not valid." % self.rhs self.msg(string) return botname = "ircbot-%s" % irc_botname + irc_ssl = "ssl" in self.switches # create a new bot bot = PlayerDB.objects.filter(username__iexact=botname) diff --git a/evennia/server/portal/irc.py b/evennia/server/portal/irc.py index b44eef787a..5771df1085 100644 --- a/evennia/server/portal/irc.py +++ b/evennia/server/portal/irc.py @@ -312,12 +312,11 @@ class IRCBotFactory(protocol.ReconnectingClientFactory): """ if self.port: if ssl: - """ - Requires PyOpenSSL - - """ - service = reactor.connectSSL(self.network, int(self.port), self, ssl.ClientContextFactory()) + try: + import OpenSSL + service = reactor.connectSSL(self.network, int(self.port), self, ssl.ClientContextFactory()) + except ImportError: + self.caller.msg("To use SSL, the PyOpenSSL module must be installed.") else: service = internet.TCPClient(self.network, int(self.port), self) - self.sessionhandler.portal.services.addService(service)