mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-30 14:49:28 +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
|
||||
return {'target': target, 'channel': channel}
|
||||
|
||||
def handle_encap(self, numeric, command, args):
|
||||
"""Handles incoming encapsulated commands (ENCAP). Hook arguments
|
||||
returned by this should have a parse_as field, that sets the correct
|
||||
hook name for the message.
|
||||
|
||||
For InspIRCd, the only ENCAP command we handle right now is KNOCK."""
|
||||
# <- :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_knock(self, numeric, command, args):
|
||||
"""Handles channel KNOCKs."""
|
||||
# <- :70MAAAAAA ENCAP * KNOCK #blah :abcdefg
|
||||
channel = self.irc.toLower(args[0])
|
||||
text = args[1]
|
||||
return {'channel': channel, 'text': text}
|
||||
|
||||
def handle_opertype(self, target, command, args):
|
||||
"""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,
|
||||
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
|
||||
subcommands used for different purposes.
|
||||
Handles SU, which is used for setting login information
|
||||
"""
|
||||
commandname = args[1]
|
||||
# <- :00A ENCAP * SU 42XAAAAAC :GLolol
|
||||
# <- :00A ENCAP * SU 42XAAAAAC
|
||||
try:
|
||||
account = args[1] # Account name is being set
|
||||
except IndexError:
|
||||
account = '' # No account name means a logout
|
||||
|
||||
if commandname == 'SU':
|
||||
# Handles SU, which is used for setting login information
|
||||
# <- :00A ENCAP * SU 42XAAAAAC :GLolol
|
||||
# <- :00A ENCAP * SU 42XAAAAAC
|
||||
try:
|
||||
account = args[3] # Account name is being set
|
||||
except IndexError:
|
||||
account = '' # No account name means a logout
|
||||
|
||||
uid = args[2]
|
||||
self.irc.callHooks([uid, 'CLIENT_SERVICES_LOGIN', {'text': account}])
|
||||
uid = args[0]
|
||||
self.irc.callHooks([uid, 'CLIENT_SERVICES_LOGIN', {'text': account}])
|
||||
|
||||
Class = TS6Protocol
|
||||
|
@ -330,6 +330,13 @@ class TS6BaseProtocol(IRCS2SProtocol):
|
||||
command = args[0]
|
||||
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:
|
||||
func = getattr(self, 'handle_'+command.lower())
|
||||
except AttributeError: # unhandled command
|
||||
|
Loading…
Reference in New Issue
Block a user