From bf7522697a7a574dc512f032c2d0600d8f7a144b Mon Sep 17 00:00:00 2001 From: James Lu Date: Sat, 26 Dec 2015 15:41:22 -0800 Subject: [PATCH] Rename PYLINK_CLIENT_OPERED hook -> CLIENT_OPERED To be consistent, any PYLINK_* hooks should internal hooks sent out by PyLink itself. CLIENT_OPERED, on the other hand, requires protocol modules to send it and thus, shouldn't be labeled as a PYLINK_* hook. --- coreplugin.py | 2 +- plugins/relay.py | 2 +- protocols/inspircd.py | 4 ++-- protocols/ts6.py | 4 ++-- protocols/unreal.py | 8 ++++---- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/coreplugin.py b/coreplugin.py index 2337117..9f5b9c5 100644 --- a/coreplugin.py +++ b/coreplugin.py @@ -133,7 +133,7 @@ utils.add_hook(handle_mode, 'MODE') def handle_operup(irc, source, command, args): """Logs successful oper-ups on networks.""" log.info("(%s) Successful oper-up (opertype %r) from %s", irc.name, args.get('text'), utils.getHostmask(irc, source)) -utils.add_hook(handle_operup, 'PYLINK_CLIENT_OPERED') +utils.add_hook(handle_operup, 'CLIENT_OPERED') # Essential, core commands go here so that the "commands" plugin with less-important, # but still generic functions can be reloaded. diff --git a/plugins/relay.py b/plugins/relay.py index 7c02b50..b78fc10 100644 --- a/plugins/relay.py +++ b/plugins/relay.py @@ -635,7 +635,7 @@ def handle_operup(irc, numeric, command, args): irc.name, user, netname, newtype) remoteirc = world.networkobjects[netname] remoteirc.users[user].opertype = newtype -utils.add_hook(handle_operup, 'PYLINK_CLIENT_OPERED') +utils.add_hook(handle_operup, 'CLIENT_OPERED') def handle_join(irc, numeric, command, args): channel = args['channel'] diff --git a/protocols/inspircd.py b/protocols/inspircd.py index 523240d..53b172a 100644 --- a/protocols/inspircd.py +++ b/protocols/inspircd.py @@ -558,7 +558,7 @@ class InspIRCdProtocol(TS6BaseProtocol): def handle_opertype(self, numeric, command, args): """Handles incoming OPERTYPE, which is used to denote an oper up. - This calls the internal hook PYLINK_CLIENT_OPERED, sets the internal + This calls the internal hook CLIENT_OPERED, sets the internal opertype of the client, and assumes setting user mode +o on the caller.""" # This is used by InspIRCd to denote an oper up; there is no MODE # command sent for it. @@ -568,7 +568,7 @@ class InspIRCdProtocol(TS6BaseProtocol): utils.applyModes(self.irc, numeric, omode) # OPERTYPE is essentially umode +o and metadata in one command; # we'll call that too. - self.irc.callHooks([numeric, 'PYLINK_CLIENT_OPERED', {'text': opertype}]) + self.irc.callHooks([numeric, 'CLIENT_OPERED', {'text': opertype}]) return {'target': numeric, 'modes': omode} def handle_fident(self, numeric, command, args): diff --git a/protocols/ts6.py b/protocols/ts6.py index 8ebcb91..18709f8 100644 --- a/protocols/ts6.py +++ b/protocols/ts6.py @@ -521,7 +521,7 @@ class TS6Protocol(TS6BaseProtocol): # Call the OPERED UP hook if +o is being added to the mode list. if ('+o', None) in parsedmodes: otype = 'Server_Administrator' if ('+a', None) in parsedmodes else 'IRC_Operator' - self.irc.callHooks([uid, 'PYLINK_CLIENT_OPERED', {'text': otype}]) + self.irc.callHooks([uid, 'CLIENT_OPERED', {'text': otype}]) return {'uid': uid, 'ts': ts, 'nick': nick, 'realhost': realhost, 'host': host, 'ident': ident, 'ip': ip} def handle_uid(self, numeric, command, args): @@ -568,7 +568,7 @@ class TS6Protocol(TS6BaseProtocol): # Call the OPERED UP hook if +o is being set. if ('+o', None) in changedmodes: otype = 'Server_Administrator' if ('a', None) in self.irc.users[target].modes else 'IRC_Operator' - self.irc.callHooks([target, 'PYLINK_CLIENT_OPERED', {'text': otype}]) + self.irc.callHooks([target, 'CLIENT_OPERED', {'text': otype}]) return {'target': target, 'modes': changedmodes} def handle_tb(self, numeric, command, args): diff --git a/protocols/unreal.py b/protocols/unreal.py index 9723cc9..35bd0f3 100644 --- a/protocols/unreal.py +++ b/protocols/unreal.py @@ -355,8 +355,8 @@ class UnrealProtocol(TS6BaseProtocol): self.irc.users[uid].cloaked_host = args[9] if ('+o', None) in parsedmodes: - # If +o being set, call the PYLINK_CLIENT_OPERED internal hook. - self.irc.callHooks([uid, 'PYLINK_CLIENT_OPERED', {'text': 'IRC_Operator'}]) + # If +o being set, call the CLIENT_OPERED internal hook. + self.irc.callHooks([uid, 'CLIENT_OPERED', {'text': 'IRC_Operator'}]) return {'uid': uid, 'ts': ts, 'nick': nick, 'realhost': realhost, 'host': host, 'ident': ident, 'ip': ip} @@ -632,8 +632,8 @@ class UnrealProtocol(TS6BaseProtocol): utils.applyModes(self.irc, numeric, parsedmodes) if ('+o', None) in parsedmodes: - # If +o being set, call the PYLINK_CLIENT_OPERED internal hook. - self.irc.callHooks([uid, 'PYLINK_CLIENT_OPERED', {'text': 'IRC_Operator'}]) + # If +o being set, call the CLIENT_OPERED internal hook. + self.irc.callHooks([uid, 'CLIENT_OPERED', {'text': 'IRC_Operator'}]) return {'target': numeric, 'modes': parsedmodes}