mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-24 03:29:28 +01:00
unreal: handle UMODE2 (self user mode changes)
For #114. TODO: find out if it's possible to set modes on other users, and handle that if applicable
This commit is contained in:
parent
f97d3eb756
commit
a3ee7f2c8a
@ -18,7 +18,7 @@ class UnrealProtocol(TS6BaseProtocol):
|
|||||||
# Set our case mapping (rfc1459 maps "\" and "|" together, for example".
|
# Set our case mapping (rfc1459 maps "\" and "|" together, for example".
|
||||||
self.casemapping = 'ascii'
|
self.casemapping = 'ascii'
|
||||||
self.proto_ver = 2351
|
self.proto_ver = 2351
|
||||||
self.hook_map = {}
|
self.hook_map = {'UMODE2': 'MODE'}
|
||||||
self.uidgen = {}
|
self.uidgen = {}
|
||||||
|
|
||||||
self.caps = {}
|
self.caps = {}
|
||||||
@ -337,12 +337,23 @@ class UnrealProtocol(TS6BaseProtocol):
|
|||||||
# Well... this seems relatively inconsistent.
|
# Well... this seems relatively inconsistent.
|
||||||
# Why does only setting some modes show a TS?
|
# Why does only setting some modes show a TS?
|
||||||
# Also, we need to get rid of that extra space following the +f argument. :|
|
# Also, we need to get rid of that extra space following the +f argument. :|
|
||||||
channel = utils.toLower(self.irc, args[0])
|
if utils.isChannel(args[0]):
|
||||||
oldobj = self.irc.channels[channel].deepcopy()
|
channel = utils.toLower(self.irc, args[0])
|
||||||
modes = list(filter(None, args[1:]))
|
oldobj = self.irc.channels[channel].deepcopy()
|
||||||
parsedmodes = utils.parseModes(self.irc, channel, modes)
|
modes = list(filter(None, args[1:]))
|
||||||
if parsedmodes:
|
parsedmodes = utils.parseModes(self.irc, channel, modes)
|
||||||
utils.applyModes(self.irc, channel, parsedmodes)
|
if parsedmodes:
|
||||||
return {'target': channel, 'modes': parsedmodes, 'oldchan': oldobj}
|
utils.applyModes(self.irc, channel, parsedmodes)
|
||||||
|
return {'target': channel, 'modes': parsedmodes, 'oldchan': oldobj}
|
||||||
|
else:
|
||||||
|
log.warning("(%s) received MODE for non-channel target: %r",
|
||||||
|
self.irc.name, args)
|
||||||
|
|
||||||
|
def handle_umode2(self, numeric, command, args):
|
||||||
|
"""Handles UMODE2, used to set user modes on oneself."""
|
||||||
|
parsedmodes = utils.parseModes(self.irc, numeric, args)
|
||||||
|
utils.applyModes(self.irc, numeric, parsedmodes)
|
||||||
|
return {'target': numeric, 'modes': parsedmodes}
|
||||||
|
|
||||||
|
|
||||||
Class = UnrealProtocol
|
Class = UnrealProtocol
|
||||||
|
Loading…
Reference in New Issue
Block a user