mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
message: Add stanza-id as a direct payload.
This commit is contained in:
parent
b22acff15e
commit
36b0bead49
1 changed files with 5 additions and 0 deletions
|
@ -23,6 +23,7 @@ use delay::Delay;
|
||||||
use attention::Attention;
|
use attention::Attention;
|
||||||
use message_correct::Replace;
|
use message_correct::Replace;
|
||||||
use eme::ExplicitMessageEncryption;
|
use eme::ExplicitMessageEncryption;
|
||||||
|
use stanza_id::StanzaId;
|
||||||
|
|
||||||
/// Lists every known payload of a `<message/>`.
|
/// Lists every known payload of a `<message/>`.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
@ -34,6 +35,7 @@ pub enum MessagePayload {
|
||||||
Attention(Attention),
|
Attention(Attention),
|
||||||
MessageCorrect(Replace),
|
MessageCorrect(Replace),
|
||||||
ExplicitMessageEncryption(ExplicitMessageEncryption),
|
ExplicitMessageEncryption(ExplicitMessageEncryption),
|
||||||
|
StanzaId(StanzaId),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
|
@ -163,6 +165,8 @@ impl<'a> TryFrom<&'a Element> for Message {
|
||||||
Some(MessagePayload::MessageCorrect(replace))
|
Some(MessagePayload::MessageCorrect(replace))
|
||||||
} else if let Ok(eme) = ExplicitMessageEncryption::try_from(elem) {
|
} else if let Ok(eme) = ExplicitMessageEncryption::try_from(elem) {
|
||||||
Some(MessagePayload::ExplicitMessageEncryption(eme))
|
Some(MessagePayload::ExplicitMessageEncryption(eme))
|
||||||
|
} else if let Ok(stanza_id) = StanzaId::try_from(elem) {
|
||||||
|
Some(MessagePayload::StanzaId(stanza_id))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
@ -195,6 +199,7 @@ impl<'a> Into<Element> for &'a MessagePayload {
|
||||||
MessagePayload::Delay(ref delay) => delay.into(),
|
MessagePayload::Delay(ref delay) => delay.into(),
|
||||||
MessagePayload::MessageCorrect(ref replace) => replace.into(),
|
MessagePayload::MessageCorrect(ref replace) => replace.into(),
|
||||||
MessagePayload::ExplicitMessageEncryption(ref eme) => eme.into(),
|
MessagePayload::ExplicitMessageEncryption(ref eme) => eme.into(),
|
||||||
|
MessagePayload::StanzaId(ref stanza_id) => stanza_id.into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue