mirror of
https://github.com/chatmail/core.git
synced 2026-04-24 17:06:28 +03:00
committed by
GitHub
parent
a247e5b143
commit
f0cfcef864
@@ -16,7 +16,6 @@ use deltachat::dc_job::{
|
||||
dc_perform_smtp_jobs,
|
||||
};
|
||||
use deltachat::dc_lot::*;
|
||||
use deltachat::x::strdup;
|
||||
|
||||
extern "C" fn cb(_ctx: &dc_context_t, event: Event, data1: usize, data2: usize) -> usize {
|
||||
println!("[{:?}]", event);
|
||||
@@ -26,22 +25,6 @@ extern "C" fn cb(_ctx: &dc_context_t, event: Event, data1: usize, data2: usize)
|
||||
println!(" progress: {}", data1);
|
||||
0
|
||||
}
|
||||
Event::HTTP_GET => {
|
||||
let url = unsafe { CStr::from_ptr(data1 as *const _).to_str().unwrap() };
|
||||
|
||||
match reqwest::get(url) {
|
||||
Ok(ref mut res) => {
|
||||
let c_res = CString::new(res.text().unwrap()).unwrap();
|
||||
// need to use strdup to allocate the result with malloc
|
||||
// so it can be `free`d later.
|
||||
unsafe { strdup(c_res.as_ptr()) as usize }
|
||||
}
|
||||
Err(err) => {
|
||||
println!("failed to download: {}: {:?}", url, err);
|
||||
0
|
||||
}
|
||||
}
|
||||
}
|
||||
Event::INFO | Event::WARNING | Event::ERROR | Event::ERROR_NETWORK => {
|
||||
println!(
|
||||
" {}",
|
||||
|
||||
Reference in New Issue
Block a user