im.pidgin.pidgin: b8c613f6120f38c693118573e89ea1a032781b31

jeff2 at soc.pidgin.im jeff2 at soc.pidgin.im
Sat Jan 26 23:40:46 EST 2008


-----------------------------------------------------------------
Revision: b8c613f6120f38c693118573e89ea1a032781b31
Ancestor: edd672a79a29dc97a942d9520e7a3b93519af9d4
Author: jeff2 at soc.pidgin.im
Date: 2008-01-20T06:13:25
Branch: im.pidgin.pidgin

Modified files:
        libpurple/protocols/myspace/myspace.c

ChangeLog: 

a

-------------- next part --------------
============================================================
--- libpurple/protocols/myspace/myspace.c	edc2cc1f9bfecf255b4df9b072d9fc23cc74abda
+++ libpurple/protocols/myspace/myspace.c	d4f801689f5236f4351f3d883408ff681b26584d
@@ -1210,12 +1210,12 @@ static const gchar *
  *
  */
 static const gchar *
-msim_uid2username_from_blist(MsimSession *session, guint wanted_uid)
+msim_uid2username_from_blist(PurpleAccount *account, guint wanted_uid)
 {
 	GSList *buddies, *cur;
 	gchar *ret;
 
-	buddies = purple_find_buddies(session->account, NULL); 
+	buddies = purple_find_buddies(account, NULL); 
 
 	if (!buddies)
 	{
@@ -1266,7 +1266,7 @@ msim_preprocess_incoming(MsimSession *se
 		/* 'f' = userid message is from, in buddy messages */
 		uid = msim_msg_get_integer(msg, "f");
 
-		username = msim_uid2username_from_blist(session, uid); 
+		username = msim_uid2username_from_blist(session->account, uid); 
 
 		if (username) {
 			/* Know username already, use it. */
@@ -2338,7 +2338,6 @@ const char *msim_normalize(const PurpleA
  */
 const char *msim_normalize(const PurpleAccount *account, const char *str) {
 	static char normalized[BUF_LEN];
-	MsimSession *session;
 	char *tmp1, *tmp2;
 	int i, j;
 	guint id;
@@ -2350,25 +2349,20 @@ const char *msim_normalize(const PurpleA
 		const char *username;
 
 		/* If the account does not exist, we can't look up the user. */
-		g_return_val_if_fail(account != NULL, str);
-		g_return_val_if_fail(account->gc != NULL, str);
-		g_return_val_if_fail(account->gc->state == PURPLE_CONNECTED, str);
+                if (!account)
+                    return str;
 
-		purple_debug_info("msim_normalize", "%s is a userid\n",str);
-
-		session = (MsimSession *)account->gc->proto_data;
 		id = atol(str);
-		username = msim_uid2username_from_blist(session, id);
+		username = msim_uid2username_from_blist(
+                        (PurpleAccount *)account, id);
 		if (!username) {
 			/* Not in buddy list... scheisse... TODO: Manual Lookup! Bug #4631 */
 			/* Note: manual lookup using msim_lookup_user() is a problem inside 
 			 * msim_normalize(), because msim_lookup_user() calls a callback function
 			 * when the user information has been looked up, but msim_normalize() expects
 			 * the result immediately. */
-			purple_debug_info("msim_normalize", "Failure! %s is not in my list\n", str);
 			strncpy(normalized, str, BUF_LEN);
 		} else {
-			purple_debug_info("msim_normalize","%d is %s\n", id, username);
 			strncpy(normalized, username, BUF_LEN);
 		}
 	} else {
@@ -2762,7 +2756,7 @@ msim_add_contact_from_server_cb(MsimSess
 	uid = msim_msg_get_integer(contact_info, "ContactID");
 
 	if (!user_lookup_info) {
-		username = g_strdup(msim_uid2username_from_blist(session, uid));
+		username = g_strdup(msim_uid2username_from_blist(session->account, uid));
 		g_return_if_fail(username != NULL);
 	} else {
 		user_lookup_info_body = msim_msg_get_dictionary(user_lookup_info, "body");
@@ -2830,7 +2824,7 @@ msim_add_contact_from_server(MsimSession
 	g_return_val_if_fail(uid != 0, FALSE);
 
 	/* Lookup the username, since NickName and IMName is unreliable */
-	username = msim_uid2username_from_blist(session, uid);
+	username = msim_uid2username_from_blist(session->account, uid);
 	if (!username) {
 		gchar *uid_str;
 


More information about the Commits mailing list