Conversation: who added
authorRagner Magalhaes <ragner.magalhaes@openbossa.org>
Tue, 2 Dec 2008 20:45:16 +0000 (20:45 +0000)
committerAnderson Briglia <anderson.briglia@openbossa.org>
Sat, 28 Feb 2009 21:11:13 +0000 (17:11 -0400)
Who variable added to write_im callback. Now, it's possible to know who is sending a message.
Take care to check if "who" is not None.

Signed-off-by: Anderson Briglia <anderson.briglia@indt.org.br>

git-svn-id: https://garage.maemo.org/svn/carman/branches/carman-0.7-beta2/python-purple@1347 596f6dd7-e928-0410-a184-9e12fd12cf7e

conversation.pyx
conversation_cbs.pxd
nullclient-ecore.py

index f743e41..6b44c63 100644 (file)
@@ -81,4 +81,5 @@ cdef class Conversation:
         conversation.c_purple_conversations_get_handle()
 
     def destroy(self):
         conversation.c_purple_conversations_get_handle()
 
     def destroy(self):
+        print "[DEBUG]: Destroy conversation: %s" % self.name
         conversation.c_purple_conversation_destroy(self.__conv)
         conversation.c_purple_conversation_destroy(self.__conv)
index 53729d2..4f8852a 100644 (file)
@@ -56,8 +56,12 @@ cdef void write_im (conversation.PurpleConversation *conv, const_char *who,
                     const_char *message, conversation.PurpleMessageFlags flags,
                     time_t mtime):
     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation", "write_im\n")
                     const_char *message, conversation.PurpleMessageFlags flags,
                     time_t mtime):
     debug.c_purple_debug(debug.PURPLE_DEBUG_INFO, "conversation", "write_im\n")
+    if who:
+        sender = <char *> who
+    else:
+        sender = None
     try:
     try:
-        (<object>conversation_cbs["write_im"])(conv.account.username, <char *> message)
+        (<object>conversation_cbs["write_im"])(conv.account.username, sender, <char *> message)
     except KeyError:
         pass
 
     except KeyError:
         pass
 
index 8825af4..cd99eec 100644 (file)
@@ -211,8 +211,12 @@ class MainWindow:
         if callable(cb):
             self.quit_cb = cb
 
         if callable(cb):
             self.quit_cb = cb
 
-    def _write_im_cb(self, name, message):
-        self.txt_area.text +=  str(name) + ": " + str(message) + "<br> "
+    def _write_im_cb(self, name, who, message):
+        if who:
+            w = who.split("/")[0]
+            self.txt_area.text +=  w + ": " + str(message) + "<br> "
+        else:
+            self.txt_area.text += str(name) + ": " + str(message) + "<br> "
         self._window.show_all()
 
 
         self._window.show_all()