tokio-xmpp: implicitly add bound_jid on received IQs

This commit is contained in:
famfo 2026-02-16 22:17:42 +01:00 committed by pep
commit 4316bb02a5
2 changed files with 11 additions and 3 deletions

View file

@ -6,8 +6,8 @@ Version NEXT:
* Fixed:
- Ignore missing "version" stream attribute for 0114 components.
- Gate `AsRawFd` behind `ktls` feature to make Windows build work again.
- Implicitly use the `Client`'s bound JID on empty `to` in tokio-xmpp's
`IqResponseTracker`.
- Implicitly use the `Client`'s bound JID on empty `from` and `to` in
tokio-xmpp's `IqResponseTracker`.
- Actually count inbound stream management stanzas (!657) instead of
always sending h='0' in our `<a/>`.

View file

@ -278,7 +278,7 @@ impl IqResponseTracker {
/// Returns the IQ stanza unharmed if it is not an IQ response matching
/// any request which is still being tracked.
pub fn handle_iq(&self, iq: Iq) -> ControlFlow<(), Iq> {
let (from, to, id, payload) = match iq {
let (mut from, to, id, payload) = match iq {
Iq::Error {
from,
to,
@ -294,6 +294,14 @@ impl IqResponseTracker {
} => (from, to, id, IqResponse::Result(payload)),
_ => return ControlFlow::Continue(iq),
};
if from.is_none() {
// Implicitly setting None to the JID the tracker is active for in case the server
// doesn't. This ensures that the IQ can be matched in the map again.
let account_jid = self.account_jid.lock().unwrap();
from = account_jid.clone().map(Jid::from);
}
let key = (from, id);
let mut map = self.map.lock().unwrap();
match map.remove(&key) {