address @flub comments

This commit is contained in:
holger krekel
2019-10-09 14:25:27 +02:00
parent 45f011c63c
commit 24c0a833bd
6 changed files with 6 additions and 34 deletions

View File

@@ -4201,16 +4201,10 @@ int64_t dc_lot_get_timestamp (const dc_lot_t* lot);
/** /**
* Requeste a localized string from the frontend. * (DEPRECATED, DC_EVENT_GET_STRING is not emmitted anymore. Use
* dc_set_stock_translation() to pre-fill translations for stock
* messages.
* *
* @param data1 (int) ID of the string to request, one of the DC_STR_* constants.
* @param data2 (int) The count. If the requested string contains a placeholder for a numeric value,
* the ui may use this value to return different strings on different plural forms.
* @return (const char*) Null-terminated UTF-8 string.
* The string will be free()'d by the core,
* so it must be allocated using malloc() or a compatible function.
* Return 0 if the ui cannot provide the requested string
* the core will use a default string in english language then.
*/ */
#define DC_EVENT_GET_STRING 2091 #define DC_EVENT_GET_STRING 2091

View File

@@ -167,12 +167,6 @@ impl ContextWrapper {
contact_id as uintptr_t, contact_id as uintptr_t,
progress as uintptr_t, progress as uintptr_t,
), ),
Event::GetString { id, count } => ffi_cb(
self,
event_id,
id.to_u32().unwrap_or_default() as uintptr_t,
count as uintptr_t,
),
} }
} }
None => 0, None => 0,

View File

@@ -43,7 +43,6 @@ use self::cmdline::*;
fn receive_event(_context: &Context, event: Event) -> libc::uintptr_t { fn receive_event(_context: &Context, event: Event) -> libc::uintptr_t {
match event { match event {
Event::GetString { .. } => {}
Event::Info(msg) => { Event::Info(msg) => {
/* do not show the event as this would fill the screen */ /* do not show the event as this would fill the screen */
println!("{}", msg); println!("{}", msg);

View File

@@ -63,7 +63,7 @@ pub struct Context {
pub running_state: Arc<RwLock<RunningState>>, pub running_state: Arc<RwLock<RunningState>>,
/// Mutex to avoid generating the key for the user more than once. /// Mutex to avoid generating the key for the user more than once.
pub generating_key_mutex: Mutex<()>, pub generating_key_mutex: Mutex<()>,
pub translated_stockstrings: Arc<RwLock<HashMap<usize, String>>>, pub translated_stockstrings: RwLock<HashMap<usize, String>>,
} }
#[derive(Debug, PartialEq, Eq)] #[derive(Debug, PartialEq, Eq)]
@@ -146,7 +146,7 @@ impl Context {
probe_imap_network: Arc::new(RwLock::new(false)), probe_imap_network: Arc::new(RwLock::new(false)),
perform_inbox_jobs_needed: Arc::new(RwLock::new(false)), perform_inbox_jobs_needed: Arc::new(RwLock::new(false)),
generating_key_mutex: Mutex::new(()), generating_key_mutex: Mutex::new(()),
translated_stockstrings: Arc::new(RwLock::new(HashMap::new())), translated_stockstrings: RwLock::new(HashMap::new()),
}; };
ensure!( ensure!(

View File

@@ -2,8 +2,6 @@ use std::path::PathBuf;
use strum::EnumProperty; use strum::EnumProperty;
use crate::stock::StockMessage;
impl Event { impl Event {
/// Returns the corresponding Event id. /// Returns the corresponding Event id.
pub fn as_id(&self) -> i32 { pub fn as_id(&self) -> i32 {
@@ -237,17 +235,4 @@ pub enum Event {
/// @return 0 /// @return 0
#[strum(props(id = "2061"))] #[strum(props(id = "2061"))]
SecurejoinJoinerProgress { contact_id: u32, progress: usize }, SecurejoinJoinerProgress { contact_id: u32, progress: usize },
// the following events are functions that should be provided by the frontends
/// Requeste a localized string from the frontend.
/// @param data1 (int) ID of the string to request, one of the DC_STR_/// constants.
/// @param data2 (int) The count. If the requested string contains a placeholder for a numeric value,
/// the ui may use this value to return different strings on different plural forms.
/// @return (const char*) Null-terminated UTF-8 string.
/// The string will be free()'d by the core,
/// so it must be allocated using malloc() or a compatible function.
/// Return 0 if the ui cannot provide the requested string
/// the core will use a default string in english language then.
#[strum(props(id = "2091"))]
GetString { id: StockMessage, count: usize },
} }

View File

@@ -806,7 +806,7 @@ mod tests {
} }
#[test] #[test]
fn otest_render_setup_file_newline_replace() { fn test_render_setup_file_newline_replace() {
let t = dummy_context(); let t = dummy_context();
t.ctx t.ctx
.set_stock_translation(StockMessage::AcSetupMsgBody, "hello\r\nthere".to_string()) .set_stock_translation(StockMessage::AcSetupMsgBody, "hello\r\nthere".to_string())