mirror of
https://github.com/chatmail/core.git
synced 2026-05-09 01:46:30 +03:00
cargo fmt
This commit is contained in:
committed by
Floris Bruynooghe
parent
612600278a
commit
ee18d60644
@@ -1690,10 +1690,13 @@ fn set_group_explicitly_left(context: &Context, grpid: impl AsRef<str>) -> Resul
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_group_explicitly_left(context: &Context, grpid: impl AsRef<str>) -> Result<bool, Error> {
|
pub fn is_group_explicitly_left(context: &Context, grpid: impl AsRef<str>) -> Result<bool, Error> {
|
||||||
context.sql.exists(
|
context
|
||||||
|
.sql
|
||||||
|
.exists(
|
||||||
"SELECT id FROM leftgrps WHERE grpid=?;",
|
"SELECT id FROM leftgrps WHERE grpid=?;",
|
||||||
params![grpid.as_ref()],
|
params![grpid.as_ref()],
|
||||||
).map_err(Into::into)
|
)
|
||||||
|
.map_err(Into::into)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_chat_name(
|
pub fn set_chat_name(
|
||||||
|
|||||||
@@ -495,7 +495,9 @@ pub fn save(
|
|||||||
independent: bool,
|
independent: bool,
|
||||||
) -> Result<u32, Error> {
|
) -> Result<u32, Error> {
|
||||||
ensure!(chat_id > DC_CHAT_ID_LAST_SPECIAL, "Invalid chat id");
|
ensure!(chat_id > DC_CHAT_ID_LAST_SPECIAL, "Invalid chat id");
|
||||||
context.sql.prepare2(
|
context
|
||||||
|
.sql
|
||||||
|
.prepare2(
|
||||||
"SELECT id FROM locations WHERE timestamp=? AND from_id=?",
|
"SELECT id FROM locations WHERE timestamp=? AND from_id=?",
|
||||||
"INSERT INTO locations\
|
"INSERT INTO locations\
|
||||||
(timestamp, from_id, chat_id, latitude, longitude, accuracy, independent) \
|
(timestamp, from_id, chat_id, latitude, longitude, accuracy, independent) \
|
||||||
@@ -505,7 +507,8 @@ pub fn save(
|
|||||||
let mut newest_location_id = 0;
|
let mut newest_location_id = 0;
|
||||||
|
|
||||||
for location in locations {
|
for location in locations {
|
||||||
let exists = stmt_test.exists(params![location.timestamp, contact_id as i32])?;
|
let exists =
|
||||||
|
stmt_test.exists(params![location.timestamp, contact_id as i32])?;
|
||||||
|
|
||||||
if independent || !exists {
|
if independent || !exists {
|
||||||
stmt_insert.execute(params![
|
stmt_insert.execute(params![
|
||||||
@@ -534,7 +537,8 @@ pub fn save(
|
|||||||
}
|
}
|
||||||
Ok(newest_location_id)
|
Ok(newest_location_id)
|
||||||
},
|
},
|
||||||
).map_err(Into::into)
|
)
|
||||||
|
.map_err(Into::into)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
|
|||||||
@@ -191,7 +191,9 @@ impl Message {
|
|||||||
!id.is_special(),
|
!id.is_special(),
|
||||||
"Can not load special message IDs from DB."
|
"Can not load special message IDs from DB."
|
||||||
);
|
);
|
||||||
context.sql.query_row(
|
context
|
||||||
|
.sql
|
||||||
|
.query_row(
|
||||||
concat!(
|
concat!(
|
||||||
"SELECT",
|
"SELECT",
|
||||||
" m.id AS id,",
|
" m.id AS id,",
|
||||||
@@ -266,7 +268,8 @@ impl Message {
|
|||||||
|
|
||||||
Ok(msg)
|
Ok(msg)
|
||||||
},
|
},
|
||||||
).map_err(Into::into)
|
)
|
||||||
|
.map_err(Into::into)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn delete_from_db(context: &Context, msg_id: MsgId) {
|
pub fn delete_from_db(context: &Context, msg_id: MsgId) {
|
||||||
@@ -1246,7 +1249,9 @@ pub(crate) fn rfc724_mid_exists(
|
|||||||
) -> Result<(String, u32, MsgId), Error> {
|
) -> Result<(String, u32, MsgId), Error> {
|
||||||
ensure!(!rfc724_mid.is_empty(), "empty rfc724_mid");
|
ensure!(!rfc724_mid.is_empty(), "empty rfc724_mid");
|
||||||
|
|
||||||
context.sql.query_row(
|
context
|
||||||
|
.sql
|
||||||
|
.query_row(
|
||||||
"SELECT server_folder, server_uid, id FROM msgs WHERE rfc724_mid=?",
|
"SELECT server_folder, server_uid, id FROM msgs WHERE rfc724_mid=?",
|
||||||
&[rfc724_mid],
|
&[rfc724_mid],
|
||||||
|row| {
|
|row| {
|
||||||
@@ -1256,7 +1261,8 @@ pub(crate) fn rfc724_mid_exists(
|
|||||||
|
|
||||||
Ok((server_folder, server_uid, msg_id))
|
Ok((server_folder, server_uid, msg_id))
|
||||||
},
|
},
|
||||||
).map_err(Into::into)
|
)
|
||||||
|
.map_err(Into::into)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update_server_uid(
|
pub fn update_server_uid(
|
||||||
|
|||||||
Reference in New Issue
Block a user