Fri, 27 May 2022 03:32:41 -0500
Fix unable to unblock XMPP buddy
If the user blocked an XMPP buddy that was not in the buddy list,
Pidgin sent the XID with the resource to the server's block list.
If the user tried to unblock that buddy after adding them to the
buddy list, Pidgin sent the XID without the resource to the server
for unblocking.
This resulted in users unable to unblock their buddies.
This patch fixes this situation by sending just the normalized XID
(i.e. without the resource) to the server for blocking and
unblocking.
Testing Done:
Tested on a Prosody XMPP server by adding a buddy and unblocking them.
Bugs closed: PIDGIN-16414
Reviewed at https://reviews.imfreedom.org/r/1479/
| libpurple/protocols/jabber/jabber.c | file | annotate | diff | comparison | revisions |
--- a/libpurple/protocols/jabber/jabber.c Wed May 25 23:51:44 2022 -0500 +++ b/libpurple/protocols/jabber/jabber.c Fri May 27 03:32:41 2022 -0500 @@ -1912,6 +1912,7 @@ JabberStream *js; JabberIq *iq; xmlnode *block, *item; + const char *norm = NULL; g_return_if_fail(who != NULL && *who != '\0'); @@ -1932,13 +1933,15 @@ return; } + norm = jabber_normalize(purple_connection_get_account(gc), who); + iq = jabber_iq_new(js, JABBER_IQ_SET); block = xmlnode_new_child(iq->node, "block"); xmlnode_set_namespace(block, NS_SIMPLE_BLOCKING); item = xmlnode_new_child(block, "item"); - xmlnode_set_attrib(item, "jid", who); + xmlnode_set_attrib(item, "jid", norm ? norm : who); jabber_iq_send(iq); } @@ -1948,6 +1951,7 @@ JabberStream *js; JabberIq *iq; xmlnode *unblock, *item; + const char *norm = NULL; g_return_if_fail(who != NULL && *who != '\0'); @@ -1964,13 +1968,15 @@ if (!(js->server_caps & JABBER_CAP_BLOCKING)) return; + norm = jabber_normalize(purple_connection_get_account(gc), who); + iq = jabber_iq_new(js, JABBER_IQ_SET); unblock = xmlnode_new_child(iq->node, "unblock"); xmlnode_set_namespace(unblock, NS_SIMPLE_BLOCKING); item = xmlnode_new_child(unblock, "item"); - xmlnode_set_attrib(item, "jid", who); + xmlnode_set_attrib(item, "jid", norm ? norm : who); jabber_iq_send(iq); }