lib: Export attention as a MessagePayload.
This commit is contained in:
parent
458099cef0
commit
9410b9682a
1 changed files with 5 additions and 1 deletions
|
@ -54,9 +54,11 @@ pub enum MessagePayload {
|
|||
Body(body::Body),
|
||||
ChatState(chatstates::ChatState),
|
||||
Receipt(receipts::Receipt),
|
||||
Attention(attention::Attention),
|
||||
}
|
||||
|
||||
/// Parse one of the payloads of a `<message/>` element, and return `Some` of a `MessagePayload` if parsing it succeeded, `None` otherwise.
|
||||
/// Parse one of the payloads of a `<message/>` element, and return `Some` of a
|
||||
/// `MessagePayload` if parsing it succeeded, `None` otherwise.
|
||||
pub fn parse_message_payload(elem: &Element) -> Option<MessagePayload> {
|
||||
if let Ok(body) = body::parse_body(elem) {
|
||||
Some(MessagePayload::Body(body))
|
||||
|
@ -64,6 +66,8 @@ pub fn parse_message_payload(elem: &Element) -> Option<MessagePayload> {
|
|||
Some(MessagePayload::ChatState(chatstate))
|
||||
} else if let Ok(receipt) = receipts::parse_receipt(elem) {
|
||||
Some(MessagePayload::Receipt(receipt))
|
||||
} else if let Ok(attention) = attention::parse_attention(elem) {
|
||||
Some(MessagePayload::Attention(attention))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue