jabber_mirror: Guess the conference domain when it isn't specified
(imported from commit 3fed4bdf5ca73b3b9d58ec42a2031e75e813bbd2)
This commit is contained in:
parent
d2bc74003e
commit
3e13e87a84
|
@ -311,7 +311,7 @@ user and mirrors messages sent to Jabber rooms to Zulip.'''.replace("\n", " "))
|
||||||
default=None,
|
default=None,
|
||||||
action='store',
|
action='store',
|
||||||
help="Your Jabber conference domain (E.g. conference.jabber.example.com). "
|
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',
|
jabber_group.add_option('--openfire',
|
||||||
default=None,
|
default=None,
|
||||||
action='store_true',
|
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'):
|
if options.mode not in ('public', 'personal'):
|
||||||
sys.exit("Bad value for --mode: must be one of 'public' or '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):
|
if None in (options.jid, options.jabber_password):
|
||||||
sys.exit("You must specify your Jabber JID and Jabber password either "
|
sys.exit("You must specify your Jabber JID and Jabber password either "
|
||||||
+ "in the Zulip configuration file or on the commandline")
|
+ "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)
|
jid = JID(options.jid)
|
||||||
except InvalidJID as e:
|
except InvalidJID as e:
|
||||||
sys.exit("Bad JID: %s: %s" % (options.jid, e.message))
|
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),
|
xmpp = JabberToZulipBot(jid, options.jabber_password, get_rooms(zulip),
|
||||||
openfire=options.openfire)
|
openfire=options.openfire)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue