mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-01 09:19:23 +01:00
bots: don't allow setting umode +o on InspIRCd users (forbidden and causes desync)
This commit is contained in:
parent
b8d6e1e2ef
commit
7ced47e9b3
@ -399,6 +399,9 @@ class Protocol():
|
|||||||
# Whether the IRCd allows forcing user mode changes on other servers' clients.
|
# Whether the IRCd allows forcing user mode changes on other servers' clients.
|
||||||
self.allow_forceset_usermodes = False
|
self.allow_forceset_usermodes = False
|
||||||
|
|
||||||
|
# Ditto, but for setting user mode +o. InspIRCd forbids this as an example.
|
||||||
|
self.allow_forceoper = False
|
||||||
|
|
||||||
class FakeProto(Protocol):
|
class FakeProto(Protocol):
|
||||||
"""Dummy protocol module for testing purposes."""
|
"""Dummy protocol module for testing purposes."""
|
||||||
def handle_events(self, data):
|
def handle_events(self, data):
|
||||||
|
@ -146,17 +146,21 @@ def mode(irc, source, args):
|
|||||||
irc.msg(source, 'Error: Not enough arguments. Needs 3: source nick, target, modes to set.')
|
irc.msg(source, 'Error: Not enough arguments. Needs 3: source nick, target, modes to set.')
|
||||||
return
|
return
|
||||||
target = utils.nickToUid(irc, target) or target
|
target = utils.nickToUid(irc, target) or target
|
||||||
|
extclient = target in irc.users and not utils.isInternalClient(irc, target)
|
||||||
|
parsedmodes = utils.parseModes(irc, target, modes)
|
||||||
if not (target in irc.users or target in irc.channels):
|
if not (target in irc.users or target in irc.channels):
|
||||||
irc.msg(source, "Error: Invalid channel or nick %r." % target)
|
irc.msg(source, "Error: Invalid channel or nick %r." % target)
|
||||||
return
|
return
|
||||||
elif target in irc.users and not utils.isInternalClient(irc, target) and \
|
elif not parsedmodes:
|
||||||
not irc.proto.allow_forceset_usermodes:
|
irc.msg(source, "Error: No valid modes were given.")
|
||||||
|
return
|
||||||
|
elif extclient and not irc.proto.allow_forceset_usermodes:
|
||||||
irc.msg(source, "Error: this IRCd does not allow forcing user mode "
|
irc.msg(source, "Error: this IRCd does not allow forcing user mode "
|
||||||
"changes on other servers' users!")
|
"changes on other servers' users!")
|
||||||
return
|
return
|
||||||
parsedmodes = utils.parseModes(irc, target, modes)
|
elif extclient and ("+o", None) in parsedmodes and not irc.proto.allow_forceoper:
|
||||||
if not parsedmodes:
|
irc.msg(source, "Error: this IRCd does not allow forcing an oper up "
|
||||||
irc.msg(source, "Error: No valid modes were given.")
|
"for other servers' users!")
|
||||||
return
|
return
|
||||||
if utils.isInternalServer(irc, modesource):
|
if utils.isInternalServer(irc, modesource):
|
||||||
# Setting modes from a server.
|
# Setting modes from a server.
|
||||||
|
Loading…
Reference in New Issue
Block a user