mirror of
https://github.com/ArcaneChat/core.git
synced 2026-07-03 14:05:33 +02:00
refactor: reorg code and drop usage of libetpans base64 encoder
This commit is contained in:
@@ -21,6 +21,7 @@ libsqlite3-sys = { version = "0.14.0", features = ["bundled"] }
|
||||
reqwest = "0.9.15"
|
||||
num-derive = "0.2.5"
|
||||
num-traits = "0.2.6"
|
||||
base64 = "0.10.1"
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3.0.7"
|
||||
|
||||
@@ -18,9 +18,7 @@ fn add_search_path(p: &str) {
|
||||
|
||||
fn build_tools() {
|
||||
let mut config = cc::Build::new();
|
||||
config.file("misc.h");
|
||||
config.file("misc.c");
|
||||
config.compile("libtools.a");
|
||||
config.file("misc.h").file("misc.c").compile("libtools.a");
|
||||
|
||||
println!("rerun-if-changed=build.rs");
|
||||
println!("rerun-if-changed=misc.h");
|
||||
|
||||
+14
-35
@@ -3227,11 +3227,8 @@ pub unsafe extern "C" fn stress_functions(mut context: *mut dc_context_t) {
|
||||
let mut ah: *mut dc_aheader_t = dc_aheader_new();
|
||||
let mut rendered: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||
let mut ah_ok: libc::c_int = 0;
|
||||
ah_ok = dc_aheader_set_from_string(
|
||||
ah,
|
||||
b"addr=a@b.example.org; prefer-encrypt=mutual; keydata=RGVsdGEgQ2hhdA==\x00" as *const u8
|
||||
as *const libc::c_char,
|
||||
);
|
||||
let fixed_header = b"addr=a@b.example.org; prefer-encrypt=mutual; keydata= xsBNBFzG3j0BCAC6iNhT8zydvCXi8LI/gFnkadMbfmSE/rTJskRRra/utGbLyDta/yTrJgWL7O3y/g 4HdDW/dN2z26Y6W13IMzx9gLInn1KQZChtqWAcr/ReUucXcymwcfg1mdkBGk3TSLeLihN6CJx8Wsv8 ig+kgAzte4f5rqEEAJVQ9WZHuti7UiYs6oRzqTo06CRe9owVXxzdMf0VDQtf7ZFm9dpzKKbhH7Lu88 80iiotQ9/yRCkDGp9fNThsrLdZiK6OIAcIBAqi2rI89aS1dAmnRbktQieCx5izzyYkR1KvVL3gTTll HOzfKVEC2asmtWu2e4se/+O4WMIS1eGrn7GeWVb0Vwc5ABEBAAHNETxhQEBiLmV4YW1wbGUuZGU+ws CJBBABCAAzAhkBBQJcxt5FAhsDBAsJCAcGFQgJCgsCAxYCARYhBI4xxYKBgH3ANh5cufaKrc9mtiML AAoJEPaKrc9mtiML938H/18F+3Wf9/JaAy/8hCO1v4S2PVBhxaKCokaNFtkfaMRne2l087LscCFPiF Nyb4mv6Z3YeK8Xpxlp2sI0ecvdiqLUOGfnxS6tQrj+83EjtIrZ/hXOk1h121QFWH9Zg2VNHtODXjAg dLDC0NWUrclR0ZOqEDQHeo0ibTILdokVfXFN25wakPmGaYJP2y729cb1ve7RzvIvwn+Dddfxo3ao72 rBfLi7l4NQ4S0KsY4cw+/6l5bRCKYCP77wZtvCwUvfVVosLdT43agtSiBI49+ayqvZ8OCvSJa61i+v 81brTiEy9GBod4eAp45Ibsuemkw+gon4ZOvUXHTjwFB+h63MrozOwE0EXMbePQEIAL/vauf1zK8JgC u3V+G+SOX0iWw5xUlCPX+ERpBbWfwu3uAqn4wYXD3JDE/fVAF668xiV4eTPtlSUd5h0mn+G7uXMMOt kb+20SoEt50f8zw8TrL9t+ZsV11GKZWJpCar5AhXWsn6EEi8I2hLL5vn55ZZmHuGgN4jjmkRl3ToKC LhaXwTBjCJem7N5EH7F75wErEITa55v4Lb4Nfca7vnvtYrI1OA446xa8gHra0SINelTD09/JM/Fw4s WVPBaRZmJK/Tnu79N23No9XBUubmFPv1pNexZsQclicnTpt/BEWhiun7d6lfGB63K1aoHRTR1pcrWv BuALuuz0gqar2zlI0AEQEAAcLAdgQYAQgAIAUCXMbeRQIbDBYhBI4xxYKBgH3ANh5cufaKrc9mtiML AAoJEPaKrc9mtiMLKSEIAIyLCRO2OyZ0IYRvRPpMn4p7E+7Pfcz/0mSkOy+1hshgJnqivXurm8zwGr wdMqeV4eslKR9H1RUdWGUQJNbtwmmjrt5DHpIhYHl5t3FpCBaGbV20Omo00Q38lBl9MtrmZkZw+ktE k6X+0xCKssMF+2MADkSOIufbR5HrDVB89VZOHCO9DeXvCUUAw2hyJiL/LHmLzJ40zYoTmb+F//f0k0 j+tRdbkefyRoCmwG7YGiT+2hnCdgcezswnzah5J3ZKlrg7jOGo1LxtbvNUzxNBbC6S/aNgwm6qxo7x egRhmEl5uZ16zwyj4qz+xkjGy25Of5mWfUDoNw7OT7sjUbHOOMc=";
|
||||
ah_ok = dc_aheader_set_from_string(ah, fixed_header as *const u8 as *const libc::c_char);
|
||||
if 0 != !(ah_ok == 1i32) as libc::c_int as libc::c_long {
|
||||
__assert_rtn(
|
||||
(*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00"))
|
||||
@@ -3258,21 +3255,9 @@ pub unsafe extern "C" fn stress_functions(mut context: *mut dc_context_t) {
|
||||
);
|
||||
} else {
|
||||
};
|
||||
if 0 != !((*(*ah).public_key).bytes == 10i32
|
||||
&& strncmp(
|
||||
(*(*ah).public_key).binary as *mut libc::c_char,
|
||||
b"Delta Chat\x00" as *const u8 as *const libc::c_char,
|
||||
10,
|
||||
) == 0i32) as libc::c_int as libc::c_long
|
||||
{
|
||||
__assert_rtn((*::std::mem::transmute::<&[u8; 17],
|
||||
&[libc::c_char; 17]>(b"stress_functions\x00")).as_ptr(),
|
||||
b"../cmdline/stress.c\x00" as *const u8 as
|
||||
*const libc::c_char, 771i32,
|
||||
b"ah->public_key->bytes==10 && strncmp((char*)ah->public_key->binary, \"Delta Chat\", 10)==0\x00"
|
||||
as *const u8 as *const libc::c_char);
|
||||
} else {
|
||||
};
|
||||
|
||||
assert_eq!((*(*ah).public_key).bytes, 1212);
|
||||
|
||||
if 0 != !((*ah).prefer_encrypt == 1i32) as libc::c_int as libc::c_long {
|
||||
__assert_rtn(
|
||||
(*::std::mem::transmute::<&[u8; 17], &[libc::c_char; 17]>(b"stress_functions\x00"))
|
||||
@@ -3283,22 +3268,15 @@ pub unsafe extern "C" fn stress_functions(mut context: *mut dc_context_t) {
|
||||
);
|
||||
} else {
|
||||
};
|
||||
|
||||
rendered = dc_aheader_render(ah);
|
||||
if 0 != !(!rendered.is_null()
|
||||
&& strcmp(
|
||||
rendered,
|
||||
b"addr=a@b.example.org; prefer-encrypt=mutual; keydata= RGVsdGEgQ2hhdA==\x00"
|
||||
as *const u8 as *const libc::c_char,
|
||||
) == 0i32) as libc::c_int as libc::c_long
|
||||
{
|
||||
__assert_rtn((*::std::mem::transmute::<&[u8; 17],
|
||||
&[libc::c_char; 17]>(b"stress_functions\x00")).as_ptr(),
|
||||
b"../cmdline/stress.c\x00" as *const u8 as
|
||||
*const libc::c_char, 775i32,
|
||||
b"rendered && strcmp(rendered, \"addr=a@b.example.org; prefer-encrypt=mutual; keydata= RGVsdGEgQ2hhdA==\")==0\x00"
|
||||
as *const u8 as *const libc::c_char);
|
||||
} else {
|
||||
};
|
||||
|
||||
assert!(!rendered.is_null());
|
||||
assert_eq!(
|
||||
std::ffi::CStr::from_ptr(rendered).to_str().unwrap(),
|
||||
std::str::from_utf8(fixed_header).unwrap()
|
||||
);
|
||||
|
||||
ah_ok =
|
||||
dc_aheader_set_from_string(ah,
|
||||
b" _foo; __FOO=BAR ;;; addr = a@b.example.org ;\r\n prefer-encrypt = mutual ; keydata = RG VsdGEgQ\r\n2hhdA==\x00"
|
||||
@@ -3329,6 +3307,7 @@ pub unsafe extern "C" fn stress_functions(mut context: *mut dc_context_t) {
|
||||
);
|
||||
} else {
|
||||
};
|
||||
|
||||
if 0 != !((*(*ah).public_key).bytes == 10i32
|
||||
&& strncmp(
|
||||
(*(*ah).public_key).binary as *mut libc::c_char,
|
||||
|
||||
+1
-6
@@ -259,12 +259,7 @@ pub unsafe fn dc_aheader_render(mut aheader: *const dc_aheader_t) -> *mut libc::
|
||||
);
|
||||
/* adds a whitespace every 78 characters, this allows libEtPan to wrap the lines according to RFC 5322
|
||||
(which may insert a linebreak before every whitespace) */
|
||||
keybase64_wrapped = dc_key_render_base64(
|
||||
(*aheader).public_key,
|
||||
78i32,
|
||||
b" \x00" as *const u8 as *const libc::c_char,
|
||||
0i32,
|
||||
);
|
||||
keybase64_wrapped = dc_key_render_base64((*aheader).public_key, 78);
|
||||
if !keybase64_wrapped.is_null() {
|
||||
/*no checksum*/
|
||||
dc_strbuilder_cat(&mut ret, keybase64_wrapped);
|
||||
|
||||
+3
-2
@@ -769,8 +769,9 @@ pub unsafe fn dc_get_info(mut context: *mut dc_context_t) -> *mut libc::c_char {
|
||||
VERSION as *const u8 as *const libc::c_char,
|
||||
libsqlite3_sys::SQLITE_VERSION as *const u8 as *const libc::c_char,
|
||||
sqlite3_threadsafe(),
|
||||
libetpan_get_version_major(),
|
||||
libetpan_get_version_minor(),
|
||||
// libetpan not used anymore
|
||||
0,
|
||||
0,
|
||||
// openssl (none used, so setting to 0)
|
||||
0 as libc::c_int,
|
||||
0 as libc::c_int,
|
||||
|
||||
+2
-2
@@ -280,9 +280,9 @@ pub unsafe extern "C" fn dc_render_setup_file(
|
||||
let mut payload_key_asc: *mut libc::c_char = dc_key_render_asc(
|
||||
curr_private_key,
|
||||
if 0 != e2ee_enabled {
|
||||
b"Autocrypt-Prefer-Encrypt: mutual\r\n\x00" as *const u8 as *const libc::c_char
|
||||
Some(("Autocrypt-Prefer-Encrypt", "mutual"))
|
||||
} else {
|
||||
0 as *const libc::c_char
|
||||
None
|
||||
},
|
||||
);
|
||||
if !payload_key_asc.is_null() {
|
||||
|
||||
+78
-122
@@ -1,4 +1,11 @@
|
||||
use std::collections::BTreeMap;
|
||||
use std::ffi::CString;
|
||||
use std::io::Cursor;
|
||||
use std::slice;
|
||||
|
||||
use libc;
|
||||
use pgp::composed::{Deserializable, SignedPublicKey, SignedSecretKey};
|
||||
use pgp::ser::Serialize;
|
||||
|
||||
use crate::dc_context::dc_context_t;
|
||||
use crate::dc_log::*;
|
||||
@@ -8,9 +15,7 @@ use crate::dc_strbuilder::*;
|
||||
use crate::dc_tools::*;
|
||||
use crate::types::*;
|
||||
use crate::x::*;
|
||||
/* *
|
||||
* Library-internal.
|
||||
*/
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct dc_key_t {
|
||||
@@ -335,133 +340,84 @@ pub unsafe fn dc_key_load_self_private(
|
||||
sqlite3_finalize(stmt);
|
||||
return success;
|
||||
}
|
||||
/* the result must be freed */
|
||||
pub unsafe fn dc_render_base64(
|
||||
mut buf: *const libc::c_void,
|
||||
mut buf_bytes: size_t,
|
||||
mut break_every: libc::c_int,
|
||||
mut break_chars: *const libc::c_char,
|
||||
mut add_checksum: libc::c_int,
|
||||
) -> *mut libc::c_char {
|
||||
let mut ret: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||
if !(buf == 0 as *mut libc::c_void || buf_bytes <= 0) {
|
||||
ret = encode_base64(buf as *const libc::c_char, buf_bytes as libc::c_int);
|
||||
if !ret.is_null() {
|
||||
if break_every > 0i32 {
|
||||
let mut temp: *mut libc::c_char = ret;
|
||||
ret = dc_insert_breaks(temp, break_every, break_chars);
|
||||
free(temp as *mut libc::c_void);
|
||||
}
|
||||
if add_checksum == 2i32 {
|
||||
let mut checksum: libc::c_long = crc_octets(buf as *const libc::c_uchar, buf_bytes);
|
||||
let mut c: [uint8_t; 3] = [0; 3];
|
||||
c[0usize] = (checksum >> 16i32 & 0xffi32 as libc::c_long) as uint8_t;
|
||||
c[1usize] = (checksum >> 8i32 & 0xffi32 as libc::c_long) as uint8_t;
|
||||
c[2usize] = (checksum & 0xffi32 as libc::c_long) as uint8_t;
|
||||
let mut c64: *mut libc::c_char =
|
||||
encode_base64(c.as_mut_ptr() as *const libc::c_char, 3i32);
|
||||
let mut temp_0: *mut libc::c_char = ret;
|
||||
ret = dc_mprintf(
|
||||
b"%s%s=%s\x00" as *const u8 as *const libc::c_char,
|
||||
temp_0,
|
||||
break_chars,
|
||||
c64,
|
||||
);
|
||||
free(temp_0 as *mut libc::c_void);
|
||||
free(c64 as *mut libc::c_void);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* ******************************************************************************
|
||||
* Render keys
|
||||
******************************************************************************/
|
||||
unsafe fn crc_octets(mut octets: *const libc::c_uchar, mut len: size_t) -> libc::c_long {
|
||||
let mut crc: libc::c_long = 0xb704ce;
|
||||
loop {
|
||||
let fresh0 = len;
|
||||
len = len.wrapping_sub(1);
|
||||
if !(0 != fresh0) {
|
||||
break;
|
||||
}
|
||||
let fresh1 = octets;
|
||||
octets = octets.offset(1);
|
||||
crc ^= ((*fresh1 as libc::c_int) << 16i32) as libc::c_long;
|
||||
let mut i: libc::c_int = 0i32;
|
||||
while i < 8i32 {
|
||||
crc <<= 1i32;
|
||||
if 0 != crc & 0x1000000 as libc::c_long {
|
||||
crc ^= 0x1864cfb
|
||||
}
|
||||
i += 1
|
||||
}
|
||||
}
|
||||
return crc & 0xffffff;
|
||||
}
|
||||
|
||||
/* the result must be freed */
|
||||
pub unsafe fn dc_key_render_base64(
|
||||
mut key: *const dc_key_t,
|
||||
mut break_every: libc::c_int,
|
||||
mut break_chars: *const libc::c_char,
|
||||
mut add_checksum: libc::c_int,
|
||||
) -> *mut libc::c_char {
|
||||
pub fn dc_key_render_base64(key: *const dc_key_t, break_every: usize) -> *mut libc::c_char {
|
||||
if key.is_null() {
|
||||
return 0 as *mut libc::c_char;
|
||||
return std::ptr::null_mut();
|
||||
}
|
||||
return dc_render_base64(
|
||||
(*key).binary,
|
||||
(*key).bytes as size_t,
|
||||
break_every,
|
||||
break_chars,
|
||||
add_checksum,
|
||||
);
|
||||
|
||||
let key = unsafe { *key };
|
||||
let bytes = unsafe { slice::from_raw_parts(key.binary as *const u8, key.bytes as usize) };
|
||||
assert_eq!(bytes.len(), key.bytes as usize);
|
||||
|
||||
let buf = if key.type_0 == 0 {
|
||||
// public key
|
||||
let skey = SignedPublicKey::from_bytes(Cursor::new(bytes)).expect("invalid pub key");
|
||||
skey.to_bytes().expect("failed to serialize key")
|
||||
} else {
|
||||
// secret key
|
||||
let skey = SignedSecretKey::from_bytes(Cursor::new(bytes)).expect("invalid sec key");
|
||||
skey.to_bytes().expect("failed to serialize key")
|
||||
};
|
||||
|
||||
let encoded = base64::encode(&buf);
|
||||
let res = encoded
|
||||
.as_bytes()
|
||||
.chunks(break_every)
|
||||
.fold(String::new(), |mut res, buf| {
|
||||
// safe because we are using a base64 encoded string
|
||||
res += unsafe { std::str::from_utf8_unchecked(buf) };
|
||||
res += " ";
|
||||
res
|
||||
});
|
||||
|
||||
let res_c = CString::new(res.trim()).unwrap();
|
||||
|
||||
// need to use strdup to allocate the result with malloc
|
||||
// so it can be `free`d later.
|
||||
unsafe { libc::strdup(res_c.as_ptr()) }
|
||||
}
|
||||
/* each header line must be terminated by \r\n, the result must be freed */
|
||||
pub unsafe fn dc_key_render_asc(
|
||||
mut key: *const dc_key_t,
|
||||
mut add_header_lines: *const libc::c_char,
|
||||
) -> *mut libc::c_char {
|
||||
/* see RFC 4880, 6.2. Forming ASCII Armor, https://tools.ietf.org/html/rfc4880#section-6.2 */
|
||||
let mut base64: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||
let mut ret: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||
if !key.is_null() {
|
||||
base64 = dc_key_render_base64(
|
||||
key,
|
||||
76i32,
|
||||
b"\r\n\x00" as *const u8 as *const libc::c_char,
|
||||
2i32,
|
||||
);
|
||||
if !base64.is_null() {
|
||||
/*checksum in new line*/
|
||||
/* RFC: The encoded output stream must be represented in lines of no more than 76 characters each. */
|
||||
ret =
|
||||
dc_mprintf(b"-----BEGIN PGP %s KEY BLOCK-----\r\n%s\r\n%s\r\n-----END PGP %s KEY BLOCK-----\r\n\x00"
|
||||
as *const u8 as *const libc::c_char,
|
||||
if (*key).type_0 == 0i32 {
|
||||
b"PUBLIC\x00" as *const u8 as
|
||||
*const libc::c_char
|
||||
} else {
|
||||
b"PRIVATE\x00" as *const u8 as
|
||||
*const libc::c_char
|
||||
},
|
||||
if !add_header_lines.is_null() {
|
||||
add_header_lines
|
||||
} else {
|
||||
b"\x00" as *const u8 as *const libc::c_char
|
||||
}, base64,
|
||||
if (*key).type_0 == 0i32 {
|
||||
b"PUBLIC\x00" as *const u8 as
|
||||
*const libc::c_char
|
||||
} else {
|
||||
b"PRIVATE\x00" as *const u8 as
|
||||
*const libc::c_char
|
||||
})
|
||||
}
|
||||
|
||||
/// each header line must be terminated by `\r\n`, the result must be freed.
|
||||
pub fn dc_key_render_asc(key: *const dc_key_t, header: Option<(&str, &str)>) -> *mut libc::c_char {
|
||||
if key.is_null() {
|
||||
return std::ptr::null_mut();
|
||||
}
|
||||
free(base64 as *mut libc::c_void);
|
||||
return ret;
|
||||
|
||||
let key = unsafe { *key };
|
||||
|
||||
let headers = header.map(|(key, value)| {
|
||||
let mut m = BTreeMap::new();
|
||||
m.insert(key.to_string(), value.to_string());
|
||||
m
|
||||
});
|
||||
|
||||
let bytes = unsafe { slice::from_raw_parts(key.binary as *const u8, key.bytes as usize) };
|
||||
|
||||
let buf = if key.type_0 == 0 {
|
||||
// public key
|
||||
let skey = SignedPublicKey::from_bytes(Cursor::new(bytes)).expect("invalid key");
|
||||
skey.to_armored_string(headers.as_ref())
|
||||
.expect("failed to serialize key")
|
||||
} else {
|
||||
// secret key
|
||||
let skey = SignedSecretKey::from_bytes(Cursor::new(bytes)).expect("invalid key");
|
||||
skey.to_armored_string(headers.as_ref())
|
||||
.expect("failed to serialize key")
|
||||
};
|
||||
|
||||
let buf_c = CString::new(buf).unwrap();
|
||||
|
||||
// need to use strdup to allocate the result with malloc
|
||||
// so it can be `free`d later.
|
||||
unsafe { libc::strdup(buf_c.as_ptr()) }
|
||||
}
|
||||
|
||||
pub unsafe fn dc_key_render_asc_to_file(
|
||||
mut key: *const dc_key_t,
|
||||
mut file: *const libc::c_char,
|
||||
@@ -470,7 +426,7 @@ pub unsafe fn dc_key_render_asc_to_file(
|
||||
let mut success: libc::c_int = 0i32;
|
||||
let mut file_content: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||
if !(key.is_null() || file.is_null() || context.is_null()) {
|
||||
file_content = dc_key_render_asc(key, 0 as *const libc::c_char);
|
||||
file_content = dc_key_render_asc(key, None);
|
||||
if !file_content.is_null() {
|
||||
if 0 == dc_write_file(
|
||||
context,
|
||||
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
use crate::types::*;
|
||||
use libc;
|
||||
|
||||
extern "C" {
|
||||
pub fn mailimap_date_time_new(
|
||||
dt_day: libc::c_int,
|
||||
dt_month: libc::c_int,
|
||||
dt_year: libc::c_int,
|
||||
dt_hour: libc::c_int,
|
||||
dt_min: libc::c_int,
|
||||
dt_sec: libc::c_int,
|
||||
dt_zone: libc::c_int,
|
||||
) -> *mut mailimap_date_time;
|
||||
pub fn mailimap_xlist(
|
||||
session: *mut mailimap,
|
||||
mb: *const libc::c_char,
|
||||
list_mb: *const libc::c_char,
|
||||
result: *mut *mut clist,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimap_create(session: *mut mailimap, mb: *const libc::c_char) -> libc::c_int;
|
||||
pub fn mailimap_list(
|
||||
session: *mut mailimap,
|
||||
mb: *const libc::c_char,
|
||||
list_mb: *const libc::c_char,
|
||||
result: *mut *mut clist,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimap_list_result_free(list: *mut clist);
|
||||
pub fn mailimap_subscribe(session: *mut mailimap, mb: *const libc::c_char) -> libc::c_int;
|
||||
pub fn mailstream_close(s: *mut mailstream) -> libc::c_int;
|
||||
pub fn mailstream_wait_idle(s: *mut mailstream, max_idle_delay: libc::c_int) -> libc::c_int;
|
||||
pub fn mailstream_setup_idle(s: *mut mailstream) -> libc::c_int;
|
||||
pub fn mailstream_unsetup_idle(s: *mut mailstream);
|
||||
pub fn mailstream_interrupt_idle(s: *mut mailstream);
|
||||
pub fn mailimap_section_new(sec_spec: *mut mailimap_section_spec) -> *mut mailimap_section;
|
||||
pub fn mailimap_set_free(set: *mut mailimap_set);
|
||||
pub fn mailimap_fetch_type_free(fetch_type: *mut mailimap_fetch_type);
|
||||
pub fn mailimap_store_att_flags_free(store_att_flags: *mut mailimap_store_att_flags);
|
||||
pub fn mailimap_set_new_interval(first: uint32_t, last: uint32_t) -> *mut mailimap_set;
|
||||
pub fn mailimap_set_new_single(indx: uint32_t) -> *mut mailimap_set;
|
||||
pub fn mailimap_fetch_att_new_envelope() -> *mut mailimap_fetch_att;
|
||||
pub fn mailimap_fetch_att_new_flags() -> *mut mailimap_fetch_att;
|
||||
pub fn mailimap_fetch_att_new_uid() -> *mut mailimap_fetch_att;
|
||||
pub fn mailimap_fetch_att_new_body_peek_section(
|
||||
section: *mut mailimap_section,
|
||||
) -> *mut mailimap_fetch_att;
|
||||
pub fn mailimap_fetch_type_new_fetch_att_list_empty() -> *mut mailimap_fetch_type;
|
||||
pub fn mailimap_fetch_type_new_fetch_att_list_add(
|
||||
fetch_type: *mut mailimap_fetch_type,
|
||||
fetch_att: *mut mailimap_fetch_att,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimap_store_att_flags_new_add_flags(
|
||||
flags: *mut mailimap_flag_list,
|
||||
) -> *mut mailimap_store_att_flags;
|
||||
pub fn mailimap_flag_list_new_empty() -> *mut mailimap_flag_list;
|
||||
pub fn mailimap_flag_list_add(
|
||||
flag_list: *mut mailimap_flag_list,
|
||||
f: *mut mailimap_flag,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimap_flag_new_deleted() -> *mut mailimap_flag;
|
||||
pub fn mailimap_flag_new_seen() -> *mut mailimap_flag;
|
||||
pub fn mailimap_flag_new_flag_keyword(flag_keyword: *mut libc::c_char) -> *mut mailimap_flag;
|
||||
pub fn mailimap_socket_connect(
|
||||
f: *mut mailimap,
|
||||
server: *const libc::c_char,
|
||||
port: uint16_t,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimap_socket_starttls(f: *mut mailimap) -> libc::c_int;
|
||||
pub fn mailimap_ssl_connect(
|
||||
f: *mut mailimap,
|
||||
server: *const libc::c_char,
|
||||
port: uint16_t,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimap_uidplus_uid_copy(
|
||||
session: *mut mailimap,
|
||||
set: *mut mailimap_set,
|
||||
mb: *const libc::c_char,
|
||||
uidvalidity_result: *mut uint32_t,
|
||||
source_result: *mut *mut mailimap_set,
|
||||
dest_result: *mut *mut mailimap_set,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimap_uidplus_uid_move(
|
||||
session: *mut mailimap,
|
||||
set: *mut mailimap_set,
|
||||
mb: *const libc::c_char,
|
||||
uidvalidity_result: *mut uint32_t,
|
||||
source_result: *mut *mut mailimap_set,
|
||||
dest_result: *mut *mut mailimap_set,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimap_idle(session: *mut mailimap) -> libc::c_int;
|
||||
pub fn mailimap_idle_done(session: *mut mailimap) -> libc::c_int;
|
||||
pub fn mailimap_has_idle(session: *mut mailimap) -> libc::c_int;
|
||||
pub fn mailimap_has_xlist(session: *mut mailimap) -> libc::c_int;
|
||||
pub fn mailimap_oauth2_authenticate(
|
||||
session: *mut mailimap,
|
||||
auth_user: *const libc::c_char,
|
||||
access_token: *const libc::c_char,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimap_close(session: *mut mailimap) -> libc::c_int;
|
||||
pub fn mailimap_fetch(
|
||||
session: *mut mailimap,
|
||||
set: *mut mailimap_set,
|
||||
fetch_type: *mut mailimap_fetch_type,
|
||||
result: *mut *mut clist,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimap_uid_fetch(
|
||||
session: *mut mailimap,
|
||||
set: *mut mailimap_set,
|
||||
fetch_type: *mut mailimap_fetch_type,
|
||||
result: *mut *mut clist,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimap_fetch_list_free(fetch_list: *mut clist);
|
||||
pub fn mailimap_login(
|
||||
session: *mut mailimap,
|
||||
userid: *const libc::c_char,
|
||||
password: *const libc::c_char,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimap_select(session: *mut mailimap, mb: *const libc::c_char) -> libc::c_int;
|
||||
pub fn mailimap_uid_store(
|
||||
session: *mut mailimap,
|
||||
set: *mut mailimap_set,
|
||||
store_att_flags: *mut mailimap_store_att_flags,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimap_new(
|
||||
imap_progr_rate: size_t,
|
||||
imap_progr_fun: Option<unsafe extern "C" fn(_: size_t, _: size_t) -> ()>,
|
||||
) -> *mut mailimap;
|
||||
pub fn mailimap_free(session: *mut mailimap);
|
||||
pub fn mailimap_set_timeout(session: *mut mailimap, timeout: time_t);
|
||||
}
|
||||
@@ -22,7 +22,10 @@ extern crate failure;
|
||||
#[macro_use]
|
||||
extern crate num_derive;
|
||||
|
||||
mod imap;
|
||||
mod mime;
|
||||
mod pgp;
|
||||
mod smtp;
|
||||
|
||||
pub mod dc_aheader;
|
||||
pub mod dc_apeerstate;
|
||||
|
||||
+254
@@ -0,0 +1,254 @@
|
||||
use libc;
|
||||
|
||||
use crate::types::*;
|
||||
|
||||
extern "C" {
|
||||
pub fn mailmime_base64_body_parse(
|
||||
message: *const libc::c_char,
|
||||
length: size_t,
|
||||
indx: *mut size_t,
|
||||
result: *mut *mut libc::c_char,
|
||||
result_len: *mut size_t,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimf_address_new(
|
||||
ad_type: libc::c_int,
|
||||
ad_mailbox: *mut mailimf_mailbox,
|
||||
ad_group: *mut mailimf_group,
|
||||
) -> *mut mailimf_address;
|
||||
pub fn mailimf_mailbox_new(
|
||||
mb_display_name: *mut libc::c_char,
|
||||
mb_addr_spec: *mut libc::c_char,
|
||||
) -> *mut mailimf_mailbox;
|
||||
pub fn mailimf_field_new(
|
||||
fld_type: libc::c_int,
|
||||
fld_return_path: *mut mailimf_return,
|
||||
fld_resent_date: *mut mailimf_orig_date,
|
||||
fld_resent_from: *mut mailimf_from,
|
||||
fld_resent_sender: *mut mailimf_sender,
|
||||
fld_resent_to: *mut mailimf_to,
|
||||
fld_resent_cc: *mut mailimf_cc,
|
||||
fld_resent_bcc: *mut mailimf_bcc,
|
||||
fld_resent_msg_id: *mut mailimf_message_id,
|
||||
fld_orig_date: *mut mailimf_orig_date,
|
||||
fld_from: *mut mailimf_from,
|
||||
fld_sender: *mut mailimf_sender,
|
||||
fld_reply_to: *mut mailimf_reply_to,
|
||||
fld_to: *mut mailimf_to,
|
||||
fld_cc: *mut mailimf_cc,
|
||||
fld_bcc: *mut mailimf_bcc,
|
||||
fld_message_id: *mut mailimf_message_id,
|
||||
fld_in_reply_to: *mut mailimf_in_reply_to,
|
||||
fld_references: *mut mailimf_references,
|
||||
fld_subject: *mut mailimf_subject,
|
||||
fld_comments: *mut mailimf_comments,
|
||||
fld_keywords: *mut mailimf_keywords,
|
||||
fld_optional_field: *mut mailimf_optional_field,
|
||||
) -> *mut mailimf_field;
|
||||
pub fn mailimf_subject_new(sbj_value: *mut libc::c_char) -> *mut mailimf_subject;
|
||||
pub fn mailimf_mailbox_list_new_empty() -> *mut mailimf_mailbox_list;
|
||||
pub fn mailimf_mailbox_list_add(
|
||||
mailbox_list: *mut mailimf_mailbox_list,
|
||||
mb: *mut mailimf_mailbox,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimf_address_list_new_empty() -> *mut mailimf_address_list;
|
||||
pub fn mailimf_address_list_add(
|
||||
address_list: *mut mailimf_address_list,
|
||||
addr: *mut mailimf_address,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimf_fields_add(
|
||||
fields: *mut mailimf_fields,
|
||||
field: *mut mailimf_field,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimf_fields_new_with_data_all(
|
||||
date: *mut mailimf_date_time,
|
||||
from: *mut mailimf_mailbox_list,
|
||||
sender: *mut mailimf_mailbox,
|
||||
reply_to: *mut mailimf_address_list,
|
||||
to: *mut mailimf_address_list,
|
||||
cc: *mut mailimf_address_list,
|
||||
bcc: *mut mailimf_address_list,
|
||||
message_id: *mut libc::c_char,
|
||||
in_reply_to: *mut clist,
|
||||
references: *mut clist,
|
||||
subject: *mut libc::c_char,
|
||||
) -> *mut mailimf_fields;
|
||||
pub fn mailimf_get_date(time_0: time_t) -> *mut mailimf_date_time;
|
||||
pub fn mailimf_field_new_custom(
|
||||
name: *mut libc::c_char,
|
||||
value: *mut libc::c_char,
|
||||
) -> *mut mailimf_field;
|
||||
pub fn mailmime_parameter_new(
|
||||
pa_name: *mut libc::c_char,
|
||||
pa_value: *mut libc::c_char,
|
||||
) -> *mut mailmime_parameter;
|
||||
pub fn mailmime_free(mime: *mut mailmime);
|
||||
pub fn mailmime_disposition_parm_new(
|
||||
pa_type: libc::c_int,
|
||||
pa_filename: *mut libc::c_char,
|
||||
pa_creation_date: *mut libc::c_char,
|
||||
pa_modification_date: *mut libc::c_char,
|
||||
pa_read_date: *mut libc::c_char,
|
||||
pa_size: size_t,
|
||||
pa_parameter: *mut mailmime_parameter,
|
||||
) -> *mut mailmime_disposition_parm;
|
||||
pub fn mailmime_new_message_data(msg_mime: *mut mailmime) -> *mut mailmime;
|
||||
pub fn mailmime_new_empty(
|
||||
content: *mut mailmime_content,
|
||||
mime_fields: *mut mailmime_fields,
|
||||
) -> *mut mailmime;
|
||||
pub fn mailmime_set_body_file(
|
||||
build_info: *mut mailmime,
|
||||
filename: *mut libc::c_char,
|
||||
) -> libc::c_int;
|
||||
pub fn mailmime_set_body_text(
|
||||
build_info: *mut mailmime,
|
||||
data_str: *mut libc::c_char,
|
||||
length: size_t,
|
||||
) -> libc::c_int;
|
||||
pub fn mailmime_add_part(build_info: *mut mailmime, part: *mut mailmime) -> libc::c_int;
|
||||
pub fn mailmime_set_imf_fields(build_info: *mut mailmime, fields: *mut mailimf_fields);
|
||||
pub fn mailmime_smart_add_part(mime: *mut mailmime, mime_sub: *mut mailmime) -> libc::c_int;
|
||||
pub fn mailmime_content_new_with_str(str: *const libc::c_char) -> *mut mailmime_content;
|
||||
pub fn mailmime_fields_new_encoding(type_0: libc::c_int) -> *mut mailmime_fields;
|
||||
pub fn mailmime_multiple_new(type_0: *const libc::c_char) -> *mut mailmime;
|
||||
pub fn mailmime_fields_new_filename(
|
||||
dsp_type: libc::c_int,
|
||||
filename: *mut libc::c_char,
|
||||
encoding_type: libc::c_int,
|
||||
) -> *mut mailmime_fields;
|
||||
pub fn mailmime_param_new_with_data(
|
||||
name: *mut libc::c_char,
|
||||
value: *mut libc::c_char,
|
||||
) -> *mut mailmime_parameter;
|
||||
pub fn mailmime_write_mem(
|
||||
f: *mut MMAPString,
|
||||
col: *mut libc::c_int,
|
||||
build_info: *mut mailmime,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimf_fields_free(fields: *mut mailimf_fields);
|
||||
pub fn mailimf_fields_new_empty() -> *mut mailimf_fields;
|
||||
pub fn mailimf_envelope_and_optional_fields_parse(
|
||||
message: *const libc::c_char,
|
||||
length: size_t,
|
||||
indx: *mut size_t,
|
||||
result: *mut *mut mailimf_fields,
|
||||
) -> libc::c_int;
|
||||
pub fn mailmime_content_free(content: *mut mailmime_content);
|
||||
pub fn mailmime_mechanism_new(
|
||||
enc_type: libc::c_int,
|
||||
enc_token: *mut libc::c_char,
|
||||
) -> *mut mailmime_mechanism;
|
||||
pub fn mailmime_mechanism_free(mechanism: *mut mailmime_mechanism);
|
||||
pub fn mailmime_fields_free(fields: *mut mailmime_fields);
|
||||
pub fn mailmime_new(
|
||||
mm_type: libc::c_int,
|
||||
mm_mime_start: *const libc::c_char,
|
||||
mm_length: size_t,
|
||||
mm_mime_fields: *mut mailmime_fields,
|
||||
mm_content_type: *mut mailmime_content,
|
||||
mm_body: *mut mailmime_data,
|
||||
mm_preamble: *mut mailmime_data,
|
||||
mm_epilogue: *mut mailmime_data,
|
||||
mm_mp_list: *mut clist,
|
||||
mm_fields: *mut mailimf_fields,
|
||||
mm_msg_mime: *mut mailmime,
|
||||
) -> *mut mailmime;
|
||||
pub fn mailmime_fields_new_empty() -> *mut mailmime_fields;
|
||||
pub fn mailmime_fields_new_with_data(
|
||||
encoding: *mut mailmime_mechanism,
|
||||
id: *mut libc::c_char,
|
||||
description: *mut libc::c_char,
|
||||
disposition: *mut mailmime_disposition,
|
||||
language: *mut mailmime_language,
|
||||
) -> *mut mailmime_fields;
|
||||
pub fn mailmime_get_content_message() -> *mut mailmime_content;
|
||||
pub fn mailmime_parse(
|
||||
message: *const libc::c_char,
|
||||
length: size_t,
|
||||
indx: *mut size_t,
|
||||
result: *mut *mut mailmime,
|
||||
) -> libc::c_int;
|
||||
pub fn mailmime_part_parse(
|
||||
message: *const libc::c_char,
|
||||
length: size_t,
|
||||
indx: *mut size_t,
|
||||
encoding: libc::c_int,
|
||||
result: *mut *mut libc::c_char,
|
||||
result_len: *mut size_t,
|
||||
) -> libc::c_int;
|
||||
pub fn mailmime_substitute(old_mime: *mut mailmime, new_mime: *mut mailmime) -> libc::c_int;
|
||||
pub fn mailprivacy_prepare_mime(mime: *mut mailmime);
|
||||
pub fn mailmime_encoded_phrase_parse(
|
||||
default_fromcode: *const libc::c_char,
|
||||
message: *const libc::c_char,
|
||||
length: size_t,
|
||||
indx: *mut size_t,
|
||||
tocode: *const libc::c_char,
|
||||
result: *mut *mut libc::c_char,
|
||||
) -> libc::c_int;
|
||||
|
||||
pub fn mailimf_msg_id_parse(
|
||||
message: *const libc::c_char,
|
||||
length: size_t,
|
||||
indx: *mut size_t,
|
||||
result: *mut *mut libc::c_char,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimf_mailbox_list_free(mb_list: *mut mailimf_mailbox_list);
|
||||
pub fn mailimf_mailbox_list_parse(
|
||||
message: *const libc::c_char,
|
||||
length: size_t,
|
||||
indx: *mut size_t,
|
||||
result: *mut *mut mailimf_mailbox_list,
|
||||
) -> libc::c_int;
|
||||
pub fn mailmime_content_charset_get(content: *mut mailmime_content) -> *mut libc::c_char;
|
||||
|
||||
pub fn carray_new(initsize: libc::c_uint) -> *mut carray;
|
||||
pub fn carray_add(
|
||||
array: *mut carray,
|
||||
data: *mut libc::c_void,
|
||||
indx: *mut libc::c_uint,
|
||||
) -> libc::c_int;
|
||||
pub fn carray_set_size(array: *mut carray, new_size: libc::c_uint);
|
||||
pub fn carray_free(array: *mut carray);
|
||||
pub fn carray_delete_slow(array: *mut carray, indx: libc::c_uint) -> libc::c_int;
|
||||
|
||||
pub fn mmap_string_unref(str: *mut libc::c_char) -> libc::c_int;
|
||||
pub fn mmap_string_new(init: *const libc::c_char) -> *mut MMAPString;
|
||||
pub fn mmap_string_free(string: *mut MMAPString);
|
||||
pub fn mmap_string_append(string: *mut MMAPString, val: *const libc::c_char)
|
||||
-> *mut MMAPString;
|
||||
pub fn mmap_string_append_len(
|
||||
string: *mut MMAPString,
|
||||
val: *const libc::c_char,
|
||||
len: size_t,
|
||||
) -> *mut MMAPString;
|
||||
pub fn mmap_string_append_c(string: *mut MMAPString, c: libc::c_char) -> *mut MMAPString;
|
||||
|
||||
pub fn clist_free(_: *mut clist);
|
||||
pub fn clist_insert_after(
|
||||
_: *mut clist,
|
||||
_: *mut clistiter,
|
||||
_: *mut libc::c_void,
|
||||
) -> libc::c_int;
|
||||
pub fn clist_new() -> *mut clist;
|
||||
pub fn clist_delete(_: *mut clist, _: *mut clistiter) -> *mut clistiter;
|
||||
|
||||
// --charconv
|
||||
|
||||
pub fn charconv(
|
||||
tocode: *const libc::c_char,
|
||||
fromcode: *const libc::c_char,
|
||||
str: *const libc::c_char,
|
||||
length: size_t,
|
||||
result: *mut *mut libc::c_char,
|
||||
) -> libc::c_int;
|
||||
pub fn charconv_buffer(
|
||||
tocode: *const libc::c_char,
|
||||
fromcode: *const libc::c_char,
|
||||
str: *const libc::c_char,
|
||||
length: size_t,
|
||||
result: *mut *mut libc::c_char,
|
||||
result_len: *mut size_t,
|
||||
) -> libc::c_int;
|
||||
pub fn charconv_buffer_free(str: *mut libc::c_char);
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
use crate::types::*;
|
||||
use libc;
|
||||
|
||||
extern "C" {
|
||||
pub fn gethostname(_: *mut libc::c_char, _: size_t) -> libc::c_int;
|
||||
|
||||
pub fn mailsmtp_socket_connect(
|
||||
session: *mut mailsmtp,
|
||||
server: *const libc::c_char,
|
||||
port: uint16_t,
|
||||
) -> libc::c_int;
|
||||
pub fn mailsmtp_socket_starttls(session: *mut mailsmtp) -> libc::c_int;
|
||||
pub fn mailsmtp_ssl_connect(
|
||||
session: *mut mailsmtp,
|
||||
server: *const libc::c_char,
|
||||
port: uint16_t,
|
||||
) -> libc::c_int;
|
||||
pub fn mailsmtp_oauth2_authenticate(
|
||||
session: *mut mailsmtp,
|
||||
auth_user: *const libc::c_char,
|
||||
access_token: *const libc::c_char,
|
||||
) -> libc::c_int;
|
||||
pub fn mailsmtp_new(
|
||||
progr_rate: size_t,
|
||||
progr_fun: Option<unsafe extern "C" fn(_: size_t, _: size_t) -> ()>,
|
||||
) -> *mut mailsmtp;
|
||||
pub fn mailsmtp_free(session: *mut mailsmtp);
|
||||
pub fn mailsmtp_set_timeout(session: *mut mailsmtp, timeout: time_t);
|
||||
pub fn mailsmtp_auth(
|
||||
session: *mut mailsmtp,
|
||||
user: *const libc::c_char,
|
||||
pass: *const libc::c_char,
|
||||
) -> libc::c_int;
|
||||
pub fn mailsmtp_helo(session: *mut mailsmtp) -> libc::c_int;
|
||||
pub fn mailsmtp_mail(session: *mut mailsmtp, from: *const libc::c_char) -> libc::c_int;
|
||||
pub fn mailsmtp_rcpt(session: *mut mailsmtp, to: *const libc::c_char) -> libc::c_int;
|
||||
pub fn mailsmtp_data(session: *mut mailsmtp) -> libc::c_int;
|
||||
pub fn mailsmtp_data_message(
|
||||
session: *mut mailsmtp,
|
||||
message: *const libc::c_char,
|
||||
size: size_t,
|
||||
) -> libc::c_int;
|
||||
pub fn mailesmtp_ehlo(session: *mut mailsmtp) -> libc::c_int;
|
||||
pub fn mailesmtp_mail(
|
||||
session: *mut mailsmtp,
|
||||
from: *const libc::c_char,
|
||||
return_full: libc::c_int,
|
||||
envid: *const libc::c_char,
|
||||
) -> libc::c_int;
|
||||
pub fn mailesmtp_rcpt(
|
||||
session: *mut mailsmtp,
|
||||
to: *const libc::c_char,
|
||||
notify: libc::c_int,
|
||||
orcpt: *const libc::c_char,
|
||||
) -> libc::c_int;
|
||||
pub fn mailsmtp_strerror(errnum: libc::c_int) -> *const libc::c_char;
|
||||
pub fn mailesmtp_auth_sasl(
|
||||
session: *mut mailsmtp,
|
||||
auth_type: *const libc::c_char,
|
||||
server_fqdn: *const libc::c_char,
|
||||
local_ip_port: *const libc::c_char,
|
||||
remote_ip_port: *const libc::c_char,
|
||||
login: *const libc::c_char,
|
||||
auth_name: *const libc::c_char,
|
||||
password: *const libc::c_char,
|
||||
realm: *const libc::c_char,
|
||||
) -> libc::c_int;
|
||||
pub fn mailsmtp_set_progress_callback(
|
||||
session: *mut mailsmtp,
|
||||
progr_fun: Option<unsafe extern "C" fn(_: size_t, _: size_t, _: *mut libc::c_void) -> ()>,
|
||||
context: *mut libc::c_void,
|
||||
);
|
||||
}
|
||||
@@ -3,6 +3,9 @@ use libc;
|
||||
use crate::dc_strbuilder::dc_strbuilder_t;
|
||||
use crate::types::*;
|
||||
|
||||
pub use crate::imap::*;
|
||||
pub use crate::mime::*;
|
||||
pub use crate::smtp::*;
|
||||
pub use libc::{
|
||||
atoi, calloc, close, closedir, exit, fclose, fgets, fopen, fread, free, fseek, ftell, fwrite,
|
||||
gmtime, gmtime_r, localtime, localtime_r, malloc, memcmp, memcpy, memmove, memset, mkdir, open,
|
||||
@@ -55,452 +58,6 @@ extern "C" {
|
||||
_: *const libc::c_char,
|
||||
) -> !;
|
||||
|
||||
// --charconv
|
||||
|
||||
pub fn charconv(
|
||||
tocode: *const libc::c_char,
|
||||
fromcode: *const libc::c_char,
|
||||
str: *const libc::c_char,
|
||||
length: size_t,
|
||||
result: *mut *mut libc::c_char,
|
||||
) -> libc::c_int;
|
||||
pub fn charconv_buffer(
|
||||
tocode: *const libc::c_char,
|
||||
fromcode: *const libc::c_char,
|
||||
str: *const libc::c_char,
|
||||
length: size_t,
|
||||
result: *mut *mut libc::c_char,
|
||||
result_len: *mut size_t,
|
||||
) -> libc::c_int;
|
||||
pub fn charconv_buffer_free(str: *mut libc::c_char);
|
||||
|
||||
// -- libetpan Methods
|
||||
|
||||
pub fn libetpan_get_version_major() -> libc::c_int;
|
||||
pub fn libetpan_get_version_minor() -> libc::c_int;
|
||||
pub fn gethostname(_: *mut libc::c_char, _: size_t) -> libc::c_int;
|
||||
pub fn mailsmtp_socket_connect(
|
||||
session: *mut mailsmtp,
|
||||
server: *const libc::c_char,
|
||||
port: uint16_t,
|
||||
) -> libc::c_int;
|
||||
pub fn mailsmtp_socket_starttls(session: *mut mailsmtp) -> libc::c_int;
|
||||
pub fn mailsmtp_ssl_connect(
|
||||
session: *mut mailsmtp,
|
||||
server: *const libc::c_char,
|
||||
port: uint16_t,
|
||||
) -> libc::c_int;
|
||||
pub fn mailsmtp_oauth2_authenticate(
|
||||
session: *mut mailsmtp,
|
||||
auth_user: *const libc::c_char,
|
||||
access_token: *const libc::c_char,
|
||||
) -> libc::c_int;
|
||||
pub fn mailsmtp_new(
|
||||
progr_rate: size_t,
|
||||
progr_fun: Option<unsafe extern "C" fn(_: size_t, _: size_t) -> ()>,
|
||||
) -> *mut mailsmtp;
|
||||
pub fn mailsmtp_free(session: *mut mailsmtp);
|
||||
pub fn mailsmtp_set_timeout(session: *mut mailsmtp, timeout: time_t);
|
||||
pub fn mailsmtp_auth(
|
||||
session: *mut mailsmtp,
|
||||
user: *const libc::c_char,
|
||||
pass: *const libc::c_char,
|
||||
) -> libc::c_int;
|
||||
pub fn mailsmtp_helo(session: *mut mailsmtp) -> libc::c_int;
|
||||
pub fn mailsmtp_mail(session: *mut mailsmtp, from: *const libc::c_char) -> libc::c_int;
|
||||
pub fn mailsmtp_rcpt(session: *mut mailsmtp, to: *const libc::c_char) -> libc::c_int;
|
||||
pub fn mailsmtp_data(session: *mut mailsmtp) -> libc::c_int;
|
||||
pub fn mailsmtp_data_message(
|
||||
session: *mut mailsmtp,
|
||||
message: *const libc::c_char,
|
||||
size: size_t,
|
||||
) -> libc::c_int;
|
||||
pub fn mailesmtp_ehlo(session: *mut mailsmtp) -> libc::c_int;
|
||||
pub fn mailesmtp_mail(
|
||||
session: *mut mailsmtp,
|
||||
from: *const libc::c_char,
|
||||
return_full: libc::c_int,
|
||||
envid: *const libc::c_char,
|
||||
) -> libc::c_int;
|
||||
pub fn mailesmtp_rcpt(
|
||||
session: *mut mailsmtp,
|
||||
to: *const libc::c_char,
|
||||
notify: libc::c_int,
|
||||
orcpt: *const libc::c_char,
|
||||
) -> libc::c_int;
|
||||
pub fn mailsmtp_strerror(errnum: libc::c_int) -> *const libc::c_char;
|
||||
pub fn mailesmtp_auth_sasl(
|
||||
session: *mut mailsmtp,
|
||||
auth_type: *const libc::c_char,
|
||||
server_fqdn: *const libc::c_char,
|
||||
local_ip_port: *const libc::c_char,
|
||||
remote_ip_port: *const libc::c_char,
|
||||
login: *const libc::c_char,
|
||||
auth_name: *const libc::c_char,
|
||||
password: *const libc::c_char,
|
||||
realm: *const libc::c_char,
|
||||
) -> libc::c_int;
|
||||
pub fn mailsmtp_set_progress_callback(
|
||||
session: *mut mailsmtp,
|
||||
progr_fun: Option<unsafe extern "C" fn(_: size_t, _: size_t, _: *mut libc::c_void) -> ()>,
|
||||
context: *mut libc::c_void,
|
||||
);
|
||||
|
||||
pub fn mailmime_base64_body_parse(
|
||||
message: *const libc::c_char,
|
||||
length: size_t,
|
||||
indx: *mut size_t,
|
||||
result: *mut *mut libc::c_char,
|
||||
result_len: *mut size_t,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimf_address_new(
|
||||
ad_type: libc::c_int,
|
||||
ad_mailbox: *mut mailimf_mailbox,
|
||||
ad_group: *mut mailimf_group,
|
||||
) -> *mut mailimf_address;
|
||||
pub fn mailimf_mailbox_new(
|
||||
mb_display_name: *mut libc::c_char,
|
||||
mb_addr_spec: *mut libc::c_char,
|
||||
) -> *mut mailimf_mailbox;
|
||||
pub fn mailimf_field_new(
|
||||
fld_type: libc::c_int,
|
||||
fld_return_path: *mut mailimf_return,
|
||||
fld_resent_date: *mut mailimf_orig_date,
|
||||
fld_resent_from: *mut mailimf_from,
|
||||
fld_resent_sender: *mut mailimf_sender,
|
||||
fld_resent_to: *mut mailimf_to,
|
||||
fld_resent_cc: *mut mailimf_cc,
|
||||
fld_resent_bcc: *mut mailimf_bcc,
|
||||
fld_resent_msg_id: *mut mailimf_message_id,
|
||||
fld_orig_date: *mut mailimf_orig_date,
|
||||
fld_from: *mut mailimf_from,
|
||||
fld_sender: *mut mailimf_sender,
|
||||
fld_reply_to: *mut mailimf_reply_to,
|
||||
fld_to: *mut mailimf_to,
|
||||
fld_cc: *mut mailimf_cc,
|
||||
fld_bcc: *mut mailimf_bcc,
|
||||
fld_message_id: *mut mailimf_message_id,
|
||||
fld_in_reply_to: *mut mailimf_in_reply_to,
|
||||
fld_references: *mut mailimf_references,
|
||||
fld_subject: *mut mailimf_subject,
|
||||
fld_comments: *mut mailimf_comments,
|
||||
fld_keywords: *mut mailimf_keywords,
|
||||
fld_optional_field: *mut mailimf_optional_field,
|
||||
) -> *mut mailimf_field;
|
||||
pub fn mailimf_subject_new(sbj_value: *mut libc::c_char) -> *mut mailimf_subject;
|
||||
pub fn mailimf_mailbox_list_new_empty() -> *mut mailimf_mailbox_list;
|
||||
pub fn mailimf_mailbox_list_add(
|
||||
mailbox_list: *mut mailimf_mailbox_list,
|
||||
mb: *mut mailimf_mailbox,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimf_address_list_new_empty() -> *mut mailimf_address_list;
|
||||
pub fn mailimf_address_list_add(
|
||||
address_list: *mut mailimf_address_list,
|
||||
addr: *mut mailimf_address,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimf_fields_add(
|
||||
fields: *mut mailimf_fields,
|
||||
field: *mut mailimf_field,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimf_fields_new_with_data_all(
|
||||
date: *mut mailimf_date_time,
|
||||
from: *mut mailimf_mailbox_list,
|
||||
sender: *mut mailimf_mailbox,
|
||||
reply_to: *mut mailimf_address_list,
|
||||
to: *mut mailimf_address_list,
|
||||
cc: *mut mailimf_address_list,
|
||||
bcc: *mut mailimf_address_list,
|
||||
message_id: *mut libc::c_char,
|
||||
in_reply_to: *mut clist,
|
||||
references: *mut clist,
|
||||
subject: *mut libc::c_char,
|
||||
) -> *mut mailimf_fields;
|
||||
pub fn mailimf_get_date(time_0: time_t) -> *mut mailimf_date_time;
|
||||
pub fn mailimf_field_new_custom(
|
||||
name: *mut libc::c_char,
|
||||
value: *mut libc::c_char,
|
||||
) -> *mut mailimf_field;
|
||||
pub fn mailmime_parameter_new(
|
||||
pa_name: *mut libc::c_char,
|
||||
pa_value: *mut libc::c_char,
|
||||
) -> *mut mailmime_parameter;
|
||||
pub fn mailmime_free(mime: *mut mailmime);
|
||||
pub fn mailmime_disposition_parm_new(
|
||||
pa_type: libc::c_int,
|
||||
pa_filename: *mut libc::c_char,
|
||||
pa_creation_date: *mut libc::c_char,
|
||||
pa_modification_date: *mut libc::c_char,
|
||||
pa_read_date: *mut libc::c_char,
|
||||
pa_size: size_t,
|
||||
pa_parameter: *mut mailmime_parameter,
|
||||
) -> *mut mailmime_disposition_parm;
|
||||
pub fn mailmime_new_message_data(msg_mime: *mut mailmime) -> *mut mailmime;
|
||||
pub fn mailmime_new_empty(
|
||||
content: *mut mailmime_content,
|
||||
mime_fields: *mut mailmime_fields,
|
||||
) -> *mut mailmime;
|
||||
pub fn mailmime_set_body_file(
|
||||
build_info: *mut mailmime,
|
||||
filename: *mut libc::c_char,
|
||||
) -> libc::c_int;
|
||||
pub fn mailmime_set_body_text(
|
||||
build_info: *mut mailmime,
|
||||
data_str: *mut libc::c_char,
|
||||
length: size_t,
|
||||
) -> libc::c_int;
|
||||
pub fn mailmime_add_part(build_info: *mut mailmime, part: *mut mailmime) -> libc::c_int;
|
||||
pub fn mailmime_set_imf_fields(build_info: *mut mailmime, fields: *mut mailimf_fields);
|
||||
pub fn mailmime_smart_add_part(mime: *mut mailmime, mime_sub: *mut mailmime) -> libc::c_int;
|
||||
pub fn mailmime_content_new_with_str(str: *const libc::c_char) -> *mut mailmime_content;
|
||||
pub fn mailmime_fields_new_encoding(type_0: libc::c_int) -> *mut mailmime_fields;
|
||||
pub fn mailmime_multiple_new(type_0: *const libc::c_char) -> *mut mailmime;
|
||||
pub fn mailmime_fields_new_filename(
|
||||
dsp_type: libc::c_int,
|
||||
filename: *mut libc::c_char,
|
||||
encoding_type: libc::c_int,
|
||||
) -> *mut mailmime_fields;
|
||||
pub fn mailmime_param_new_with_data(
|
||||
name: *mut libc::c_char,
|
||||
value: *mut libc::c_char,
|
||||
) -> *mut mailmime_parameter;
|
||||
pub fn mailmime_write_mem(
|
||||
f: *mut MMAPString,
|
||||
col: *mut libc::c_int,
|
||||
build_info: *mut mailmime,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimf_fields_free(fields: *mut mailimf_fields);
|
||||
pub fn mailimf_fields_new_empty() -> *mut mailimf_fields;
|
||||
pub fn mailimf_envelope_and_optional_fields_parse(
|
||||
message: *const libc::c_char,
|
||||
length: size_t,
|
||||
indx: *mut size_t,
|
||||
result: *mut *mut mailimf_fields,
|
||||
) -> libc::c_int;
|
||||
pub fn mailmime_content_free(content: *mut mailmime_content);
|
||||
pub fn mailmime_mechanism_new(
|
||||
enc_type: libc::c_int,
|
||||
enc_token: *mut libc::c_char,
|
||||
) -> *mut mailmime_mechanism;
|
||||
pub fn mailmime_mechanism_free(mechanism: *mut mailmime_mechanism);
|
||||
pub fn mailmime_fields_free(fields: *mut mailmime_fields);
|
||||
pub fn mailmime_new(
|
||||
mm_type: libc::c_int,
|
||||
mm_mime_start: *const libc::c_char,
|
||||
mm_length: size_t,
|
||||
mm_mime_fields: *mut mailmime_fields,
|
||||
mm_content_type: *mut mailmime_content,
|
||||
mm_body: *mut mailmime_data,
|
||||
mm_preamble: *mut mailmime_data,
|
||||
mm_epilogue: *mut mailmime_data,
|
||||
mm_mp_list: *mut clist,
|
||||
mm_fields: *mut mailimf_fields,
|
||||
mm_msg_mime: *mut mailmime,
|
||||
) -> *mut mailmime;
|
||||
pub fn mailmime_fields_new_empty() -> *mut mailmime_fields;
|
||||
pub fn mailmime_fields_new_with_data(
|
||||
encoding: *mut mailmime_mechanism,
|
||||
id: *mut libc::c_char,
|
||||
description: *mut libc::c_char,
|
||||
disposition: *mut mailmime_disposition,
|
||||
language: *mut mailmime_language,
|
||||
) -> *mut mailmime_fields;
|
||||
pub fn mailmime_get_content_message() -> *mut mailmime_content;
|
||||
pub fn mailmime_parse(
|
||||
message: *const libc::c_char,
|
||||
length: size_t,
|
||||
indx: *mut size_t,
|
||||
result: *mut *mut mailmime,
|
||||
) -> libc::c_int;
|
||||
pub fn mailmime_part_parse(
|
||||
message: *const libc::c_char,
|
||||
length: size_t,
|
||||
indx: *mut size_t,
|
||||
encoding: libc::c_int,
|
||||
result: *mut *mut libc::c_char,
|
||||
result_len: *mut size_t,
|
||||
) -> libc::c_int;
|
||||
pub fn mailmime_substitute(old_mime: *mut mailmime, new_mime: *mut mailmime) -> libc::c_int;
|
||||
pub fn mailprivacy_prepare_mime(mime: *mut mailmime);
|
||||
pub fn mailmime_encoded_phrase_parse(
|
||||
default_fromcode: *const libc::c_char,
|
||||
message: *const libc::c_char,
|
||||
length: size_t,
|
||||
indx: *mut size_t,
|
||||
tocode: *const libc::c_char,
|
||||
result: *mut *mut libc::c_char,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimap_date_time_new(
|
||||
dt_day: libc::c_int,
|
||||
dt_month: libc::c_int,
|
||||
dt_year: libc::c_int,
|
||||
dt_hour: libc::c_int,
|
||||
dt_min: libc::c_int,
|
||||
dt_sec: libc::c_int,
|
||||
dt_zone: libc::c_int,
|
||||
) -> *mut mailimap_date_time;
|
||||
pub fn mailimap_xlist(
|
||||
session: *mut mailimap,
|
||||
mb: *const libc::c_char,
|
||||
list_mb: *const libc::c_char,
|
||||
result: *mut *mut clist,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimap_create(session: *mut mailimap, mb: *const libc::c_char) -> libc::c_int;
|
||||
pub fn mailimap_list(
|
||||
session: *mut mailimap,
|
||||
mb: *const libc::c_char,
|
||||
list_mb: *const libc::c_char,
|
||||
result: *mut *mut clist,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimap_list_result_free(list: *mut clist);
|
||||
pub fn mailimap_subscribe(session: *mut mailimap, mb: *const libc::c_char) -> libc::c_int;
|
||||
pub fn mailstream_close(s: *mut mailstream) -> libc::c_int;
|
||||
pub fn mailstream_wait_idle(s: *mut mailstream, max_idle_delay: libc::c_int) -> libc::c_int;
|
||||
pub fn mailstream_setup_idle(s: *mut mailstream) -> libc::c_int;
|
||||
pub fn mailstream_unsetup_idle(s: *mut mailstream);
|
||||
pub fn mailstream_interrupt_idle(s: *mut mailstream);
|
||||
pub fn mailimap_section_new(sec_spec: *mut mailimap_section_spec) -> *mut mailimap_section;
|
||||
pub fn mailimap_set_free(set: *mut mailimap_set);
|
||||
pub fn mailimap_fetch_type_free(fetch_type: *mut mailimap_fetch_type);
|
||||
pub fn mailimap_store_att_flags_free(store_att_flags: *mut mailimap_store_att_flags);
|
||||
pub fn mailimap_set_new_interval(first: uint32_t, last: uint32_t) -> *mut mailimap_set;
|
||||
pub fn mailimap_set_new_single(indx: uint32_t) -> *mut mailimap_set;
|
||||
pub fn mailimap_fetch_att_new_envelope() -> *mut mailimap_fetch_att;
|
||||
pub fn mailimap_fetch_att_new_flags() -> *mut mailimap_fetch_att;
|
||||
pub fn mailimap_fetch_att_new_uid() -> *mut mailimap_fetch_att;
|
||||
pub fn mailimap_fetch_att_new_body_peek_section(
|
||||
section: *mut mailimap_section,
|
||||
) -> *mut mailimap_fetch_att;
|
||||
pub fn mailimap_fetch_type_new_fetch_att_list_empty() -> *mut mailimap_fetch_type;
|
||||
pub fn mailimap_fetch_type_new_fetch_att_list_add(
|
||||
fetch_type: *mut mailimap_fetch_type,
|
||||
fetch_att: *mut mailimap_fetch_att,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimap_store_att_flags_new_add_flags(
|
||||
flags: *mut mailimap_flag_list,
|
||||
) -> *mut mailimap_store_att_flags;
|
||||
pub fn mailimap_flag_list_new_empty() -> *mut mailimap_flag_list;
|
||||
pub fn mailimap_flag_list_add(
|
||||
flag_list: *mut mailimap_flag_list,
|
||||
f: *mut mailimap_flag,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimap_flag_new_deleted() -> *mut mailimap_flag;
|
||||
pub fn mailimap_flag_new_seen() -> *mut mailimap_flag;
|
||||
pub fn mailimap_flag_new_flag_keyword(flag_keyword: *mut libc::c_char) -> *mut mailimap_flag;
|
||||
pub fn mailimap_socket_connect(
|
||||
f: *mut mailimap,
|
||||
server: *const libc::c_char,
|
||||
port: uint16_t,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimap_socket_starttls(f: *mut mailimap) -> libc::c_int;
|
||||
pub fn mailimap_ssl_connect(
|
||||
f: *mut mailimap,
|
||||
server: *const libc::c_char,
|
||||
port: uint16_t,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimap_uidplus_uid_copy(
|
||||
session: *mut mailimap,
|
||||
set: *mut mailimap_set,
|
||||
mb: *const libc::c_char,
|
||||
uidvalidity_result: *mut uint32_t,
|
||||
source_result: *mut *mut mailimap_set,
|
||||
dest_result: *mut *mut mailimap_set,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimap_uidplus_uid_move(
|
||||
session: *mut mailimap,
|
||||
set: *mut mailimap_set,
|
||||
mb: *const libc::c_char,
|
||||
uidvalidity_result: *mut uint32_t,
|
||||
source_result: *mut *mut mailimap_set,
|
||||
dest_result: *mut *mut mailimap_set,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimap_idle(session: *mut mailimap) -> libc::c_int;
|
||||
pub fn mailimap_idle_done(session: *mut mailimap) -> libc::c_int;
|
||||
pub fn mailimap_has_idle(session: *mut mailimap) -> libc::c_int;
|
||||
pub fn mailimap_has_xlist(session: *mut mailimap) -> libc::c_int;
|
||||
pub fn mailimap_oauth2_authenticate(
|
||||
session: *mut mailimap,
|
||||
auth_user: *const libc::c_char,
|
||||
access_token: *const libc::c_char,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimap_close(session: *mut mailimap) -> libc::c_int;
|
||||
pub fn mailimap_fetch(
|
||||
session: *mut mailimap,
|
||||
set: *mut mailimap_set,
|
||||
fetch_type: *mut mailimap_fetch_type,
|
||||
result: *mut *mut clist,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimap_uid_fetch(
|
||||
session: *mut mailimap,
|
||||
set: *mut mailimap_set,
|
||||
fetch_type: *mut mailimap_fetch_type,
|
||||
result: *mut *mut clist,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimap_fetch_list_free(fetch_list: *mut clist);
|
||||
pub fn mailimap_login(
|
||||
session: *mut mailimap,
|
||||
userid: *const libc::c_char,
|
||||
password: *const libc::c_char,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimap_select(session: *mut mailimap, mb: *const libc::c_char) -> libc::c_int;
|
||||
pub fn mailimap_uid_store(
|
||||
session: *mut mailimap,
|
||||
set: *mut mailimap_set,
|
||||
store_att_flags: *mut mailimap_store_att_flags,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimap_new(
|
||||
imap_progr_rate: size_t,
|
||||
imap_progr_fun: Option<unsafe extern "C" fn(_: size_t, _: size_t) -> ()>,
|
||||
) -> *mut mailimap;
|
||||
pub fn mailimap_free(session: *mut mailimap);
|
||||
pub fn mailimap_set_timeout(session: *mut mailimap, timeout: time_t);
|
||||
pub fn mailimf_msg_id_parse(
|
||||
message: *const libc::c_char,
|
||||
length: size_t,
|
||||
indx: *mut size_t,
|
||||
result: *mut *mut libc::c_char,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimf_mailbox_list_free(mb_list: *mut mailimf_mailbox_list);
|
||||
pub fn mailimf_mailbox_list_parse(
|
||||
message: *const libc::c_char,
|
||||
length: size_t,
|
||||
indx: *mut size_t,
|
||||
result: *mut *mut mailimf_mailbox_list,
|
||||
) -> libc::c_int;
|
||||
pub fn mailmime_content_charset_get(content: *mut mailmime_content) -> *mut libc::c_char;
|
||||
|
||||
pub fn carray_new(initsize: libc::c_uint) -> *mut carray;
|
||||
pub fn carray_add(
|
||||
array: *mut carray,
|
||||
data: *mut libc::c_void,
|
||||
indx: *mut libc::c_uint,
|
||||
) -> libc::c_int;
|
||||
pub fn carray_set_size(array: *mut carray, new_size: libc::c_uint);
|
||||
pub fn carray_free(array: *mut carray);
|
||||
pub fn carray_delete_slow(array: *mut carray, indx: libc::c_uint) -> libc::c_int;
|
||||
|
||||
pub fn mmap_string_unref(str: *mut libc::c_char) -> libc::c_int;
|
||||
pub fn mmap_string_new(init: *const libc::c_char) -> *mut MMAPString;
|
||||
pub fn mmap_string_free(string: *mut MMAPString);
|
||||
pub fn mmap_string_append(string: *mut MMAPString, val: *const libc::c_char)
|
||||
-> *mut MMAPString;
|
||||
pub fn mmap_string_append_len(
|
||||
string: *mut MMAPString,
|
||||
val: *const libc::c_char,
|
||||
len: size_t,
|
||||
) -> *mut MMAPString;
|
||||
pub fn mmap_string_append_c(string: *mut MMAPString, c: libc::c_char) -> *mut MMAPString;
|
||||
|
||||
pub fn clist_free(_: *mut clist);
|
||||
pub fn clist_insert_after(
|
||||
_: *mut clist,
|
||||
_: *mut clistiter,
|
||||
_: *mut libc::c_void,
|
||||
) -> libc::c_int;
|
||||
pub fn clist_new() -> *mut clist;
|
||||
pub fn clist_delete(_: *mut clist, _: *mut clistiter) -> *mut clistiter;
|
||||
|
||||
pub fn encode_base64(in_0: *const libc::c_char, len: libc::c_int) -> *mut libc::c_char;
|
||||
|
||||
// -- DC Methods
|
||||
|
||||
pub fn dc_strbuilder_catf(_: *mut dc_strbuilder_t, format: *const libc::c_char, _: ...);
|
||||
|
||||
Reference in New Issue
Block a user