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

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.
This commit is contained in:
James Lu 2015-12-26 15:41:22 -08:00
parent 04275d1dfa
commit bf7522697a
5 changed files with 10 additions and 10 deletions

View File

@ -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.

View File

@ -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']

View File

@ -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):

View File

@ -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):

View File

@ -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}