changeset 21629:6636546aeacf

We need to work with the exclusive status.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Mon, 26 Nov 2007 05:39:37 +0000
parents 495f2f1de998
children ed57eeb486d5
files libpurple/protocols/jabber/presence.c
diffstat 1 files changed, 14 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/presence.c	Mon Nov 26 05:36:09 2007 +0000
+++ b/libpurple/protocols/jabber/presence.c	Mon Nov 26 05:39:37 2007 +0000
@@ -99,8 +99,6 @@
 {
 	PurpleConnection *gc = NULL;
 	JabberStream *js = NULL;
-	gboolean disconnected;
-	int primitive;
 	xmlnode *presence, *x, *photo;
 	char *stripped = NULL;
 	JabberBuddyState state;
@@ -108,22 +106,26 @@
 	const char *artist = NULL, *title = NULL, *source = NULL, *uri = NULL, *track = NULL;
 	int length = -1;
 	gboolean allowBuzz;
-	PurplePresence *p = purple_account_get_presence(account);
+	PurplePresence *p;
 	PurpleStatus *tune;
 
+	if (purple_account_is_disconnected(account))
+		return;
+
+	p = purple_account_get_presence(account);
 	if (NULL == status) {
 		status = purple_presence_get_active_status(p);
 	}
 
-	if(!purple_status_is_active(status))
-		return;
-
-	disconnected = purple_account_is_disconnected(account);
-
-	if(disconnected)
-		return;
-
-	primitive = purple_status_type_get_primitive(purple_status_get_type(status));
+	if (purple_status_is_exclusive(status)) {
+		/* An exclusive status can't be deactivated. You should just
+		 * activate some other exclusive status. */
+		if (!purple_status_is_active(status))
+			return;
+	} else {
+		/* Work with the exclusive status. */
+		status = purple_presence_get_active_status(p);
+	}
 
 	gc = purple_account_get_connection(account);
 	js = gc->proto_data;