Implement reactions

This commit is contained in:
link2xt
2022-10-04 13:19:04 +00:00
parent 895c723d4e
commit d34f9e23fe
23 changed files with 804 additions and 22 deletions

View File

@@ -102,6 +102,14 @@ pub enum JSONRPCEventType {
msg_id: u32,
},
/// Reactions for the message changed.
#[serde(rename_all = "camelCase")]
ReactionsChanged {
chat_id: u32,
msg_id: u32,
contact_id: u32,
},
/// There is a fresh message. Typically, the user will show an notification
/// when receiving this message.
///
@@ -284,6 +292,15 @@ impl From<EventType> for JSONRPCEventType {
chat_id: chat_id.to_u32(),
msg_id: msg_id.to_u32(),
},
EventType::ReactionsChanged {
chat_id,
msg_id,
contact_id,
} => ReactionsChanged {
chat_id: chat_id.to_u32(),
msg_id: msg_id.to_u32(),
contact_id: contact_id.to_u32(),
},
EventType::IncomingMsg { chat_id, msg_id } => IncomingMsg {
chat_id: chat_id.to_u32(),
msg_id: msg_id.to_u32(),

View File

@@ -205,6 +205,9 @@ pub enum MessageViewtype {
/// Text message.
Text,
/// Reaction emoji.
Reaction,
/// Image message.
/// If the image is an animated GIF, the type `Viewtype.Gif` should be used.
Image,
@@ -242,6 +245,7 @@ impl From<Viewtype> for MessageViewtype {
match viewtype {
Viewtype::Unknown => MessageViewtype::Unknown,
Viewtype::Text => MessageViewtype::Text,
Viewtype::Reaction => MessageViewtype::Reaction,
Viewtype::Image => MessageViewtype::Image,
Viewtype::Gif => MessageViewtype::Gif,
Viewtype::Sticker => MessageViewtype::Sticker,
@@ -260,6 +264,7 @@ impl From<MessageViewtype> for Viewtype {
match viewtype {
MessageViewtype::Unknown => Viewtype::Unknown,
MessageViewtype::Text => Viewtype::Text,
MessageViewtype::Reaction => Viewtype::Reaction,
MessageViewtype::Image => Viewtype::Image,
MessageViewtype::Gif => Viewtype::Gif,
MessageViewtype::Sticker => Viewtype::Sticker,