pidgin: e6dc0b75: Document the resource<>conversation bind...
darkrain42 at pidgin.im
darkrain42 at pidgin.im
Wed Feb 10 01:08:24 EST 2010
-----------------------------------------------------------------
Revision: e6dc0b75d96693c72f0ce70eec29ffc6fd65cbc5
Ancestor: 16b06c832bb37014304670307b6db672c94d5dd0
Author: darkrain42 at pidgin.im
Date: 2010-02-10T04:32:51
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/e6dc0b75d96693c72f0ce70eec29ffc6fd65cbc5
Modified files:
libpurple/protocols/jabber/message.c
libpurple/protocols/jabber/presence.c
ChangeLog:
Document the resource<>conversation binding (and how it works).
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/message.c c70839219e5cdc78427ac3d3bb10acebd9853841
+++ libpurple/protocols/jabber/message.c 72bb1a4f1af71ff911da12ae566fd026253c20f2
@@ -73,14 +73,22 @@ static void handle_chat(JabberMessage *j
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);
============================================================
--- libpurple/protocols/jabber/presence.c 5938cd894a39d409c2970bace614ced31a802cdc
+++ libpurple/protocols/jabber/presence.c 887df241d743700d4401973996e0049e0afdb027
@@ -1005,6 +1005,11 @@ void jabber_presence_parse(JabberStream
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 {
More information about the Commits
mailing list