diff --git a/src/contact.rs b/src/contact.rs index 98ea82b85..e094972c9 100644 --- a/src/contact.rs +++ b/src/contact.rs @@ -15,8 +15,9 @@ use crate::chat::ChatId; use crate::color::str_to_color; use crate::config::Config; use crate::constants::{ - Blocked, Chattype, DC_CONTACT_ID_DEVICE, DC_CONTACT_ID_DEVICE_ADDR, DC_CONTACT_ID_LAST_SPECIAL, - DC_CONTACT_ID_SELF, DC_GCL_ADD_SELF, DC_GCL_VERIFIED_ONLY, + Blocked, Chattype, DC_CONTACT_ID_DEVICE, DC_CONTACT_ID_DEVICE_ADDR, DC_CONTACT_ID_INFO, + DC_CONTACT_ID_LAST_SPECIAL, DC_CONTACT_ID_SELF, DC_CONTACT_ID_UNDEFINED, DC_GCL_ADD_SELF, + DC_GCL_VERIFIED_ONLY, }; use crate::context::Context; use crate::dc_tools::{dc_get_abs_path, improve_single_line_input, EmailAddress}; @@ -52,20 +53,19 @@ impl ContactId { impl fmt::Display for ContactId { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}", self.0) - // if *self == DC_CONTACT_ID_UNDEFINED { - // write!(f, "Contact#Undefined") - // } else if *self == DC_CONTACT_ID_SELF { - // write!(f, "Contact#Self") - // } else if *self == DC_CONTACT_ID_INFO { - // write!(f, "Contact#Info") - // } else if *self == DC_CONTACT_ID_DEVICE { - // write!(f, "Contact#Device") - // } else if *self <= DC_CONTACT_ID_LAST_SPECIAL { - // write!(f, "Contact#Special{}", self.0) - // } else { - // write!(f, "Contact#{}", self.0) - // } + if *self == DC_CONTACT_ID_UNDEFINED { + write!(f, "Contact#Undefined") + } else if *self == DC_CONTACT_ID_SELF { + write!(f, "Contact#Self") + } else if *self == DC_CONTACT_ID_INFO { + write!(f, "Contact#Info") + } else if *self == DC_CONTACT_ID_DEVICE { + write!(f, "Contact#Device") + } else if *self <= DC_CONTACT_ID_LAST_SPECIAL { + write!(f, "Contact#Special{}", self.0) + } else { + write!(f, "Contact#{}", self.0) + } } } diff --git a/src/dc_receive_imf.rs b/src/dc_receive_imf.rs index 907d1c9c9..ae5038ba1 100644 --- a/src/dc_receive_imf.rs +++ b/src/dc_receive_imf.rs @@ -2099,11 +2099,6 @@ async fn check_verified_properties( if to_ids.is_empty() { return Ok(()); } - let to_ids_str = to_ids - .iter() - .map(|x| x.to_string()) - .collect::>() - .join(","); let rows = context .sql @@ -2111,9 +2106,9 @@ async fn check_verified_properties( format!( "SELECT c.addr, LENGTH(ps.verified_key_fingerprint) FROM contacts c \ LEFT JOIN acpeerstates ps ON c.addr=ps.addr WHERE c.id IN({}) ", - to_ids_str + sql::repeat_vars(to_ids.len())? ), - paramsv![], + rusqlite::params_from_iter(to_ids), |row| { let to_addr: String = row.get(0)?; let is_verified: i32 = row.get(1).unwrap_or(0);