jabber_mirror: Do domain replacement more safely

(imported from commit 1a6a3d23120f06d54bc954d4e89d5fccf666332e)
This commit is contained in:
Zev Benjamin 2014-02-21 13:32:18 -05:00
parent 8d787f888f
commit f18525acd1

View file

@ -165,7 +165,9 @@ class ZulipToJabberBot(zulip.Client):
for recipient in msg['display_recipient']:
if recipient["email"] == self.email:
continue
jabber_recipient = recipient['email'].replace(options.zulip_domain, options.jabber_domain)
recip_email = recipient['email']
username = recip_email[:recip_email.rfind(options.zulip_domain)]
jabber_recipient = username + options.jabber_domain
outgoing = self.jabber.make_message(
mto = jabber_recipient,
mbody = msg['content'],