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

ngircd: implement KILL

This commit is contained in:
James Lu 2017-07-07 02:52:57 -07:00
parent 67a414fa2a
commit 28d2f89311

View File

@ -160,6 +160,20 @@ class NgIRCdProtocol(IRCS2SProtocol):
self.channels[channel].users.add(client)
self.users[client].channels.add(channel)
def kill(self, source, target, reason):
"""Sends a kill from a PyLink client/server."""
if (not self.is_internal_client(source)) and \
(not self.is_internal_server(source)):
raise LookupError('No such PyLink client/server exists.')
# Follow ngIRCd's formatting of the kill messages for the most part
self._send_with_prefix(source, 'KILL %s :KILLed by %s: %s' % (self._expandPUID(target),
self.get_friendly_name(source), reason))
# Implicitly remove our own client if one was the target.
if self.is_internal_client(target):
self._remove_client(target)
def knock(self, numeric, target, text):
raise NotImplementedError('KNOCK is not supported on ngIRCd.')