Add use_ssl option
This change enables using the statusbot with a non ssl server. Change-Id: I4e79625316ebaa391941743bfd1a2ea29e14df09
This commit is contained in:
parent
42e3cc433d
commit
4c31332e23
@ -354,7 +354,7 @@ class AlertFile(UpdateInterface):
|
|||||||
self.write(None)
|
self.write(None)
|
||||||
|
|
||||||
|
|
||||||
class BaseStatusBot(SSL, irc.bot.SingleServerIRCBot):
|
class BaseStatusBot(irc.bot.SingleServerIRCBot):
|
||||||
log = logging.getLogger("statusbot.bot")
|
log = logging.getLogger("statusbot.bot")
|
||||||
|
|
||||||
def on_pubmsg(self, c, e):
|
def on_pubmsg(self, c, e):
|
||||||
@ -556,20 +556,29 @@ def _main(configpath):
|
|||||||
else:
|
else:
|
||||||
use_sasl = False
|
use_sasl = False
|
||||||
if use_sasl:
|
if use_sasl:
|
||||||
bot = SASLStatusBot(channels, nicks, publishers, successlog,
|
base = SASLStatusBot
|
||||||
thankslog,
|
|
||||||
config.get('ircbot', 'nick'),
|
|
||||||
config.get('ircbot', 'pass'),
|
|
||||||
config.get('ircbot', 'server'),
|
|
||||||
config.getint('ircbot', 'port'))
|
|
||||||
else:
|
else:
|
||||||
bot = NoSASLStatusBot(channels, nicks, publishers, successlog,
|
base = NoSASLStatusBot
|
||||||
thankslog,
|
|
||||||
config.get('ircbot', 'nick'),
|
if config.has_option('ircbot', 'use_ssl'):
|
||||||
config.get('ircbot', 'pass'),
|
use_ssl = config.getboolean('ircbot', 'use_ssl')
|
||||||
config.get('ircbot', 'server'),
|
else:
|
||||||
config.getint('ircbot', 'port'))
|
use_ssl = False
|
||||||
bot.start()
|
|
||||||
|
# SSL is set through class inheritance.
|
||||||
|
if use_ssl:
|
||||||
|
class Bot(base, SSL):
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
class Bot(base):
|
||||||
|
pass
|
||||||
|
|
||||||
|
Bot(channels, nicks, publishers, successlog,
|
||||||
|
thankslog,
|
||||||
|
config.get('ircbot', 'nick'),
|
||||||
|
config.get('ircbot', 'pass'),
|
||||||
|
config.get('ircbot', 'server'),
|
||||||
|
config.getint('ircbot', 'port')).start()
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
Loading…
Reference in New Issue
Block a user