mirror of
https://github.com/jlu5/PyLink.git
synced 2025-02-03 16:14:10 +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.
|
# Sets the timeout to wait for as individual servers / the PyLink daemon to start up.
|
||||||
TCONDITION_TIMEOUT = 2
|
TCONDITION_TIMEOUT = 2
|
||||||
|
|
||||||
|
CHANNEL_DELINKED_PARTMSG = 'Channel delinked.'
|
||||||
|
|
||||||
### GLOBAL (statekeeping) VARIABLES
|
### GLOBAL (statekeeping) VARIABLES
|
||||||
relayusers = defaultdict(dict)
|
relayusers = defaultdict(dict)
|
||||||
relayservers = defaultdict(dict)
|
relayservers = defaultdict(dict)
|
||||||
@ -540,7 +542,7 @@ def remove_channel(irc, channel):
|
|||||||
return
|
return
|
||||||
|
|
||||||
try:
|
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:
|
except KeyError:
|
||||||
log.warning('(%s) relay: failed to remove persistent channel %r on delink', irc.name, channel, exc_info=True)
|
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)
|
sbot = irc.get_service_bot(user)
|
||||||
if sbot:
|
if sbot:
|
||||||
try:
|
try:
|
||||||
sbot.remove_persistent_channel(irc, 'relay', channel)
|
sbot.remove_persistent_channel(irc, 'relay', channel, part_reason=CHANNEL_DELINKED_PARTMSG)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
else:
|
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:
|
if user != irc.pseudoclient.uid and not irc.users[user].channels:
|
||||||
remoteuser = get_orig_user(irc, user)
|
remoteuser = get_orig_user(irc, user)
|
||||||
del relayusers[remoteuser][irc.name]
|
del relayusers[remoteuser][irc.name]
|
||||||
@ -832,7 +834,7 @@ def relay_part(irc, *args, **kwargs):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
# Part the relay client with the channel delinked message.
|
# 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 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:
|
if is_relay_client(remoteirc, remoteuser) and not remoteirc.users[remoteuser].channels:
|
||||||
|
Loading…
Reference in New Issue
Block a user