mirror of
https://github.com/chatmail/core.git
synced 2026-04-23 00:16:34 +03:00
committed by
GitHub
parent
a247e5b143
commit
f0cfcef864
@@ -421,33 +421,6 @@ pub enum Event {
|
||||
/// Return 0 if the ui cannot provide the requested string
|
||||
/// the core will use a default string in english language then.
|
||||
GET_STRING = 2091,
|
||||
|
||||
/// Request a HTTP-file or HTTPS-file from the frontend using HTTP-GET.
|
||||
/// @param data1 (const char*) Null-terminated UTF-8 string containing the URL.
|
||||
/// The string starts with https:// or http://.
|
||||
/// Must not be free()'d or modified and is valid only until the callback returns.
|
||||
/// @param data2 0
|
||||
/// @return (const char*) The content of the requested file as a null-terminated UTF-8 string;
|
||||
/// Response headers, encodings etc. must be stripped.
|
||||
/// Only the raw file should be returned.
|
||||
/// CAVE: The string will be free()'d by the core,
|
||||
/// so make sure it is allocated using malloc() or a compatible function.
|
||||
/// If you cannot provide the content, just return 0 or an empty string.
|
||||
HTTP_GET = 2100,
|
||||
|
||||
/// Request a HTTP-file or HTTPS-file from the frontend using HTTP-POST.
|
||||
/// @param data1 (const char*) Null-terminated UTF-8 string containing the URL.
|
||||
/// The string starts with https:// or http://.
|
||||
/// Must not be free()'d or modified and is valid only until the callback returns.
|
||||
/// Parameter to POST are added to the url after `?`.
|
||||
/// @param data2 0
|
||||
/// @return (const char*) The content of the requested file as a null-terminated UTF-8 string;
|
||||
/// Response headers, encodings etc. must be stripped.
|
||||
/// Only the raw file should be returned.
|
||||
/// CAVE: The string will be free()'d by the core,
|
||||
/// so make sure it is allocated using malloc() or a compatible function.
|
||||
/// If you cannot provide the content, just return 0 or an empty string.
|
||||
HTTP_POST = 2110,
|
||||
}
|
||||
|
||||
pub const DC_EVENT_FILE_COPIED: usize = 2055; // deprecated;
|
||||
|
||||
@@ -1521,34 +1521,24 @@ unsafe fn moz_autoconfigure_starttag_cb(
|
||||
(*moz_ac).tag_config = 12i32
|
||||
};
|
||||
}
|
||||
unsafe fn read_autoconf_file(
|
||||
context: &dc_context_t,
|
||||
url: *const libc::c_char,
|
||||
) -> *mut libc::c_char {
|
||||
let filecontent: *mut libc::c_char;
|
||||
dc_log_info(
|
||||
context,
|
||||
0i32,
|
||||
b"Testing %s ...\x00" as *const u8 as *const libc::c_char,
|
||||
url,
|
||||
);
|
||||
filecontent = (context.cb)(
|
||||
context,
|
||||
Event::HTTP_GET,
|
||||
url as uintptr_t,
|
||||
0i32 as uintptr_t,
|
||||
) as *mut libc::c_char;
|
||||
if filecontent.is_null() || *filecontent.offset(0isize) as libc::c_int == 0i32 {
|
||||
free(filecontent as *mut libc::c_void);
|
||||
dc_log_info(
|
||||
context,
|
||||
0i32,
|
||||
b"Can\'t read file.\x00" as *const u8 as *const libc::c_char,
|
||||
);
|
||||
return 0 as *mut libc::c_char;
|
||||
|
||||
fn read_autoconf_file(context: &dc_context_t, url: *const libc::c_char) -> *mut libc::c_char {
|
||||
info!(context, 0, "Testing %s ...", url);
|
||||
|
||||
match reqwest::Client::new()
|
||||
.get(to_str(url))
|
||||
.send()
|
||||
.and_then(|mut res| res.text())
|
||||
{
|
||||
Ok(res) => unsafe { libc::strdup(to_cstring(res).as_ptr()) },
|
||||
Err(_err) => {
|
||||
info!(context, 0, "Can\'t read file.",);
|
||||
|
||||
std::ptr::null_mut()
|
||||
}
|
||||
}
|
||||
return filecontent;
|
||||
}
|
||||
|
||||
unsafe fn outlk_autodiscover(
|
||||
context: &dc_context_t,
|
||||
url__: *const libc::c_char,
|
||||
|
||||
Reference in New Issue
Block a user