Nonetype for string config #16
@ -53,7 +53,7 @@ SnoParser = conf.registerPlugin('SnoParser')
|
|||||||
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
|
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
|
||||||
|
|
||||||
conf.registerGlobalValue(SnoParser, 'targetChannel',
|
conf.registerGlobalValue(SnoParser, 'targetChannel',
|
||||||
registry.String(None, ("""Sends reformatted snolines to the <channel>""")))
|
registry.String("", ("""Sends reformatted snolines to the <channel>""")))
|
||||||
|
|
||||||
conf.registerGlobalValue(SnoParser, 'AutoVhost',
|
conf.registerGlobalValue(SnoParser, 'AutoVhost',
|
||||||
registry.String('libcasa/user/', ("""Configure the vhost eg. libcasa/user/$account""")))
|
registry.String('libcasa/user/', ("""Configure the vhost eg. libcasa/user/$account""")))
|
||||||
|
13
plugin.py
13
plugin.py
@ -253,8 +253,9 @@ class SnoParser(callbacks.Plugin):
|
|||||||
(target, text) = msg.args
|
(target, text) = msg.args
|
||||||
|
|
||||||
if target == irc.nick:
|
if target == irc.nick:
|
||||||
# server notices CONNECT, KILL, XLINE, NICK, ACCOUNT
|
# server notices
|
||||||
text = ircutils.stripFormatting(text)
|
text = ircutils.stripFormatting(text)
|
||||||
|
# CONNECT
|
||||||
if 'CONNECT' in text:
|
if 'CONNECT' in text:
|
||||||
connregex = "^-CONNECT- Client connected \[(.+)\] \[u\:~(.+)\] \[h\:(.+)\] \[ip\:(.+)\] \[r\:(.+)\]$"
|
connregex = "^-CONNECT- Client connected \[(.+)\] \[u\:~(.+)\] \[h\:(.+)\] \[ip\:(.+)\] \[r\:(.+)\]$"
|
||||||
couple = re.match(connregex, text)
|
couple = re.match(connregex, text)
|
||||||
@ -272,9 +273,7 @@ class SnoParser(callbacks.Plugin):
|
|||||||
whois = self.whois_run(sourceip=ip)
|
whois = self.whois_run(sourceip=ip)
|
||||||
|
|
||||||
DictFromSnotice = {'notice': 'connect', 'nickname': nickname, 'username': username, 'host': host, 'ip': ip, 'realname': realname, 'ipCount': ip_seen, 'nickCount': nick_seen}
|
DictFromSnotice = {'notice': 'connect', 'nickname': nickname, 'username': username, 'host': host, 'ip': ip, 'realname': realname, 'ipCount': ip_seen, 'nickCount': nick_seen}
|
||||||
#repl = f"\x02\x1FNOTICE: {DictFromSnotice['notice']} \x0F\x11\x0303==>>\x0F \x02Nick:\x0F {DictFromSnotice['nickname']} \x02Username:\x0F {DictFromSnotice['username']} \x02Hostname:\x0F {DictFromSnotice['host']} \x02IP:\x0F {DictFromSnotice['ip']} \x02Realname:\x0F {DictFromSnotice['realname']} \x02IPcount:\x0F {DictFromSnotice['ipCount']} \x02NickCount:\x0F {DictFromSnotice['nickCount']}"
|
|
||||||
repl = f"\x02\x1F{DictFromSnotice['notice']} \x0F\x11\x0303==>>\x0F \x02Nick:\x0F {DictFromSnotice['nickname']} \x02Username:\x0F {DictFromSnotice['username']} \x02Hostname:\x0F {DictFromSnotice['host']} \x02IP:\x0F {DictFromSnotice['ip']} {whois} \x02Realname:\x0F {DictFromSnotice['realname']} \x02IPcount:\x0F {DictFromSnotice['ipCount']} \x02NickCount:\x0F {DictFromSnotice['nickCount']}"
|
repl = f"\x02\x1F{DictFromSnotice['notice']} \x0F\x11\x0303==>>\x0F \x02Nick:\x0F {DictFromSnotice['nickname']} \x02Username:\x0F {DictFromSnotice['username']} \x02Hostname:\x0F {DictFromSnotice['host']} \x02IP:\x0F {DictFromSnotice['ip']} {whois} \x02Realname:\x0F {DictFromSnotice['realname']} \x02IPcount:\x0F {DictFromSnotice['ipCount']} \x02NickCount:\x0F {DictFromSnotice['nickCount']}"
|
||||||
|
|
||||||
self._sendSnotice(irc, msg, repl)
|
self._sendSnotice(irc, msg, repl)
|
||||||
if 'XLINE' in text and 'temporary' in text:
|
if 'XLINE' in text and 'temporary' in text:
|
||||||
xlineregex = "^-XLINE- (.+) \[(.+)\] added temporary \((.+)\) (K-Line|D-Line) for (.+)$"
|
xlineregex = "^-XLINE- (.+) \[(.+)\] added temporary \((.+)\) (K-Line|D-Line) for (.+)$"
|
||||||
@ -344,8 +343,8 @@ class SnoParser(callbacks.Plugin):
|
|||||||
|
|
||||||
# Trigger HS SET
|
# Trigger HS SET
|
||||||
self._setvhost(irc, msg, account)
|
self._setvhost(irc, msg, account)
|
||||||
|
|
||||||
self._sendSnotice(irc, msg, repl)
|
self._sendSnotice(irc, msg, repl)
|
||||||
|
|
||||||
if 'ACCOUNT' in text and 'registered account' in text and 'SAREGISTER' in text:
|
if 'ACCOUNT' in text and 'registered account' in text and 'SAREGISTER' in text:
|
||||||
accregex = "^-ACCOUNT- Operator \[(.*)\] registered account \[(.*)\] with SAREGISTER$"
|
accregex = "^-ACCOUNT- Operator \[(.*)\] registered account \[(.*)\] with SAREGISTER$"
|
||||||
couple = re.match(accregex, text)
|
couple = re.match(accregex, text)
|
||||||
@ -353,7 +352,6 @@ class SnoParser(callbacks.Plugin):
|
|||||||
account = couple.group(2)
|
account = couple.group(2)
|
||||||
DictFromSnotice = {'notice': 'sareg', 'oper': oper, 'account': account}
|
DictFromSnotice = {'notice': 'sareg', 'oper': oper, 'account': account}
|
||||||
repl = f"\x02\x1FNOTICE: sareg -> [{account}] was registered by operator [{oper}]"
|
repl = f"\x02\x1FNOTICE: sareg -> [{account}] was registered by operator [{oper}]"
|
||||||
|
|
||||||
self._setvhost(irc, msg, account)
|
self._setvhost(irc, msg, account)
|
||||||
self._sendSnotice(irc, msg, repl)
|
self._sendSnotice(irc, msg, repl)
|
||||||
|
|
||||||
@ -362,16 +360,11 @@ class SnoParser(callbacks.Plugin):
|
|||||||
couple = re.match(operregex, text)
|
couple = re.match(operregex, text)
|
||||||
hostmask = couple.group(1)
|
hostmask = couple.group(1)
|
||||||
oper = couple.group(2)
|
oper = couple.group(2)
|
||||||
|
|
||||||
print(couple)
|
|
||||||
|
|
||||||
DictFromSnotice = {'notice': 'opered', 'hostmask': hostmask, 'oper': oper}
|
DictFromSnotice = {'notice': 'opered', 'hostmask': hostmask, 'oper': oper}
|
||||||
repl = f"\x02\x1FNOTICE:\x0F [{hostmask}] opered up as [{oper}]."
|
repl = f"\x02\x1FNOTICE:\x0F [{hostmask}] opered up as [{oper}]."
|
||||||
|
|
||||||
self._sendSnotice(irc, msg, repl)
|
self._sendSnotice(irc, msg, repl)
|
||||||
|
|
||||||
if 'OPER' in text and 'Client deopered' in text:
|
if 'OPER' in text and 'Client deopered' in text:
|
||||||
|
|
||||||
operregex = "^-OPER- Client deopered \[(.*)\]"
|
operregex = "^-OPER- Client deopered \[(.*)\]"
|
||||||
couple = re.match(operregex, text)
|
couple = re.match(operregex, text)
|
||||||
account = couple.group(1)
|
account = couple.group(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user