Add use_ssl option

This change enables using the statusbot with a non ssl server.

Change-Id: I4e79625316ebaa391941743bfd1a2ea29e14df09
This commit is contained in:
Tristan Cacqueray 2021-09-08 20:19:24 +00:00 committed by Jeremy Stanley
parent 42e3cc433d
commit 4c31332e23

View File

@ -354,7 +354,7 @@ class AlertFile(UpdateInterface):
self.write(None)
class BaseStatusBot(SSL, irc.bot.SingleServerIRCBot):
class BaseStatusBot(irc.bot.SingleServerIRCBot):
log = logging.getLogger("statusbot.bot")
def on_pubmsg(self, c, e):
@ -556,20 +556,29 @@ def _main(configpath):
else:
use_sasl = False
if use_sasl:
bot = SASLStatusBot(channels, nicks, publishers, successlog,
thankslog,
config.get('ircbot', 'nick'),
config.get('ircbot', 'pass'),
config.get('ircbot', 'server'),
config.getint('ircbot', 'port'))
base = SASLStatusBot
else:
bot = NoSASLStatusBot(channels, nicks, publishers, successlog,
thankslog,
config.get('ircbot', 'nick'),
config.get('ircbot', 'pass'),
config.get('ircbot', 'server'),
config.getint('ircbot', 'port'))
bot.start()
base = NoSASLStatusBot
if config.has_option('ircbot', 'use_ssl'):
use_ssl = config.getboolean('ircbot', 'use_ssl')
else:
use_ssl = False
# 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():