mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-24 03:29:28 +01:00
relay: forward messages from the main PyLink client too
This may or may not have nasty regressions - time will tell I guess.
This commit is contained in:
parent
97a135a6f1
commit
7d919e643a
@ -660,11 +660,11 @@ def handle_part(irc, numeric, command, args):
|
|||||||
del relayusers[(irc.name, numeric)][remoteirc.name]
|
del relayusers[(irc.name, numeric)][remoteirc.name]
|
||||||
utils.add_hook(handle_part, 'PART')
|
utils.add_hook(handle_part, 'PART')
|
||||||
|
|
||||||
def handle_privmsg(irc, numeric, command, args):
|
def handle_messages(irc, numeric, command, args):
|
||||||
notice = (command == 'NOTICE')
|
notice = (command in ('NOTICE', 'PYLINK_SELF_NOTICE'))
|
||||||
target = args['target']
|
target = args['target']
|
||||||
text = args['text']
|
text = args['text']
|
||||||
if target == irc.pseudoclient.uid:
|
if utils.isInternalClient(irc, target):
|
||||||
return
|
return
|
||||||
relay = getRelay((irc.name, target))
|
relay = getRelay((irc.name, target))
|
||||||
remoteusers = relayusers[(irc.name, numeric)]
|
remoteusers = relayusers[(irc.name, numeric)]
|
||||||
@ -685,11 +685,11 @@ def handle_privmsg(irc, numeric, command, args):
|
|||||||
'messages over the relay.' % target, notice=True)
|
'messages over the relay.' % target, notice=True)
|
||||||
return
|
return
|
||||||
if utils.isChannel(target):
|
if utils.isChannel(target):
|
||||||
for netname, user in relayusers[(irc.name, numeric)].items():
|
for name, remoteirc in world.networkobjects.items():
|
||||||
remoteirc = world.networkobjects[netname]
|
|
||||||
real_target = getRemoteChan(irc, remoteirc, target)
|
real_target = getRemoteChan(irc, remoteirc, target)
|
||||||
if not real_target:
|
if irc.name == name or not remoteirc.connected.is_set() or not real_target:
|
||||||
continue
|
continue
|
||||||
|
user = getRemoteUser(irc, remoteirc, numeric, spawnIfMissing=False)
|
||||||
real_target = prefix + real_target
|
real_target = prefix + real_target
|
||||||
if notice:
|
if notice:
|
||||||
remoteirc.proto.noticeClient(user, real_target, text)
|
remoteirc.proto.noticeClient(user, real_target, text)
|
||||||
@ -715,8 +715,8 @@ def handle_privmsg(irc, numeric, command, args):
|
|||||||
remoteirc.proto.noticeClient(user, real_target, text)
|
remoteirc.proto.noticeClient(user, real_target, text)
|
||||||
else:
|
else:
|
||||||
remoteirc.proto.messageClient(user, real_target, text)
|
remoteirc.proto.messageClient(user, real_target, text)
|
||||||
utils.add_hook(handle_privmsg, 'PRIVMSG')
|
for cmd in ('PRIVMSG', 'NOTICE', 'PYLINK_SELF_NOTICE', 'PYLINK_SELF_PRIVMSG'):
|
||||||
utils.add_hook(handle_privmsg, 'NOTICE')
|
utils.add_hook(handle_messages, cmd)
|
||||||
|
|
||||||
def handle_kick(irc, source, command, args):
|
def handle_kick(irc, source, command, args):
|
||||||
channel = args['channel']
|
channel = args['channel']
|
||||||
|
Loading…
Reference in New Issue
Block a user