diff libpurple/protocols/msn/user.c @ 23543:80d09f42b157

A patch from felipec to consistently use NULL for the status of offline MSN buddies. References #5377. And http://pidgin.im/pipermail/devel/2008-June/006136.html
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sun, 22 Jun 2008 21:31:58 +0000
parents 4cb1efafa410
children 7bceac816e19
line wrap: on
line diff
--- a/libpurple/protocols/msn/user.c	Sun Jun 22 20:35:47 2008 +0000
+++ b/libpurple/protocols/msn/user.c	Sun Jun 22 21:31:58 2008 +0000
@@ -82,37 +82,36 @@
 msn_user_update(MsnUser *user)
 {
 	PurpleAccount *account;
+	gboolean offline;
 
 	account = user->userlist->session->account;
 
-	if (user->status != NULL) {
-		gboolean offline = (strcmp(user->status, "offline") == 0);
+	offline = (user->status == NULL);
 
-		if (!offline) {
-			purple_prpl_got_user_status(account, user->passport, user->status,
-					"message", user->statusline, NULL);
+	if (!offline) {
+		purple_prpl_got_user_status(account, user->passport, user->status,
+				"message", user->statusline, NULL);
+	} else {
+		if (user->mobile) {
+			purple_prpl_got_user_status(account, user->passport, "mobile", NULL);
+			purple_prpl_got_user_status(account, user->passport, "available", NULL);
 		} else {
-			if (user->mobile) {
-				purple_prpl_got_user_status(account, user->passport, "mobile", NULL);
-				purple_prpl_got_user_status(account, user->passport, "available", NULL);
-			} else {
-				purple_prpl_got_user_status(account, user->passport, user->status, NULL);
-			}
+			purple_prpl_got_user_status(account, user->passport, "offline", NULL);
 		}
+	}
 
-		if (!offline || !user->mobile) {
-			purple_prpl_got_user_status_deactive(account, user->passport, "mobile");
-		}
+	if (!offline || !user->mobile) {
+		purple_prpl_got_user_status_deactive(account, user->passport, "mobile");
+	}
 
-		if (!offline && user->media.title) {
-			purple_prpl_got_user_status(account, user->passport, "tune",
-					PURPLE_TUNE_ARTIST, user->media.artist,
-					PURPLE_TUNE_ALBUM, user->media.album,
-					PURPLE_TUNE_TITLE, user->media.title,
-					NULL);
-		} else {
-			purple_prpl_got_user_status_deactive(account, user->passport, "tune");
-		}
+	if (!offline && user->media.title) {
+		purple_prpl_got_user_status(account, user->passport, "tune",
+				PURPLE_TUNE_ARTIST, user->media.artist,
+				PURPLE_TUNE_ALBUM, user->media.album,
+				PURPLE_TUNE_TITLE, user->media.title,
+				NULL);
+	} else {
+		purple_prpl_got_user_status_deactive(account, user->passport, "tune");
 	}
 
 	if (user->idle)
@@ -126,6 +125,11 @@
 {
 	const char *status;
 
+	if (state == NULL) {
+		user->status = NULL;
+		return;
+	}
+
 	if (!g_ascii_strcasecmp(state, "BSY"))
 		status = "busy";
 	else if (!g_ascii_strcasecmp(state, "BRB"))