changeset 13483:bd77abf05a12

[gaim-migrate @ 15859] Added id attribute to outgoing <message/> stanzas in Jabber. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Thu, 09 Mar 2006 21:03:13 +0000
parents 9b73908ebc51
children 51c6405049a3
files src/protocols/jabber/message.c src/protocols/jabber/message.h
diffstat 2 files changed, 16 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/jabber/message.c	Thu Mar 09 17:02:17 2006 +0000
+++ b/src/protocols/jabber/message.c	Thu Mar 09 21:03:13 2006 +0000
@@ -34,20 +34,14 @@
 
 void jabber_message_free(JabberMessage *jm)
 {
-	if(jm->from)
-		g_free(jm->from);
-	if(jm->to)
-		g_free(jm->to);
-	if(jm->subject)
-		g_free(jm->subject);
-	if(jm->body)
-		g_free(jm->body);
-	if(jm->xhtml)
-		g_free(jm->xhtml);
-	if(jm->password)
-		g_free(jm->password);
-	if(jm->etc)
-		g_list_free(jm->etc);
+        g_free(jm->from);
+	g_free(jm->to);
+	g_free(jm->id);
+	g_free(jm->subject);
+	g_free(jm->body);
+	g_free(jm->xhtml);
+	g_free(jm->password);
+	g_list_free(jm->etc);
 
 	g_free(jm);
 }
@@ -271,6 +265,7 @@
 
 	jm->from = g_strdup(xmlnode_get_attrib(packet, "from"));
 	jm->to = g_strdup(xmlnode_get_attrib(packet, "to"));
+	jm->id = g_strdup(xmlnode_get_attrib(packet, "id"));
 
 	for(child = packet->child; child; child = child->next) {
 		if(child->type != XMLNODE_TYPE_TAG)
@@ -405,6 +400,9 @@
 
 	if(type)
 		xmlnode_set_attrib(message, "type", type);
+ 
+	if (jm->id)
+		xmlnode_set_attrib(message, "id", jm->id);
 
 	xmlnode_set_attrib(message, "to", jm->to);
 
@@ -471,6 +469,7 @@
 	jm->type = JABBER_MESSAGE_CHAT;
 	jm->events = JABBER_MESSAGE_EVENT_COMPOSING;
 	jm->to = g_strdup(who);
+	jm->id = jabber_get_next_id(jm->js);
 	if(jbr && jbr->thread_id)
 		jm->thread_id = jbr->thread_id;
 
@@ -509,6 +508,7 @@
 	jm->js = gc->proto_data;
 	jm->type = JABBER_MESSAGE_GROUPCHAT;
 	jm->to = g_strdup_printf("%s@%s", chat->room, chat->server);
+	jm->id = jabber_get_next_id(jm->js);
 
 	buf = g_strdup_printf("<html xmlns='http://jabber.org/protocol/xhtml-im'><body xmlns='http://www.w3.org/1999/xhtml'>%s</body></html>", msg);
 	gaim_markup_html_to_xhtml(buf, &jm->xhtml, &jm->body);
@@ -544,6 +544,7 @@
 	jm->js = gc->proto_data;
 	jm->type = JABBER_MESSAGE_CHAT;
 	jm->to = g_strdup(who);
+	jm->id = jabber_get_next_id(jm->js);
 
 	if(typing == GAIM_TYPING)
 		jm->events = JABBER_MESSAGE_EVENT_COMPOSING;
--- a/src/protocols/jabber/message.h	Thu Mar 09 17:02:17 2006 +0000
+++ b/src/protocols/jabber/message.h	Thu Mar 09 21:03:13 2006 +0000
@@ -38,6 +38,7 @@
 	} type;
 	time_t sent;
 	gboolean delayed;
+	char *id;
 	char *from;
 	char *to;
 	char *subject;