[Pidgin] #3154: Threading code in jabber makes no sense
Pidgin
trac at pidgin.im
Mon Sep 17 16:14:07 EDT 2007
#3154: Threading code in jabber makes no sense
---------------------------+------------------------------------------------
Reporter: arivanov | Owner:
Type: defect | Status: new
Priority: minor | Milestone:
Component: pidgin (gtk) | Version: 2.2.0
Resolution: | Keywords:
Pending: 0 |
---------------------------+------------------------------------------------
Comment (by arivanov):
I have added code which more or less makes Pidgin compliant to the current
draft amendments to the XMPP RFCs. It looks correct on tcpdump. I do not
have another thread aware client to properly verify it and bandersnatch
which is the primary reason for me to do this has the thread logging
b0rken.
Principle of operation - if there is no Thread ID set in the message
transmit routine one globally unique is generated using the routines in
libossp. If an incoming message has a Thread ID it is used for the
conversation.
In order to compile and work it requires adding libossp-uuid to the linked
library list all the way from the jabber dir through protocols, libpurple,
etc to the top makefile. I have hacked the makefiles quick and ugly so I
am not going to post that. Someone who understands their structure better
than me should add it where it belongs.
The code to generate the UUID itself is straight out of the ossp-uuid
manpages. It may be a good idea to move it elsewhere.
{{{
*** pidgin-2.2.0/libpurple/protocols/jabber/message.c 2007-09-14
05:45:40.000000000 +0100
--- pidgin-2.2.0-thread/libpurple/protocols/jabber/message.c 2007-09-17
20:56:23.000000000 +0100
***************
*** 31,36 ****
--- 31,52 ----
#include "message.h"
#include "xmlnode.h"
#include "pep.h"
+ #include <ossp/uuid.h>
+
+
+ char *uuid_v1(void)
+ {
+ uuid_t *uuid;
+ char *str;
+
+ uuid_create(&uuid);
+ uuid_make(uuid, UUID_MAKE_V1);
+ str = NULL;
+ uuid_export(uuid, UUID_FMT_STR, (void **)&str, NULL);
+ uuid_destroy(uuid);
+ return str;
+ }
+
void jabber_message_free(JabberMessage *jm)
{
***************
*** 126,134 ****
jbr->capabilities |= JABBER_CAP_COMPOSING;
}
! if(jbr->thread_id)
! g_free(jbr->thread_id);
! jbr->thread_id = g_strdup(jbr->thread_id);
}
if (jm->js->googletalk && jm->xhtml == NULL) {
--- 142,150 ----
jbr->capabilities |= JABBER_CAP_COMPOSING;
}
! if (jm->thread_id) {
! jbr->thread_id = g_strdup(jm->thread_id);
! }
}
if (jm->js->googletalk && jm->xhtml == NULL) {
***************
*** 620,627 ****
jm->chat_state = JM_STATE_ACTIVE;
if(jbr) {
! 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;
--- 636,644 ----
jm->chat_state = JM_STATE_ACTIVE;
if(jbr) {
! if(!jbr->thread_id)
! jbr->thread_id = uuid_v1();
! jm->thread_id = g_strdup(jbr->thread_id);
if(jbr->chat_states != JABBER_CHAT_STATES_UNSUPPORTED) {
jm->typing_style |= JM_TS_JEP_0085;
}}}
--
Ticket URL: <http://developer.pidgin.im/ticket/3154#comment:2>
Pidgin <http://pidgin.im>
Pidgin
More information about the Tracker
mailing list