diff options
author | Belgin Știrbu <belginstirbu@hotmail.com> | 2022-05-27 03:32:41 -0500 |
---|---|---|
committer | Belgin Știrbu <belginstirbu@hotmail.com> | 2022-05-27 03:32:41 -0500 |
commit | 395fecbf53dbf3b9d3861991ad3998c2ab57a0c2 (patch) | |
tree | 843628c08339cd71f11bf53904479854142fb340 | |
parent | 6549d8f96be1ffc9c14c42196a46885ba76dcb6b (diff) | |
download | pidgin-395fecbf53dbf3b9d3861991ad3998c2ab57a0c2.tar.gz |
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/
-rw-r--r-- | libpurple/protocols/jabber/jabber.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c index 1f1318a065..d677ae6975 100644 --- a/libpurple/protocols/jabber/jabber.c +++ b/libpurple/protocols/jabber/jabber.c @@ -1912,6 +1912,7 @@ void jabber_add_deny(PurpleConnection *gc, const char *who) JabberStream *js; JabberIq *iq; xmlnode *block, *item; + const char *norm = NULL; g_return_if_fail(who != NULL && *who != '\0'); @@ -1932,13 +1933,15 @@ void jabber_add_deny(PurpleConnection *gc, const char *who) 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 @@ void jabber_rem_deny(PurpleConnection *gc, const char *who) JabberStream *js; JabberIq *iq; xmlnode *unblock, *item; + const char *norm = NULL; g_return_if_fail(who != NULL && *who != '\0'); @@ -1964,13 +1968,15 @@ void jabber_rem_deny(PurpleConnection *gc, const char *who) 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); } |