MCPcopy Create free account
hub / github.com/chatmail/core / delete_securejoin_wait_msg

Function delete_securejoin_wait_msg

src/securejoin/bob.rs:192–222  ·  view source on GitHub ↗
(context: &Context, chat_id: ChatId)

Source from the content-addressed store, hash-verified

190}
191
192async fn delete_securejoin_wait_msg(context: &Context, chat_id: ChatId) -> Result<()> {
193 if let Some((msg_id, param)) = context
194 .sql
195 .query_row_optional(
196 "
197SELECT id, param FROM msgs
198WHERE timestamp=(SELECT MAX(timestamp) FROM msgs WHERE chat_id=? AND hidden=0)
199 AND chat_id=? AND hidden=0
200LIMIT 1
201 ",
202 (chat_id, chat_id),
203 |row| {
204 let id: MsgId = row.get(0)?;
205 let param: String = row.get(1)?;
206 let param: Params = param.parse().unwrap_or_default();
207 Ok((id, param))
208 },
209 )
210 .await?
211 && param.get_cmd() == SystemMessage::SecurejoinWait
212 {
213 let on_server = false;
214 msg_id.trash(context, on_server).await?;
215 context.emit_event(EventType::MsgDeleted { chat_id, msg_id });
216 context.emit_msgs_changed_without_msg_id(chat_id);
217 chatlist_events::emit_chatlist_item_changed(context, chat_id);
218 context.emit_msgs_changed_without_ids();
219 chatlist_events::emit_chatlist_changed(context);
220 }
221 Ok(())
222}
223
224/// Handles `vc-auth-required`, `vg-auth-required`, and `vc-pubkey` handshake messages.
225///

Callers 1

Calls 10

emit_chatlist_changedFunction · 0.85
query_row_optionalMethod · 0.80
parseMethod · 0.80
get_cmdMethod · 0.80
trashMethod · 0.80
getMethod · 0.45
emit_eventMethod · 0.45

Tested by

no test coverage detected