mirror of
https://github.com/chatmail/core.git
synced 2026-04-20 15:06:30 +03:00
convert the last two unsafe event emissions in smtp.rs
This commit is contained in:
27
src/smtp.rs
27
src/smtp.rs
@@ -6,7 +6,6 @@ use lettre::*;
|
||||
use crate::constants::Event;
|
||||
use crate::constants::*;
|
||||
use crate::context::Context;
|
||||
use crate::dc_log::*;
|
||||
use crate::dc_loginparam::*;
|
||||
use crate::dc_tools::*;
|
||||
use crate::oauth2::*;
|
||||
@@ -62,14 +61,10 @@ impl Smtp {
|
||||
let lp = unsafe { *lp };
|
||||
|
||||
if lp.addr.is_null() || lp.send_server.is_null() || lp.send_port == 0 {
|
||||
unsafe {
|
||||
dc_log_event(
|
||||
context,
|
||||
Event::ERROR_NETWORK,
|
||||
0,
|
||||
b"SMTP bad parameters.\x00" as *const u8 as *const libc::c_char,
|
||||
);
|
||||
}
|
||||
log_event!(
|
||||
context, Event::ERROR_NETWORK, 0,
|
||||
"SMTP bad parameters.",
|
||||
);
|
||||
}
|
||||
|
||||
let raw_addr = unsafe {
|
||||
@@ -166,21 +161,15 @@ impl Smtp {
|
||||
|
||||
match transport.send(mail) {
|
||||
Ok(_) => {
|
||||
unsafe {
|
||||
dc_log_event(
|
||||
context,
|
||||
Event::SMTP_MESSAGE_SENT,
|
||||
0,
|
||||
b"Message was sent to SMTP server\x00" as *const u8
|
||||
as *const libc::c_char,
|
||||
);
|
||||
}
|
||||
log_event!(
|
||||
context, Event::SMTP_MESSAGE_SENT, 0,
|
||||
"Message was sent to SMTP server",
|
||||
);
|
||||
self.transport_connected = true;
|
||||
1
|
||||
}
|
||||
Err(err) => {
|
||||
warn!(context, 0, "SMTP failed to send message: {}", err);
|
||||
|
||||
0
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user