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

@@ -11,13 +11,9 @@ order = ["type", "net", "num", "channel", "msg", "nick",
"ident", "host", "mtype", "user", "mode", "modearg",
"realname", "server", "status", "time"]
def event(numName, c): # yes I'm using a short variable because otherwise it goes off the screen
def parsemeta(numName, c):
if not "channel" in c.keys():
c["channel"] = None
if dedup(numName, c):
return
regproc.registerTest(c)
# metadata scraping
# need to check if this was received from a relay
# in which case, do not do this
@@ -39,7 +35,13 @@ def event(numName, c): # yes I'm using a short variable because otherwise it goe
if c["mtype"] == "nick":
userinfo.renameUser(c["net"], c["nick"], c["muser"], c["user"], c["user"]+"!"+c["ident"]+"@"+c["host"])
def event(numName, c): # yes I'm using a short variable because otherwise it goes off the screen
if dedup(numName, c):
return
# make a copy of the object with dict() to prevent sending notifications with channel of None
parsemeta(numName, dict(c))
if "muser" in c.keys():
del c["muser"]
sendRelayNotification({k: c[k] for k in order if k in c}) # Sort dict keys according to order