tokio-xmpp: implicitly add bound_jid on received IQs
This commit is contained in:
parent
a1ade974b0
commit
4316bb02a5
2 changed files with 11 additions and 3 deletions
|
|
@ -6,8 +6,8 @@ Version NEXT:
|
||||||
* Fixed:
|
* Fixed:
|
||||||
- Ignore missing "version" stream attribute for 0114 components.
|
- Ignore missing "version" stream attribute for 0114 components.
|
||||||
- Gate `AsRawFd` behind `ktls` feature to make Windows build work again.
|
- 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
|
- Implicitly use the `Client`'s bound JID on empty `from` and `to` in
|
||||||
`IqResponseTracker`.
|
tokio-xmpp's `IqResponseTracker`.
|
||||||
- Actually count inbound stream management stanzas (!657) instead of
|
- Actually count inbound stream management stanzas (!657) instead of
|
||||||
always sending h='0' in our `<a/>`.
|
always sending h='0' in our `<a/>`.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -278,7 +278,7 @@ impl IqResponseTracker {
|
||||||
/// Returns the IQ stanza unharmed if it is not an IQ response matching
|
/// Returns the IQ stanza unharmed if it is not an IQ response matching
|
||||||
/// any request which is still being tracked.
|
/// any request which is still being tracked.
|
||||||
pub fn handle_iq(&self, iq: Iq) -> ControlFlow<(), Iq> {
|
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 {
|
Iq::Error {
|
||||||
from,
|
from,
|
||||||
to,
|
to,
|
||||||
|
|
@ -294,6 +294,14 @@ impl IqResponseTracker {
|
||||||
} => (from, to, id, IqResponse::Result(payload)),
|
} => (from, to, id, IqResponse::Result(payload)),
|
||||||
_ => return ControlFlow::Continue(iq),
|
_ => 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 key = (from, id);
|
||||||
let mut map = self.map.lock().unwrap();
|
let mut map = self.map.lock().unwrap();
|
||||||
match map.remove(&key) {
|
match map.remove(&key) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue