3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-25 04:02:45 +01:00

Irc: make prefixmodes a dict mapping chars to their prefixes

This is needed by TS6 support (#40), which send the characters (@+) instead of modes
This commit is contained in:
James Lu 2015-07-20 16:48:59 -07:00
parent 65ef27fd4b
commit a10a18d9cc
2 changed files with 4 additions and 2 deletions

View File

@ -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

View File

@ -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: