summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPratyush Desai2021-08-20 14:01:27 +0530
committerPratyush Desai2021-08-20 14:01:27 +0530
commit940ea7f4c924536d913e1a1c4ec6bacf51bcdc2f (patch)
tree035fb74121719fa41a7343d00835a4b5a258b7be
parent9810f1ca99e6d8283bc33cae218b02e4cd795cba (diff)
downloadsnoparser-940ea7f4c924536d913e1a1c4ec6bacf51bcdc2f.tar.gz
snoparser-940ea7f4c924536d913e1a1c4ec6bacf51bcdc2f.tar.bz2
snoparser-940ea7f4c924536d913e1a1c4ec6bacf51bcdc2f.zip
add ACCOUNT
-rw-r--r--README.md14
-rw-r--r--plugin.py22
2 files changed, 32 insertions, 4 deletions
diff --git a/README.md b/README.md
index 7812442..b8674d0 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,15 @@
+# SnoParser
+
Parses the Server Notices from ErgoIRCd
+
+Coverage:
+
+1. CONNECT
+
+2. XLINE
+
+3. NICK
+
+4. KILL
+
+5. ACCOUNT (reg only) \ No newline at end of file
diff --git a/plugin.py b/plugin.py
index 0b8d698..fcfc89b 100644
--- a/plugin.py
+++ b/plugin.py
@@ -122,12 +122,26 @@ class SnoParser(callbacks.Plugin):
quitregex = "^-QUIT- (.+) exited the network$"
couple = re.match(quitregex, text)
nick = couple.group(1)
+ DictFromSnotice = {'notice': 'quit', 'nick': nick}
repl = f"\x02\x1FNOTICE: quit nick: {nick} has exited the network"
self._sendSnotice(irc, msg, repl)
- # -ACCOUNT- Client [<redacted-hostmask>] registered account [<redacted>] from IP <redacted>
- # -ACCOUNT- Operator [<redacted>] registered account [<redacted>] with SAREGISTER
- # if 'ACCOUNT' in text and 'logged into account' in text:
- # accregex = "^-ACCOUNT- "
+ if 'ACCOUNT' in text and 'registered account' in text:
+ accregex = "^-ACCOUNT- Client \[(.*)\] registered account \[(.*)\] from IP (.*)$"
+ couple = re.match(accregex, text)
+ 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)