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

unreal: add outgoing KNOCK

In Unreal, KNOCKs are simply specially formatted notices sent from the orginating user's server. No special inbound hook is used to handle this as a result.
This commit is contained in:
James Lu 2015-11-15 21:09:40 -08:00
parent 2ddb72f9ec
commit 0f269da9b8

View File

@ -226,6 +226,16 @@ class UnrealProtocol(TS6BaseProtocol):
raise LookupError('No such PyLink client exists.')
self._send(numeric, 'INVITE %s %s' % (target, channel))
def knockClient(self, numeric, target, text):
"""Sends a KNOCK from a PyLink client."""
# KNOCKs in UnrealIRCd are actually just specially formatted NOTICEs,
# sent to all ops in a channel.
# <- :unreal.midnight.vpn NOTICE @#test :[Knock] by GL|!gl@hidden-1C620195 (test)
assert utils.isChannel(target), "Can only knock on channels!"
sender = utils.clientToServer(self.irc, numeric)
s = '[Knock] by %s (%s)' % (utils.getHostmask(self.irc, numeric), text)
self._send(sender, 'NOTICE @%s :%s' % (target, s))
### HANDLERS
def connect(self):