diff src/protocols/jabber/message.c @ 8400:0383e55cd658

[gaim-migrate @ 9129] the ietf docs say we SHOULD do this, so we will. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Fri, 05 Mar 2004 19:09:59 +0000
parents 8f4ce853e685
children dc818b62379e
line wrap: on
line diff
--- a/src/protocols/jabber/message.c	Fri Mar 05 16:37:37 2004 +0000
+++ b/src/protocols/jabber/message.c	Fri Mar 05 19:09:59 2004 +0000
@@ -87,8 +87,13 @@
 		else
 			serv_got_typing_stopped(jm->js->gc, from);
 	} else {
-		if(jbr && jm->events & JABBER_MESSAGE_EVENT_COMPOSING)
-			jbr->capabilities |= JABBER_CAP_COMPOSING;
+		if(jbr) {
+			if(jm->events & JABBER_MESSAGE_EVENT_COMPOSING)
+				jbr->capabilities |= JABBER_CAP_COMPOSING;
+			if(jbr->thread_id)
+				g_free(jbr->thread_id);
+			jbr->thread_id = g_strdup(jbr->thread_id);
+		}
 		serv_got_im(jm->js->gc, from, jm->xhtml ? jm->xhtml : jm->body, 0,
 				jm->sent);
 	}
@@ -265,6 +270,9 @@
 		if(!strcmp(child->name, "subject")) {
 			if(!jm->subject)
 				jm->subject = xmlnode_get_data(child);
+		} else if(!strcmp(child->name, "thread")) {
+			if(!jm->thread_id)
+				jm->thread_id = xmlnode_get_data(child);
 		} else if(!strcmp(child->name, "body")) {
 			if(!jm->body)
 				jm->body = xmlnode_to_str(child, NULL);
@@ -385,6 +393,11 @@
 
 	xmlnode_set_attrib(message, "to", jm->to);
 
+	if(jm->thread_id) {
+		child = xmlnode_new_child(message, "thread");
+		xmlnode_insert_data(child, jm->thread_id, -1);
+	}
+
 	if(jm->events || (!jm->body && !jm->xhtml && !jm->subject)) {
 		child = xmlnode_new_child(message, "x");
 		xmlnode_set_attrib(child, "xmlns", "jabber:x:event");
@@ -443,6 +456,8 @@
 	jm->type = JABBER_MESSAGE_CHAT;
 	jm->events = JABBER_MESSAGE_EVENT_COMPOSING;
 	jm->to = g_strdup(who);
+	if(jbr && jbr->thread_id)
+		jm->thread_id = jbr->thread_id;
 
 	buf = g_strdup_printf("<html xmlns='http://jabber.org/protocol/xhtml-im'><body xmlns='http://www.w3.org/1999/xhtml'>%s</body></html>", msg);