move sending CAP sasl request to sasl.py
This commit is contained in:
parent
f24dc72bcb
commit
d0ef4432b3
2 changed files with 10 additions and 7 deletions
|
@ -61,14 +61,11 @@ class Server(object):
|
|||
|
||||
def connect(self):
|
||||
self.socket.connect((self.target_hostname, self.port))
|
||||
self.bot.events.on("preprocess.connect").call(server=self)
|
||||
|
||||
if self.password:
|
||||
self.send_pass(self.password)
|
||||
|
||||
sasl = self.get_setting("sasl")
|
||||
if sasl:
|
||||
self.send_capability_request("sasl")
|
||||
|
||||
self.send_user(self.original_username, self.original_realname)
|
||||
self.send_nick(self.original_nickname)
|
||||
self.connected = True
|
||||
|
|
|
@ -3,11 +3,17 @@ import base64
|
|||
class Module(object):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
bot.events.on("received").on("cap").hook(self.on_cap)
|
||||
bot.events.on("received").on("authenticate").hook(self.on_authenticate)
|
||||
bot.events.on("received").on("numeric").on(
|
||||
bot.events.on("preprocess.connect").hook(self.preprocess_connect)
|
||||
bot.events.on("received.cap").hook(self.on_cap)
|
||||
bot.events.on("received.authenticate").hook(self.on_authenticate)
|
||||
bot.events.on("received.numeric").on(
|
||||
"902", "903", "904", "905", "906", "907", "908").hook(self.on_90x)
|
||||
|
||||
def preprocess_connect(self, event):
|
||||
sasl = event["server"].get_setting("sasl")
|
||||
if sasl:
|
||||
event["server"].send_capability_request("sasl")
|
||||
|
||||
def on_cap(self, event):
|
||||
if event["subcommand"] == "NAK":
|
||||
event["server"].send_capability_end()
|
||||
|
|
Loading…
Reference in a new issue