From 7d68c03101e4788ec8e6eb0e9f0c627b07b0f6fa Mon Sep 17 00:00:00 2001 From: James Lu Date: Fri, 30 Jun 2017 21:40:05 -0700 Subject: [PATCH] various: convert sortPrefixes/getPrefixModes calls to snake case --- coremods/exttargets.py | 2 +- coremods/handlers.py | 2 +- plugins/commands.py | 2 +- plugins/relay.py | 6 +++--- protocols/clientbot.py | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/coremods/exttargets.py b/coremods/exttargets.py index 8c32cf3..6f90914 100644 --- a/coremods/exttargets.py +++ b/coremods/exttargets.py @@ -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): diff --git a/coremods/handlers.py b/coremods/handlers.py index 2140aaf..c3d0fc1 100644 --- a/coremods/handlers.py +++ b/coremods/handlers.py @@ -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] diff --git a/plugins/commands.py b/plugins/commands.py index 2482dd8..ffd2463 100644 --- a/plugins/commands.py +++ b/plugins/commands.py @@ -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) diff --git a/plugins/relay.py b/plugins/relay.py index a1ffcf0..7b9ff37 100644 --- a/plugins/relay.py +++ b/plugins/relay.py @@ -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) diff --git a/protocols/clientbot.py b/protocols/clientbot.py index 846e039..3c5efce 100644 --- a/protocols/clientbot.py +++ b/protocols/clientbot.py @@ -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: