mirror of
https://github.com/jlu5/PyLink.git
synced 2025-01-12 05:02:33 +01:00
relay_clientbot: Implement relaying of text sent from service bots
This commit is contained in:
parent
dd083b9b8d
commit
bbdffc797d
@ -87,19 +87,26 @@ def cb_relay_core(irc, source, command, args):
|
|||||||
text_template = string.Template(text_template)
|
text_template = string.Template(text_template)
|
||||||
|
|
||||||
if text_template:
|
if text_template:
|
||||||
# Get the original client that the relay client source was meant for.
|
if irc.isServiceBot(source):
|
||||||
log.debug('(%s) relay_cb_core: Trying to find original sender (user) for %s', irc.name, source)
|
# HACK: service bots are global and lack the relay state we look for.
|
||||||
try:
|
# just pretend the message comes from the current network.
|
||||||
origuser = relay.getOrigUser(irc, source) or args['userdata'].remote
|
log.debug('(%s) relay_cb_core: Overriding network origin to local (source=%s)', irc.name, source)
|
||||||
except (AttributeError, KeyError):
|
netname = irc.name
|
||||||
log.debug('(%s) relay_cb_core: Trying to find original sender (server) for %s. serverdata=%s', irc.name, source, args.get('serverdata'))
|
else:
|
||||||
|
# Get the original client that the relay client source was meant for.
|
||||||
|
log.debug('(%s) relay_cb_core: Trying to find original sender (user) for %s', irc.name, source)
|
||||||
try:
|
try:
|
||||||
origuser = ((args.get('serverdata') or irc.servers[source]).remote,)
|
origuser = relay.getOrigUser(irc, source) or args['userdata'].remote
|
||||||
except (AttributeError, KeyError):
|
except (AttributeError, KeyError):
|
||||||
return
|
log.debug('(%s) relay_cb_core: Trying to find original sender (server) for %s. serverdata=%s', irc.name, source, args.get('serverdata'))
|
||||||
|
try:
|
||||||
|
origuser = ((args.get('serverdata') or irc.servers[source]).remote,)
|
||||||
|
except (AttributeError, KeyError):
|
||||||
|
return
|
||||||
|
|
||||||
|
log.debug('(%s) relay_cb_core: Original sender found as %s', irc.name, origuser)
|
||||||
|
netname = origuser[0]
|
||||||
|
|
||||||
log.debug('(%s) relay_cb_core: Original sender found as %s', irc.name, origuser)
|
|
||||||
netname = origuser[0]
|
|
||||||
try: # Try to get the full network name
|
try: # Try to get the full network name
|
||||||
netname = conf.conf['servers'][netname]['netname']
|
netname = conf.conf['servers'][netname]['netname']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
Loading…
Reference in New Issue
Block a user