From 492800fed6ad1a1105a5a1bd16c2c8372c0977d7 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Tue, 20 Feb 2024 15:01:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E6=92=A4=E5=9B=9E?= =?UTF-8?q?=E6=B6=88=E6=81=AF=20=E7=9A=84=E4=BA=8B=E4=BB=B6=20=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=20=E5=BF=BD=E7=95=A5=20closeLoading=20=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ica-rs/src/events.rs | 14 ++++++++++++++ ica-rs/src/main.rs | 1 + 2 files changed, 15 insertions(+) diff --git a/ica-rs/src/events.rs b/ica-rs/src/events.rs index 3f8501e..0b28f39 100644 --- a/ica-rs/src/events.rs +++ b/ica-rs/src/events.rs @@ -30,6 +30,18 @@ pub fn add_message(payload: Payload, _client: RawClient) { } } +/// 撤回消息 +pub fn delete_message(payload: Payload, _client: RawClient) { + if let Payload::Text(values) = payload { + // 消息 id + if let Some(value) = values.first() { + if let Some(msg_id) = value.as_str() { + warn!("delete_message {}", format!("{}", msg_id).yellow()); + } + } + } +} + pub fn any_event(event: Event, payload: Payload, _client: RawClient) { let handled = vec![ // 真正处理过的 @@ -39,9 +51,11 @@ pub fn any_event(event: Event, payload: Payload, _client: RawClient) { "requireAuth", "onlineData", "addMessage", + "deleteMessage", // "setAllRooms", // 忽略的 "notify", + "closeLoading", // 发送消息/加载新聊天 有一个 loading "updateRoom", ]; match &event { diff --git a/ica-rs/src/main.rs b/ica-rs/src/main.rs index 521695c..21e1da5 100644 --- a/ica-rs/src/main.rs +++ b/ica-rs/src/main.rs @@ -36,6 +36,7 @@ fn main() { .on("authFailed", events::connect_callback) .on("onlineData", events::get_online_data) .on("addMessage", events::add_message) + .on("deleteMessage", events::delete_message) .connect() .expect("Connection failed");