mirror of
https://github.com/chatmail/core.git
synced 2026-05-20 15:26:30 +03:00
rename DC_GCM_SYSTEM_ONLY to DC_GCM_INFO_ONLY
apply suggestions of r10s
This commit is contained in:
@@ -1000,7 +1000,7 @@ dc_msg_t* dc_get_draft (dc_context_t* context, uint32_t ch
|
|||||||
|
|
||||||
|
|
||||||
#define DC_GCM_ADDDAYMARKER 0x01
|
#define DC_GCM_ADDDAYMARKER 0x01
|
||||||
#define DC_GCM_SYSTEM_ONLY 0x02
|
#define DC_GCM_INFO_ONLY 0x02
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1019,7 +1019,7 @@ dc_msg_t* dc_get_draft (dc_context_t* context, uint32_t ch
|
|||||||
* @param flags If set to DC_GCM_ADDDAYMARKER, the marker DC_MSG_ID_DAYMARKER will
|
* @param flags If set to DC_GCM_ADDDAYMARKER, the marker DC_MSG_ID_DAYMARKER will
|
||||||
* be added before each day (regarding the local timezone). Set this to 0 if you do not want this behaviour.
|
* be added before each day (regarding the local timezone). Set this to 0 if you do not want this behaviour.
|
||||||
* To get the concrete time of the marker, use dc_array_get_timestamp().
|
* To get the concrete time of the marker, use dc_array_get_timestamp().
|
||||||
* If set to DC_GCM_SYSTEM_ONLY, only system messages will be returned, can be combined with DC_GCM_ADDDAYMARKER.
|
* If set to DC_GCM_INFO_ONLY, only system messages will be returned, can be combined with DC_GCM_ADDDAYMARKER.
|
||||||
* @param marker1before An optional message ID. If set, the id DC_MSG_ID_MARKER1 will be added just
|
* @param marker1before An optional message ID. If set, the id DC_MSG_ID_MARKER1 will be added just
|
||||||
* before the given ID in the returned array. Set this to 0 if you do not want this behaviour.
|
* before the given ID in the returned array. Set this to 0 if you do not want this behaviour.
|
||||||
* @return Array of message IDs, must be dc_array_unref()'d when no longer used.
|
* @return Array of message IDs, must be dc_array_unref()'d when no longer used.
|
||||||
|
|||||||
@@ -614,7 +614,7 @@ class TestOfflineChat:
|
|||||||
|
|
||||||
lp.sec("check message count of only system messages (without daymarkers)")
|
lp.sec("check message count of only system messages (without daymarkers)")
|
||||||
dc_array = ffi.gc(
|
dc_array = ffi.gc(
|
||||||
lib.dc_get_chat_msgs(ac1._dc_context, chat.id, const.DC_GCM_SYSTEM_ONLY, 0),
|
lib.dc_get_chat_msgs(ac1._dc_context, chat.id, const.DC_GCM_INFO_ONLY, 0),
|
||||||
lib.dc_array_unref
|
lib.dc_array_unref
|
||||||
)
|
)
|
||||||
assert len(list(iter_array(dc_array, lambda x: x))) == 2
|
assert len(list(iter_array(dc_array, lambda x: x))) == 2
|
||||||
|
|||||||
11
src/chat.rs
11
src/chat.rs
@@ -1765,7 +1765,7 @@ pub async fn get_chat_msgs(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let process_row = if (flags & DC_GCM_SYSTEM_ONLY) != 0 {
|
let process_row = if (flags & DC_GCM_INFO_ONLY) != 0 {
|
||||||
|row: &rusqlite::Row| {
|
|row: &rusqlite::Row| {
|
||||||
// is_info logic taken from Message.is_info()
|
// is_info logic taken from Message.is_info()
|
||||||
let params = row.get::<_, String>("param")?;
|
let params = row.get::<_, String>("param")?;
|
||||||
@@ -1846,21 +1846,22 @@ pub async fn get_chat_msgs(
|
|||||||
process_rows,
|
process_rows,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
} else if (flags & DC_GCM_SYSTEM_ONLY) != 0 {
|
} else if (flags & DC_GCM_INFO_ONLY) != 0 {
|
||||||
context
|
context
|
||||||
.sql
|
.sql
|
||||||
.query_map(
|
.query_map(
|
||||||
|
// GLOB is used here instead of LIKE becase it is case-sensitive
|
||||||
"SELECT m.id AS id, m.timestamp AS timestamp, m.param AS param, m.from_id AS from_id, m.to_id AS to_id
|
"SELECT m.id AS id, m.timestamp AS timestamp, m.param AS param, m.from_id AS from_id, m.to_id AS to_id
|
||||||
FROM msgs m
|
FROM msgs m
|
||||||
WHERE m.chat_id=?
|
WHERE m.chat_id=?
|
||||||
AND m.hidden=0
|
AND m.hidden=0
|
||||||
AND (
|
AND (
|
||||||
m.param GLOB \"*S=*\"
|
m.param GLOB \"*S=*\"
|
||||||
OR m.from_id == 2
|
OR m.from_id == ?
|
||||||
OR m.to_id == 2
|
OR m.to_id == ?
|
||||||
)
|
)
|
||||||
ORDER BY m.timestamp, m.id;",
|
ORDER BY m.timestamp, m.id;",
|
||||||
paramsv![chat_id],
|
paramsv![chat_id, DC_CONTACT_ID_INFO, DC_CONTACT_ID_INFO],
|
||||||
process_row,
|
process_row,
|
||||||
process_rows,
|
process_rows,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ pub const DC_GCL_ADD_ALLDONE_HINT: usize = 0x04;
|
|||||||
pub const DC_GCL_FOR_FORWARDING: usize = 0x08;
|
pub const DC_GCL_FOR_FORWARDING: usize = 0x08;
|
||||||
|
|
||||||
pub const DC_GCM_ADDDAYMARKER: u32 = 0x01;
|
pub const DC_GCM_ADDDAYMARKER: u32 = 0x01;
|
||||||
pub const DC_GCM_SYSTEM_ONLY: u32 = 0x02;
|
pub const DC_GCM_INFO_ONLY: u32 = 0x02;
|
||||||
|
|
||||||
pub const DC_GCL_VERIFIED_ONLY: usize = 0x01;
|
pub const DC_GCL_VERIFIED_ONLY: usize = 0x01;
|
||||||
pub const DC_GCL_ADD_SELF: usize = 0x02;
|
pub const DC_GCL_ADD_SELF: usize = 0x02;
|
||||||
|
|||||||
Reference in New Issue
Block a user