From 3e13e87a846d1825bf24afc54d85def95ae5061d Mon Sep 17 00:00:00 2001 From: Zev Benjamin Date: Mon, 3 Mar 2014 14:41:19 -0500 Subject: [PATCH] jabber_mirror: Guess the conference domain when it isn't specified (imported from commit 3fed4bdf5ca73b3b9d58ec42a2031e75e813bbd2) --- bots/jabber_mirror.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bots/jabber_mirror.py b/bots/jabber_mirror.py index 21e89bd..49d75eb 100755 --- a/bots/jabber_mirror.py +++ b/bots/jabber_mirror.py @@ -311,7 +311,7 @@ user and mirrors messages sent to Jabber rooms to Zulip.'''.replace("\n", " ")) default=None, action='store', help="Your Jabber conference domain (E.g. conference.jabber.example.com). " - + "Required when running in \"public\" mode.") + + "If not specifed, \"conference.\" will be prepended to your JID's domain.") jabber_group.add_option('--openfire', default=None, action='store_true', @@ -353,9 +353,6 @@ user and mirrors messages sent to Jabber rooms to Zulip.'''.replace("\n", " ")) if options.mode not in ('public', 'personal'): sys.exit("Bad value for --mode: must be one of 'public' or 'personal'") - if options.mode == 'public' and options.conference_domain is None: - sys.exit("--conference-domain is required when running in 'public' mode") - if None in (options.jid, options.jabber_password): sys.exit("You must specify your Jabber JID and Jabber password either " + "in the Zulip configuration file or on the commandline") @@ -368,6 +365,10 @@ user and mirrors messages sent to Jabber rooms to Zulip.'''.replace("\n", " ")) jid = JID(options.jid) except InvalidJID as e: sys.exit("Bad JID: %s: %s" % (options.jid, e.message)) + + if options.conference_domain is None: + options.conference_domain = "conference.%s" % (jid.domain,) + xmpp = JabberToZulipBot(jid, options.jabber_password, get_rooms(zulip), openfire=options.openfire)