From 1b946b85651422ced736ecf0a393bd0f5d0185ea Mon Sep 17 00:00:00 2001 From: Zev Benjamin Date: Fri, 28 Feb 2014 15:11:41 -0500 Subject: [PATCH] jabber_mirror: Mirror Jabber room 'foo' to stream 'foo/xmpp' (imported from commit db771b5b5056cdca5780b90f66924c6f9ae3e84d) --- bots/jabber_mirror.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bots/jabber_mirror.py b/bots/jabber_mirror.py index f67dea8..b1fa75e 100755 --- a/bots/jabber_mirror.py +++ b/bots/jabber_mirror.py @@ -35,7 +35,10 @@ import re __version__ = "1.1" def room_to_stream(room): - return str(room).rpartition("@")[0] + return str(room).rpartition("@")[0] + "/xmpp" + +def stream_to_room(stream): + return stream.rpartition("/xmpp")[0] def jid_to_zulip(jid): return "%s@%s" % (str(jid).rpartition("@")[0], options.zulip_domain) @@ -151,7 +154,8 @@ class ZulipToJabberBot(object): logging.exception("Exception forwarding Zulip => Jabber") def stream_message(self, msg): - jabber_recipient = "%s@%s" % (msg['display_recipient'], options.conference_domain) + room = stream_to_room(msg['display_recipient']) + jabber_recipient = "%s@%s" % (room, options.conference_domain) outgoing = self.jabber.make_message( mto = jabber_recipient, mbody = msg['content'],