3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-01-11 20:52:42 +01:00

relay_clientbot: Implement relaying of text sent from service bots

This commit is contained in:
James Lu 2016-09-06 19:53:31 -07:00
parent dd083b9b8d
commit bbdffc797d

View File

@ -87,6 +87,12 @@ def cb_relay_core(irc, source, command, args):
text_template = string.Template(text_template)
if text_template:
if irc.isServiceBot(source):
# HACK: service bots are global and lack the relay state we look for.
# just pretend the message comes from the current network.
log.debug('(%s) relay_cb_core: Overriding network origin to local (source=%s)', irc.name, source)
netname = irc.name
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:
@ -100,6 +106,7 @@ def cb_relay_core(irc, source, command, args):
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
netname = conf.conf['servers'][netname]['netname']
except KeyError: