3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-01-24 19:24:13 +01:00

relay: don't spam ulines with "notice failed" errors

This commit is contained in:
James Lu 2018-03-17 10:27:56 -07:00
parent 5bffe67416
commit 180bfa9917

View File

@ -1474,16 +1474,20 @@ def handle_messages(irc, numeric, command, args):
# Otherwise, the sender doesn't have a client representing them
# on the remote network, and we won't have anything to send our
# messages from.
# Note: don't spam ulined senders (e.g. services announcers) with
# these notices.
if homenet not in remoteusers.keys():
irc.msg(numeric, 'You must be in a common channel '
'with %r in order to send messages.' % \
irc.users[target].nick, notice=True)
if not _is_uline(irc, numeric):
irc.msg(numeric, 'You must be in a common channel '
'with %r in order to send messages.' % \
irc.users[target].nick, notice=True)
return
remoteirc = world.networkobjects[homenet]
if (not remoteirc.has_cap('can-spawn-clients')) and not conf.conf.get('relay', {}).get('allow_clientbot_pms'):
irc.msg(numeric, 'Private messages to users connected via Clientbot have '
'been administratively disabled.', notice=True)
if not _is_uline(irc, numeric):
irc.msg(numeric, 'Private messages to users connected via Clientbot have '
'been administratively disabled.', notice=True)
return
user = get_remote_user(irc, remoteirc, numeric, spawn_if_missing=False)