Message and message_correct::Replace now has typed Id
This commit is contained in:
parent
4f8d6697d6
commit
33098e6f2c
9 changed files with 45 additions and 32 deletions
|
|
@ -36,6 +36,9 @@ XXXX-YY-ZZ RELEASER <admin@example.com>
|
|||
fast::Tls0Rtt, legacy_omemo::IsPreKey, mam::Complete, sm::ResumeAttr (!476)
|
||||
- bookmarks::Conference and bookmarks2::Conference use ResourcePart to store
|
||||
the optional nickname instead of a String (!485)
|
||||
- message::Message id field is now Option<message::Id> instead of
|
||||
Option<String> (!504)
|
||||
- message_correction::Replace id field is now Id instead of String (!504)
|
||||
* New parsers/serialisers:
|
||||
- Stream Features (RFC 6120) (!400)
|
||||
- Spam Reporting (XEP-0377) (!506)
|
||||
|
|
@ -50,10 +53,10 @@ XXXX-YY-ZZ RELEASER <admin@example.com>
|
|||
- Keep unsupported vCard elements as `minidom::Element`, so that they
|
||||
get serialized back instead of being dropped. We now also test for
|
||||
the size of these elements (!472).
|
||||
- Add Message::extract_valid_payload method to warn in case of failure
|
||||
and return simply Option<T> instead of Result<Option<T>> (!497)
|
||||
- Add Message::get_best_body_cloned and Message::get_best_subject_cloned
|
||||
to clone automatically when performance is not an issue (!497)
|
||||
- Add Message::extract_valid_payload method to warn in case of failure
|
||||
and return simply Option<T> instead of Result<Option<T>> (!497)
|
||||
- Add Message::get_best_body_cloned and Message::get_best_subject_cloned
|
||||
to clone automatically when performance is not an issue (!497)
|
||||
|
||||
Version 0.21.0:
|
||||
2024-07-25 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
|
||||
|
|
|
|||
|
|
@ -36,6 +36,14 @@ generate_attribute!(
|
|||
|
||||
type Lang = String;
|
||||
|
||||
generate_id!(
|
||||
/// Id field in a [`Message`], if any.
|
||||
///
|
||||
/// This field is not mandatory on incoming messages, but may be useful for moderation/correction,
|
||||
/// especially for outgoing messages.
|
||||
Id
|
||||
);
|
||||
|
||||
generate_elem_id!(
|
||||
/// Represents one `<body/>` element, that is the free form text content of
|
||||
/// a message.
|
||||
|
|
@ -70,7 +78,7 @@ pub struct Message {
|
|||
|
||||
/// The @id attribute of this stanza, which is required in order to match a
|
||||
/// request with its response.
|
||||
pub id: Option<String>,
|
||||
pub id: Option<Id>,
|
||||
|
||||
/// The type of this message.
|
||||
pub type_: MessageType,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
use xso::{AsXml, FromXml};
|
||||
|
||||
use crate::message::MessagePayload;
|
||||
use crate::message::{Id, MessagePayload};
|
||||
use crate::ns;
|
||||
|
||||
/// Defines that the message containing this payload should replace a
|
||||
|
|
@ -16,7 +16,7 @@ use crate::ns;
|
|||
pub struct Replace {
|
||||
/// The 'id' attribute of the message getting corrected.
|
||||
#[xml(attribute)]
|
||||
pub id: String,
|
||||
pub id: Id,
|
||||
}
|
||||
|
||||
impl MessagePayload for Replace {}
|
||||
|
|
@ -98,7 +98,7 @@ mod tests {
|
|||
.parse()
|
||||
.unwrap();
|
||||
let replace = Replace {
|
||||
id: String::from("coucou"),
|
||||
id: Id(String::from("coucou")),
|
||||
};
|
||||
let elem2 = replace.into();
|
||||
assert_eq!(elem, elem2);
|
||||
|
|
|
|||
Loading…
Reference in a new issue