Mercurial > pidgin
changeset 24406:1406a2fa649d
A patch from Jaywalker to better handle conversations by user ID vs.
username.
Fixes #4631
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Thu, 13 Nov 2008 18:55:04 +0000 |
parents | 965699159512 |
children | 9d2ae3639079 |
files | libpurple/protocols/myspace/myspace.c libpurple/protocols/myspace/myspace.h |
diffstat | 2 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/myspace/myspace.c Thu Nov 13 17:38:36 2008 +0000 +++ b/libpurple/protocols/myspace/myspace.c Thu Nov 13 18:55:04 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 17:38:36 2008 +0000 +++ b/libpurple/protocols/myspace/myspace.h Thu Nov 13 18:55:04 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"