From a10a18d9cc820d19114897984283de38556a11fc Mon Sep 17 00:00:00 2001 From: James Lu Date: Mon, 20 Jul 2015 16:48:59 -0700 Subject: [PATCH] Irc: make prefixmodes a dict mapping chars to their prefixes This is needed by TS6 support (#40), which send the characters (@+) instead of modes --- main.py | 2 +- protocols/inspircd.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 5da7e9f..7fc63eb 100755 --- a/main.py +++ b/main.py @@ -43,7 +43,7 @@ class Irc(): # capability information is received. This handling of irc.connected # is also dependent on the protocol module. self.maxnicklen = 30 - self.prefixmodes = 'ov' + self.prefixmodes = {'o': '@', 'v': '+'} # Uplink SID (filled in by protocol module) self.uplink = None diff --git a/protocols/inspircd.py b/protocols/inspircd.py index 3867e65..8823af7 100644 --- a/protocols/inspircd.py +++ b/protocols/inspircd.py @@ -535,7 +535,9 @@ def handle_events(irc, data): = caps['CHANMODES'].split(',') irc.umodes['*A'], irc.umodes['*B'], irc.umodes['*C'], irc.umodes['*D'] \ = caps['USERMODES'].split(',') - irc.prefixmodes = re.search(r'\((.*?)\)', caps['PREFIX']).group(1) + prefixsearch = re.search(r'\(([A-Za-z]+)\)(.*)', caps['PREFIX']) + irc.prefixmodes = dict(zip(prefixsearch.group(1), prefixsearch.group(2))) + log.debug('(%s) irc.prefixmodes set to %r', irc.name, irc.prefixmodes) # Sanity check: set this AFTER we fetch the capabilities for the network! irc.connected.set() try: