summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--README.md15
-rw-r--r--README.rst27
-rw-r--r--config.py8
-rw-r--r--plugin.py29
5 files changed, 64 insertions, 18 deletions
diff --git a/.gitignore b/.gitignore
index ae412d6..684f813 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
-env/ \ No newline at end of file
+env/
+.vscode \ No newline at end of file
diff --git a/README.md b/README.md
deleted file mode 100644
index b8674d0..0000000
--- a/README.md
+++ /dev/null
@@ -1,15 +0,0 @@
-# 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/README.rst b/README.rst
new file mode 100644
index 0000000..7bb4c6a
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,27 @@
+SnoParser
+=========
+
+Parses the Server Notices from ErgoIRCd.
+
+
+Assumptions
+-----------
+
+- ``force-nick-equals-account=True``
+- The Bot needs to be oper and have all the snomasks.
+
+Current Coverage
+----------------
+
+1. CONNECT
+2. XLINE
+3. NICK
+4. KILL
+5. ACCOUNT (reg only)
+
+Configurations
+--------------
+
+1. Formatting for 'AutoVhost' post Registration (TODO: Disable)
+2. Configure the '#channel' to send the SNO lines (disabled by default) (TODO: Add Exceptions)
+3. Use ZWSP to toggle nickhighlights when in channel. \ No newline at end of file
diff --git a/config.py b/config.py
index 29d7ba8..a3a96e9 100644
--- a/config.py
+++ b/config.py
@@ -52,5 +52,13 @@ SnoParser = conf.registerPlugin('SnoParser')
# conf.registerGlobalValue(SnoParser, 'someConfigVariableName',
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
+conf.registerGlobalValue(SnoParser, 'targetChannel',
+ registry.String(None, ("""Sends reformatted snolines to the <channel>""")))
+
+conf.registerGlobalValue(SnoParser, 'AutoVhost',
+ registry.String('libcasa/user/', ("""Configure the vhost eg. libcasa/user/$account""")))
+
+conf.registerGlobalValue(SnoParser, 'preventHighlight',
+ registry.Boolean(True, ("""Toggles in channel highlights with ZWSP""")))
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
diff --git a/plugin.py b/plugin.py
index fcfc89b..8c3717e 100644
--- a/plugin.py
+++ b/plugin.py
@@ -133,6 +133,10 @@ class SnoParser(callbacks.Plugin):
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}"
+
+ # Trigger HS SET
+ self._setvhost(irc, msg, account)
+
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$"
@@ -141,13 +145,34 @@ class SnoParser(callbacks.Plugin):
account = couple.group(2)
DictFromSnotice = {'notice': 'sareg', 'oper': oper, 'account': account}
repl = f"\x02\x1FNOTICE: sareg -> [{account}] was registered by operator [{oper}]"
+
+ self._setvhost(irc, msg, account)
self._sendSnotice(irc, msg, repl)
+
+ # Post Registration
+ def _setvhost(self, irc, msg, account):
+ arg = ['SET']
+ arg.append(account)
+ vhost = self.registryValue('AutoVhost')
+ arg.append(f'{vhost}{account}')
+ irc.sendMsg(msg=ircmsgs.IrcMsg(command='HS',
+ args=arg))
+
+
+ # Send formatted SNO to channel
def _sendSnotice(self, irc, msg, repl):
- irc.queueMsg(msg=ircmsgs.IrcMsg(command='PRIVMSG',
- args=('#snotices', repl)))
+ try:
+ channel = self.registryValue('targetChannel')
+ if channel[0] == '#':
+ irc.queueMsg(msg=ircmsgs.IrcMsg(command='NOTICE',
+ args=(channel, repl)))
+ # what sort of exception does one raise
+ except:
+ pass
+
Class = SnoParser