jabber_mirror: Require the --conference-domain option when running in 'public' mode

(imported from commit 1dd564a212538e292ffc8b7a52caf7eae66d4475)
This commit is contained in:
Zev Benjamin 2014-02-26 15:23:47 -05:00
parent e9684a01fd
commit f1e3d9ab76

View file

@ -66,7 +66,7 @@ class JabberToZulipBot(ClientXMPP):
def session_start(self, event): def session_start(self, event):
self.get_roster() self.get_roster()
self.send_presence() self.send_presence()
if options.mode == "public" and options.conference_domain is not None: if options.mode == "public":
for room in self.rooms: for room in self.rooms:
self.plugin['xep_0045'].joinMUC(room + "@" + options.conference_domain, self.plugin['xep_0045'].joinMUC(room + "@" + options.conference_domain,
self.nick) self.nick)
@ -221,6 +221,9 @@ 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 options.jabber_password is None: if options.jabber_password is None:
options.jabber_password = getpass.getpass("Jabber password: ") options.jabber_password = getpass.getpass("Jabber password: ")
if options.jabber_domain is None: if options.jabber_domain is None: