3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-24 03:29:28 +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 return uid in irc.channels[channel].users
elif len(groups) >= 3: elif len(groups) >= 3:
# For things like #channel:op, check if the query is in the user's prefix modes. # 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 @bind
def pylinkacc(irc, host, uid): def pylinkacc(irc, host, uid):

View File

@ -48,7 +48,7 @@ def handle_whois(irc, source, command, args):
continue continue
# Show the highest prefix mode like a regular IRCd does, if there are any. # 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: if prefixes:
highest = prefixes[-1] highest = prefixes[-1]

View File

@ -120,7 +120,7 @@ def showchan(irc, source, args):
# Iterate over the user list, sorted by nick. # Iterate over the user list, sorted by nick.
for user, nick in sorted(zip(c.users, nicks), for user, nick in sorted(zip(c.users, nicks),
key=lambda userpair: userpair[1].lower()): 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. # Show prefix modes in order from highest to lowest.
nick = irc.prefixmodes.get(irc.cmodes.get(pmode, ''), '') + nick nick = irc.prefixmodes.get(irc.cmodes.get(pmode, ''), '') + nick
nicklist.append(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 # 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 # (e.g. owner before op before halfop). TODO: SJOIN modes should probably be
# consistently sorted IRCd-side. # 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: if pmode in remoteirc.cmodes:
modes += remoteirc.cmodes[pmode] modes += remoteirc.cmodes[pmode]
return modes 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 # 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 # rather not change the 'users' format of SJOIN just for this. -GL
try: try:
oldmodes = set(chandata.getPrefixModes(user)) oldmodes = set(chandata.get_prefix_modes(user))
except KeyError: except KeyError:
# User was never in channel. Treat their mode list as empty. # User was never in channel. Treat their mode list as empty.
oldmodes = set() oldmodes = set()
newmodes = set(current_chandata.getPrefixModes(user)) newmodes = set(current_chandata.get_prefix_modes(user))
modediff = newmodes - oldmodes modediff = newmodes - oldmodes
log.debug('(%s) relay.handle_join: mode diff for %s on %s: %s oldmodes=%s newmodes=%s', log.debug('(%s) relay.handle_join: mode diff for %s on %s: %s oldmodes=%s newmodes=%s',
irc.name, user, channel, modediff, oldmodes, newmodes) irc.name, user, channel, modediff, oldmodes, newmodes)

View File

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