diff libpurple/protocols/oscar/oscar.c @ 15524:84b3ab83df35

Use the status API to handle mobileness, and convert AIM to use it. This makes mobile buddies prioritze lower in Perons, and ensures the UI is notified of changes in mobileness. Other protocols to follow.
author Sean Egan <seanegan@gmail.com>
date Sun, 04 Feb 2007 02:31:04 +0000
parents 0b6f337a46d5
children a7b4a4c2cfcf
line wrap: on
line diff
--- a/libpurple/protocols/oscar/oscar.c	Sat Feb 03 23:32:43 2007 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Sun Feb 04 02:31:04 2007 +0000
@@ -58,6 +58,7 @@
 #define OSCAR_STATUS_ID_OCCUPIED    "occupied"
 #define OSCAR_STATUS_ID_FREE4CHAT   "free4chat"
 #define OSCAR_STATUS_ID_CUSTOM      "custom"
+#define OSCAR_STATUS_ID_MOBILE	    "mobile"
 
 #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3"
 
@@ -1767,6 +1768,13 @@
 											 info->status, info->status_len);
 	}
 
+	if (info->flags & AIM_FLAG_WIRELESS || info->capabilities & OSCAR_CAPABILITY_HIPTOP)
+	{
+		gaim_prpl_got_user_status(account, info->sn, OSCAR_STATUS_ID_MOBILE, NULL);
+	} else {
+		gaim_prpl_got_user_status_deactive(account, info->sn, OSCAR_STATUS_ID_MOBILE);
+	}
+
 	if (have_status_message)
 	{
 		gaim_prpl_got_user_status(account, info->sn, status_id,
@@ -1881,7 +1889,7 @@
 	va_end(ap);
 
 	gaim_prpl_got_user_status(account, info->sn, OSCAR_STATUS_ID_OFFLINE, NULL);
-
+	gaim_prpl_got_user_status_deactive(account, info->sn, OSCAR_STATUS_ID_MOBILE);
 	g_hash_table_remove(od->buddyinfo, gaim_normalize(gc->account, info->sn));
 
 	return 1;
@@ -5431,10 +5439,6 @@
 	if (userinfo != NULL ) {
 		if (userinfo->flags & AIM_FLAG_ADMINISTRATOR)
 			return "admin";
-		if (userinfo->flags & AIM_FLAG_WIRELESS)
-			return "mobile";
-		if (userinfo->capabilities & OSCAR_CAPABILITY_HIPTOP)
-			return "mobile";
 		if (userinfo->flags & AIM_FLAG_ACTIVEBUDDY)
 			return "bot";
 		if (userinfo->flags & AIM_FLAG_AOL)
@@ -5718,6 +5722,9 @@
 									 NULL, TRUE, TRUE, FALSE);
 	status_types = g_list_prepend(status_types, type);
 
+	type = gaim_status_type_new_full(GAIM_STATUS_MOBILE, OSCAR_STATUS_ID_MOBILE, NULL, FALSE, FALSE, TRUE);
+	status_types = g_list_prepend(status_types, type);
+
 	/* ICQ-specific status types */
 	type = gaim_status_type_new_with_attrs(GAIM_STATUS_UNAVAILABLE,
 				OSCAR_STATUS_ID_OCCUPIED,