changeset 27588:ed284238509b

Use Entity Capabilities to pick up Chat States support. Refs #4650.
author Paul Aurich <paul@darkrain42.org>
date Sun, 12 Jul 2009 05:25:59 +0000
parents 5d82a9298ed5
children ecae4c8ee0c3 a08e84032814
files libpurple/protocols/jabber/message.c libpurple/protocols/jabber/presence.c
diffstat 2 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/message.c	Sun Jul 12 05:14:32 2009 +0000
+++ b/libpurple/protocols/jabber/message.c	Sun Jul 12 05:25:59 2009 +0000
@@ -87,6 +87,9 @@
 	}
 
 	if(!jm->xhtml && !jm->body) {
+		if (jbr)
+			jbr->chat_states = JABBER_CHAT_STATES_SUPPORTED;
+
 		if(JM_STATE_COMPOSING == jm->chat_state) {
 			serv_got_typing(jm->js->gc, from, 0, PURPLE_TYPING);
 		} else if(JM_STATE_PAUSED == jm->chat_state) {
--- a/libpurple/protocols/jabber/presence.c	Sun Jul 12 05:14:32 2009 +0000
+++ b/libpurple/protocols/jabber/presence.c	Sun Jul 12 05:25:59 2009 +0000
@@ -447,6 +447,9 @@
 	jbr->caps.info = info;
 	jbr->caps.exts = exts;
 
+	if (info == NULL)
+		goto out;
+
 	if (!jbr->commands_fetched && jabber_resource_has_capability(jbr, "http://jabber.org/protocol/commands")) {
 		JabberIq *iq = jabber_iq_new_query(userdata->js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#items");
 		xmlnode *query = xmlnode_get_child_with_namespace(iq->node, "query", "http://jabber.org/protocol/disco#items");
@@ -458,6 +461,12 @@
 		jbr->commands_fetched = TRUE;
 	}
 
+	if (jabber_resource_has_capability(jbr, "http://jabber.org/protocol/chatstates"))
+		jbr->chat_states = JABBER_CHAT_STATES_SUPPORTED;
+	else
+		jbr->chat_states = JABBER_CHAT_STATES_UNSUPPORTED;
+
+out:
 	g_free(userdata->from);
 	g_free(userdata);
 }