add ACCOUNT

This commit is contained in:
Pratyush Desai 2021-08-20 14:01:27 +05:30
parent 9810f1ca99
commit 940ea7f4c9
Signed by: pratyush
GPG Key ID: DBA5BB7505946FAD
2 changed files with 32 additions and 4 deletions

View File

@ -1 +1,15 @@
# SnoParser
Parses the Server Notices from ErgoIRCd Parses the Server Notices from ErgoIRCd
Coverage:
1. CONNECT
2. XLINE
3. NICK
4. KILL
5. ACCOUNT (reg only)

View File

@ -122,12 +122,26 @@ class SnoParser(callbacks.Plugin):
quitregex = "^-QUIT- (.+) exited the network$" quitregex = "^-QUIT- (.+) exited the network$"
couple = re.match(quitregex, text) couple = re.match(quitregex, text)
nick = couple.group(1) nick = couple.group(1)
DictFromSnotice = {'notice': 'quit', 'nick': nick}
repl = f"\x02\x1FNOTICE: quit nick: {nick} has exited the network" repl = f"\x02\x1FNOTICE: quit nick: {nick} has exited the network"
self._sendSnotice(irc, msg, repl) self._sendSnotice(irc, msg, repl)
# -ACCOUNT- Client [<redacted-hostmask>] registered account [<redacted>] from IP <redacted> if 'ACCOUNT' in text and 'registered account' in text:
# -ACCOUNT- Operator [<redacted>] registered account [<redacted>] with SAREGISTER accregex = "^-ACCOUNT- Client \[(.*)\] registered account \[(.*)\] from IP (.*)$"
# if 'ACCOUNT' in text and 'logged into account' in text: couple = re.match(accregex, text)
# accregex = "^-ACCOUNT- " hostmask = couple.group(1)
account = couple.group(2)
ip = couple.group(3)
DictFromSnotice = {'notice': 'accreg', 'hostmask': hostmask, 'account': account, 'ip': ip}
repl = f"\x02\x1FNOTICE: accreg -> [{account}] was registered by hostmask [{hostmask}] from IP {ip}"
self._sendSnotice(irc, msg, repl)
if 'ACCOUNT' in text and 'registered account' in text and 'SAREGISTER' in text:
accregex = "^-ACCOUNT- Operator \[(.*)\] registered account \[(.*)\] with SAREGISTER$"
couple = re.match(accregex, text)
oper = couple.group(1)
account = couple.group(2)
DictFromSnotice = {'notice': 'sareg', 'oper': oper, 'account': account}
repl = f"\x02\x1FNOTICE: sareg -> [{account}] was registered by operator [{oper}]"
self._sendSnotice(irc, msg, repl)