Implemented @Griatch's suggestions
This commit is contained in:
parent
2d54bc33ab
commit
4c113f9ab7
2 changed files with 10 additions and 13 deletions
|
|
@ -755,7 +755,8 @@ class CmdIRC2Chan(MuxCommand):
|
||||||
link an evennia channel to an external IRC channel
|
link an evennia channel to an external IRC channel
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
@irc2chan[/switches] <evennia_channel> = <ircnetwork> <[+]port> <#irchannel> <botname>
|
@irc2chan[/switches] <evennia_channel> = <ircnetwork> <port> <#irchannel> <botname>
|
||||||
|
@irc2chan/ssl "
|
||||||
@irc2chan/list
|
@irc2chan/list
|
||||||
@irc2chan/delete botname|#dbid
|
@irc2chan/delete botname|#dbid
|
||||||
|
|
||||||
|
|
@ -774,8 +775,7 @@ class CmdIRC2Chan(MuxCommand):
|
||||||
vice versa. The bot will automatically connect at server start, so this
|
vice versa. The bot will automatically connect at server start, so this
|
||||||
comman need only be given once. The /disconnect switch will permanently
|
comman need only be given once. The /disconnect switch will permanently
|
||||||
delete the bot. To only temporarily deactivate it, use the {w@services{n
|
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
|
command instead.
|
||||||
number.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
key = "@irc2chan"
|
key = "@irc2chan"
|
||||||
|
|
@ -821,7 +821,7 @@ class CmdIRC2Chan(MuxCommand):
|
||||||
return
|
return
|
||||||
|
|
||||||
if not self.args or not self.rhs:
|
if not self.args or not self.rhs:
|
||||||
string = "Usage: @irc2chan[/switches] <evennia_channel> = <ircnetwork> <[+]port> <#irchannel> <botname>"
|
string = "Usage: @irc2chan[/switches] <evennia_channel> = <ircnetwork> <port> <#irchannel> <botname>"
|
||||||
self.msg(string)
|
self.msg(string)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -831,15 +831,13 @@ class CmdIRC2Chan(MuxCommand):
|
||||||
irc_network, irc_port, irc_channel, irc_botname = \
|
irc_network, irc_port, irc_channel, irc_botname = \
|
||||||
[part.strip() for part in self.rhs.split(None, 3)]
|
[part.strip() for part in self.rhs.split(None, 3)]
|
||||||
irc_channel = "#%s" % irc_channel
|
irc_channel = "#%s" % irc_channel
|
||||||
if "+" in irc_port:
|
|
||||||
irc_ssl = True
|
|
||||||
irc_port = irc_port[1:]
|
|
||||||
except Exception:
|
except Exception:
|
||||||
string = "IRC bot definition '%s' is not valid." % self.rhs
|
string = "IRC bot definition '%s' is not valid." % self.rhs
|
||||||
self.msg(string)
|
self.msg(string)
|
||||||
return
|
return
|
||||||
|
|
||||||
botname = "ircbot-%s" % irc_botname
|
botname = "ircbot-%s" % irc_botname
|
||||||
|
irc_ssl = "ssl" in self.switches
|
||||||
|
|
||||||
# create a new bot
|
# create a new bot
|
||||||
bot = PlayerDB.objects.filter(username__iexact=botname)
|
bot = PlayerDB.objects.filter(username__iexact=botname)
|
||||||
|
|
|
||||||
|
|
@ -312,12 +312,11 @@ class IRCBotFactory(protocol.ReconnectingClientFactory):
|
||||||
"""
|
"""
|
||||||
if self.port:
|
if self.port:
|
||||||
if ssl:
|
if ssl:
|
||||||
"""
|
try:
|
||||||
Requires PyOpenSSL
|
import OpenSSL
|
||||||
|
|
||||||
"""
|
|
||||||
service = reactor.connectSSL(self.network, int(self.port), self, ssl.ClientContextFactory())
|
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:
|
else:
|
||||||
service = internet.TCPClient(self.network, int(self.port), self)
|
service = internet.TCPClient(self.network, int(self.port), self)
|
||||||
|
|
||||||
self.sessionhandler.portal.services.addService(service)
|
self.sessionhandler.portal.services.addService(service)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue