mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-30 14:49:28 +01:00
Revert "service_support: consistently rejoin all channels on kick and kill"
This is no longer needed with plugin-specific persistent channels.
This reverts commit 3c9dac7e6b
.
This commit is contained in:
parent
92be421fad
commit
01c22aac21
@ -107,26 +107,17 @@ def handle_kill(irc, source, command, args):
|
|||||||
irc.pseudoclient = None
|
irc.pseudoclient = None
|
||||||
userdata = args.get('userdata')
|
userdata = args.get('userdata')
|
||||||
sbot = irc.get_service_bot(target)
|
sbot = irc.get_service_bot(target)
|
||||||
|
|
||||||
servicename = None
|
servicename = None
|
||||||
channels = []
|
|
||||||
|
|
||||||
if userdata:
|
if userdata and hasattr(userdata, 'service'): # Look for the target's service name attribute
|
||||||
# Look for the target's service name
|
servicename = userdata.service
|
||||||
servicename = getattr(userdata, 'service', servicename)
|
elif sbot: # Or their service bot instance
|
||||||
channels = getattr(userdata, 'channels', channels)
|
|
||||||
elif sbot:
|
|
||||||
# Or its service bot instance
|
|
||||||
servicename = sbot.name
|
servicename = sbot.name
|
||||||
channels = irc.users[target].channels
|
|
||||||
if servicename:
|
if servicename:
|
||||||
log.info('(%s) Received kill to service %r (nick: %r) from %s (reason: %r).', irc.name, servicename,
|
log.info('(%s) Received kill to service %r (nick: %r) from %s (reason: %r).', irc.name, servicename,
|
||||||
userdata.nick if userdata else irc.users[target].nick, irc.get_hostmask(source), args.get('text'))
|
userdata.nick if userdata else irc.users[target].nick, irc.get_hostmask(source), args.get('text'))
|
||||||
spawn_service(irc, source, command, {'name': servicename})
|
spawn_service(irc, source, command, {'name': servicename})
|
||||||
|
|
||||||
# Rejoin the killed service bot to all channels it was previously in.
|
|
||||||
world.services[servicename].join(irc, channels)
|
|
||||||
|
|
||||||
utils.add_hook(handle_kill, 'KILL')
|
utils.add_hook(handle_kill, 'KILL')
|
||||||
|
|
||||||
def handle_join(irc, source, command, args):
|
def handle_join(irc, source, command, args):
|
||||||
@ -173,7 +164,7 @@ def handle_kick(irc, source, command, args):
|
|||||||
if not _services_dynamic_part(irc, channel):
|
if not _services_dynamic_part(irc, channel):
|
||||||
kicked = args['target']
|
kicked = args['target']
|
||||||
sbot = irc.get_service_bot(kicked)
|
sbot = irc.get_service_bot(kicked)
|
||||||
if sbot:
|
if sbot and channel in sbot.get_persistent_channels(irc):
|
||||||
sbot.join(irc, channel)
|
sbot.join(irc, channel)
|
||||||
utils.add_hook(handle_kick, 'KICK')
|
utils.add_hook(handle_kick, 'KICK')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user