3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

ts6: support +AOS charybdis extension modes, warning if the IRCd doesn't support them

Also, add 'adminonly' (+A) to relay's whitelist.
This commit is contained in:
James Lu 2015-07-24 20:55:48 -07:00
parent e4da670ae0
commit 146ab5e444
2 changed files with 19 additions and 1 deletions

View File

@ -457,7 +457,7 @@ whitelisted_cmodes = {'admin', 'allowinvite', 'autoop', 'ban', 'banexception',
'limit', 'moderated', 'noctcp', 'noextmsg', 'nokick', 'limit', 'moderated', 'noctcp', 'noextmsg', 'nokick',
'noknock', 'nonick', 'nonotice', 'op', 'operonly', 'noknock', 'nonick', 'nonotice', 'op', 'operonly',
'opmoderated', 'owner', 'private', 'regonly', 'opmoderated', 'owner', 'private', 'regonly',
'regmoderated', 'secret', 'sslonly', 'regmoderated', 'secret', 'sslonly', 'adminonly',
'stripcolor', 'topiclock', 'voice'} 'stripcolor', 'topiclock', 'voice'}
whitelisted_umodes = {'bot', 'hidechans', 'hideoper', 'invisible', 'oper', whitelisted_umodes = {'bot', 'hidechans', 'hideoper', 'invisible', 'oper',
'regdeaf', 'u_stripcolor', 'u_noctcp', 'wallops'} 'regdeaf', 'u_stripcolor', 'u_noctcp', 'wallops'}

View File

@ -476,6 +476,8 @@ def handle_events(irc, data):
'joinflood': 'j', 'largebanlist': 'L', 'permanent': 'P', 'joinflood': 'j', 'largebanlist': 'L', 'permanent': 'P',
'c_noforwards': 'Q', 'stripcolor': 'c', 'allowinvite': 'c_noforwards': 'Q', 'stripcolor': 'c', 'allowinvite':
'g', 'opmoderated': 'z', 'noctcp': 'C', 'g', 'opmoderated': 'z', 'noctcp': 'C',
# charybdis-specific modes provided by EXTENSIONS
'operonly': 'O', 'adminonly': 'A', 'sslonly': 'S',
# Now, map all the ABCD type modes: # Now, map all the ABCD type modes:
'*A': 'beI', '*B': 'k', '*C': 'l', '*D': 'mnprst'} '*A': 'beI', '*B': 'k', '*C': 'l', '*D': 'mnprst'}
if 'EX' in caps: if 'EX' in caps:
@ -609,3 +611,19 @@ def handle_bmask(irc, numeric, command, args):
def handle_whois(irc, numeric, command, args): def handle_whois(irc, numeric, command, args):
# <- :42XAAAAAB WHOIS 5PYAAAAAA :pylink-devel # <- :42XAAAAAB WHOIS 5PYAAAAAA :pylink-devel
return {'target': args[0]} return {'target': args[0]}
def handle_472(irc, numeric, command, args):
# <- :charybdis.midnight.vpn 472 GL|devel O :is an unknown mode char to me
# 472 is sent to us when one of our clients tries to set a mode the server
# doesn't support. In this case, we'll raise a warning to alert the user
# about it.
badmode = args[1]
reason = args[-1]
setter = args[0]
charlist = {'A': 'chm_adminonly', 'O': 'chm_operonly', 'S': 'chm_sslonly'}
if badmode in charlist:
log.warning('(%s) User %r attempted to set channel mode %r, but the '
'extension providing it isn\'t loaded! To prevent possible'
' desyncs, try adding the line "loadmodule "extensions/%s.so";" to '
'your IRCd configuration.', irc.name, setter, badmode,
charlist[badmode])