Permalink
Browse files

Example 59: A method to handle received messages as they come in from…

… SleekXMPP.

Since this method isn't being called anywhere yet, it's kind of useless. But we'll hook it up right away.
  • Loading branch information...
1 parent 312eb3e commit ef7c07b1677d2fa2fc6b27392cda6bc2b1a82b4a @buchuki committed Jul 23, 2013
Showing with 12 additions and 0 deletions.
  1. +12 −0 orkiv/__main__.py
View
12 orkiv/__main__.py
@@ -140,6 +140,18 @@ def show_buddy_chat(self, jabber_id):
self.chat_windows[jabber_id] = ChatWindow(jabber_id=jabber_id)
self.add_widget(self.chat_windows[jabber_id])
+ def handle_xmpp_message(self, message):
+ if message['type'] not in ['normal', 'chat']:
+ return
+ jabber_id = message['from'].bare
+
+ if jabber_id not in self.chat_windows:
+ self.chat_windows[jabber_id] = ChatWindow(jabber_id=jabber_id)
+ self.chat_windows[jabber_id].chat_log_label.text += "(%s) %s: %s\n" % (
+ datetime.datetime.now().strftime("%Y-%m-%d %H:%M"),
+ jabber_id,
+ message['body'])
+
class Orkiv(App):
def __init__(self):

0 comments on commit ef7c07b

Please sign in to comment.