# HG changeset patch # User Paul Aurich # Date 1265776371 0 # Node ID 7cf5e442bbc8a89eae48d9d11aa23b067eb96a84 # Parent a8e19b69e6b425db7d670eea5e14f15bd6151ab1 Document the resource<>conversation binding (and how it works). diff -r a8e19b69e6b4 -r 7cf5e442bbc8 libpurple/protocols/jabber/message.c --- a/libpurple/protocols/jabber/message.c Wed Feb 10 04:01:08 2010 +0000 +++ b/libpurple/protocols/jabber/message.c Wed Feb 10 04:32:51 2010 +0000 @@ -73,14 +73,22 @@ if(jabber_find_unnormalized_conv(jm->from, jm->js->gc->account)) { from = g_strdup(jm->from); } else if(jid->node) { - if(jid->resource) { + if (jid->resource) { + /* + * We received a message from a specific resource, so we probably want a + * reply to go to this specific resource (i.e. bind the conversation to + * this resource). + * + * This works because purple_conv_im_send gets the name from + * purple_conversation_get_name() + */ PurpleConversation *conv; from = g_strdup_printf("%s@%s", jid->node, jid->domain); conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, from, jm->js->gc->account); - if(conv) { + if (conv) { purple_conversation_set_name(conv, jm->from); - } + } g_free(from); } from = g_strdup(jm->from); diff -r a8e19b69e6b4 -r 7cf5e442bbc8 libpurple/protocols/jabber/presence.c --- a/libpurple/protocols/jabber/presence.c Wed Feb 10 04:01:08 2010 +0000 +++ b/libpurple/protocols/jabber/presence.c Wed Feb 10 04:32:51 2010 +0000 @@ -1005,6 +1005,11 @@ jabber_buddy_remove_resource(jb, jid->resource); if((conv = jabber_find_unnormalized_conv(from, js->gc->account))) + /* + * If a resource went offline (or the buddy unsubscribed), + * send further messages to the bare JID. (This is also + * updated in message.c when receiving a message) + */ purple_conversation_set_name(conv, buddy_name); } else {