fix and implement ffi tranlation

This commit is contained in:
dignifiedquire
2019-09-15 19:31:07 +02:00
committed by Floris Bruynooghe
parent 5486ac5b9f
commit 0bf3d20e07
8 changed files with 80 additions and 41 deletions

View File

@@ -102,15 +102,15 @@ pub unsafe fn dc_receive_imf(
free(rfc724_mid.cast());
if let Some(create_event_to_send) = create_event_to_send {
for (msg_id, insert_id) in created_db_entries {
for (chat_id, msg_id) in created_db_entries {
let event = match create_event_to_send {
CreateEvent::MsgsChanged => Event::MsgsChanged {
msg_id: *msg_id as u32,
chat_id: *insert_id as u32,
chat_id: *chat_id as u32,
},
CreateEvent::IncomingMsg => Event::IncomingMsg {
msg_id: *msg_id as u32,
chat_id: *insert_id as u32,
chat_id: *chat_id as u32,
},
};
context.call_cb(event);

View File

@@ -81,12 +81,9 @@ pub enum Event {
/// it is probably more useful to report this to the user
/// instead of the string from data2.
///
/// @param data1 (usize) 1=first/new network error, should be reported the user;
/// 0=subsequent network error, should be logged only
/// @param data2 (String) string
/// @return 0
#[strum(props(id = "401"))]
ErrorNetwork(usize, String),
ErrorNetwork(String),
/// An action cannot be performed because the user is not in the group.
/// Reported eg. after a call to

View File

@@ -440,13 +440,10 @@ impl Imap {
emit_event!(
context,
Event::ErrorNetwork(
0,
format!(
"Could not connect to IMAP-server {}:{}. ({})",
imap_server, imap_port, err
)
)
Event::ErrorNetwork(format!(
"Could not connect to IMAP-server {}:{}. ({})",
imap_server, imap_port, err
))
);
return false;
@@ -464,7 +461,7 @@ impl Imap {
Err((err, _)) => {
emit_event!(
context,
Event::ErrorNetwork(0, format!("Cannot login ({})", err))
Event::ErrorNetwork(format!("Cannot login ({})", err))
);
self.unsetup_handle(context);

View File

@@ -94,7 +94,7 @@ impl fmt::Display for Params {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
for (i, (key, value)) in self.inner.iter().enumerate() {
if i > 0 {
write!(f, "\n")?;
writeln!(f)?;
}
write!(f, "{}={}", *key as u8 as char, value)?;
}

View File

@@ -52,7 +52,7 @@ impl Smtp {
}
if lp.send_server.is_empty() || lp.send_port == 0 {
context.call_cb(Event::ErrorNetwork(0, "SMTP bad parameters.".into()));
context.call_cb(Event::ErrorNetwork("SMTP bad parameters.".into()));
}
self.from = if let Ok(addr) = EmailAddress::new(lp.addr.clone()) {