mirror of
https://github.com/jlu5/PyLink.git
synced 2025-01-24 19:24:13 +01:00
relay: consistently use "Channel delinked." as part message for service bots too
This commit is contained in:
parent
c7da7f0025
commit
72c2fa38e9
@ -12,6 +12,8 @@ from pylinkirc.coremods import permissions
|
||||
# Sets the timeout to wait for as individual servers / the PyLink daemon to start up.
|
||||
TCONDITION_TIMEOUT = 2
|
||||
|
||||
CHANNEL_DELINKED_PARTMSG = 'Channel delinked.'
|
||||
|
||||
### GLOBAL (statekeeping) VARIABLES
|
||||
relayusers = defaultdict(dict)
|
||||
relayservers = defaultdict(dict)
|
||||
@ -540,7 +542,7 @@ def remove_channel(irc, channel):
|
||||
return
|
||||
|
||||
try:
|
||||
world.services['pylink'].remove_persistent_channel(irc, 'relay', channel)
|
||||
world.services['pylink'].remove_persistent_channel(irc, 'relay', channel, part_reason=CHANNEL_DELINKED_PARTMSG)
|
||||
except KeyError:
|
||||
log.warning('(%s) relay: failed to remove persistent channel %r on delink', irc.name, channel, exc_info=True)
|
||||
|
||||
@ -558,11 +560,11 @@ def remove_channel(irc, channel):
|
||||
sbot = irc.get_service_bot(user)
|
||||
if sbot:
|
||||
try:
|
||||
sbot.remove_persistent_channel(irc, 'relay', channel)
|
||||
sbot.remove_persistent_channel(irc, 'relay', channel, part_reason=CHANNEL_DELINKED_PARTMSG)
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
irc.part(user, channel, 'Channel delinked.')
|
||||
irc.part(user, channel, CHANNEL_DELINKED_PARTMSG)
|
||||
if user != irc.pseudoclient.uid and not irc.users[user].channels:
|
||||
remoteuser = get_orig_user(irc, user)
|
||||
del relayusers[remoteuser][irc.name]
|
||||
@ -832,7 +834,7 @@ def relay_part(irc, *args, **kwargs):
|
||||
pass
|
||||
|
||||
# Part the relay client with the channel delinked message.
|
||||
remoteirc.part(remoteuser, remotechan, 'Channel delinked.')
|
||||
remoteirc.part(remoteuser, remotechan, CHANNEL_DELINKED_PARTMSG)
|
||||
|
||||
# If the relay client no longer has any channels, quit them to prevent inflating /lusers.
|
||||
if is_relay_client(remoteirc, remoteuser) and not remoteirc.users[remoteuser].channels:
|
||||
|
Loading…
Reference in New Issue
Block a user