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

various: convert sortPrefixes/getPrefixModes calls to snake case

This commit is contained in:
James Lu 2017-06-30 21:40:05 -07:00
parent 6d7e2c667d
commit 7d68c03101
5 changed files with 7 additions and 7 deletions

View File

@ -123,7 +123,7 @@ def channel(irc, host, uid):
return uid in irc.channels[channel].users
elif len(groups) >= 3:
# For things like #channel:op, check if the query is in the user's prefix modes.
return (uid in irc.channels[channel].users) and (groups[2].lower() in irc.channels[channel].getPrefixModes(uid))
return (uid in irc.channels[channel].users) and (groups[2].lower() in irc.channels[channel].get_prefix_modes(uid))
@bind
def pylinkacc(irc, host, uid):

View File

@ -48,7 +48,7 @@ def handle_whois(irc, source, command, args):
continue
# Show the highest prefix mode like a regular IRCd does, if there are any.
prefixes = c.getPrefixModes(target)
prefixes = c.get_prefix_modes(target)
if prefixes:
highest = prefixes[-1]

View File

@ -120,7 +120,7 @@ def showchan(irc, source, args):
# Iterate over the user list, sorted by nick.
for user, nick in sorted(zip(c.users, nicks),
key=lambda userpair: userpair[1].lower()):
for pmode in c.getPrefixModes(user):
for pmode in c.get_prefix_modes(user):
# Show prefix modes in order from highest to lowest.
nick = irc.prefixmodes.get(irc.cmodes.get(pmode, ''), '') + nick
nicklist.append(nick)

View File

@ -206,7 +206,7 @@ def get_prefix_modes(irc, remoteirc, channel, user, mlist=None):
# Note: reverse the order so prefix modes are bursted in their traditional order
# (e.g. owner before op before halfop). TODO: SJOIN modes should probably be
# consistently sorted IRCd-side.
for pmode in reversed(irc.channels[channel].getPrefixModes(user, prefixmodes=mlist)):
for pmode in reversed(irc.channels[channel].get_prefix_modes(user, prefixmodes=mlist)):
if pmode in remoteirc.cmodes:
modes += remoteirc.cmodes[pmode]
return modes
@ -920,11 +920,11 @@ def handle_join(irc, numeric, command, args):
# XXX: Find the diff of the new and old mode lists of the channel. Not pretty, but I'd
# rather not change the 'users' format of SJOIN just for this. -GL
try:
oldmodes = set(chandata.getPrefixModes(user))
oldmodes = set(chandata.get_prefix_modes(user))
except KeyError:
# User was never in channel. Treat their mode list as empty.
oldmodes = set()
newmodes = set(current_chandata.getPrefixModes(user))
newmodes = set(current_chandata.get_prefix_modes(user))
modediff = newmodes - oldmodes
log.debug('(%s) relay.handle_join: mode diff for %s on %s: %s oldmodes=%s newmodes=%s',
irc.name, user, channel, modediff, oldmodes, newmodes)

View File

@ -761,7 +761,7 @@ class ClientbotWrapperProtocol(IRCCommonProtocol):
for user in users:
# Fill in prefix modes of everyone when doing mock SJOIN.
try:
for mode in c.getPrefixModes(user):
for mode in c.get_prefix_modes(user):
modechar = self.cmodes.get(mode)
log.debug('(%s) handle_315: adding mode %s +%s %s', self.name, mode, modechar, user)
if modechar: