mirror of
https://github.com/jlu5/PyLink.git
synced 2025-02-26 10:30:59 +01:00
parent
ed6293e54a
commit
3b80802d1a
@ -644,29 +644,12 @@ class InspIRCdProtocol(TS6BaseProtocol):
|
|||||||
# We don't actually need to process this; just send the hook so plugins can use it
|
# We don't actually need to process this; just send the hook so plugins can use it
|
||||||
return {'target': target, 'channel': channel}
|
return {'target': target, 'channel': channel}
|
||||||
|
|
||||||
def handle_encap(self, numeric, command, args):
|
def handle_knock(self, numeric, command, args):
|
||||||
"""Handles incoming encapsulated commands (ENCAP). Hook arguments
|
"""Handles channel KNOCKs."""
|
||||||
returned by this should have a parse_as field, that sets the correct
|
# <- :70MAAAAAA ENCAP * KNOCK #blah :abcdefg
|
||||||
hook name for the message.
|
channel = self.irc.toLower(args[0])
|
||||||
|
text = args[1]
|
||||||
For InspIRCd, the only ENCAP command we handle right now is KNOCK."""
|
return {'channel': channel, 'text': text}
|
||||||
# <- :70MAAAAAA ENCAP * KNOCK #blah :agsdfas
|
|
||||||
# From charybdis TS6 docs: https://github.com/grawity/irc-docs/blob/03ba884a54f1cef2193cd62b6a86803d89c1ac41/server/ts6.txt
|
|
||||||
|
|
||||||
# ENCAP
|
|
||||||
# source: any
|
|
||||||
# parameters: target server mask, subcommand, opt. parameters...
|
|
||||||
|
|
||||||
# Sends a command to matching servers. Propagation is independent of
|
|
||||||
# understanding the subcommand.
|
|
||||||
|
|
||||||
targetmask = args[0]
|
|
||||||
real_command = args[1]
|
|
||||||
if targetmask == '*' and real_command == 'KNOCK':
|
|
||||||
channel = self.irc.toLower(args[2])
|
|
||||||
text = args[3]
|
|
||||||
return {'parse_as': real_command, 'channel': channel,
|
|
||||||
'text': text}
|
|
||||||
|
|
||||||
def handle_opertype(self, target, command, args):
|
def handle_opertype(self, target, command, args):
|
||||||
"""Handles incoming OPERTYPE, which is used to denote an oper up.
|
"""Handles incoming OPERTYPE, which is used to denote an oper up.
|
||||||
|
@ -666,23 +666,18 @@ class TS6Protocol(TS6BaseProtocol):
|
|||||||
'your IRCd configuration.', self.irc.name, setter, badmode,
|
'your IRCd configuration.', self.irc.name, setter, badmode,
|
||||||
charlist[badmode])
|
charlist[badmode])
|
||||||
|
|
||||||
def handle_encap(self, numeric, command, args):
|
def handle_su(self, numeric, command, args):
|
||||||
"""
|
"""
|
||||||
Handles the ENCAP command - encapsulated TS6 commands with a variety of
|
Handles SU, which is used for setting login information
|
||||||
subcommands used for different purposes.
|
|
||||||
"""
|
"""
|
||||||
commandname = args[1]
|
|
||||||
|
|
||||||
if commandname == 'SU':
|
|
||||||
# Handles SU, which is used for setting login information
|
|
||||||
# <- :00A ENCAP * SU 42XAAAAAC :GLolol
|
# <- :00A ENCAP * SU 42XAAAAAC :GLolol
|
||||||
# <- :00A ENCAP * SU 42XAAAAAC
|
# <- :00A ENCAP * SU 42XAAAAAC
|
||||||
try:
|
try:
|
||||||
account = args[3] # Account name is being set
|
account = args[1] # Account name is being set
|
||||||
except IndexError:
|
except IndexError:
|
||||||
account = '' # No account name means a logout
|
account = '' # No account name means a logout
|
||||||
|
|
||||||
uid = args[2]
|
uid = args[0]
|
||||||
self.irc.callHooks([uid, 'CLIENT_SERVICES_LOGIN', {'text': account}])
|
self.irc.callHooks([uid, 'CLIENT_SERVICES_LOGIN', {'text': account}])
|
||||||
|
|
||||||
Class = TS6Protocol
|
Class = TS6Protocol
|
||||||
|
@ -330,6 +330,13 @@ class TS6BaseProtocol(IRCS2SProtocol):
|
|||||||
command = args[0]
|
command = args[0]
|
||||||
args = args[1:]
|
args = args[1:]
|
||||||
|
|
||||||
|
if command == 'ENCAP':
|
||||||
|
# Special case for encapsulated commands (ENCAP), in forms like this:
|
||||||
|
# <- :00A ENCAP * SU 42XAAAAAC :GLolol
|
||||||
|
command = args[1]
|
||||||
|
args = args[2:]
|
||||||
|
log.debug("(%s) Rewriting incoming ENCAP to command %s (args: %s)", self.irc.name, command, args)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
func = getattr(self, 'handle_'+command.lower())
|
func = getattr(self, 'handle_'+command.lower())
|
||||||
except AttributeError: # unhandled command
|
except AttributeError: # unhandled command
|
||||||
|
Loading…
x
Reference in New Issue
Block a user