mirror of
https://github.com/jlu5/PyLink.git
synced 2025-02-09 11:04:08 +01:00
classes: support looking at older versions of prefix modes mappings
This commit is contained in:
parent
d84cfbcda1
commit
e948db5c7b
12
classes.py
12
classes.py
@ -635,15 +635,21 @@ class IrcChannel():
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def getPrefixModes(self, uid):
|
def getPrefixModes(self, uid, prefixmodes=None):
|
||||||
"""Returns a list of all named prefix modes the given user has in the channel."""
|
"""Returns a list of all named prefix modes the given user has in the channel.
|
||||||
|
|
||||||
|
Optionally, a prefixmodes argument can be given to look at an earlier state of
|
||||||
|
the channel's prefix modes mapping, e.g. for checking the op status of a mode
|
||||||
|
setter before their modes are processed and added to the channel state.
|
||||||
|
"""
|
||||||
|
|
||||||
if uid not in self.users:
|
if uid not in self.users:
|
||||||
return KeyError("User %s does not exist or is not in the channel" % uid)
|
return KeyError("User %s does not exist or is not in the channel" % uid)
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
|
prefixmodes = prefixmodes or self.prefixmodes
|
||||||
|
|
||||||
for mode, modelist in self.prefixmodes.items():
|
for mode, modelist in prefixmodes.items():
|
||||||
if uid in modelist:
|
if uid in modelist:
|
||||||
result.append(mode)
|
result.append(mode)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user