Fixes to auth detection and message parsing

* don't check authentication if the network doesn't need to
  register
* don't pass through muser for ZNC type messages
* avoid duplicate message for queries containing highlights
* make a copy of the cast for metadata analysis to avoid poisoning it
* set up callback for when the instance is authenticated, so we can
  request a LIST immediately if so desired
* separate out seeding functions to populate CHANLIMIT to ease future
  work involving other options, such as PREFIX
This commit is contained in:
2020-06-07 17:26:53 +01:00
parent 2a9869d0f9
commit 3acf182171
5 changed files with 116 additions and 85 deletions

View File

@@ -4,6 +4,14 @@ from utils.logging.log import *
from utils.logging.debug import *
from copy import deepcopy
def needToRegister(net):
inst = selectInst(net)
if "register" in inst.keys():
if inst["register"]:
return True
else:
return False
def selectInst(net):
if net in main.irc.keys():
inst = deepcopy(main.irc[net])
@@ -48,6 +56,7 @@ def confirmRegistration(net, num):
if name in main.IRCPool.keys():
debug("Relay authenticated: %s - %i" %(net, num))
main.IRCPool[name].authenticated = True
main.IRCPool[name].recheckList()
if obj.relays[num]["registered"]:
return
if name in main.IRCPool.keys():
@@ -78,7 +87,8 @@ def registerTest(c):
confirmRegistration(c["net"], c["num"])
return
elif inst["checktype"] == "mode":
if c["type"] == "mode":
if inst["checkmode"] in c["modes"] and c["status"] == True:
confirmRegistration(c["net"], c["num"])
return
if c["type"] == "self":
if c["mtype"] == "mode":
if inst["checkmode"] in c["mode"] and c["status"] == True:
confirmRegistration(c["net"], c["num"])
return