changeset 24351:9d2ae3639079

merge of 'b1b60077658bb1e01f71e81175786a8e7c3c4916' and 'd74085222c90ffa62b79ed27984dded8a8725c00'
author Mark Doliner <mark@kingant.net>
date Thu, 13 Nov 2008 19:11:19 +0000
parents 1406a2fa649d (diff) e71c1fad229f (current diff)
children b44e1bbd5b4a
files
diffstat 3 files changed, 20 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/dbus-analyze-functions.py	Thu Nov 13 09:19:17 2008 +0000
+++ b/libpurple/dbus-analyze-functions.py	Thu Nov 13 19:11:19 2008 +0000
@@ -372,13 +372,13 @@
 
     def inputsimple(self, type, name, us):
         if us:
+            self.cdecls.append("\tdbus_uint32_t %s;" % name)
+            self.cparams.append(("UINT32", name))
+            self.addintype("u", name)
+        else:
             self.cdecls.append("\tdbus_int32_t %s;" % name)
             self.cparams.append(("INT32", name))
             self.addintype("i", name)
-        else:
-            self.cdecls.append("\tdbus_uint32_t %s;" % name)
-            self.cparams.append(("UINT32", name))
-            self.addintype("u", name)
 
     def inputstring(self, type, name, us):
         if us:
--- a/libpurple/protocols/myspace/myspace.c	Thu Nov 13 09:19:17 2008 +0000
+++ b/libpurple/protocols/myspace/myspace.c	Thu Nov 13 19:11:19 2008 +0000
@@ -680,20 +680,34 @@
 msim_incoming_im(MsimSession *session, MsimMessage *msg)
 {
 	gchar *username, *msg_msim_markup, *msg_purple_markup;
+	gchar *userid;
 	time_t time_received;
+	PurpleConversation *conv;
 
 	g_return_val_if_fail(MSIM_SESSION_VALID(session), FALSE);
 	g_return_val_if_fail(msg != NULL, FALSE);
 
 	username = msim_msg_get_string(msg, "_username");
+	/* I know this isn't really a string... but we need it to be one for
+	 * purple_find_conversation_with_account(). */
+	userid = msim_msg_get_string(msg, "f");
 	g_return_val_if_fail(username != NULL, FALSE);
 
+	purple_debug_info("msim_incoming_im", "UserID is %s", userid);
+
 	if (msim_is_userid(username)) {
 		purple_debug_info("msim", "Ignoring message from spambot (%s) on account %s\n",
 				username, purple_account_get_username(session->account));
 		g_free(username);
 		return FALSE;
 	}
+	
+	/* See if a conversation with their UID already exists...*/
+	conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, userid, session->account);
+	if (conv) {
+		/* Since the conversation exists... We need to normalize it */
+		purple_conversation_set_name(conv, username);
+	}
 
 	msg_msim_markup = msim_msg_get_string(msg, "msg");
 	g_return_val_if_fail(msg_msim_markup != NULL, FALSE);
@@ -703,6 +717,7 @@
 
 	time_received = msim_msg_get_integer(msg, "date");
 	if (!time_received) {
+		purple_debug_info("msim_incoming_im", "date in message not set.\n");
 		time_received = time(NULL);
 	}
 
--- a/libpurple/protocols/myspace/myspace.h	Thu Nov 13 09:19:17 2008 +0000
+++ b/libpurple/protocols/myspace/myspace.h	Thu Nov 13 19:11:19 2008 +0000
@@ -48,6 +48,7 @@
 #include "request.h"    /* For dialogs used in setting the username */
 #include "xmlnode.h"
 #include "core.h"
+#include "conversation.h" /* For late normalization */
 
 /* MySpaceIM includes */
 #include "persist.h"