changeset 22159:e5883c888fd2

a
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Sun, 20 Jan 2008 06:13:25 +0000
parents 327541a4c302
children 2cae01b9fc14
files libpurple/protocols/myspace/myspace.c
diffstat 1 files changed, 10 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/myspace/myspace.c	Sun Jan 20 05:52:48 2008 +0000
+++ b/libpurple/protocols/myspace/myspace.c	Sun Jan 20 06:13:25 2008 +0000
@@ -1210,12 +1210,12 @@
  *
  */
 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 @@
 		/* '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 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 *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);
-
-		purple_debug_info("msim_normalize", "%s is a userid\n",str);
-
-		session = (MsimSession *)account->gc->proto_data;
+                if (!account)
+                    return str;
+
 		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 @@
 	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 @@
 	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;