3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-01-12 05:02:33 +01:00

pr/insp: add kickServer

This commit is contained in:
James Lu 2015-07-14 22:32:05 -07:00
parent 7de8f1509d
commit 8942c2fa08

View File

@ -136,13 +136,11 @@ def quitClient(irc, numeric, reason):
"a user that's not a PyLink PseudoClient from " "a user that's not a PyLink PseudoClient from "
"the internal state, use removeClient() instead.") "the internal state, use removeClient() instead.")
def kickClient(irc, numeric, channel, target, reason=None): def _sendKick(irc, numeric, channel, target, reason=None):
"""<irc object> <kicker client numeric> """<irc object> <kicker client numeric>
Sends a kick from a PyLink PseudoClient.""" Sends a kick from a PyLink PseudoClient."""
channel = channel.lower() channel = channel.lower()
if not utils.isInternalClient(irc, numeric):
raise LookupError('No such PyLink PseudoClient exists.')
if not reason: if not reason:
reason = 'No reason given' reason = 'No reason given'
_sendFromUser(irc, numeric, 'KICK %s %s :%s' % (channel, target, reason)) _sendFromUser(irc, numeric, 'KICK %s %s :%s' % (channel, target, reason))
@ -151,6 +149,16 @@ def kickClient(irc, numeric, channel, target, reason=None):
# handle_part() does that just fine. # handle_part() does that just fine.
handle_part(irc, target, 'KICK', [channel]) handle_part(irc, target, 'KICK', [channel])
def kickClient(irc, numeric, channel, target, reason=None):
if not utils.isInternalClient(irc, numeric):
raise LookupError('No such PyLink PseudoClient exists.')
_sendKick(irc, numeric, channel, target, reason=reason)
def kickServer(irc, numeric, channel, target, reason=None):
if not utils.isInternalServer(irc, numeric):
raise LookupError('No such PyLink PseudoServer exists.')
_sendKick(irc, numeric, channel, target, reason=reason)
def nickClient(irc, numeric, newnick): def nickClient(irc, numeric, newnick):
"""<irc object> <client numeric> <new nickname> """<irc object> <client numeric> <new nickname>