import hexchat

__module_name__ = "RequireSASL"
__module_author__ = "TingPing"
__module_version__ = "0"
__module_description__ = "Disconnect if SASL fails"

def fail_cb(word, word_eol, userdata):
  hexchat.command("timer .1 discon") # Delay so disconnect happens after message.

hexchat.hook_server("904", fail_cb)
hexchat.hook_server("905", fail_cb)

@@ -94,17 +94,17 @@
 on__ = %22
-0
+1
 %22%0A__modu
@@ -154,20 +154,24 @@
 s%22%0A%0Adef 
-fail
+response
 _cb(word
@@ -197,10 +197,80 @@
 a):%0A
-  
+%09if %22fail%22 in word_eol%5B0%5D: # This is flawed but HexChat relies on 904%0A%09%09
 hexc
@@ -363,62 +363,39 @@
 ook_
-server(%22904%22, fail_cb)%0Ahexchat.hook_server(%22905%22, fail
+print(%22SASL Response%22, response
 _cb)

Update requiresasl.py