changeset 3769:303e40b66b96

[gaim-migrate @ 3908] Another patch by faceprint--and I don't even know what this one does. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sun, 20 Oct 2002 19:40:48 +0000
parents f53370197bb9
children a72e303e6f5c
files src/protocols/jabber/jabber.c
diffstat 1 files changed, 17 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/jabber/jabber.c	Sun Oct 20 19:38:36 2002 +0000
+++ b/src/protocols/jabber/jabber.c	Sun Oct 20 19:40:48 2002 +0000
@@ -1226,7 +1226,11 @@
 		if(jri->thread_id)
 			ct = g_strdup(jri->thread_id);
 	}
-
+	if(!ct) {
+		char buf[1024];
+		snprintf(buf, sizeof(buf), "%s%d", name, (int)time(NULL));
+		ct = g_strdup(shahash(buf));
+	}
 	return ct;
 }
 
@@ -1268,9 +1272,11 @@
 	char m[BUF_LONG * 2];
 
 	type = xmlnode_get_attrib(p->x, "type");
- 
+
 	if ((y = xmlnode_get_tag(p->x, "thread")))
 		thread_id = xmlnode_get_data(y);
+	if(!thread_id)
+		thread_id = "";
 
 	y = xmlnode_get_firstchild(p->x);
 
@@ -1321,16 +1327,14 @@
 					time_sent);
 			else {
 				int flags = 0;
-				jab_res_info jri = jabber_find_resource(GJ_GC(gjc), jid_full(p->from));
+				jab_res_info jri = jabber_find_resource(GJ_GC(gjc), from);
 				if(jri && typing)
 					jri->has_composing = TRUE;
 				if (xmlnode_get_tag(p->x, "gaim"))
 					flags = IM_FLAG_GAIMUSER;
-				if ((y = xmlnode_get_tag(p->x, "thread")))
-					jabber_track_convo_thread(gjc, jid_full(p->from),
-						xmlnode_get_data(y));
-				if (find_conversation(jid_full(p->from)))
-					serv_got_im(GJ_GC(gjc), jid_full(p->from), m, flags,
+				jabber_track_convo_thread(gjc, from, thread_id);
+				if (find_conversation(from))
+					serv_got_im(GJ_GC(gjc), from, m, flags,
 						time_sent, -1);
 				else {
 					if(p->from->user) {
@@ -2448,12 +2452,14 @@
 
 	x = xmlnode_new_tag("message");
 	xmlnode_put_attrib(x, "to", realwho);
-	
+
 	thread_id = jabber_get_convo_thread(gjc, realwho);
 	if(thread_id)
 	{
-		y = xmlnode_insert_tag(x, "thread");
-		xmlnode_insert_cdata(y, thread_id, -1);
+		if(strcmp(thread_id, "")) {
+			y = xmlnode_insert_tag(x, "thread");
+			xmlnode_insert_cdata(y, thread_id, -1);
+		}
 		g_free(thread_id);
 	}