jabber_mirror: Allow the MUC nickname to be specified

This allows users to run the public mirror as a regular user.

(imported from commit 3512dacf329dadc784d7be492ad290b17082bad4)
This commit is contained in:
Zev Benjamin 2014-03-03 14:52:09 -05:00
parent 88458043bb
commit 2f70b8ff39

View file

@ -61,8 +61,10 @@ def jid_to_zulip(jid):
class JabberToZulipBot(ClientXMPP):
def __init__(self, jid, password, rooms, openfire=False):
self.nick = jid.username
if not jid.resource:
if jid.resource:
self.nick = jid.resource
else:
self.nick = jid.username
jid.resource = "zulip"
ClientXMPP.__init__(self, jid, password)
self.password = password
@ -302,7 +304,11 @@ user and mirrors messages sent to Jabber rooms to Zulip.'''.replace("\n", " "))
jabber_group.add_option('--jid',
default=None,
action='store',
help="Your Jabber JID")
help="Your Jabber JID. If a resource is specified, "
+ "it will be used as the nickname when joining MUCs. "
+ "Specifying the nickname is mostly useful if you want "
+ "to run the public mirror from a regular user instead of "
+ "from a dedicated account.")
jabber_group.add_option('--jabber-password',
default=None,
action='store',