Permalink
Browse files

jabber: Fix chat joins when ext_jid is provided for your own user

This is the presence needed to finalize a join to the channel, the
'from' field is our own user in the context of that channel:

    <presence to="dx@server/resource" from="channel@gateway.server/dx">
      <x xmlns="http://jabber.org/protocol/muc#user">
        <status code="110"/>
        <item jid="~dx@198.51.100.1" affiliation="none" role="participant"/>
      </x>
    </presence>

Bitlbee takes the stuff to <item jid="..."> as the "real" jid, as it
does for non-anonymous MUCs. It sets that to ext_jid, and uses it as the
handle internally.

In this particular case, that real jid is nonsense for us, so
imcb_chat_add_buddy() interprets that as yet another person joining the
channel, instead of the expected self-join.

This fixes it by checking if the buddy is our own user, and ignoring the
provided ext_jid in those cases.

Thanks to ivucica for reporting this, who was using Biboumi (a gateway
from XMPP to IRC)
  • Loading branch information...
dequis committed Nov 20, 2017
1 parent f75aaac commit 49108f35b8ca7974820b9d29e31965e5f0264270
Showing with 3 additions and 0 deletions.
  1. +3 −0 protocols/jabber/conference.c
@@ -328,6 +328,9 @@ void jabber_chat_pkt_presence(struct im_connection *ic, struct jabber_buddy *bud
}
}
bud->flags |= JBFLAG_IS_ANONYMOUS;
} else if (bud == jc->me) {
g_free(bud->ext_jid);
bud->ext_jid = g_strdup(jd->me);
}
if (bud != jc->me && bud->flags & JBFLAG_IS_ANONYMOUS) {

0 comments on commit 49108f3

Please sign in to comment.