mirror of
https://github.com/chatmail/core.git
synced 2026-05-03 21:36:29 +03:00
Fix spawning task and introduce ProviderInfo event
This commit is contained in:
@@ -3928,18 +3928,18 @@ pub type dc_provider_t = provider::Provider;
|
|||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn dc_provider_new_from_email(
|
pub unsafe extern "C" fn dc_provider_new_from_email(
|
||||||
context: *const dc_context_t,
|
context: *mut dc_context_t,
|
||||||
addr: *const libc::c_char,
|
addr: *mut libc::c_char,
|
||||||
) {
|
) {
|
||||||
if context.is_null() || addr.is_null() {
|
if context.is_null() || addr.is_null() {
|
||||||
eprintln!("ignoring careless call to dc_provider_new_from_email()");
|
eprintln!("ignoring careless call to dc_provider_new_from_email()");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let ctx = &*context;
|
||||||
let addr = to_string_lossy(addr);
|
let addr = to_string_lossy(addr);
|
||||||
|
|
||||||
|
spawn(async move {
|
||||||
async_std::task::spawn(async move {
|
|
||||||
let ctx = &*context;
|
|
||||||
let socks5_enabled = ctx.get_config_bool(config::Config::Socks5Enabled)
|
let socks5_enabled = ctx.get_config_bool(config::Config::Socks5Enabled)
|
||||||
.await
|
.await
|
||||||
.log_err(ctx, "Can't get config");
|
.log_err(ctx, "Can't get config");
|
||||||
@@ -3959,7 +3959,7 @@ pub unsafe extern "C" fn dc_provider_new_from_email(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
context.as_ref().unwrap().emit_event(EventType::Error(format!(
|
ctx.emit_event(EventType::Error(format!(
|
||||||
"Failed to get provider info: {:#}",
|
"Failed to get provider info: {:#}",
|
||||||
err
|
err
|
||||||
)));
|
)));
|
||||||
|
|||||||
@@ -333,4 +333,7 @@ pub enum EventType {
|
|||||||
msg_id: MsgId,
|
msg_id: MsgId,
|
||||||
status_update_id: StatusUpdateId,
|
status_update_id: StatusUpdateId,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#[strum(props(id = "2201"))]
|
||||||
|
ProviderInfo(String),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user