Upon connection, hostmasks.json is read and cached in a runtime array. When a new user is spotted, this gets iterated and the hostmasks therein compared to the user (using dialect.common.matchesByMask). If they match, the user gets assigned the account listed as the value of the hostmask key. The pairing is then further cached in a separate runtime array, to speed up future lookups. (The cache entry is properly invalidated on NICK and such.)
It seems to work -- at least better than it did before, which was just broken.
This revamps hostmasks mode into something actually usable.
hostmasks.json
is a file with a JSONstring[string]
associative array of account values and hostmask keys.user.json
remains a file with astring[][string][string]
array with the top keysstaff
,operator
,whitelist
andblacklist
.Upon connection,
hostmasks.json
is read and cached in a runtime array. When a new user is spotted, this gets iterated and the hostmasks therein compared to the user (usingdialect.common.matchesByMask
). If they match, the user gets assigned the account listed as the value of the hostmask key. The pairing is then further cached in a separate runtime array, to speed up future lookups. (The cache entry is properly invalidated onNICK
and such.)It seems to work -- at least better than it did before, which was just broken.