mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-27 21:19:31 +01:00
plugins, docs, test suite: update to use irc.proto.kick
This commit is contained in:
parent
975ace3e04
commit
983edaf8d0
@ -48,9 +48,9 @@ internals](https://github.com/GLolol/PyLink/blob/0.4.0-dev/classes.py#L267-L272)
|
|||||||
|
|
||||||
- **`invite`**`(self, source, target, channel)` - Sends an INVITE from a PyLink client.
|
- **`invite`**`(self, source, target, channel)` - Sends an INVITE from a PyLink client.
|
||||||
|
|
||||||
- **`kickClient`**`(self, source, channel, target, reason=None)` - Sends a kick from a PyLink client.
|
- **`kick`**`(self, source, channel, target, reason=None)` - Sends a kick from a PyLink client.
|
||||||
|
|
||||||
- **`kickServer`**`(self, source, channel, target, reason=None)` - Sends a kick from a PyLink server.
|
- **`kick`**`(self, source, channel, target, reason=None)` - Sends a kick from a PyLink server.
|
||||||
|
|
||||||
- **`killClient`**`(self, source, target, reason)` - Sends a kill from a PyLink client.
|
- **`killClient`**`(self, source, target, reason)` - Sends a kill from a PyLink client.
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ def kick(irc, source, args):
|
|||||||
|
|
||||||
if irc.isInternalServer(u):
|
if irc.isInternalServer(u):
|
||||||
# Send kick from server if the given kicker is a SID
|
# Send kick from server if the given kicker is a SID
|
||||||
irc.proto.kickServer(u, channel, targetu, reason)
|
irc.proto.kick(u, channel, targetu, reason)
|
||||||
elif u not in irc.users:
|
elif u not in irc.users:
|
||||||
# Whatever we were told to send the kick from wasn't valid; try to be
|
# Whatever we were told to send the kick from wasn't valid; try to be
|
||||||
# somewhat user friendly in the error. message
|
# somewhat user friendly in the error. message
|
||||||
@ -148,7 +148,7 @@ def kick(irc, source, args):
|
|||||||
irc.reply("Error: No such nick '%s'." % target)
|
irc.reply("Error: No such nick '%s'." % target)
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
irc.proto.kickClient(u, channel, targetu, reason)
|
irc.proto.kick(u, channel, targetu, reason)
|
||||||
|
|
||||||
irc.callHooks([u, 'CHANCMDS_KICK', {'channel': channel, 'target': targetu,
|
irc.callHooks([u, 'CHANCMDS_KICK', {'channel': channel, 'target': targetu,
|
||||||
'text': reason, 'parse_as': 'KICK'}])
|
'text': reason, 'parse_as': 'KICK'}])
|
||||||
|
@ -836,7 +836,7 @@ def handle_kick(irc, source, command, args):
|
|||||||
# Propogate the kick!
|
# Propogate the kick!
|
||||||
if real_kicker:
|
if real_kicker:
|
||||||
log.debug('(%s) Relay kick: Kicking %s from channel %s via %s on behalf of %s/%s', irc.name, real_target, remotechan,real_kicker, kicker, irc.name)
|
log.debug('(%s) Relay kick: Kicking %s from channel %s via %s on behalf of %s/%s', irc.name, real_target, remotechan,real_kicker, kicker, irc.name)
|
||||||
remoteirc.proto.kickClient(real_kicker, remotechan, real_target, args['text'])
|
remoteirc.proto.kick(real_kicker, remotechan, real_target, args['text'])
|
||||||
else:
|
else:
|
||||||
# Kick originated from a server, or the kicker isn't in any
|
# Kick originated from a server, or the kicker isn't in any
|
||||||
# common channels with the target relay network.
|
# common channels with the target relay network.
|
||||||
@ -850,7 +850,7 @@ def handle_kick(irc, source, command, args):
|
|||||||
text = "(%s/%s) %s" % (kname, irc.name, args['text'])
|
text = "(%s/%s) %s" % (kname, irc.name, args['text'])
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
text = "(<unknown kicker>@%s) %s" % (irc.name, args['text'])
|
text = "(<unknown kicker>@%s) %s" % (irc.name, args['text'])
|
||||||
remoteirc.proto.kickServer(rsid, remotechan, real_target, text)
|
remoteirc.proto.kick(rsid, remotechan, real_target, text)
|
||||||
|
|
||||||
# If the target isn't on any channels, quit them.
|
# If the target isn't on any channels, quit them.
|
||||||
if remoteirc != irc and (not remoteirc.users[real_target].channels) and not origuser:
|
if remoteirc != irc and (not remoteirc.users[real_target].channels) and not origuser:
|
||||||
|
@ -30,7 +30,7 @@ class CorePluginTestCase(tests_common.PluginTestCase):
|
|||||||
self.assertNotEqual(self.irc.pseudoclient.uid, spmain[0]['olduser'])
|
self.assertNotEqual(self.irc.pseudoclient.uid, spmain[0]['olduser'])
|
||||||
|
|
||||||
def testKickRejoin(self):
|
def testKickRejoin(self):
|
||||||
self.proto.kickClient(self.u, '#pylink', self.u, 'test')
|
self.proto.kick(self.u, '#pylink', self.u, 'test')
|
||||||
msgs = self.irc.takeMsgs()
|
msgs = self.irc.takeMsgs()
|
||||||
commands = self.irc.takeCommands(msgs)
|
commands = self.irc.takeCommands(msgs)
|
||||||
self.assertIn('FJOIN', commands)
|
self.assertIn('FJOIN', commands)
|
||||||
|
@ -37,7 +37,7 @@ class CommonProtoTestCase(PluginTestCase):
|
|||||||
self.proto.join(target, '#pylink')
|
self.proto.join(target, '#pylink')
|
||||||
self.assertIn(self.u, self.irc.channels['#pylink'].users)
|
self.assertIn(self.u, self.irc.channels['#pylink'].users)
|
||||||
self.assertIn(target, self.irc.channels['#pylink'].users)
|
self.assertIn(target, self.irc.channels['#pylink'].users)
|
||||||
self.proto.kickClient(self.u, '#pylink', target, 'Pow!')
|
self.proto.kick(self.u, '#pylink', target, 'Pow!')
|
||||||
self.assertNotIn(target, self.irc.channels['#pylink'].users)
|
self.assertNotIn(target, self.irc.channels['#pylink'].users)
|
||||||
|
|
||||||
def testModeClient(self):
|
def testModeClient(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user