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");