jsonrpc: fix daymarkers

This commit is contained in:
Simon Laux
2022-10-01 22:08:11 +02:00
parent b2f7a7bb2e
commit 6922a66f49
3 changed files with 15 additions and 5 deletions

View File

@@ -11,7 +11,7 @@
- ci: add github ci action to upload it to our download server automaticaly on realease - ci: add github ci action to upload it to our download server automaticaly on realease
### Fixes ### Fixes
- jsonrpc: fix daymarkers
## 1.95.0 ## 1.95.0

View File

@@ -6,6 +6,7 @@ use deltachat::{
}, },
chatlist::Chatlist, chatlist::Chatlist,
config::Config, config::Config,
constants::DC_MSG_ID_DAYMARKER,
contact::{may_be_valid_addr, Contact, ContactId}, contact::{may_be_valid_addr, Contact, ContactId},
context::get_info, context::get_info,
message::{delete_msgs, get_msg_info, markseen_msgs, Message, MessageState, MsgId, Viewtype}, message::{delete_msgs, get_msg_info, markseen_msgs, Message, MessageState, MsgId, Viewtype},
@@ -604,6 +605,10 @@ impl CommandApi {
markseen_msgs(&ctx, msg_ids.into_iter().map(MsgId::new).collect()).await markseen_msgs(&ctx, msg_ids.into_iter().map(MsgId::new).collect()).await
} }
/// get ids of messages for a chat
/// (this api is similar to the cffi api, because it's still used that way by desktop)
///
/// returns list with message ids and daymarkers (DC_MSG_ID_DAYMARKER = 9) if daymarkers are active
async fn message_list_get_message_ids( async fn message_list_get_message_ids(
&self, &self,
account_id: u32, account_id: u32,
@@ -614,9 +619,9 @@ impl CommandApi {
let msg = get_chat_msgs(&ctx, ChatId::new(chat_id), flags).await?; let msg = get_chat_msgs(&ctx, ChatId::new(chat_id), flags).await?;
Ok(msg Ok(msg
.iter() .iter()
.filter_map(|chat_item| match chat_item { .map(|chat_item| match chat_item {
deltachat::chat::ChatItem::Message { msg_id } => Some(msg_id.to_u32()), deltachat::chat::ChatItem::Message { msg_id } => msg_id.to_u32(),
_ => None, deltachat::chat::ChatItem::DayMarker { .. } => DC_MSG_ID_DAYMARKER,
}) })
.collect()) .collect())
} }

View File

@@ -385,7 +385,12 @@ export class RawClient {
return (this._transport.request('markseen_msgs', [accountId, msgIds] as RPC.Params)) as Promise<null>; return (this._transport.request('markseen_msgs', [accountId, msgIds] as RPC.Params)) as Promise<null>;
} }
/**
* get ids of messages for a chat
* (this api is similar to the cffi api, because it's still used that way by desktop)
*
* returns list with message ids and daymarkers (DC_MSG_ID_DAYMARKER = 9) if daymarkers are active
*/
public messageListGetMessageIds(accountId: T.U32, chatId: T.U32, flags: T.U32): Promise<(T.U32)[]> { public messageListGetMessageIds(accountId: T.U32, chatId: T.U32, flags: T.U32): Promise<(T.U32)[]> {
return (this._transport.request('message_list_get_message_ids', [accountId, chatId, flags] as RPC.Params)) as Promise<(T.U32)[]>; return (this._transport.request('message_list_get_message_ids', [accountId, chatId, flags] as RPC.Params)) as Promise<(T.U32)[]>;
} }