1. Miki Tebeka
  2. logbot

Commits

Miki Tebeka  committed a34e46c

--use-tls and typo

  • Participants
  • Parent commits 004e9fe
  • Branches default

Comments (0)

Files changed (2)

File logbot/__main__.py

View file
     parser.add_argument('--passwd', help='jabber password', default=None)
     parser.add_argument('--host', help='jabber host', default='localhost')
     parser.add_argument('--port', help='jabber port', default=5222, type=int)
+    parser.add_argument('--use-tls', help='use tls',
+                        action='store_true', default=False)
     parser.add_argument('room', help='room to log')  # FIXME: Rooms
     parser.add_argument('--version', action='version',
                         version='logbot {}'.format(__version__))
 
     run_thread(httpd.run)
 
-    bot.run(args.host, args.port, user, passwd, [args.room])
+    bot.run(args.host, args.port, user, passwd, [args.room], args.use_tls)
 
 
 if __name__ == '__main__':

File logbot/bot.py

View file
     def publish(self, xmpp_msg):
         msg = Message(
             user=self.xmpp_user(xmpp_msg),
-            message=xmpp_msg['body'],
+            content=xmpp_msg['body'],
             time=datetime.now(),
         )
         publish(msg)
 
 
-def run(host, port, user, passwd, rooms):
+def run(host, port, user, passwd, rooms, use_tls=False):
     xmpp = LogBot(user, passwd, rooms)
 
     signal(SIGINT, lambda signum, frame: xmpp.disconnect())
 
-    xmpp.connect((host, port))
+    xmpp.connect((host, port), use_tls=use_tls)
     xmpp.process(block=True)