jabber_mirror: Separate Jabber options into their own group
(imported from commit 223ecceee956ab30b1647eb0925d11982b2ef37d)
This commit is contained in:
parent
0c9a5179ae
commit
5fe2caeb5e
|
@ -180,34 +180,37 @@ if __name__ == '__main__':
|
||||||
format='%(levelname)-8s %(message)s')
|
format='%(levelname)-8s %(message)s')
|
||||||
|
|
||||||
parser = optparse.OptionParser()
|
parser = optparse.OptionParser()
|
||||||
parser.add_option('--openfire',
|
|
||||||
default=False,
|
|
||||||
action='store_true',
|
|
||||||
help="Set if Jabber server is an OpenFire server")
|
|
||||||
parser.add_option('--password',
|
|
||||||
default=None,
|
|
||||||
action='store',
|
|
||||||
help="Your Jabber password")
|
|
||||||
parser.add_option('--jabber-domain',
|
|
||||||
default=None,
|
|
||||||
action='store',
|
|
||||||
help="Your Jabber server")
|
|
||||||
parser.add_option('--stream-mirror',
|
parser.add_option('--stream-mirror',
|
||||||
default=False,
|
default=False,
|
||||||
action='store_true')
|
action='store_true')
|
||||||
parser.add_option('--no-use-tls',
|
|
||||||
|
jabber_group = optparse.OptionGroup(parser, "Jabber configuration")
|
||||||
|
jabber_group.add_option('--openfire',
|
||||||
|
default=False,
|
||||||
|
action='store_true',
|
||||||
|
help="Set if Jabber server is an OpenFire server")
|
||||||
|
jabber_group.add_option('--jabber-password',
|
||||||
|
default=None,
|
||||||
|
action='store',
|
||||||
|
help="Your Jabber password")
|
||||||
|
jabber_group.add_option('--jabber-domain',
|
||||||
|
default=None,
|
||||||
|
action='store',
|
||||||
|
help="Your Jabber server")
|
||||||
|
jabber_group.add_option('--no-use-tls',
|
||||||
default=False,
|
default=False,
|
||||||
action='store_true')
|
action='store_true')
|
||||||
parser.add_option('--conference-domain',
|
jabber_group.add_option('--conference-domain',
|
||||||
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)")
|
||||||
|
|
||||||
|
parser.add_option_group(jabber_group)
|
||||||
parser.add_option_group(zulip.generate_option_group(parser, "zulip-"))
|
parser.add_option_group(zulip.generate_option_group(parser, "zulip-"))
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
if options.password is None:
|
if options.jabber_password is None:
|
||||||
options.password = getpass.getpass("Jabber password: ")
|
options.jabber_password = getpass.getpass("Jabber password: ")
|
||||||
if options.jabber_domain is None:
|
if options.jabber_domain is None:
|
||||||
sys.exit("Must specify a Jabber server")
|
sys.exit("Must specify a Jabber server")
|
||||||
|
|
||||||
|
@ -216,7 +219,7 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
zulip = ZulipToJabberBot(email=options.zulip_email, api_key=options.zulip_api_key);
|
zulip = ZulipToJabberBot(email=options.zulip_email, api_key=options.zulip_api_key);
|
||||||
rooms = [s['name'] for s in zulip.get_streams()['streams']]
|
rooms = [s['name'] for s in zulip.get_streams()['streams']]
|
||||||
xmpp = JabberToZulipBot(jabber_username, options.password, rooms,
|
xmpp = JabberToZulipBot(jabber_username, options.jabber_password, rooms,
|
||||||
openfire=options.openfire)
|
openfire=options.openfire)
|
||||||
xmpp.connect(use_tls=not options.no_use_tls)
|
xmpp.connect(use_tls=not options.no_use_tls)
|
||||||
xmpp.process(block=False)
|
xmpp.process(block=False)
|
||||||
|
|
Loading…
Reference in a new issue