changeset 27101:ad04d94e6ddf

Remove code for obsoleted XEP-0022 (Message Events)
author Paul Aurich <paul@darkrain42.org>
date Thu, 11 Jun 2009 22:25:25 +0000
parents 710cb8df1b69
children 2e91b80a9179
files libpurple/protocols/jabber/message.c libpurple/protocols/jabber/message.h
diffstat 2 files changed, 12 insertions(+), 46 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/message.c	Thu Jun 11 10:45:39 2009 +0000
+++ b/libpurple/protocols/jabber/message.c	Thu Jun 11 22:25:25 2009 +0000
@@ -125,15 +125,10 @@
 		}
 	} else {
 		if(jbr) {
-			if(JM_TS_JEP_0085 == (jm->typing_style & JM_TS_JEP_0085)) {
+			if (jm->chat_state != JM_STATE_NONE)
 				jbr->chat_states = JABBER_CHAT_STATES_SUPPORTED;
-			} else {
+			else
 				jbr->chat_states = JABBER_CHAT_STATES_UNSUPPORTED;
-			}
-
-			if(JM_TS_JEP_0022 == (jm->typing_style & JM_TS_JEP_0022)) {
-				jbr->capabilities |= JABBER_CAP_COMPOSING;
-			}
 
 			if(jbr->thread_id)
 				g_free(jbr->thread_id);
@@ -550,6 +545,7 @@
 	jm->js = js;
 	jm->sent = time(NULL);
 	jm->delayed = FALSE;
+	jm->chat_state = JM_STATE_NONE;
 
 	if(type) {
 		if(!strcmp(type, "normal"))
@@ -723,19 +719,14 @@
 			}
 		} else if(!strcmp(child->name, "active") && !strcmp(xmlns,"http://jabber.org/protocol/chatstates")) {
 			jm->chat_state = JM_STATE_ACTIVE;
-			jm->typing_style |= JM_TS_JEP_0085;
 		} else if(!strcmp(child->name, "composing") && !strcmp(xmlns,"http://jabber.org/protocol/chatstates")) {
 			jm->chat_state = JM_STATE_COMPOSING;
-			jm->typing_style |= JM_TS_JEP_0085;
 		} else if(!strcmp(child->name, "paused") && !strcmp(xmlns,"http://jabber.org/protocol/chatstates")) {
 			jm->chat_state = JM_STATE_PAUSED;
-			jm->typing_style |= JM_TS_JEP_0085;
 		} else if(!strcmp(child->name, "inactive") && !strcmp(xmlns,"http://jabber.org/protocol/chatstates")) {
 			jm->chat_state = JM_STATE_INACTIVE;
-			jm->typing_style |= JM_TS_JEP_0085;
 		} else if(!strcmp(child->name, "gone") && !strcmp(xmlns,"http://jabber.org/protocol/chatstates")) {
 			jm->chat_state = JM_STATE_GONE;
-			jm->typing_style |= JM_TS_JEP_0085;
 		} else if(!strcmp(child->name, "event") && !strcmp(xmlns,"http://jabber.org/protocol/pubsub#event")) {
 			xmlnode *items;
 			jm->type = JABBER_MESSAGE_EVENT;
@@ -749,13 +740,7 @@
 			if(timestamp)
 				jm->sent = purple_str_to_time(timestamp, TRUE, NULL, NULL, NULL);
 		} else if(!strcmp(child->name, "x")) {
-			if(!strcmp(xmlns, "jabber:x:event")) {
-				if(xmlnode_get_child(child, "composing")) {
-					if(jm->chat_state == JM_STATE_ACTIVE)
-						jm->chat_state = JM_STATE_COMPOSING;
-					jm->typing_style |= JM_TS_JEP_0022;
-				}
-			} else if(!strcmp(xmlns, "jabber:x:delay")) {
+			if(!strcmp(xmlns, "jabber:x:delay")) {
 				const char *timestamp = xmlnode_get_attrib(child, "stamp");
 				jm->delayed = TRUE;
 				if(timestamp)
@@ -1056,14 +1041,7 @@
 		xmlnode_insert_data(child, jm->thread_id, -1);
 	}
 
-	if(JM_TS_JEP_0022 == (jm->typing_style & JM_TS_JEP_0022)) {
-		child = xmlnode_new_child(message, "x");
-		xmlnode_set_namespace(child, "jabber:x:event");
-		if(jm->chat_state == JM_STATE_COMPOSING || jm->body)
-			xmlnode_new_child(child, "composing");
-	}
-
-	if(JM_TS_JEP_0085 == (jm->typing_style & JM_TS_JEP_0085)) {
+	if (jm->chat_state != JM_STATE_NONE) {
 		child = NULL;
 		switch(jm->chat_state)
 		{
@@ -1180,14 +1158,12 @@
 		if(jbr->thread_id)
 			jm->thread_id = jbr->thread_id;
 
-		if(jbr->chat_states != JABBER_CHAT_STATES_UNSUPPORTED) {
-			jm->typing_style |= JM_TS_JEP_0085;
+		if (jbr->chat_states == JABBER_CHAT_STATES_UNSUPPORTED)
+			jm->chat_state = JM_STATE_NONE;
+		else {
 			/* if(JABBER_CHAT_STATES_UNKNOWN == jbr->chat_states)
 			   jbr->chat_states = JABBER_CHAT_STATES_UNSUPPORTED; */
 		}
-
-		if(jbr->chat_states != JABBER_CHAT_STATES_SUPPORTED)
-			jm->typing_style |= JM_TS_JEP_0022;
 	}
 
 	tmp = purple_utf8_strip_unprintables(msg);
@@ -1265,7 +1241,7 @@
 
 	g_free(resource);
 
-	if(!jbr || !((jbr->capabilities & JABBER_CAP_COMPOSING) || (jbr->chat_states != JABBER_CHAT_STATES_UNSUPPORTED)))
+	if (!jbr || (jbr->chat_states != JABBER_CHAT_STATES_UNSUPPORTED))
 		return 0;
 
 	/* TODO: figure out threading */
@@ -1282,14 +1258,8 @@
 	else
 		jm->chat_state = JM_STATE_ACTIVE;
 
-	if(jbr->chat_states != JABBER_CHAT_STATES_UNSUPPORTED) {
-		jm->typing_style |= JM_TS_JEP_0085;
-		/* if(JABBER_CHAT_STATES_UNKNOWN == jbr->chat_states)
-			jbr->chat_states = JABBER_CHAT_STATES_UNSUPPORTED; */
-	}
-
-	if(jbr->chat_states != JABBER_CHAT_STATES_SUPPORTED)
-		jm->typing_style |= JM_TS_JEP_0022;
+	/* if(JABBER_CHAT_STATES_UNKNOWN == jbr->chat_states)
+		jbr->chat_states = JABBER_CHAT_STATES_UNSUPPORTED; */
 
 	jabber_message_send(jm);
 	jabber_message_free(jm);
--- a/libpurple/protocols/jabber/message.h	Thu Jun 11 10:45:39 2009 +0000
+++ b/libpurple/protocols/jabber/message.h	Thu Jun 11 22:25:25 2009 +0000
@@ -53,11 +53,7 @@
 	char *error;
 	char *thread_id;
 	enum {
-		JM_TS_NONE = 0,
-		JM_TS_JEP_0022 = 0x1,
-		JM_TS_JEP_0085 = 0x2
-	} typing_style;
-	enum {
+		JM_STATE_NONE,
 		JM_STATE_ACTIVE,
 		JM_STATE_COMPOSING,
 		JM_STATE_PAUSED,