mirror of
https://github.com/chatmail/core.git
synced 2026-04-06 15:42:10 +03:00
we compile again
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
use libc;
|
||||
|
||||
use crate::dc_key::dc_key_t;
|
||||
use crate::dc_strbuilder::dc_strbuilder_t;
|
||||
use crate::dc_contact::*;
|
||||
use crate::dc_key::*;
|
||||
use crate::dc_strbuilder::*;
|
||||
use crate::dc_tools::*;
|
||||
use crate::types::*;
|
||||
use crate::x::*;
|
||||
|
||||
|
||||
@@ -2,11 +2,13 @@ use c2rust_bitfields::BitfieldStruct;
|
||||
use libc;
|
||||
|
||||
use crate::dc_aheader::*;
|
||||
use crate::dc_chat::*;
|
||||
use crate::dc_context::dc_context_t;
|
||||
use crate::dc_hash::*;
|
||||
use crate::dc_key::dc_key_t;
|
||||
use crate::dc_key::*;
|
||||
use crate::dc_lot::dc_lot_t;
|
||||
use crate::dc_sqlite3::*;
|
||||
use crate::dc_tools::*;
|
||||
use crate::types::*;
|
||||
use crate::x::*;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ use libc;
|
||||
use crate::dc_context::dc_context_t;
|
||||
use crate::dc_lot::dc_lot_t;
|
||||
use crate::dc_sqlite3::*;
|
||||
use crate::dc_tools::*;
|
||||
use crate::types::*;
|
||||
use crate::x::*;
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
use c2rust_bitfields::BitfieldStruct;
|
||||
use libc;
|
||||
|
||||
use crate::dc_array::dc_array_t;
|
||||
use crate::dc_array::*;
|
||||
use crate::dc_chatlist::*;
|
||||
use crate::dc_contact::*;
|
||||
use crate::dc_context::dc_context_t;
|
||||
use crate::dc_job::*;
|
||||
use crate::dc_log::*;
|
||||
use crate::dc_lot::dc_lot_t;
|
||||
use crate::dc_msg::*;
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
use c2rust_bitfields::BitfieldStruct;
|
||||
use libc;
|
||||
|
||||
use crate::dc_array::dc_array_t;
|
||||
use crate::dc_context::dc_context_t;
|
||||
use crate::dc_lot::dc_lot_t;
|
||||
use crate::dc_array::*;
|
||||
use crate::dc_chat::*;
|
||||
use crate::dc_contact::*;
|
||||
use crate::dc_context::*;
|
||||
use crate::dc_lot::*;
|
||||
use crate::dc_msg::*;
|
||||
use crate::dc_sqlite3::*;
|
||||
use crate::dc_stock::*;
|
||||
use crate::dc_tools::*;
|
||||
use crate::types::*;
|
||||
use crate::x::*;
|
||||
|
||||
@@ -18,27 +23,6 @@ pub struct dc_chatlist_t {
|
||||
pub chatNlastmsg_ids: *mut dc_array_t,
|
||||
}
|
||||
|
||||
pub type dc_move_state_t = libc::c_uint;
|
||||
pub const DC_MOVE_STATE_MOVING: dc_move_state_t = 3;
|
||||
pub const DC_MOVE_STATE_STAY: dc_move_state_t = 2;
|
||||
pub const DC_MOVE_STATE_PENDING: dc_move_state_t = 1;
|
||||
pub const DC_MOVE_STATE_UNDEFINED: dc_move_state_t = 0;
|
||||
pub type dc_msg_t = _dc_msg;
|
||||
/* * the structure behind dc_contact_t */
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct _dc_contact {
|
||||
pub magic: uint32_t,
|
||||
pub context: *mut dc_context_t,
|
||||
pub id: uint32_t,
|
||||
pub name: *mut libc::c_char,
|
||||
pub authname: *mut libc::c_char,
|
||||
pub addr: *mut libc::c_char,
|
||||
pub blocked: libc::c_int,
|
||||
pub origin: libc::c_int,
|
||||
}
|
||||
pub type dc_contact_t = _dc_contact;
|
||||
pub type sqlite3_destructor_type = Option<unsafe extern "C" fn(_: *mut libc::c_void) -> ()>;
|
||||
// handle chatlists
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_get_chatlist(
|
||||
|
||||
@@ -3,14 +3,19 @@ use libc;
|
||||
|
||||
use crate::dc_array::*;
|
||||
use crate::dc_context::dc_context_t;
|
||||
use crate::dc_e2ee::*;
|
||||
use crate::dc_imap::*;
|
||||
use crate::dc_job::*;
|
||||
use crate::dc_jobthread::dc_jobthread_t;
|
||||
use crate::dc_log::*;
|
||||
use crate::dc_loginparam::*;
|
||||
use crate::dc_lot::dc_lot_t;
|
||||
use crate::dc_oauth2::*;
|
||||
use crate::dc_saxparser::*;
|
||||
use crate::dc_smtp::dc_smtp_t;
|
||||
use crate::dc_smtp::*;
|
||||
use crate::dc_sqlite3::*;
|
||||
use crate::dc_stock::*;
|
||||
use crate::dc_strencode::*;
|
||||
use crate::dc_tools::*;
|
||||
use crate::types::*;
|
||||
use crate::x::*;
|
||||
@@ -1667,7 +1672,7 @@ unsafe extern "C" fn moz_autoconfigure(
|
||||
mut param_in: *const dc_loginparam_t,
|
||||
) -> *mut dc_loginparam_t {
|
||||
let mut p: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||
let mut saxparser: dc_saxparser_t = _dc_saxparser {
|
||||
let mut saxparser: dc_saxparser_t = dc_saxparser_t {
|
||||
starttag_cb: None,
|
||||
endtag_cb: None,
|
||||
text_cb: None,
|
||||
@@ -1698,7 +1703,7 @@ unsafe extern "C" fn moz_autoconfigure(
|
||||
*p = 0i32 as libc::c_char;
|
||||
moz_ac.in_emaildomain = dc_strdup(p.offset(1isize));
|
||||
moz_ac.out = dc_loginparam_new();
|
||||
saxparser = _dc_saxparser {
|
||||
saxparser = dc_saxparser_t {
|
||||
starttag_cb: None,
|
||||
endtag_cb: None,
|
||||
text_cb: None,
|
||||
@@ -1950,7 +1955,7 @@ unsafe extern "C" fn outlk_autodiscover(
|
||||
}
|
||||
outlk_ad.in_0 = param_in;
|
||||
outlk_ad.out = dc_loginparam_new();
|
||||
let mut saxparser: dc_saxparser_t = _dc_saxparser {
|
||||
let mut saxparser: dc_saxparser_t = dc_saxparser_t {
|
||||
starttag_cb: None,
|
||||
endtag_cb: None,
|
||||
text_cb: None,
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
use c2rust_bitfields::BitfieldStruct;
|
||||
use libc;
|
||||
|
||||
use crate::dc_apeerstate::*;
|
||||
use crate::dc_array::*;
|
||||
use crate::dc_context::dc_context_t;
|
||||
use crate::dc_lot::dc_lot_t;
|
||||
use crate::dc_context::*;
|
||||
use crate::dc_e2ee::*;
|
||||
use crate::dc_key::*;
|
||||
use crate::dc_log::*;
|
||||
use crate::dc_loginparam::*;
|
||||
use crate::dc_lot::*;
|
||||
use crate::dc_pgp::*;
|
||||
use crate::dc_sqlite3::*;
|
||||
use crate::dc_stock::*;
|
||||
use crate::dc_strbuilder::*;
|
||||
use crate::dc_tools::*;
|
||||
use crate::types::*;
|
||||
use crate::x::*;
|
||||
|
||||
|
||||
@@ -2,7 +2,10 @@ use c2rust_bitfields::BitfieldStruct;
|
||||
use libc;
|
||||
|
||||
use crate::dc_array::*;
|
||||
use crate::dc_chat::*;
|
||||
use crate::dc_contact::*;
|
||||
use crate::dc_imap::*;
|
||||
use crate::dc_job::*;
|
||||
use crate::dc_jobthread::*;
|
||||
use crate::dc_key::*;
|
||||
use crate::dc_log::*;
|
||||
@@ -10,9 +13,12 @@ use crate::dc_loginparam::*;
|
||||
use crate::dc_lot::dc_lot_t;
|
||||
use crate::dc_move::*;
|
||||
use crate::dc_msg::*;
|
||||
use crate::dc_openssl::*;
|
||||
use crate::dc_pgp::*;
|
||||
use crate::dc_receive_imf::*;
|
||||
use crate::dc_smtp::*;
|
||||
use crate::dc_sqlite3::*;
|
||||
use crate::dc_stock::*;
|
||||
use crate::dc_strbuilder::*;
|
||||
use crate::dc_tools::*;
|
||||
use crate::types::*;
|
||||
@@ -150,7 +156,7 @@ pub unsafe extern "C" fn dc_context_new(
|
||||
seed[1usize] = seed.as_mut_ptr() as uintptr_t;
|
||||
seed[2usize] = context as uintptr_t;
|
||||
seed[3usize] = pthread_self() as uintptr_t;
|
||||
seed[4usize] = getpid() as uintptr_t;
|
||||
seed[4usize] = libc::getpid() as uintptr_t;
|
||||
dc_pgp_rand_seed(
|
||||
context,
|
||||
seed.as_mut_ptr() as *const libc::c_void,
|
||||
|
||||
@@ -32,7 +32,7 @@ pub unsafe extern "C" fn dc_dehtml(mut buf_terminated: *mut libc::c_char) -> *mu
|
||||
add_text: 0,
|
||||
last_href: 0 as *mut libc::c_char,
|
||||
};
|
||||
let mut saxparser: dc_saxparser_t = _dc_saxparser {
|
||||
let mut saxparser: dc_saxparser_t = dc_saxparser_t {
|
||||
starttag_cb: None,
|
||||
endtag_cb: None,
|
||||
text_cb: None,
|
||||
|
||||
@@ -3,12 +3,14 @@ use libc;
|
||||
|
||||
use crate::dc_aheader::*;
|
||||
use crate::dc_apeerstate::*;
|
||||
use crate::dc_array::*;
|
||||
use crate::dc_context::dc_context_t;
|
||||
use crate::dc_hash::*;
|
||||
use crate::dc_key::*;
|
||||
use crate::dc_keyring::*;
|
||||
use crate::dc_log::*;
|
||||
use crate::dc_lot::dc_lot_t;
|
||||
use crate::dc_mimeparser::*;
|
||||
use crate::dc_pgp::*;
|
||||
use crate::dc_securejoin::*;
|
||||
use crate::dc_sqlite3::*;
|
||||
|
||||
@@ -11,6 +11,7 @@ use crate::dc_lot::dc_lot_t;
|
||||
use crate::dc_param::*;
|
||||
use crate::dc_simplify::*;
|
||||
use crate::dc_sqlite3::*;
|
||||
use crate::dc_stock::*;
|
||||
use crate::dc_strbuilder::*;
|
||||
use crate::dc_strencode::*;
|
||||
use crate::dc_tools::*;
|
||||
|
||||
@@ -6,7 +6,8 @@ use crate::dc_chat::*;
|
||||
use crate::dc_contact::*;
|
||||
use crate::dc_context::dc_context_t;
|
||||
use crate::dc_key::*;
|
||||
use crate::dc_lot::dc_lot_t;
|
||||
use crate::dc_log::*;
|
||||
use crate::dc_lot::*;
|
||||
use crate::dc_param::*;
|
||||
use crate::dc_sqlite3::*;
|
||||
use crate::dc_strencode::*;
|
||||
|
||||
@@ -1,9 +1,27 @@
|
||||
use c2rust_bitfields::BitfieldStruct;
|
||||
use libc;
|
||||
|
||||
use crate::dc_apeerstate::*;
|
||||
use crate::dc_array::*;
|
||||
use crate::dc_chat::*;
|
||||
use crate::dc_contact::*;
|
||||
use crate::dc_context::dc_context_t;
|
||||
use crate::dc_hash::*;
|
||||
use crate::dc_job::*;
|
||||
use crate::dc_location::*;
|
||||
use crate::dc_log::*;
|
||||
use crate::dc_lot::dc_lot_t;
|
||||
use crate::dc_mimeparser::*;
|
||||
use crate::dc_move::*;
|
||||
use crate::dc_msg::*;
|
||||
use crate::dc_param::*;
|
||||
use crate::dc_pgp::*;
|
||||
use crate::dc_securejoin::*;
|
||||
use crate::dc_sqlite3::*;
|
||||
use crate::dc_stock::*;
|
||||
use crate::dc_strbuilder::*;
|
||||
use crate::dc_strencode::*;
|
||||
use crate::dc_tools::*;
|
||||
use crate::types::*;
|
||||
use crate::x::*;
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ use crate::dc_chat::*;
|
||||
use crate::dc_configure::*;
|
||||
use crate::dc_contact::*;
|
||||
use crate::dc_context::dc_context_t;
|
||||
use crate::dc_e2ee::*;
|
||||
use crate::dc_hash::*;
|
||||
use crate::dc_imap::dc_imap_t;
|
||||
use crate::dc_key::*;
|
||||
@@ -15,6 +16,7 @@ use crate::dc_lot::*;
|
||||
use crate::dc_mimeparser::*;
|
||||
use crate::dc_msg::*;
|
||||
use crate::dc_param::*;
|
||||
use crate::dc_qr::*;
|
||||
use crate::dc_sqlite3::*;
|
||||
use crate::dc_stock::*;
|
||||
use crate::dc_stock::*;
|
||||
|
||||
194
src/lib.rs
194
src/lib.rs
@@ -26,7 +26,7 @@ pub mod dc_aheader;
|
||||
pub mod dc_apeerstate;
|
||||
pub mod dc_array;
|
||||
pub mod dc_chat;
|
||||
// pub mod dc_chatlist;
|
||||
pub mod dc_chatlist;
|
||||
pub mod dc_configure;
|
||||
pub mod dc_contact;
|
||||
pub mod dc_context;
|
||||
@@ -50,11 +50,11 @@ pub mod dc_mimeparser;
|
||||
pub mod dc_move;
|
||||
pub mod dc_msg;
|
||||
pub mod dc_oauth2;
|
||||
// pub mod dc_openssl;
|
||||
pub mod dc_openssl;
|
||||
pub mod dc_param;
|
||||
pub mod dc_pgp;
|
||||
pub mod dc_qr;
|
||||
// pub mod dc_receive_imf;
|
||||
pub mod dc_receive_imf;
|
||||
pub mod dc_saxparser;
|
||||
pub mod dc_securejoin;
|
||||
pub mod dc_simplify;
|
||||
@@ -66,113 +66,113 @@ pub mod dc_strencode;
|
||||
pub mod dc_token;
|
||||
pub mod dc_tools;
|
||||
|
||||
// #[cfg(test)]
|
||||
// mod tests {
|
||||
// use std::ffi::{CStr, CString};
|
||||
// use std::os::raw::c_int;
|
||||
// use std::ptr::NonNull;
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::ffi::{CStr, CString};
|
||||
use std::os::raw::c_int;
|
||||
use std::ptr::NonNull;
|
||||
|
||||
// use crate::dc_chat::*;
|
||||
// use crate::dc_chatlist::*;
|
||||
// use crate::dc_configure::dc_configure;
|
||||
// use crate::dc_contact::*;
|
||||
// use crate::dc_context::*;
|
||||
// use crate::dc_imap::*;
|
||||
// use crate::dc_job::{
|
||||
// dc_perform_imap_fetch, dc_perform_imap_idle, dc_perform_imap_jobs, dc_perform_smtp_idle,
|
||||
// dc_perform_smtp_jobs,
|
||||
// };
|
||||
// use crate::dc_lot::*;
|
||||
use crate::dc_chat::*;
|
||||
use crate::dc_chatlist::*;
|
||||
use crate::dc_configure::dc_configure;
|
||||
use crate::dc_contact::*;
|
||||
use crate::dc_context::*;
|
||||
use crate::dc_imap::*;
|
||||
use crate::dc_job::{
|
||||
dc_perform_imap_fetch, dc_perform_imap_idle, dc_perform_imap_jobs, dc_perform_smtp_idle,
|
||||
dc_perform_smtp_jobs,
|
||||
};
|
||||
use crate::dc_lot::*;
|
||||
|
||||
// extern "C" fn cb(ctx: *mut dc_context_t, event: c_int, data1: u64, data2: u64) -> u64 {
|
||||
// println!("event: {} ({}, {})", event, data1, data2);
|
||||
// if data2 > 10000 {
|
||||
// println!(
|
||||
// " {}",
|
||||
// unsafe { CStr::from_ptr(data2 as *const _) }
|
||||
// .to_str()
|
||||
// .unwrap()
|
||||
// );
|
||||
// }
|
||||
// 0
|
||||
// }
|
||||
extern "C" fn cb(ctx: *mut dc_context_t, event: c_int, data1: u64, data2: u64) -> u64 {
|
||||
println!("event: {} ({}, {})", event, data1, data2);
|
||||
if data2 > 10000 {
|
||||
println!(
|
||||
" {}",
|
||||
unsafe { CStr::from_ptr(data2 as *const _) }
|
||||
.to_str()
|
||||
.unwrap()
|
||||
);
|
||||
}
|
||||
0
|
||||
}
|
||||
|
||||
// struct Wrapper(NonNull<dc_context_t>);
|
||||
struct Wrapper(NonNull<dc_context_t>);
|
||||
|
||||
// unsafe impl std::marker::Send for Wrapper {}
|
||||
// unsafe impl std::marker::Sync for Wrapper {}
|
||||
unsafe impl std::marker::Send for Wrapper {}
|
||||
unsafe impl std::marker::Sync for Wrapper {}
|
||||
|
||||
// #[test]
|
||||
// fn test_basics() {
|
||||
// unsafe {
|
||||
// let mut ctx = dc_context_new(Some(cb), std::ptr::null_mut(), std::ptr::null_mut());
|
||||
// let info = dc_get_info(ctx);
|
||||
// let info_s = CStr::from_ptr(info);
|
||||
// println!("info: {}", info_s.to_str().unwrap());
|
||||
#[test]
|
||||
fn test_basics() {
|
||||
unsafe {
|
||||
let mut ctx = dc_context_new(Some(cb), std::ptr::null_mut(), std::ptr::null_mut());
|
||||
let info = dc_get_info(ctx);
|
||||
let info_s = CStr::from_ptr(info);
|
||||
println!("info: {}", info_s.to_str().unwrap());
|
||||
|
||||
// let sendable_ctx = Wrapper(NonNull::new(ctx).unwrap());
|
||||
// let t1 = std::thread::spawn(move || loop {
|
||||
// dc_perform_imap_jobs(sendable_ctx.0.as_ptr());
|
||||
// dc_perform_imap_fetch(sendable_ctx.0.as_ptr());
|
||||
// dc_perform_imap_idle(sendable_ctx.0.as_ptr());
|
||||
// });
|
||||
let sendable_ctx = Wrapper(NonNull::new(ctx).unwrap());
|
||||
let t1 = std::thread::spawn(move || loop {
|
||||
dc_perform_imap_jobs(sendable_ctx.0.as_ptr());
|
||||
dc_perform_imap_fetch(sendable_ctx.0.as_ptr());
|
||||
dc_perform_imap_idle(sendable_ctx.0.as_ptr());
|
||||
});
|
||||
|
||||
// let sendable_ctx = Wrapper(NonNull::new(ctx).unwrap());
|
||||
// let t2 = std::thread::spawn(move || loop {
|
||||
// dc_perform_smtp_jobs(sendable_ctx.0.as_ptr());
|
||||
// dc_perform_smtp_idle(sendable_ctx.0.as_ptr());
|
||||
// });
|
||||
let sendable_ctx = Wrapper(NonNull::new(ctx).unwrap());
|
||||
let t2 = std::thread::spawn(move || loop {
|
||||
dc_perform_smtp_jobs(sendable_ctx.0.as_ptr());
|
||||
dc_perform_smtp_idle(sendable_ctx.0.as_ptr());
|
||||
});
|
||||
|
||||
// let dbfile = CString::new("../deltachat-core/build/hello.db").unwrap();
|
||||
// println!("opening dir");
|
||||
// dc_open(ctx, dbfile.as_ptr(), std::ptr::null());
|
||||
let dbfile = CString::new("../deltachat-core/build/hello.db").unwrap();
|
||||
println!("opening dir");
|
||||
dc_open(ctx, dbfile.as_ptr(), std::ptr::null());
|
||||
|
||||
// dc_configure(ctx);
|
||||
dc_configure(ctx);
|
||||
|
||||
// std::thread::sleep_ms(4000);
|
||||
std::thread::sleep_ms(4000);
|
||||
|
||||
// let email = CString::new("dignifiedquire@gmail.com").unwrap();
|
||||
// println!("sending a message");
|
||||
// let contact_id = dc_create_contact(ctx, std::ptr::null(), email.as_ptr());
|
||||
// let chat_id = dc_create_chat_by_contact_id(ctx, contact_id);
|
||||
// let msg_text = CString::new("Hi, here is my first message!").unwrap();
|
||||
// dc_send_text_msg(ctx, chat_id, msg_text.as_ptr());
|
||||
let email = CString::new("dignifiedquire@gmail.com").unwrap();
|
||||
println!("sending a message");
|
||||
let contact_id = dc_create_contact(ctx, std::ptr::null(), email.as_ptr());
|
||||
let chat_id = dc_create_chat_by_contact_id(ctx, contact_id);
|
||||
let msg_text = CString::new("Hi, here is my first message!").unwrap();
|
||||
dc_send_text_msg(ctx, chat_id, msg_text.as_ptr());
|
||||
|
||||
// println!("fetching chats..");
|
||||
// let chats = dc_get_chatlist(ctx, 0, std::ptr::null(), 0);
|
||||
println!("fetching chats..");
|
||||
let chats = dc_get_chatlist(ctx, 0, std::ptr::null(), 0);
|
||||
|
||||
// for i in 0..dc_chatlist_get_cnt(chats) {
|
||||
// let summary = dc_chatlist_get_summary(chats, 0, std::ptr::null_mut());
|
||||
// let text1 = dc_lot_get_text1(summary);
|
||||
// let text2 = dc_lot_get_text2(summary);
|
||||
for i in 0..dc_chatlist_get_cnt(chats) {
|
||||
let summary = dc_chatlist_get_summary(chats, 0, std::ptr::null_mut());
|
||||
let text1 = dc_lot_get_text1(summary);
|
||||
let text2 = dc_lot_get_text2(summary);
|
||||
|
||||
// let text1_s = if !text1.is_null() {
|
||||
// Some(CStr::from_ptr(text1))
|
||||
// } else {
|
||||
// None
|
||||
// };
|
||||
// let text2_s = if !text2.is_null() {
|
||||
// Some(CStr::from_ptr(text2))
|
||||
// } else {
|
||||
// None
|
||||
// };
|
||||
// println!("chat: {} - {:?} - {:?}", i, text1_s, text2_s,);
|
||||
// dc_lot_unref(summary);
|
||||
// }
|
||||
// dc_chatlist_unref(chats);
|
||||
let text1_s = if !text1.is_null() {
|
||||
Some(CStr::from_ptr(text1))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let text2_s = if !text2.is_null() {
|
||||
Some(CStr::from_ptr(text2))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
println!("chat: {} - {:?} - {:?}", i, text1_s, text2_s,);
|
||||
dc_lot_unref(summary);
|
||||
}
|
||||
dc_chatlist_unref(chats);
|
||||
|
||||
// // let msglist = dc_get_chat_msgs(ctx, chat_id, 0, 0);
|
||||
// // for i in 0..dc_array_get_cnt(msglist) {
|
||||
// // let msg_id = dc_array_get_id(msglist, i);
|
||||
// // let msg = dc_get_msg(context, msg_id);
|
||||
// // let text = CStr::from_ptr(dc_msg_get_text(msg)).unwrap();
|
||||
// // println!("Message {}: {}\n", i + 1, text.to_str().unwrap());
|
||||
// // dc_msg_unref(msg);
|
||||
// // }
|
||||
// // dc_array_unref(msglist);
|
||||
// let msglist = dc_get_chat_msgs(ctx, chat_id, 0, 0);
|
||||
// for i in 0..dc_array_get_cnt(msglist) {
|
||||
// let msg_id = dc_array_get_id(msglist, i);
|
||||
// let msg = dc_get_msg(context, msg_id);
|
||||
// let text = CStr::from_ptr(dc_msg_get_text(msg)).unwrap();
|
||||
// println!("Message {}: {}\n", i + 1, text.to_str().unwrap());
|
||||
// dc_msg_unref(msg);
|
||||
// }
|
||||
// dc_array_unref(msglist);
|
||||
|
||||
// t1.join().unwrap();
|
||||
// t2.join().unwrap();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
t1.join().unwrap();
|
||||
t2.join().unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
58
src/types.rs
58
src/types.rs
@@ -1,7 +1,10 @@
|
||||
use c2rust_bitfields::BitfieldStruct;
|
||||
use libc;
|
||||
|
||||
use crate::dc_context::dc_context_t;
|
||||
use crate::dc_imap::dc_imap_t;
|
||||
use crate::dc_sqlite3::dc_sqlite3_t;
|
||||
use crate::x::*;
|
||||
|
||||
extern "C" {
|
||||
pub type __sFILEX;
|
||||
@@ -1405,10 +1408,10 @@ pub const MAILIMF_ERROR_MEMORY: libc::c_uint = 2;
|
||||
pub const MAILIMF_ERROR_PARSE: libc::c_uint = 1;
|
||||
pub const MAILIMF_NO_ERROR: libc::c_uint = 0;
|
||||
|
||||
pub const MAIL_CHARCONV_ERROR_CONV: libc::c_uint_0 = 3;
|
||||
pub const MAIL_CHARCONV_ERROR_MEMORY: libc::c_uint_0 = 2;
|
||||
pub const MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET: libc::c_uint_0 = 1;
|
||||
pub const MAIL_CHARCONV_NO_ERROR: libc::c_uint_0 = 0;
|
||||
pub const MAIL_CHARCONV_ERROR_CONV: libc::c_uint = 3;
|
||||
pub const MAIL_CHARCONV_ERROR_MEMORY: libc::c_uint = 2;
|
||||
pub const MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET: libc::c_uint = 1;
|
||||
pub const MAIL_CHARCONV_NO_ERROR: libc::c_uint = 0;
|
||||
|
||||
pub const MAILSMTP_ERROR_CLIENTID_NOT_SUPPORTED: libc::c_uint = 28;
|
||||
pub const MAILSMTP_ERROR_SSL: libc::c_uint = 27;
|
||||
@@ -1635,3 +1638,50 @@ pub union unnamed_0n {
|
||||
pub ad_mailbox: *mut mailimf_mailbox,
|
||||
pub ad_group: *mut mailimf_group,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct mailmime_parameter {
|
||||
pub pa_name: *mut libc::c_char,
|
||||
pub pa_value: *mut libc::c_char,
|
||||
}
|
||||
|
||||
pub const MAILMIME_DISCRETE_TYPE_EXTENSION: libc::c_uint = 6;
|
||||
pub const MAILMIME_DISCRETE_TYPE_APPLICATION: libc::c_uint = 5;
|
||||
pub const MAILMIME_DISCRETE_TYPE_VIDEO: libc::c_uint = 4;
|
||||
pub const MAILMIME_DISCRETE_TYPE_AUDIO: libc::c_uint = 3;
|
||||
pub const MAILMIME_DISCRETE_TYPE_IMAGE: libc::c_uint = 2;
|
||||
pub const MAILMIME_DISCRETE_TYPE_TEXT: libc::c_uint = 1;
|
||||
pub const MAILMIME_DISCRETE_TYPE_ERROR: libc::c_uint = 0;
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct CRYPTO_dynlock_value {
|
||||
pub mutex: pthread_mutex_t,
|
||||
}
|
||||
|
||||
pub const MAILIMAP_MBX_LIST_OFLAG_FLAG_EXT: libc::c_uint = 2;
|
||||
pub const MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS: libc::c_uint = 1;
|
||||
pub const MAILIMAP_MBX_LIST_OFLAG_ERROR: libc::c_uint = 0;
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct mailimap_mbx_list_oflag {
|
||||
pub of_type: libc::c_int,
|
||||
pub of_flag_ext: *mut libc::c_char,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct mailimap_mailbox_list {
|
||||
pub mb_flag: *mut mailimap_mbx_list_flags,
|
||||
pub mb_delimiter: libc::c_char,
|
||||
pub mb_name: *mut libc::c_char,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct mailimap_mbx_list_flags {
|
||||
pub mbf_type: libc::c_int,
|
||||
pub mbf_oflags: *mut clist,
|
||||
pub mbf_sflag: libc::c_int,
|
||||
}
|
||||
|
||||
454
src/x.rs
454
src/x.rs
@@ -1,7 +1,8 @@
|
||||
use libc;
|
||||
use libc::{self, FILE};
|
||||
|
||||
use crate::dc_context::dc_context_t;
|
||||
use crate::dc_key::dc_key_t;
|
||||
use crate::dc_pgp::*;
|
||||
use crate::dc_sqlite3::dc_sqlite3_t;
|
||||
use crate::dc_strbuilder::dc_strbuilder_t;
|
||||
use crate::types::*;
|
||||
@@ -16,31 +17,6 @@ extern "C" {
|
||||
pub fn strspn(_: *const libc::c_char, _: *const libc::c_char) -> libc::c_ulong;
|
||||
pub fn strcasecmp(_: *const libc::c_char, _: *const libc::c_char) -> libc::c_int;
|
||||
pub fn strlen(_: *const libc::c_char) -> libc::c_ulong;
|
||||
pub fn sqlite3_bind_blob(
|
||||
_: *mut sqlite3_stmt,
|
||||
_: libc::c_int,
|
||||
_: *const libc::c_void,
|
||||
n: libc::c_int,
|
||||
_: Option<unsafe extern "C" fn(_: *mut libc::c_void) -> ()>,
|
||||
) -> libc::c_int;
|
||||
pub fn sqlite3_bind_int64(
|
||||
_: *mut sqlite3_stmt,
|
||||
_: libc::c_int,
|
||||
_: sqlite3_int64,
|
||||
) -> libc::c_int;
|
||||
pub fn sqlite3_bind_text(
|
||||
_: *mut sqlite3_stmt,
|
||||
_: libc::c_int,
|
||||
_: *const libc::c_char,
|
||||
_: libc::c_int,
|
||||
_: Option<unsafe extern "C" fn(_: *mut libc::c_void) -> ()>,
|
||||
) -> libc::c_int;
|
||||
pub fn sqlite3_step(_: *mut sqlite3_stmt) -> libc::c_int;
|
||||
pub fn sqlite3_column_int(_: *mut sqlite3_stmt, iCol: libc::c_int) -> libc::c_int;
|
||||
pub fn sqlite3_column_int64(_: *mut sqlite3_stmt, iCol: libc::c_int) -> sqlite3_int64;
|
||||
pub fn sqlite3_column_text(_: *mut sqlite3_stmt, iCol: libc::c_int) -> *const libc::c_uchar;
|
||||
pub fn sqlite3_column_type(_: *mut sqlite3_stmt, iCol: libc::c_int) -> libc::c_int;
|
||||
pub fn sqlite3_finalize(pStmt: *mut sqlite3_stmt) -> libc::c_int;
|
||||
pub fn malloc(_: libc::c_ulong) -> *mut libc::c_void;
|
||||
pub fn realloc(_: *mut libc::c_void, _: libc::c_ulong) -> *mut libc::c_void;
|
||||
pub fn qsort(
|
||||
@@ -60,7 +36,6 @@ extern "C" {
|
||||
pub fn strcmp(_: *const libc::c_char, _: *const libc::c_char) -> libc::c_int;
|
||||
pub fn sprintf(_: *mut libc::c_char, _: *const libc::c_char, _: ...) -> libc::c_int;
|
||||
pub fn time(_: *mut time_t) -> time_t;
|
||||
pub fn sqlite3_bind_int(_: *mut sqlite3_stmt, _: libc::c_int, _: libc::c_int) -> libc::c_int;
|
||||
pub fn strchr(_: *const libc::c_char, _: libc::c_int) -> *mut libc::c_char;
|
||||
pub fn strstr(_: *const libc::c_char, _: *const libc::c_char) -> *mut libc::c_char;
|
||||
pub fn strncasecmp(
|
||||
@@ -116,11 +91,6 @@ extern "C" {
|
||||
result: *mut *mut libc::c_char,
|
||||
result_len: *mut size_t,
|
||||
) -> libc::c_int;
|
||||
pub fn sqlite3_column_blob(_: *mut sqlite3_stmt, iCol: libc::c_int) -> *const libc::c_void;
|
||||
pub fn sqlite3_column_bytes(_: *mut sqlite3_stmt, iCol: libc::c_int) -> libc::c_int;
|
||||
pub fn sqlite3_reset(pStmt: *mut sqlite3_stmt) -> libc::c_int;
|
||||
pub fn sqlite3_mprintf(_: *const libc::c_char, _: ...) -> *mut libc::c_char;
|
||||
pub fn sqlite3_free(_: *mut libc::c_void);
|
||||
pub fn __toupper(_: __darwin_ct_rune_t) -> __darwin_ct_rune_t;
|
||||
pub fn memcmp(_: *const libc::c_void, _: *const libc::c_void, _: libc::c_ulong) -> libc::c_int;
|
||||
pub fn encode_base64(in_0: *const libc::c_char, len: libc::c_int) -> *mut libc::c_char;
|
||||
@@ -253,12 +223,6 @@ extern "C" {
|
||||
pub fn atoi(_: *const libc::c_char) -> libc::c_int;
|
||||
pub fn strdup(_: *const libc::c_char) -> *mut libc::c_char;
|
||||
pub fn gmtime(_: *const time_t) -> *mut tm;
|
||||
pub fn sqlite3_bind_double(
|
||||
_: *mut sqlite3_stmt,
|
||||
_: libc::c_int,
|
||||
_: libc::c_double,
|
||||
) -> libc::c_int;
|
||||
pub fn sqlite3_column_double(_: *mut sqlite3_stmt, iCol: libc::c_int) -> libc::c_double;
|
||||
pub fn pthread_self() -> pthread_t;
|
||||
pub fn clist_delete(_: *mut clist, _: *mut clistiter) -> *mut clistiter;
|
||||
pub fn mailimf_fields_free(fields: *mut mailimf_fields);
|
||||
@@ -314,74 +278,7 @@ extern "C" {
|
||||
) -> 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_find_mailimf_fields(_: *mut mailmime) -> *mut mailimf_fields;
|
||||
pub fn mailimf_find_first_addr(_: *const mailimf_mailbox_list) -> *mut libc::c_char;
|
||||
pub fn mailimf_find_field(
|
||||
_: *mut mailimf_fields,
|
||||
wanted_fld_type: libc::c_int,
|
||||
) -> *mut mailimf_field;
|
||||
pub fn mailimf_get_recipients(_: *mut mailimf_fields) -> *mut dc_hash_t;
|
||||
pub fn atol(_: *const libc::c_char) -> libc::c_long;
|
||||
pub fn rpgp_create_rsa_skey(
|
||||
bits: uint32_t,
|
||||
user_id: *const libc::c_char,
|
||||
) -> *mut rpgp_signed_secret_key;
|
||||
pub fn rpgp_cvec_data(cvec_ptr: *mut rpgp_cvec) -> *const uint8_t;
|
||||
pub fn rpgp_cvec_drop(cvec_ptr: *mut rpgp_cvec);
|
||||
pub fn rpgp_cvec_len(cvec_ptr: *mut rpgp_cvec) -> size_t;
|
||||
pub fn rpgp_encrypt_bytes_to_keys(
|
||||
bytes_ptr: *const uint8_t,
|
||||
bytes_len: size_t,
|
||||
pkeys_ptr: *const *const rpgp_signed_public_key,
|
||||
pkeys_len: size_t,
|
||||
) -> *mut rpgp_message;
|
||||
pub fn rpgp_encrypt_bytes_with_password(
|
||||
bytes_ptr: *const uint8_t,
|
||||
bytes_len: size_t,
|
||||
password_ptr: *const libc::c_char,
|
||||
) -> *mut rpgp_message;
|
||||
pub fn rpgp_key_drop(key_ptr: *mut rpgp_public_or_secret_key);
|
||||
pub fn rpgp_key_fingerprint(key_ptr: *mut rpgp_public_or_secret_key) -> *mut rpgp_cvec;
|
||||
pub fn rpgp_key_from_bytes(raw: *const uint8_t, len: size_t) -> *mut rpgp_public_or_secret_key;
|
||||
pub fn rpgp_key_is_public(key_ptr: *mut rpgp_public_or_secret_key) -> bool;
|
||||
pub fn rpgp_key_is_secret(key_ptr: *mut rpgp_public_or_secret_key) -> bool;
|
||||
pub fn rpgp_last_error_length() -> libc::c_int;
|
||||
pub fn rpgp_last_error_message() -> *mut libc::c_char;
|
||||
pub fn rpgp_message_decrypt_result_drop(res_ptr: *mut rpgp_message_decrypt_result);
|
||||
pub fn rpgp_msg_decrypt_no_pw(
|
||||
msg_ptr: *const rpgp_message,
|
||||
skeys_ptr: *const *const rpgp_signed_secret_key,
|
||||
skeys_len: size_t,
|
||||
pkeys_ptr: *const *const rpgp_signed_public_key,
|
||||
pkeys_len: size_t,
|
||||
) -> *mut rpgp_message_decrypt_result;
|
||||
pub fn rpgp_msg_decrypt_with_password(
|
||||
msg_ptr: *const rpgp_message,
|
||||
password_ptr: *const libc::c_char,
|
||||
) -> *mut rpgp_message;
|
||||
pub fn rpgp_msg_drop(msg_ptr: *mut rpgp_message);
|
||||
pub fn rpgp_msg_from_armor(msg_ptr: *const uint8_t, msg_len: size_t) -> *mut rpgp_message;
|
||||
pub fn rpgp_msg_from_bytes(msg_ptr: *const uint8_t, msg_len: size_t) -> *mut rpgp_message;
|
||||
pub fn rpgp_msg_to_armored(msg_ptr: *const rpgp_message) -> *mut rpgp_cvec;
|
||||
pub fn rpgp_msg_to_armored_str(msg_ptr: *const rpgp_message) -> *mut libc::c_char;
|
||||
pub fn rpgp_msg_to_bytes(msg_ptr: *const rpgp_message) -> *mut rpgp_cvec;
|
||||
pub fn rpgp_pkey_drop(pkey_ptr: *mut rpgp_signed_public_key);
|
||||
pub fn rpgp_pkey_from_bytes(raw: *const uint8_t, len: size_t) -> *mut rpgp_signed_public_key;
|
||||
pub fn rpgp_pkey_to_bytes(pkey_ptr: *mut rpgp_signed_public_key) -> *mut rpgp_cvec;
|
||||
pub fn rpgp_sign_encrypt_bytes_to_keys(
|
||||
bytes_ptr: *const uint8_t,
|
||||
bytes_len: size_t,
|
||||
pkeys_ptr: *const *const rpgp_signed_public_key,
|
||||
pkeys_len: size_t,
|
||||
skey_ptr: *const rpgp_signed_secret_key,
|
||||
) -> *mut rpgp_message;
|
||||
pub fn rpgp_skey_drop(skey_ptr: *mut rpgp_signed_secret_key);
|
||||
pub fn rpgp_skey_from_bytes(raw: *const uint8_t, len: size_t) -> *mut rpgp_signed_secret_key;
|
||||
pub fn rpgp_skey_public_key(
|
||||
skey_ptr: *mut rpgp_signed_secret_key,
|
||||
) -> *mut rpgp_signed_public_key;
|
||||
pub fn rpgp_skey_to_bytes(skey_ptr: *mut rpgp_signed_secret_key) -> *mut rpgp_cvec;
|
||||
pub fn rpgp_string_drop(p: *mut libc::c_char);
|
||||
pub fn __maskrune(_: __darwin_ct_rune_t, _: libc::c_ulong) -> libc::c_int;
|
||||
pub fn __tolower(_: __darwin_ct_rune_t) -> __darwin_ct_rune_t;
|
||||
pub fn mmap_string_append(string: *mut MMAPString, val: *const libc::c_char)
|
||||
@@ -584,8 +481,6 @@ extern "C" {
|
||||
) -> *mut mailimap;
|
||||
pub fn mailimap_free(session: *mut mailimap);
|
||||
pub fn mailimap_set_timeout(session: *mut mailimap, timeout: time_t);
|
||||
pub fn libetpan_get_version_minor() -> libc::c_int;
|
||||
pub fn sqlite3_threadsafe() -> libc::c_int;
|
||||
pub fn strtol(
|
||||
_: *const libc::c_char,
|
||||
_: *mut *mut libc::c_char,
|
||||
@@ -597,22 +492,14 @@ extern "C" {
|
||||
_: libc::c_int,
|
||||
_: *const libc::c_char,
|
||||
) -> !;
|
||||
pub fn mailmime_find_ct_parameter(
|
||||
_: *mut mailmime,
|
||||
name: *const libc::c_char,
|
||||
) -> *mut mailmime_parameter;
|
||||
pub fn mailmime_transfer_decode(
|
||||
_: *mut mailmime,
|
||||
ret_decoded_data: *mut *const libc::c_char,
|
||||
ret_decoded_data_bytes: *mut size_t,
|
||||
ret_to_mmap_string_unref: *mut *mut libc::c_char,
|
||||
) -> libc::c_int;
|
||||
pub fn mailimf_find_optional_field(
|
||||
_: *mut mailimf_fields,
|
||||
wanted_fld_name: *const libc::c_char,
|
||||
) -> *mut mailimf_optional_field;
|
||||
pub fn rpgp_hash_sha256(bytes_ptr: *const uint8_t, bytes_len: size_t) -> *mut rpgp_cvec;
|
||||
|
||||
pub fn carray_delete_slow(array: *mut carray, indx: libc::c_uint) -> 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,
|
||||
@@ -631,6 +518,234 @@ extern "C" {
|
||||
) -> libc::c_int;
|
||||
pub fn charconv_buffer_free(str: *mut libc::c_char);
|
||||
pub fn sscanf(_: *const libc::c_char, _: *const libc::c_char, _: ...) -> libc::c_int;
|
||||
|
||||
// -- 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 mailstream_openssl_init_not_required();
|
||||
|
||||
// -- OpenSSL
|
||||
|
||||
/* return CRYPTO_NUM_LOCKS (shared libs!) */
|
||||
pub fn CRYPTO_num_locks() -> libc::c_int;
|
||||
pub fn CRYPTO_set_locking_callback(
|
||||
func: Option<
|
||||
unsafe extern "C" fn(
|
||||
_: libc::c_int,
|
||||
_: libc::c_int,
|
||||
_: *const libc::c_char,
|
||||
_: libc::c_int,
|
||||
) -> (),
|
||||
>,
|
||||
);
|
||||
pub fn CRYPTO_set_id_callback(func: Option<unsafe extern "C" fn() -> libc::c_ulong>);
|
||||
pub fn CRYPTO_set_dynlock_create_callback(
|
||||
dyn_create_function_0: Option<
|
||||
unsafe extern "C" fn(
|
||||
_: *const libc::c_char,
|
||||
_: libc::c_int,
|
||||
) -> *mut CRYPTO_dynlock_value,
|
||||
>,
|
||||
);
|
||||
pub fn CRYPTO_set_dynlock_lock_callback(
|
||||
dyn_lock_function_0: Option<
|
||||
unsafe extern "C" fn(
|
||||
_: libc::c_int,
|
||||
_: *mut CRYPTO_dynlock_value,
|
||||
_: *const libc::c_char,
|
||||
_: libc::c_int,
|
||||
) -> (),
|
||||
>,
|
||||
);
|
||||
pub fn CRYPTO_set_dynlock_destroy_callback(
|
||||
dyn_destroy_function_0: Option<
|
||||
unsafe extern "C" fn(
|
||||
_: *mut CRYPTO_dynlock_value,
|
||||
_: *const libc::c_char,
|
||||
_: libc::c_int,
|
||||
) -> (),
|
||||
>,
|
||||
);
|
||||
pub fn OPENSSL_init();
|
||||
pub fn OPENSSL_add_all_algorithms_noconf();
|
||||
|
||||
// -- DC Methods
|
||||
|
||||
pub fn dc_strbuilder_catf(_: *mut dc_strbuilder_t, format: *const libc::c_char, _: ...);
|
||||
pub fn dc_mprintf(format: *const libc::c_char, _: ...) -> *mut libc::c_char;
|
||||
|
||||
// -- rpgp
|
||||
|
||||
pub fn rpgp_create_rsa_skey(
|
||||
bits: uint32_t,
|
||||
user_id: *const libc::c_char,
|
||||
) -> *mut rpgp_signed_secret_key;
|
||||
pub fn rpgp_cvec_data(cvec_ptr: *mut rpgp_cvec) -> *const uint8_t;
|
||||
pub fn rpgp_cvec_drop(cvec_ptr: *mut rpgp_cvec);
|
||||
pub fn rpgp_cvec_len(cvec_ptr: *mut rpgp_cvec) -> size_t;
|
||||
pub fn rpgp_encrypt_bytes_to_keys(
|
||||
bytes_ptr: *const uint8_t,
|
||||
bytes_len: size_t,
|
||||
pkeys_ptr: *const *const rpgp_signed_public_key,
|
||||
pkeys_len: size_t,
|
||||
) -> *mut rpgp_message;
|
||||
pub fn rpgp_encrypt_bytes_with_password(
|
||||
bytes_ptr: *const uint8_t,
|
||||
bytes_len: size_t,
|
||||
password_ptr: *const libc::c_char,
|
||||
) -> *mut rpgp_message;
|
||||
pub fn rpgp_key_drop(key_ptr: *mut rpgp_public_or_secret_key);
|
||||
pub fn rpgp_key_fingerprint(key_ptr: *mut rpgp_public_or_secret_key) -> *mut rpgp_cvec;
|
||||
pub fn rpgp_key_from_bytes(raw: *const uint8_t, len: size_t) -> *mut rpgp_public_or_secret_key;
|
||||
pub fn rpgp_key_is_public(key_ptr: *mut rpgp_public_or_secret_key) -> bool;
|
||||
pub fn rpgp_key_is_secret(key_ptr: *mut rpgp_public_or_secret_key) -> bool;
|
||||
pub fn rpgp_last_error_length() -> libc::c_int;
|
||||
pub fn rpgp_last_error_message() -> *mut libc::c_char;
|
||||
pub fn rpgp_message_decrypt_result_drop(res_ptr: *mut rpgp_message_decrypt_result);
|
||||
pub fn rpgp_msg_decrypt_no_pw(
|
||||
msg_ptr: *const rpgp_message,
|
||||
skeys_ptr: *const *const rpgp_signed_secret_key,
|
||||
skeys_len: size_t,
|
||||
pkeys_ptr: *const *const rpgp_signed_public_key,
|
||||
pkeys_len: size_t,
|
||||
) -> *mut rpgp_message_decrypt_result;
|
||||
pub fn rpgp_msg_decrypt_with_password(
|
||||
msg_ptr: *const rpgp_message,
|
||||
password_ptr: *const libc::c_char,
|
||||
) -> *mut rpgp_message;
|
||||
pub fn rpgp_msg_drop(msg_ptr: *mut rpgp_message);
|
||||
pub fn rpgp_msg_from_armor(msg_ptr: *const uint8_t, msg_len: size_t) -> *mut rpgp_message;
|
||||
pub fn rpgp_msg_from_bytes(msg_ptr: *const uint8_t, msg_len: size_t) -> *mut rpgp_message;
|
||||
pub fn rpgp_msg_to_armored(msg_ptr: *const rpgp_message) -> *mut rpgp_cvec;
|
||||
pub fn rpgp_msg_to_armored_str(msg_ptr: *const rpgp_message) -> *mut libc::c_char;
|
||||
pub fn rpgp_msg_to_bytes(msg_ptr: *const rpgp_message) -> *mut rpgp_cvec;
|
||||
pub fn rpgp_pkey_drop(pkey_ptr: *mut rpgp_signed_public_key);
|
||||
pub fn rpgp_pkey_from_bytes(raw: *const uint8_t, len: size_t) -> *mut rpgp_signed_public_key;
|
||||
pub fn rpgp_pkey_to_bytes(pkey_ptr: *mut rpgp_signed_public_key) -> *mut rpgp_cvec;
|
||||
pub fn rpgp_sign_encrypt_bytes_to_keys(
|
||||
bytes_ptr: *const uint8_t,
|
||||
bytes_len: size_t,
|
||||
pkeys_ptr: *const *const rpgp_signed_public_key,
|
||||
pkeys_len: size_t,
|
||||
skey_ptr: *const rpgp_signed_secret_key,
|
||||
) -> *mut rpgp_message;
|
||||
pub fn rpgp_skey_drop(skey_ptr: *mut rpgp_signed_secret_key);
|
||||
pub fn rpgp_skey_from_bytes(raw: *const uint8_t, len: size_t) -> *mut rpgp_signed_secret_key;
|
||||
pub fn rpgp_skey_public_key(
|
||||
skey_ptr: *mut rpgp_signed_secret_key,
|
||||
) -> *mut rpgp_signed_public_key;
|
||||
pub fn rpgp_skey_to_bytes(skey_ptr: *mut rpgp_signed_secret_key) -> *mut rpgp_cvec;
|
||||
pub fn rpgp_string_drop(p: *mut libc::c_char);
|
||||
pub fn rpgp_hash_sha256(bytes_ptr: *const uint8_t, bytes_len: size_t) -> *mut rpgp_cvec;
|
||||
|
||||
// -- Sqlite3
|
||||
|
||||
pub fn sqlite3_bind_blob(
|
||||
_: *mut sqlite3_stmt,
|
||||
_: libc::c_int,
|
||||
_: *const libc::c_void,
|
||||
n: libc::c_int,
|
||||
_: Option<unsafe extern "C" fn(_: *mut libc::c_void) -> ()>,
|
||||
) -> libc::c_int;
|
||||
pub fn sqlite3_bind_int64(
|
||||
_: *mut sqlite3_stmt,
|
||||
_: libc::c_int,
|
||||
_: sqlite3_int64,
|
||||
) -> libc::c_int;
|
||||
pub fn sqlite3_bind_text(
|
||||
_: *mut sqlite3_stmt,
|
||||
_: libc::c_int,
|
||||
_: *const libc::c_char,
|
||||
_: libc::c_int,
|
||||
_: Option<unsafe extern "C" fn(_: *mut libc::c_void) -> ()>,
|
||||
) -> libc::c_int;
|
||||
pub fn sqlite3_step(_: *mut sqlite3_stmt) -> libc::c_int;
|
||||
pub fn sqlite3_column_int(_: *mut sqlite3_stmt, iCol: libc::c_int) -> libc::c_int;
|
||||
pub fn sqlite3_column_int64(_: *mut sqlite3_stmt, iCol: libc::c_int) -> sqlite3_int64;
|
||||
pub fn sqlite3_column_text(_: *mut sqlite3_stmt, iCol: libc::c_int) -> *const libc::c_uchar;
|
||||
pub fn sqlite3_column_type(_: *mut sqlite3_stmt, iCol: libc::c_int) -> libc::c_int;
|
||||
pub fn sqlite3_finalize(pStmt: *mut sqlite3_stmt) -> libc::c_int;
|
||||
pub fn sqlite3_bind_int(_: *mut sqlite3_stmt, _: libc::c_int, _: libc::c_int) -> libc::c_int;
|
||||
pub fn sqlite3_column_blob(_: *mut sqlite3_stmt, iCol: libc::c_int) -> *const libc::c_void;
|
||||
pub fn sqlite3_column_bytes(_: *mut sqlite3_stmt, iCol: libc::c_int) -> libc::c_int;
|
||||
pub fn sqlite3_reset(pStmt: *mut sqlite3_stmt) -> libc::c_int;
|
||||
pub fn sqlite3_mprintf(_: *const libc::c_char, _: ...) -> *mut libc::c_char;
|
||||
pub fn sqlite3_free(_: *mut libc::c_void);
|
||||
pub fn sqlite3_bind_double(
|
||||
_: *mut sqlite3_stmt,
|
||||
_: libc::c_int,
|
||||
_: libc::c_double,
|
||||
) -> libc::c_int;
|
||||
pub fn sqlite3_column_double(_: *mut sqlite3_stmt, iCol: libc::c_int) -> libc::c_double;
|
||||
pub fn sqlite3_threadsafe() -> libc::c_int;
|
||||
pub fn sqlite3_close(_: *mut sqlite3) -> libc::c_int;
|
||||
pub fn sqlite3_busy_timeout(_: *mut sqlite3, ms: libc::c_int) -> libc::c_int;
|
||||
pub fn sqlite3_vmprintf(_: *const libc::c_char, _: ::std::ffi::VaList) -> *mut libc::c_char;
|
||||
@@ -648,99 +763,4 @@ extern "C" {
|
||||
ppStmt: *mut *mut sqlite3_stmt,
|
||||
pzTail: *mut *const libc::c_char,
|
||||
) -> libc::c_int;
|
||||
|
||||
// -- libetpan Methods
|
||||
|
||||
#[no_mangle]
|
||||
pub fn gethostname(_: *mut libc::c_char, _: size_t) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
pub fn mailsmtp_socket_connect(
|
||||
session: *mut mailsmtp,
|
||||
server: *const libc::c_char,
|
||||
port: uint16_t,
|
||||
) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
pub fn mailsmtp_socket_starttls(session: *mut mailsmtp) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
pub fn mailsmtp_ssl_connect(
|
||||
session: *mut mailsmtp,
|
||||
server: *const libc::c_char,
|
||||
port: uint16_t,
|
||||
) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
pub fn mailsmtp_oauth2_authenticate(
|
||||
session: *mut mailsmtp,
|
||||
auth_user: *const libc::c_char,
|
||||
access_token: *const libc::c_char,
|
||||
) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
pub fn mailsmtp_new(
|
||||
progr_rate: size_t,
|
||||
progr_fun: Option<unsafe extern "C" fn(_: size_t, _: size_t) -> ()>,
|
||||
) -> *mut mailsmtp;
|
||||
#[no_mangle]
|
||||
pub fn mailsmtp_free(session: *mut mailsmtp);
|
||||
#[no_mangle]
|
||||
pub fn mailsmtp_set_timeout(session: *mut mailsmtp, timeout: time_t);
|
||||
#[no_mangle]
|
||||
pub fn mailsmtp_auth(
|
||||
session: *mut mailsmtp,
|
||||
user: *const libc::c_char,
|
||||
pass: *const libc::c_char,
|
||||
) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
pub fn mailsmtp_helo(session: *mut mailsmtp) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
pub fn mailsmtp_mail(session: *mut mailsmtp, from: *const libc::c_char) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
pub fn mailsmtp_rcpt(session: *mut mailsmtp, to: *const libc::c_char) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
pub fn mailsmtp_data(session: *mut mailsmtp) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
pub fn mailsmtp_data_message(
|
||||
session: *mut mailsmtp,
|
||||
message: *const libc::c_char,
|
||||
size: size_t,
|
||||
) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
pub fn mailesmtp_ehlo(session: *mut mailsmtp) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
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;
|
||||
#[no_mangle]
|
||||
pub fn mailesmtp_rcpt(
|
||||
session: *mut mailsmtp,
|
||||
to: *const libc::c_char,
|
||||
notify: libc::c_int,
|
||||
orcpt: *const libc::c_char,
|
||||
) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
pub fn mailsmtp_strerror(errnum: libc::c_int) -> *const libc::c_char;
|
||||
#[no_mangle]
|
||||
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;
|
||||
#[no_mangle]
|
||||
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,
|
||||
);
|
||||
|
||||
// -- DC Methods
|
||||
|
||||
pub fn dc_strbuilder_catf(_: *mut dc_strbuilder_t, format: *const libc::c_char, _: ...);
|
||||
pub fn dc_mprintf(format: *const libc::c_char, _: ...) -> *mut libc::c_char;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user