Add use_ssl option
This change enables using the statusbot with a non ssl server. Change-Id: I4e79625316ebaa391941743bfd1a2ea29e14df09
This commit is contained in:
parent
6c55c0c444
commit
66c1629a41
|
@ -359,7 +359,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):
|
||||||
|
@ -561,20 +561,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