- xmpp = MUCBot(JID, PASS, ROOM, NICK)
- xmpp.register_bot_plugin(Ping)
- # Connect to the XMPP server and start processing XMPP stanzas.
- if xmpp.connect():
- xmpp.process(block=True)
- xmpp.shutdown_plugins()
- xmpp.log.info('Done')
- else:
- xmpp.log.info('Unable to connect.')
+ xmpp = MUCBot(JID, PASS, ROOM, NICK)
+ xmpp.register_bot_plugin(Ping)
+ # Connect to the XMPP server and start processing XMPP stanzas.
+ try:
+ xmpp.connect()
+ xmpp.process()
+ except KeyboardInterrupt:
+ xmpp.shutdown_plugins()