mirror of
https://github.com/jlu5/PyLink.git
synced 2025-02-03 16:14:10 +01:00
automode: disable on networks where IRC modes aren't supported
Closes #638.
This commit is contained in:
parent
297d31dab2
commit
d28a9681ac
@ -94,10 +94,14 @@ def _check_automode_access(irc, uid, channel, command):
|
||||
|
||||
def match(irc, channel, uids=None):
|
||||
"""
|
||||
Automode matcher engine.
|
||||
Set modes on matching users. If uids is not given, check all users in the channel and give
|
||||
them modes as needed.
|
||||
"""
|
||||
dbentry = db.get(irc.name+channel)
|
||||
if dbentry is None:
|
||||
if not irc.has_cap('has-irc-modes'):
|
||||
log.debug('(%s) automode: skipping match() because IRC modes are not supported on this protocol', irc.name)
|
||||
return
|
||||
elif dbentry is None:
|
||||
return
|
||||
|
||||
modebot_uid = modebot.uids.get(irc.name)
|
||||
@ -162,8 +166,7 @@ utils.add_hook(handle_services_login, 'PYLINK_RELAY_SERVICES_LOGIN')
|
||||
|
||||
def _get_channel_pair(irc, source, chanpair, perm=None):
|
||||
"""
|
||||
Fetches the network and channel given a channel pair,
|
||||
also optionally checking the caller's permissions.
|
||||
Fetches the network and channel given a channel pair, also optionally checking the caller's permissions.
|
||||
"""
|
||||
log.debug('(%s) Looking up chanpair %s', irc.name, chanpair)
|
||||
try:
|
||||
@ -173,9 +176,6 @@ def _get_channel_pair(irc, source, chanpair, perm=None):
|
||||
channel = '#' + channel
|
||||
channel = irc.to_lower(channel)
|
||||
|
||||
if not irc.is_channel(channel):
|
||||
raise ValueError("Invalid channel name %s." % channel)
|
||||
|
||||
if network:
|
||||
ircobj = world.networkobjects.get(network)
|
||||
else:
|
||||
@ -211,6 +211,9 @@ def setacc(irc, source, args):
|
||||
|
||||
\x02SETACC #staffchan $channel:#mainchan:op o
|
||||
"""
|
||||
if not irc.has_cap('has-irc-modes'):
|
||||
error(irc, "IRC style modes are not supported on this protocol.")
|
||||
return
|
||||
|
||||
try:
|
||||
chanpair, mask, modes = args
|
||||
|
Loading…
Reference in New Issue
Block a user