diff --git a/build.rs b/build.rs index 941eda770..bcf779ef6 100644 --- a/build.rs +++ b/build.rs @@ -7,17 +7,19 @@ fn main() { config.file("misc.c"); config.compile("libtools.a"); - println!("cargo:rustc-link-search=native=/usr/local/opt/openssl/lib"); + println!("cargo:rustc-link-search=/usr/local/opt/openssl/lib"); + // println!("cargo:rustc-link-search=/usr/local/lib"); + println!("cargo:rustc-link-search=/Users/dignifiedquire/opensource/libetpan/build-mac/debug"); + println!("cargo:rustc-link-lib=static=etpan"); + println!("cargo:rustc-link-lib=dylib=iconv"); println!("cargo:rustc-link-lib=dylib=sasl2"); - println!("cargo:rustc-link-lib=dylib=ssl"); + println!("cargo:rustc-link-lib=dylib=z"); + println!("cargo:rustc-link-lib=dylib=sqlite3"); println!("cargo:rustc-link-lib=dylib=pthread"); println!("cargo:rustc-link-lib=dylib=rpgp"); - println!("cargo:rustc-link-lib=dylib=etpan"); - println!("cargo:rustc-link-lib=dylib=iconv"); println!("cargo:rustc-link-lib=dylib=crypto"); - println!("cargo:rustc-link-lib=dylib=z"); println!("cargo:rustc-link-lib=dylib=tools"); if std::env::var("TARGET").unwrap().contains("-apple") { diff --git a/src/dc_apeerstate.rs b/src/dc_apeerstate.rs index a43ef0421..020638bd9 100644 --- a/src/dc_apeerstate.rs +++ b/src/dc_apeerstate.rs @@ -493,7 +493,7 @@ pub struct _dc_context { pub ongoing_running: libc::c_int, pub shall_stop_ongoing: libc::c_int, } -pub type dc_lot_t = _dc_lot; +use crate::dc_lot::dc_lot_t; /* * Structure behind dc_lot_t */ #[derive(Copy, Clone)] #[repr(C)] @@ -703,7 +703,7 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; +use crate::dc_context::dc_context_t; /* ** library-private **********************************************************/ pub type dc_smtp_t = _dc_smtp; #[derive(Copy, Clone)] @@ -802,7 +802,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; +use crate::dc_sqlite3::dc_sqlite3_t; /* * * Library-internal. */ diff --git a/src/dc_array.rs b/src/dc_array.rs index a028bba96..db806992d 100644 --- a/src/dc_array.rs +++ b/src/dc_array.rs @@ -1,5 +1,8 @@ use c2rust_bitfields::BitfieldStruct; use libc; + +use crate::types::*; + extern "C" { pub type mailstream_cancel; pub type sqlite3; @@ -304,58 +307,6 @@ pub union unnamed_1 { pub ft_fetch_att: *mut mailimap_fetch_att, pub ft_fetch_att_list: *mut clist, } -pub type mailimap_msg_att_handler = - unsafe extern "C" fn(_: *mut mailimap_msg_att, _: *mut libc::c_void) -> (); -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap { - pub imap_response: *mut libc::c_char, - pub imap_stream: *mut mailstream, - pub imap_progr_rate: size_t, - pub imap_progr_fun: Option ()>, - pub imap_stream_buffer: *mut MMAPString, - pub imap_response_buffer: *mut MMAPString, - pub imap_state: libc::c_int, - pub imap_tag: libc::c_int, - pub imap_connection_info: *mut mailimap_connection_info, - pub imap_selection_info: *mut mailimap_selection_info, - pub imap_response_info: *mut mailimap_response_info, - pub imap_sasl: unnamed_2, - pub imap_idle_timestamp: time_t, - pub imap_idle_maxdelay: time_t, - pub imap_body_progress_fun: - Option ()>, - pub imap_items_progress_fun: - Option ()>, - pub imap_progress_context: *mut libc::c_void, - pub imap_msg_att_handler: - Option ()>, - pub imap_msg_att_handler_context: *mut libc::c_void, - pub imap_msg_body_handler: Option< - unsafe extern "C" fn( - _: libc::c_int, - _: *mut mailimap_msg_att_body_section, - _: *const libc::c_char, - _: size_t, - _: *mut libc::c_void, - ) -> bool, - >, - pub imap_msg_body_handler_context: *mut libc::c_void, - pub imap_timeout: time_t, - pub imap_logger: Option< - unsafe extern "C" fn( - _: *mut mailimap, - _: libc::c_int, - _: *const libc::c_char, - _: size_t, - _: *mut libc::c_void, - ) -> (), - >, - pub imap_logger_context: *mut libc::c_void, - pub is_163_workaround_enabled: libc::c_int, - pub is_rambler_workaround_enabled: libc::c_int, - pub is_qip_workaround_enabled: libc::c_int, -} #[derive(Copy, Clone)] #[repr(C)] pub struct unnamed_2 { @@ -446,7 +397,7 @@ pub struct _dc_context { pub ongoing_running: libc::c_int, pub shall_stop_ongoing: libc::c_int, } -pub type dc_lot_t = _dc_lot; +use crate::dc_lot::dc_lot_t; /* * Structure behind dc_lot_t */ #[derive(Copy, Clone)] #[repr(C)] @@ -656,7 +607,7 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; +use crate::dc_context::dc_context_t; /* ** library-private **********************************************************/ pub type dc_smtp_t = _dc_smtp; #[derive(Copy, Clone)] @@ -755,7 +706,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; +use crate::dc_sqlite3::dc_sqlite3_t; /* * * Library-internal. */ diff --git a/src/dc_chat.rs b/src/dc_chat.rs index 6a3189802..d0cb4b1fe 100644 --- a/src/dc_chat.rs +++ b/src/dc_chat.rs @@ -755,7 +755,7 @@ pub struct _dc_context { pub ongoing_running: libc::c_int, pub shall_stop_ongoing: libc::c_int, } -pub type dc_lot_t = _dc_lot; +use crate::dc_lot::dc_lot_t; /* * Structure behind dc_lot_t */ #[derive(Copy, Clone)] #[repr(C)] @@ -965,7 +965,7 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; +use crate::dc_context::dc_context_t; /* ** library-private **********************************************************/ pub type dc_smtp_t = _dc_smtp; #[derive(Copy, Clone)] @@ -1064,7 +1064,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; +use crate::dc_sqlite3::dc_sqlite3_t; /* * * Library-internal. */ diff --git a/src/dc_chatlist.rs b/src/dc_chatlist.rs index 254182833..a690154cb 100644 --- a/src/dc_chatlist.rs +++ b/src/dc_chatlist.rs @@ -1,5 +1,9 @@ use c2rust_bitfields::BitfieldStruct; use libc; + +use crate::dc_context::dc_context_t; +use crate::dc_lot::dc_lot_t; + extern "C" { pub type mailstream_cancel; pub type sqlite3; @@ -566,7 +570,7 @@ pub struct _dc_context { pub ongoing_running: libc::c_int, pub shall_stop_ongoing: libc::c_int, } -pub type dc_lot_t = _dc_lot; + /* * Structure behind dc_lot_t */ #[derive(Copy, Clone)] #[repr(C)] @@ -776,7 +780,7 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; + /* ** library-private **********************************************************/ pub type dc_smtp_t = _dc_smtp; #[derive(Copy, Clone)] @@ -875,16 +879,10 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; +use crate::dc_sqlite3::dc_sqlite3_t; /* * * Library-internal. */ -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_sqlite3 { - pub cobj: *mut sqlite3, - pub context: *mut dc_context_t, -} /* * the structure behind dc_array_t */ #[derive(Copy, Clone)] #[repr(C)] diff --git a/src/dc_configure.rs b/src/dc_configure.rs index f7b2b0704..0d5b80c71 100644 --- a/src/dc_configure.rs +++ b/src/dc_configure.rs @@ -1,5 +1,12 @@ use c2rust_bitfields::BitfieldStruct; use libc; + +use crate::dc_context::dc_context_t; +use crate::dc_imap::dc_imap_t; +use crate::dc_jobthread::dc_jobthread_t; +use crate::dc_smtp::dc_smtp_t; +use crate::types::*; + extern "C" { pub type mailstream_cancel; pub type sqlite3; @@ -607,7 +614,7 @@ pub struct _dc_context { pub ongoing_running: libc::c_int, pub shall_stop_ongoing: libc::c_int, } -pub type dc_lot_t = _dc_lot; +use crate::dc_lot::dc_lot_t; /* * Structure behind dc_lot_t */ #[derive(Copy, Clone)] #[repr(C)] @@ -817,8 +824,7 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -//pub type dc_context_t = _dc_context; -use crate::dc_context::*; + /* ** library-private **********************************************************/ // pub type dc_smtp_t = _dc_smtp; #[derive(Copy, Clone)] @@ -917,7 +923,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -// pub type dc_sqlite3_t = _dc_sqlite3; +use crate::dc_sqlite3::dc_sqlite3_t; /* * * Library-internal. */ diff --git a/src/dc_contact.rs b/src/dc_contact.rs index b7095f8b0..89052ea65 100644 --- a/src/dc_contact.rs +++ b/src/dc_contact.rs @@ -552,7 +552,7 @@ pub struct _dc_context { pub ongoing_running: libc::c_int, pub shall_stop_ongoing: libc::c_int, } -pub type dc_lot_t = _dc_lot; +use crate::dc_lot::dc_lot_t; /* * Structure behind dc_lot_t */ #[derive(Copy, Clone)] #[repr(C)] @@ -762,7 +762,7 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; +use crate::dc_context::dc_context_t; /* ** library-private **********************************************************/ pub type dc_smtp_t = _dc_smtp; #[derive(Copy, Clone)] @@ -861,7 +861,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; +use crate::dc_sqlite3::dc_sqlite3_t; /* * * Library-internal. */ diff --git a/src/dc_context.rs b/src/dc_context.rs index 8ded29e31..024045b1b 100644 --- a/src/dc_context.rs +++ b/src/dc_context.rs @@ -1,9 +1,13 @@ use c2rust_bitfields::BitfieldStruct; use libc; + +use crate::dc_imap::dc_imap_t; +use crate::dc_jobthread::dc_jobthread_t; +use crate::dc_lot::dc_lot_t; +use crate::dc_smtp::dc_smtp_t; +use crate::types::*; + extern "C" { - pub type mailstream_cancel; - pub type sqlite3; - pub type sqlite3_stmt; #[no_mangle] fn getpid() -> pid_t; #[no_mangle] @@ -257,68 +261,6 @@ extern "C" { #[no_mangle] fn dc_trim(_: *mut libc::c_char); } -pub type __int32_t = libc::c_int; -pub type __darwin_size_t = libc::c_ulong; -pub type __darwin_ssize_t = libc::c_long; -pub type __darwin_time_t = libc::c_long; -pub type __darwin_pid_t = __int32_t; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct __darwin_pthread_handler_rec { - pub __routine: Option ()>, - pub __arg: *mut libc::c_void, - pub __next: *mut __darwin_pthread_handler_rec, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _opaque_pthread_cond_t { - pub __sig: libc::c_long, - pub __opaque: [libc::c_char; 40], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _opaque_pthread_condattr_t { - pub __sig: libc::c_long, - pub __opaque: [libc::c_char; 8], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _opaque_pthread_mutex_t { - pub __sig: libc::c_long, - pub __opaque: [libc::c_char; 56], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _opaque_pthread_mutexattr_t { - pub __sig: libc::c_long, - pub __opaque: [libc::c_char; 8], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _opaque_pthread_t { - pub __sig: libc::c_long, - pub __cleanup_stack: *mut __darwin_pthread_handler_rec, - pub __opaque: [libc::c_char; 8176], -} -pub type __darwin_pthread_cond_t = _opaque_pthread_cond_t; -pub type __darwin_pthread_condattr_t = _opaque_pthread_condattr_t; -pub type __darwin_pthread_mutex_t = _opaque_pthread_mutex_t; -pub type __darwin_pthread_mutexattr_t = _opaque_pthread_mutexattr_t; -pub type __darwin_pthread_t = *mut _opaque_pthread_t; -pub type int32_t = libc::c_int; -pub type uintptr_t = libc::c_ulong; -pub type time_t = __darwin_time_t; -pub type pid_t = __darwin_pid_t; -pub type size_t = __darwin_size_t; -pub type ssize_t = __darwin_ssize_t; -pub type pthread_cond_t = __darwin_pthread_cond_t; -pub type pthread_condattr_t = __darwin_pthread_condattr_t; -pub type pthread_mutex_t = __darwin_pthread_mutex_t; -pub type pthread_mutexattr_t = __darwin_pthread_mutexattr_t; -pub type pthread_t = __darwin_pthread_t; -pub type uint32_t = libc::c_uint; -pub type uint8_t = libc::c_uchar; -pub type uint16_t = libc::c_ushort; #[derive(Copy, Clone)] #[repr(C)] pub struct carray_s { @@ -669,7 +611,7 @@ preferrably, this should be done in the project configuration currently */ /* * Structure behind dc_context_t */ #[derive(Copy, Clone)] #[repr(C)] -pub struct _dc_context { +pub struct dc_context_t { pub magic: uint32_t, pub userdata: *mut libc::c_void, pub dbfile: *mut libc::c_char, @@ -703,25 +645,8 @@ pub struct _dc_context { pub shall_stop_ongoing: libc::c_int, } -unsafe impl Send for _dc_context {} -unsafe impl Sync for _dc_context {} - -pub type dc_lot_t = _dc_lot; -/* * Structure behind dc_lot_t */ -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_lot { - pub magic: uint32_t, - pub text1_meaning: libc::c_int, - pub text1: *mut libc::c_char, - pub text2: *mut libc::c_char, - pub timestamp: time_t, - pub state: libc::c_int, - pub id: uint32_t, - pub fingerprint: *mut libc::c_char, - pub invitenumber: *mut libc::c_char, - pub auth: *mut libc::c_char, -} +unsafe impl Send for dc_context_t {} +unsafe impl Sync for dc_context_t {} /* * * Callback function that should be given to dc_context_new(). * @@ -916,72 +841,12 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; + /* ** library-private **********************************************************/ -pub type dc_smtp_t = _dc_smtp; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_smtp { - pub etpan: *mut mailsmtp, - pub from: *mut libc::c_char, - pub esmtp: libc::c_int, - pub log_connect_errors: libc::c_int, - pub context: *mut dc_context_t, - pub error: *mut libc::c_char, - pub error_etpan: libc::c_int, -} -pub type dc_jobthread_t = _dc_jobthread; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_jobthread { - pub context: *mut dc_context_t, - pub name: *mut libc::c_char, - pub folder_config_name: *mut libc::c_char, - pub imap: *mut _dc_imap, - pub mutex: pthread_mutex_t, - pub idle_cond: pthread_cond_t, - pub idle_condflag: libc::c_int, - pub jobs_needed: libc::c_int, - pub suspended: libc::c_int, - pub using_handle: libc::c_int, -} + /* * * Library-internal. */ -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_imap { - pub addr: *mut libc::c_char, - pub imap_server: *mut libc::c_char, - pub imap_port: libc::c_int, - pub imap_user: *mut libc::c_char, - pub imap_pw: *mut libc::c_char, - pub server_flags: libc::c_int, - pub connected: libc::c_int, - pub etpan: *mut mailimap, - pub idle_set_up: libc::c_int, - pub selected_folder: *mut libc::c_char, - pub selected_folder_needs_expunge: libc::c_int, - pub should_reconnect: libc::c_int, - pub can_idle: libc::c_int, - pub has_xlist: libc::c_int, - pub imap_delimiter: libc::c_char, - pub watch_folder: *mut libc::c_char, - pub watch_cond: pthread_cond_t, - pub watch_condmutex: pthread_mutex_t, - pub watch_condflag: libc::c_int, - pub fetch_type_prefetch: *mut mailimap_fetch_type, - pub fetch_type_body: *mut mailimap_fetch_type, - pub fetch_type_flags: *mut mailimap_fetch_type, - pub get_config: dc_get_config_t, - pub set_config: dc_set_config_t, - pub precheck_imf: dc_precheck_imf_t, - pub receive_imf: dc_receive_imf_t, - pub userData: *mut libc::c_void, - pub context: *mut dc_context_t, - pub log_connect_errors: libc::c_int, - pub skip_log_capabilities: libc::c_int, -} pub type dc_receive_imf_t = Option< unsafe extern "C" fn( _: *mut dc_imap_t, @@ -995,7 +860,6 @@ pub type dc_receive_imf_t = Option< /* Purpose: Reading from IMAP servers with no dependencies to the database. dc_context_t is only used for logging and to get information about the online state. */ -pub type dc_imap_t = _dc_imap; pub type dc_precheck_imf_t = Option< unsafe extern "C" fn( _: *mut dc_imap_t, @@ -1015,7 +879,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; +use crate::dc_sqlite3::dc_sqlite3_t; /* * * Library-internal. */ diff --git a/src/dc_e2ee.rs b/src/dc_e2ee.rs index 329e651a2..78e9a7a4f 100644 --- a/src/dc_e2ee.rs +++ b/src/dc_e2ee.rs @@ -1238,7 +1238,7 @@ pub struct _dc_context { pub ongoing_running: libc::c_int, pub shall_stop_ongoing: libc::c_int, } -pub type dc_lot_t = _dc_lot; +use crate::dc_lot::dc_lot_t; /* * Structure behind dc_lot_t */ #[derive(Copy, Clone)] #[repr(C)] @@ -1448,7 +1448,7 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; +use crate::dc_context::dc_context_t; /* ** library-private **********************************************************/ pub type dc_smtp_t = _dc_smtp; #[derive(Copy, Clone)] @@ -1547,7 +1547,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; +use crate::dc_sqlite3::dc_sqlite3_t; /* * * Library-internal. */ diff --git a/src/dc_imap.rs b/src/dc_imap.rs index a378bba69..f828d1549 100644 --- a/src/dc_imap.rs +++ b/src/dc_imap.rs @@ -1,8 +1,10 @@ use c2rust_bitfields::BitfieldStruct; use libc; + +use crate::dc_context::dc_context_t; +use crate::types::*; + extern "C" { - pub type mailstream_cancel; - pub type sqlite3; #[no_mangle] fn calloc(_: libc::c_ulong, _: libc::c_ulong) -> *mut libc::c_void; #[no_mangle] @@ -248,871 +250,12 @@ extern "C" { #[no_mangle] fn dc_log_error(_: *mut dc_context_t, data1: libc::c_int, msg: *const libc::c_char, _: ...); } -pub type __darwin_size_t = libc::c_ulong; -pub type __darwin_ssize_t = libc::c_long; -pub type __darwin_time_t = libc::c_long; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _opaque_pthread_cond_t { - pub __sig: libc::c_long, - pub __opaque: [libc::c_char; 40], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _opaque_pthread_condattr_t { - pub __sig: libc::c_long, - pub __opaque: [libc::c_char; 8], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _opaque_pthread_mutex_t { - pub __sig: libc::c_long, - pub __opaque: [libc::c_char; 56], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _opaque_pthread_mutexattr_t { - pub __sig: libc::c_long, - pub __opaque: [libc::c_char; 8], -} -pub type __darwin_pthread_cond_t = _opaque_pthread_cond_t; -pub type __darwin_pthread_condattr_t = _opaque_pthread_condattr_t; -pub type __darwin_pthread_mutex_t = _opaque_pthread_mutex_t; -pub type __darwin_pthread_mutexattr_t = _opaque_pthread_mutexattr_t; -pub type uintptr_t = libc::c_ulong; -pub type size_t = __darwin_size_t; -pub type uint8_t = libc::c_uchar; -pub type uint16_t = libc::c_ushort; -pub type uint32_t = libc::c_uint; -pub type ssize_t = __darwin_ssize_t; -pub type time_t = __darwin_time_t; -pub type pthread_cond_t = __darwin_pthread_cond_t; -pub type pthread_condattr_t = __darwin_pthread_condattr_t; -pub type pthread_mutex_t = __darwin_pthread_mutex_t; -pub type pthread_mutexattr_t = __darwin_pthread_mutexattr_t; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct timespec { - pub tv_sec: __darwin_time_t, - pub tv_nsec: libc::c_long, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct carray_s { - pub array: *mut *mut libc::c_void, - pub len: libc::c_uint, - pub max: libc::c_uint, -} -pub type carray = carray_s; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _mailstream { - pub buffer_max_size: size_t, - pub write_buffer: *mut libc::c_char, - pub write_buffer_len: size_t, - pub read_buffer: *mut libc::c_char, - pub read_buffer_len: size_t, - pub low: *mut mailstream_low, - pub idle: *mut mailstream_cancel, - pub idling: libc::c_int, - pub logger: Option< - unsafe extern "C" fn( - _: *mut mailstream, - _: libc::c_int, - _: *const libc::c_char, - _: size_t, - _: *mut libc::c_void, - ) -> (), - >, - pub logger_context: *mut libc::c_void, -} -pub type mailstream = _mailstream; -pub type mailstream_low = _mailstream_low; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _mailstream_low { - pub data: *mut libc::c_void, - pub driver: *mut mailstream_low_driver, - pub privacy: libc::c_int, - pub identifier: *mut libc::c_char, - pub timeout: libc::c_ulong, - pub logger: Option< - unsafe extern "C" fn( - _: *mut mailstream_low, - _: libc::c_int, - _: *const libc::c_char, - _: size_t, - _: *mut libc::c_void, - ) -> (), - >, - pub logger_context: *mut libc::c_void, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailstream_low_driver { - pub mailstream_read: Option< - unsafe extern "C" fn(_: *mut mailstream_low, _: *mut libc::c_void, _: size_t) -> ssize_t, - >, - pub mailstream_write: Option< - unsafe extern "C" fn(_: *mut mailstream_low, _: *const libc::c_void, _: size_t) -> ssize_t, - >, - pub mailstream_close: Option libc::c_int>, - pub mailstream_get_fd: Option libc::c_int>, - pub mailstream_free: Option ()>, - pub mailstream_cancel: Option ()>, - pub mailstream_get_cancel: - Option *mut mailstream_cancel>, - pub mailstream_get_certificate_chain: - Option *mut carray>, - pub mailstream_setup_idle: Option libc::c_int>, - pub mailstream_unsetup_idle: - Option libc::c_int>, - pub mailstream_interrupt_idle: - Option libc::c_int>, -} -pub type progress_function = unsafe extern "C" fn(_: size_t, _: size_t) -> (); -pub type mailprogress_function = - unsafe extern "C" fn(_: size_t, _: size_t, _: *mut libc::c_void) -> (); -pub type unnamed = libc::c_uint; -pub const MAILSTREAM_IDLE_CANCELLED: unnamed = 4; -pub const MAILSTREAM_IDLE_TIMEOUT: unnamed = 3; -pub const MAILSTREAM_IDLE_HASDATA: unnamed = 2; -pub const MAILSTREAM_IDLE_INTERRUPTED: unnamed = 1; -pub const MAILSTREAM_IDLE_ERROR: unnamed = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _MMAPString { - pub str_0: *mut libc::c_char, - pub len: size_t, - pub allocated_len: size_t, - pub fd: libc::c_int, - pub mmapped_size: size_t, -} -pub type MMAPString = _MMAPString; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct clistcell_s { - pub data: *mut libc::c_void, - pub previous: *mut clistcell_s, - pub next: *mut clistcell_s, -} -pub type clistcell = clistcell_s; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct clist_s { - pub first: *mut clistcell, - pub last: *mut clistcell, - pub count: libc::c_int, -} -pub type clist = clist_s; -pub type clistiter = clistcell; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailsmtp { - pub stream: *mut mailstream, - pub progr_rate: size_t, - pub progr_fun: Option ()>, - pub response: *mut libc::c_char, - pub line_buffer: *mut MMAPString, - pub response_buffer: *mut MMAPString, - pub esmtp: libc::c_int, - pub auth: libc::c_int, - pub smtp_sasl: unnamed_0, - pub smtp_max_msg_size: size_t, - pub smtp_progress_fun: - Option ()>, - pub smtp_progress_context: *mut libc::c_void, - pub response_code: libc::c_int, - pub smtp_timeout: time_t, - pub smtp_logger: Option< - unsafe extern "C" fn( - _: *mut mailsmtp, - _: libc::c_int, - _: *const libc::c_char, - _: size_t, - _: *mut libc::c_void, - ) -> (), - >, - pub smtp_logger_context: *mut libc::c_void, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct unnamed_0 { - pub sasl_conn: *mut libc::c_void, - pub sasl_server_fqdn: *const libc::c_char, - pub sasl_login: *const libc::c_char, - pub sasl_auth_name: *const libc::c_char, - pub sasl_password: *const libc::c_char, - pub sasl_realm: *const libc::c_char, - pub sasl_secret: *mut libc::c_void, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_body { - pub bd_type: libc::c_int, - pub bd_data: unnamed_1, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union unnamed_1 { - pub bd_body_1part: *mut mailimap_body_type_1part, - pub bd_body_mpart: *mut mailimap_body_type_mpart, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_body_type_mpart { - pub bd_list: *mut clist, - pub bd_media_subtype: *mut libc::c_char, - pub bd_ext_mpart: *mut mailimap_body_ext_mpart, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_body_ext_mpart { - pub bd_parameter: *mut mailimap_body_fld_param, - pub bd_disposition: *mut mailimap_body_fld_dsp, - pub bd_language: *mut mailimap_body_fld_lang, - pub bd_loc: *mut libc::c_char, - pub bd_extension_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_body_fld_lang { - pub lg_type: libc::c_int, - pub lg_data: unnamed_2, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union unnamed_2 { - pub lg_single: *mut libc::c_char, - pub lg_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_body_fld_dsp { - pub dsp_type: *mut libc::c_char, - pub dsp_attributes: *mut mailimap_body_fld_param, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_body_fld_param { - pub pa_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_body_type_1part { - pub bd_type: libc::c_int, - pub bd_data: unnamed_3, - pub bd_ext_1part: *mut mailimap_body_ext_1part, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_body_ext_1part { - pub bd_md5: *mut libc::c_char, - pub bd_disposition: *mut mailimap_body_fld_dsp, - pub bd_language: *mut mailimap_body_fld_lang, - pub bd_loc: *mut libc::c_char, - pub bd_extension_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union unnamed_3 { - pub bd_type_basic: *mut mailimap_body_type_basic, - pub bd_type_msg: *mut mailimap_body_type_msg, - pub bd_type_text: *mut mailimap_body_type_text, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_body_type_text { - pub bd_media_text: *mut libc::c_char, - pub bd_fields: *mut mailimap_body_fields, - pub bd_lines: uint32_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_body_fields { - pub bd_parameter: *mut mailimap_body_fld_param, - pub bd_id: *mut libc::c_char, - pub bd_description: *mut libc::c_char, - pub bd_encoding: *mut mailimap_body_fld_enc, - pub bd_size: uint32_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_body_fld_enc { - pub enc_type: libc::c_int, - pub enc_value: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_body_type_msg { - pub bd_fields: *mut mailimap_body_fields, - pub bd_envelope: *mut mailimap_envelope, - pub bd_body: *mut mailimap_body, - pub bd_lines: uint32_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_envelope { - pub env_date: *mut libc::c_char, - pub env_subject: *mut libc::c_char, - pub env_from: *mut mailimap_env_from, - pub env_sender: *mut mailimap_env_sender, - pub env_reply_to: *mut mailimap_env_reply_to, - pub env_to: *mut mailimap_env_to, - pub env_cc: *mut mailimap_env_cc, - pub env_bcc: *mut mailimap_env_bcc, - pub env_in_reply_to: *mut libc::c_char, - pub env_message_id: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_env_bcc { - pub bcc_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_env_cc { - pub cc_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_env_to { - pub to_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_env_reply_to { - pub rt_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_env_sender { - pub snd_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_env_from { - pub frm_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_body_type_basic { - pub bd_media_basic: *mut mailimap_media_basic, - pub bd_fields: *mut mailimap_body_fields, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_media_basic { - pub med_type: libc::c_int, - pub med_basic_type: *mut libc::c_char, - pub med_subtype: *mut libc::c_char, -} -pub type unnamed_4 = libc::c_uint; -pub const MAILIMAP_CAPABILITY_NAME: unnamed_4 = 1; -pub const MAILIMAP_CAPABILITY_AUTH_TYPE: unnamed_4 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_capability { - pub cap_type: libc::c_int, - pub cap_data: unnamed_5, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union unnamed_5 { - pub cap_auth_type: *mut libc::c_char, - pub cap_name: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_capability_data { - pub cap_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_extension_data { - pub ext_extension: *mut mailimap_extension_api, - pub ext_type: libc::c_int, - pub ext_data: *mut libc::c_void, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_extension_api { - pub ext_name: *mut libc::c_char, - pub ext_id: libc::c_int, - pub ext_parser: Option< - unsafe extern "C" fn( - _: libc::c_int, - _: *mut mailstream, - _: *mut MMAPString, - _: *mut mailimap_parser_context, - _: *mut size_t, - _: *mut *mut mailimap_extension_data, - _: size_t, - _: Option ()>, - ) -> libc::c_int, - >, - pub ext_free: Option ()>, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_parser_context { - pub is_rambler_workaround_enabled: libc::c_int, - pub is_qip_workaround_enabled: libc::c_int, - pub msg_body_handler: Option< - unsafe extern "C" fn( - _: libc::c_int, - _: *mut mailimap_msg_att_body_section, - _: *const libc::c_char, - _: size_t, - _: *mut libc::c_void, - ) -> bool, - >, - pub msg_body_handler_context: *mut libc::c_void, - pub msg_body_section: *mut mailimap_msg_att_body_section, - pub msg_body_att_type: libc::c_int, - pub msg_body_parse_in_progress: bool, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_msg_att_body_section { - pub sec_section: *mut mailimap_section, - pub sec_origin_octet: uint32_t, - pub sec_body_part: *mut libc::c_char, - pub sec_length: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_section { - pub sec_spec: *mut mailimap_section_spec, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_section_spec { - pub sec_type: libc::c_int, - pub sec_data: unnamed_6, - pub sec_text: *mut mailimap_section_text, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_section_text { - pub sec_type: libc::c_int, - pub sec_msgtext: *mut mailimap_section_msgtext, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_section_msgtext { - pub sec_type: libc::c_int, - pub sec_header_list: *mut mailimap_header_list, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_header_list { - pub hdr_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union unnamed_6 { - pub sec_msgtext: *mut mailimap_section_msgtext, - pub sec_part: *mut mailimap_section_part, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_section_part { - pub sec_id: *mut clist, -} -pub type mailimap_msg_body_handler = unsafe extern "C" fn( - _: libc::c_int, - _: *mut mailimap_msg_att_body_section, - _: *const libc::c_char, - _: size_t, - _: *mut libc::c_void, -) -> bool; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_date_time { - pub dt_day: libc::c_int, - pub dt_month: libc::c_int, - pub dt_year: libc::c_int, - pub dt_hour: libc::c_int, - pub dt_min: libc::c_int, - pub dt_sec: libc::c_int, - pub dt_zone: libc::c_int, -} -pub type unnamed_7 = libc::c_uint; -pub const MAILIMAP_FLAG_EXTENSION: unnamed_7 = 6; -pub const MAILIMAP_FLAG_KEYWORD: unnamed_7 = 5; -pub const MAILIMAP_FLAG_DRAFT: unnamed_7 = 4; -pub const MAILIMAP_FLAG_SEEN: unnamed_7 = 3; -pub const MAILIMAP_FLAG_DELETED: unnamed_7 = 2; -pub const MAILIMAP_FLAG_FLAGGED: unnamed_7 = 1; -pub const MAILIMAP_FLAG_ANSWERED: unnamed_7 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_flag { - pub fl_type: libc::c_int, - pub fl_data: unnamed_8, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union unnamed_8 { - pub fl_keyword: *mut libc::c_char, - pub fl_extension: *mut libc::c_char, -} -pub type unnamed_9 = libc::c_uint; -pub const MAILIMAP_FLAG_FETCH_OTHER: unnamed_9 = 2; -pub const MAILIMAP_FLAG_FETCH_RECENT: unnamed_9 = 1; -pub const MAILIMAP_FLAG_FETCH_ERROR: unnamed_9 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_flag_fetch { - pub fl_type: libc::c_int, - pub fl_flag: *mut mailimap_flag, -} -pub type unnamed_10 = libc::c_uint; -pub const MAILIMAP_FLAG_PERM_ALL: unnamed_10 = 2; -pub const MAILIMAP_FLAG_PERM_FLAG: unnamed_10 = 1; -pub const MAILIMAP_FLAG_PERM_ERROR: unnamed_10 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_flag_perm { - pub fl_type: libc::c_int, - pub fl_flag: *mut mailimap_flag, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_flag_list { - pub fl_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_mailbox_data_status { - pub st_mailbox: *mut libc::c_char, - pub st_info_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_msg_att { - pub att_list: *mut clist, - pub att_number: uint32_t, -} -pub type unnamed_11 = libc::c_uint; -pub const MAILIMAP_MSG_ATT_ITEM_EXTENSION: unnamed_11 = 3; -pub const MAILIMAP_MSG_ATT_ITEM_STATIC: unnamed_11 = 2; -pub const MAILIMAP_MSG_ATT_ITEM_DYNAMIC: unnamed_11 = 1; -pub const MAILIMAP_MSG_ATT_ITEM_ERROR: unnamed_11 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_msg_att_item { - pub att_type: libc::c_int, - pub att_data: unnamed_12, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union unnamed_12 { - pub att_dyn: *mut mailimap_msg_att_dynamic, - pub att_static: *mut mailimap_msg_att_static, - pub att_extension_data: *mut mailimap_extension_data, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_msg_att_static { - pub att_type: libc::c_int, - pub att_data: unnamed_13, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union unnamed_13 { - pub att_env: *mut mailimap_envelope, - pub att_internal_date: *mut mailimap_date_time, - pub att_rfc822: unnamed_16, - pub att_rfc822_header: unnamed_15, - pub att_rfc822_text: unnamed_14, - pub att_rfc822_size: uint32_t, - pub att_bodystructure: *mut mailimap_body, - pub att_body: *mut mailimap_body, - pub att_body_section: *mut mailimap_msg_att_body_section, - pub att_uid: uint32_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct unnamed_14 { - pub att_content: *mut libc::c_char, - pub att_length: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct unnamed_15 { - pub att_content: *mut libc::c_char, - pub att_length: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct unnamed_16 { - pub att_content: *mut libc::c_char, - pub att_length: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_msg_att_dynamic { - pub att_list: *mut clist, -} -pub type unnamed_17 = libc::c_uint; -pub const MAILIMAP_MSG_ATT_UID: unnamed_17 = 10; -pub const MAILIMAP_MSG_ATT_BODY_SECTION: unnamed_17 = 9; -pub const MAILIMAP_MSG_ATT_BODYSTRUCTURE: unnamed_17 = 8; -pub const MAILIMAP_MSG_ATT_BODY: unnamed_17 = 7; -pub const MAILIMAP_MSG_ATT_RFC822_SIZE: unnamed_17 = 6; -pub const MAILIMAP_MSG_ATT_RFC822_TEXT: unnamed_17 = 5; -pub const MAILIMAP_MSG_ATT_RFC822_HEADER: unnamed_17 = 4; -pub const MAILIMAP_MSG_ATT_RFC822: unnamed_17 = 3; -pub const MAILIMAP_MSG_ATT_INTERNALDATE: unnamed_17 = 2; -pub const MAILIMAP_MSG_ATT_ENVELOPE: unnamed_17 = 1; -pub const MAILIMAP_MSG_ATT_ERROR: unnamed_17 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_set_item { - pub set_first: uint32_t, - pub set_last: uint32_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_set { - pub set_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_fetch_att { - pub att_type: libc::c_int, - pub att_section: *mut mailimap_section, - pub att_offset: uint32_t, - pub att_size: uint32_t, - pub att_extension: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_fetch_type { - pub ft_type: libc::c_int, - pub ft_data: unnamed_18, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union unnamed_18 { - pub ft_fetch_att: *mut mailimap_fetch_att, - pub ft_fetch_att_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_store_att_flags { - pub fl_sign: libc::c_int, - pub fl_silent: libc::c_int, - pub fl_flag_list: *mut mailimap_flag_list, -} -pub type mailimap_msg_att_handler = - unsafe extern "C" fn(_: *mut mailimap_msg_att, _: *mut libc::c_void) -> (); -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap { - pub imap_response: *mut libc::c_char, - pub imap_stream: *mut mailstream, - pub imap_progr_rate: size_t, - pub imap_progr_fun: Option ()>, - pub imap_stream_buffer: *mut MMAPString, - pub imap_response_buffer: *mut MMAPString, - pub imap_state: libc::c_int, - pub imap_tag: libc::c_int, - pub imap_connection_info: *mut mailimap_connection_info, - pub imap_selection_info: *mut mailimap_selection_info, - pub imap_response_info: *mut mailimap_response_info, - pub imap_sasl: unnamed_19, - pub imap_idle_timestamp: time_t, - pub imap_idle_maxdelay: time_t, - pub imap_body_progress_fun: - Option ()>, - pub imap_items_progress_fun: - Option ()>, - pub imap_progress_context: *mut libc::c_void, - pub imap_msg_att_handler: - Option ()>, - pub imap_msg_att_handler_context: *mut libc::c_void, - pub imap_msg_body_handler: Option< - unsafe extern "C" fn( - _: libc::c_int, - _: *mut mailimap_msg_att_body_section, - _: *const libc::c_char, - _: size_t, - _: *mut libc::c_void, - ) -> bool, - >, - pub imap_msg_body_handler_context: *mut libc::c_void, - pub imap_timeout: time_t, - pub imap_logger: Option< - unsafe extern "C" fn( - _: *mut mailimap, - _: libc::c_int, - _: *const libc::c_char, - _: size_t, - _: *mut libc::c_void, - ) -> (), - >, - pub imap_logger_context: *mut libc::c_void, - pub is_163_workaround_enabled: libc::c_int, - pub is_rambler_workaround_enabled: libc::c_int, - pub is_qip_workaround_enabled: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct unnamed_19 { - pub sasl_conn: *mut libc::c_void, - pub sasl_server_fqdn: *const libc::c_char, - pub sasl_login: *const libc::c_char, - pub sasl_auth_name: *const libc::c_char, - pub sasl_password: *const libc::c_char, - pub sasl_realm: *const libc::c_char, - pub sasl_secret: *mut libc::c_void, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_response_info { - pub rsp_alert: *mut libc::c_char, - pub rsp_parse: *mut libc::c_char, - pub rsp_badcharset: *mut clist, - pub rsp_trycreate: libc::c_int, - pub rsp_mailbox_list: *mut clist, - pub rsp_mailbox_lsub: *mut clist, - pub rsp_search_result: *mut clist, - pub rsp_status: *mut mailimap_mailbox_data_status, - pub rsp_expunged: *mut clist, - pub rsp_fetch_list: *mut clist, - pub rsp_extension_list: *mut clist, - pub rsp_atom: *mut libc::c_char, - pub rsp_value: *mut libc::c_char, -} -#[derive(BitfieldStruct, Clone, Copy)] -#[repr(C)] -pub struct mailimap_selection_info { - pub sel_perm_flags: *mut clist, - pub sel_perm: libc::c_int, - pub sel_uidnext: uint32_t, - pub sel_uidvalidity: uint32_t, - pub sel_first_unseen: uint32_t, - pub sel_flags: *mut mailimap_flag_list, - pub sel_exists: uint32_t, - pub sel_recent: uint32_t, - pub sel_unseen: uint32_t, - #[bitfield(name = "sel_has_exists", ty = "uint8_t", bits = "0..=0")] - #[bitfield(name = "sel_has_recent", ty = "uint8_t", bits = "1..=1")] - pub sel_has_exists_sel_has_recent: [u8; 1], - pub _pad: [u8; 3], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_connection_info { - pub imap_capability: *mut mailimap_capability_data, -} -pub type unnamed_20 = libc::c_uint; -pub const MAILIMAP_ERROR_CLIENTID: unnamed_20 = 46; -pub const MAILIMAP_ERROR_CUSTOM_COMMAND: unnamed_20 = 45; -pub const MAILIMAP_ERROR_NEEDS_MORE_DATA: unnamed_20 = 44; -pub const MAILIMAP_ERROR_SSL: unnamed_20 = 43; -pub const MAILIMAP_ERROR_SASL: unnamed_20 = 42; -pub const MAILIMAP_ERROR_EXTENSION: unnamed_20 = 41; -pub const MAILIMAP_ERROR_INVAL: unnamed_20 = 40; -pub const MAILIMAP_ERROR_STARTTLS: unnamed_20 = 39; -pub const MAILIMAP_ERROR_UNSUBSCRIBE: unnamed_20 = 38; -pub const MAILIMAP_ERROR_SUBSCRIBE: unnamed_20 = 37; -pub const MAILIMAP_ERROR_UID_STORE: unnamed_20 = 36; -pub const MAILIMAP_ERROR_STORE: unnamed_20 = 35; -pub const MAILIMAP_ERROR_STATUS: unnamed_20 = 34; -pub const MAILIMAP_ERROR_SELECT: unnamed_20 = 33; -pub const MAILIMAP_ERROR_UID_SEARCH: unnamed_20 = 32; -pub const MAILIMAP_ERROR_SEARCH: unnamed_20 = 31; -pub const MAILIMAP_ERROR_RENAME: unnamed_20 = 30; -pub const MAILIMAP_ERROR_LSUB: unnamed_20 = 29; -pub const MAILIMAP_ERROR_LOGIN: unnamed_20 = 28; -pub const MAILIMAP_ERROR_LIST: unnamed_20 = 27; -pub const MAILIMAP_ERROR_UID_FETCH: unnamed_20 = 26; -pub const MAILIMAP_ERROR_FETCH: unnamed_20 = 25; -pub const MAILIMAP_ERROR_EXAMINE: unnamed_20 = 24; -pub const MAILIMAP_ERROR_DELETE: unnamed_20 = 23; -pub const MAILIMAP_ERROR_CREATE: unnamed_20 = 22; -pub const MAILIMAP_ERROR_UID_MOVE: unnamed_20 = 21; -pub const MAILIMAP_ERROR_MOVE: unnamed_20 = 20; -pub const MAILIMAP_ERROR_UID_COPY: unnamed_20 = 19; -pub const MAILIMAP_ERROR_COPY: unnamed_20 = 18; -pub const MAILIMAP_ERROR_EXPUNGE: unnamed_20 = 17; -pub const MAILIMAP_ERROR_CLOSE: unnamed_20 = 16; -pub const MAILIMAP_ERROR_CHECK: unnamed_20 = 15; -pub const MAILIMAP_ERROR_CAPABILITY: unnamed_20 = 14; -pub const MAILIMAP_ERROR_LOGOUT: unnamed_20 = 13; -pub const MAILIMAP_ERROR_NOOP: unnamed_20 = 12; -pub const MAILIMAP_ERROR_APPEND: unnamed_20 = 11; -pub const MAILIMAP_ERROR_DONT_ACCEPT_CONNECTION: unnamed_20 = 10; -pub const MAILIMAP_ERROR_PROTOCOL: unnamed_20 = 9; -pub const MAILIMAP_ERROR_FATAL: unnamed_20 = 8; -pub const MAILIMAP_ERROR_MEMORY: unnamed_20 = 7; -pub const MAILIMAP_ERROR_CONNECTION_REFUSED: unnamed_20 = 6; -pub const MAILIMAP_ERROR_PARSE: unnamed_20 = 5; -pub const MAILIMAP_ERROR_STREAM: unnamed_20 = 4; -pub const MAILIMAP_ERROR_BAD_STATE: unnamed_20 = 3; -pub const MAILIMAP_NO_ERROR_NON_AUTHENTICATED: unnamed_20 = 2; -pub const MAILIMAP_NO_ERROR_AUTHENTICATED: unnamed_20 = 1; -pub const MAILIMAP_NO_ERROR: unnamed_20 = 0; + /* define DC_USE_RPGP to enable use of rPGP instead of netpgp where available; preferrably, this should be done in the project configuration currently */ //#define DC_USE_RPGP 1 /* Includes that are used frequently. This file may also be used to create predefined headers. */ -/* * Structure behind dc_context_t */ -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_context { - pub magic: uint32_t, - pub userdata: *mut libc::c_void, - pub dbfile: *mut libc::c_char, - pub blobdir: *mut libc::c_char, - pub sql: *mut dc_sqlite3_t, - pub inbox: *mut dc_imap_t, - pub inboxidle_condmutex: pthread_mutex_t, - pub perform_inbox_jobs_needed: libc::c_int, - pub probe_imap_network: libc::c_int, - pub sentbox_thread: dc_jobthread_t, - pub mvbox_thread: dc_jobthread_t, - pub smtp: *mut dc_smtp_t, - pub smtpidle_cond: pthread_cond_t, - pub smtpidle_condmutex: pthread_mutex_t, - pub smtpidle_condflag: libc::c_int, - pub smtp_suspended: libc::c_int, - pub smtp_doing_jobs: libc::c_int, - pub perform_smtp_jobs_needed: libc::c_int, - pub probe_smtp_network: libc::c_int, - pub oauth2_critical: pthread_mutex_t, - pub cb: dc_callback_t, - pub os_name: *mut libc::c_char, - pub cmdline_sel_chat_id: uint32_t, - pub bob_expects: libc::c_int, - pub bobs_status: libc::c_int, - pub bobs_qr_scan: *mut dc_lot_t, - pub bobs_qr_critical: pthread_mutex_t, - pub last_smeared_timestamp: time_t, - pub smear_critical: pthread_mutex_t, - pub ongoing_running: libc::c_int, - pub shall_stop_ongoing: libc::c_int, -} -pub type dc_lot_t = _dc_lot; -/* * Structure behind dc_lot_t */ -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_lot { - pub magic: uint32_t, - pub text1_meaning: libc::c_int, - pub text1: *mut libc::c_char, - pub text2: *mut libc::c_char, - pub timestamp: time_t, - pub state: libc::c_int, - pub id: uint32_t, - pub fingerprint: *mut libc::c_char, - pub invitenumber: *mut libc::c_char, - pub auth: *mut libc::c_char, -} + /* * * Callback function that should be given to dc_context_new(). * @@ -1307,35 +450,8 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; /* ** library-private **********************************************************/ -pub type dc_smtp_t = _dc_smtp; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_smtp { - pub etpan: *mut mailsmtp, - pub from: *mut libc::c_char, - pub esmtp: libc::c_int, - pub log_connect_errors: libc::c_int, - pub context: *mut dc_context_t, - pub error: *mut libc::c_char, - pub error_etpan: libc::c_int, -} -pub type dc_jobthread_t = _dc_jobthread; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_jobthread { - pub context: *mut dc_context_t, - pub name: *mut libc::c_char, - pub folder_config_name: *mut libc::c_char, - pub imap: *mut _dc_imap, - pub mutex: pthread_mutex_t, - pub idle_cond: pthread_cond_t, - pub idle_condflag: libc::c_int, - pub jobs_needed: libc::c_int, - pub suspended: libc::c_int, - pub using_handle: libc::c_int, -} + /* * * Library-internal. */ @@ -1406,7 +522,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; +use crate::dc_sqlite3::dc_sqlite3_t; /* * * Library-internal. */ diff --git a/src/dc_imex.rs b/src/dc_imex.rs index 045c67da5..8c69295ba 100644 --- a/src/dc_imex.rs +++ b/src/dc_imex.rs @@ -779,7 +779,7 @@ pub struct _dc_context { pub ongoing_running: libc::c_int, pub shall_stop_ongoing: libc::c_int, } -pub type dc_lot_t = _dc_lot; +use crate::dc_lot::dc_lot_t; /* * Structure behind dc_lot_t */ #[derive(Copy, Clone)] #[repr(C)] @@ -989,7 +989,7 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; +use crate::dc_context::dc_context_t; /* ** library-private **********************************************************/ pub type dc_smtp_t = _dc_smtp; #[derive(Copy, Clone)] @@ -1088,16 +1088,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; -/* * - * Library-internal. - */ -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_sqlite3 { - pub cobj: *mut sqlite3, - pub context: *mut dc_context_t, -} +use crate::dc_sqlite3::dc_sqlite3_t; pub type dc_param_t = _dc_param; /* * * @class dc_param_t diff --git a/src/dc_job.rs b/src/dc_job.rs index 5abffeb1b..5e7d485d6 100644 --- a/src/dc_job.rs +++ b/src/dc_job.rs @@ -1,11 +1,15 @@ use c2rust_bitfields::BitfieldStruct; use libc; + +use crate::dc_context::dc_context_t; +use crate::dc_imap::dc_imap_t; +use crate::dc_jobthread::dc_jobthread_t; +use crate::dc_smtp::dc_smtp_t; +use crate::types::*; + extern "C" { - pub type mailstream_cancel; - pub type sqlite3; - pub type sqlite3_stmt; #[no_mangle] - fn usleep(_: useconds_t) -> libc::c_int; + fn usleep(_: libc::useconds_t) -> libc::c_int; #[no_mangle] fn pow(_: libc::c_double, _: libc::c_double) -> libc::c_double; #[no_mangle] @@ -15,7 +19,7 @@ extern "C" { #[no_mangle] fn memset(_: *mut libc::c_void, _: libc::c_int, _: libc::c_ulong) -> *mut libc::c_void; #[no_mangle] - fn clock() -> clock_t; + fn clock() -> libc::clock_t; #[no_mangle] fn time(_: *mut time_t) -> time_t; #[no_mangle] @@ -312,53 +316,6 @@ extern "C" { #[no_mangle] fn dc_mimefactory_load_msg(_: *mut dc_mimefactory_t, msg_id: uint32_t) -> libc::c_int; } -pub type __uint32_t = libc::c_uint; -pub type __darwin_size_t = libc::c_ulong; -pub type __darwin_clock_t = libc::c_ulong; -pub type __darwin_ssize_t = libc::c_long; -pub type __darwin_time_t = libc::c_long; -pub type __darwin_useconds_t = __uint32_t; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _opaque_pthread_cond_t { - pub __sig: libc::c_long, - pub __opaque: [libc::c_char; 40], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _opaque_pthread_mutex_t { - pub __sig: libc::c_long, - pub __opaque: [libc::c_char; 56], -} -pub type __darwin_pthread_cond_t = _opaque_pthread_cond_t; -pub type __darwin_pthread_mutex_t = _opaque_pthread_mutex_t; -pub type size_t = __darwin_size_t; -pub type uint32_t = libc::c_uint; -pub type int32_t = libc::c_int; -pub type uintptr_t = libc::c_ulong; -pub type ssize_t = __darwin_ssize_t; -pub type useconds_t = __darwin_useconds_t; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct timespec { - pub tv_sec: __darwin_time_t, - pub tv_nsec: libc::c_long, -} -pub type time_t = __darwin_time_t; -pub type uint8_t = libc::c_uchar; -pub type uint16_t = libc::c_ushort; -pub type clock_t = __darwin_clock_t; - -// pub type pthread_cond_t = __darwin_pthread_cond_t; -// pub type pthread_mutex_t = __darwin_pthread_mutex_t; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct carray_s { - pub array: *mut *mut libc::c_void, - pub len: libc::c_uint, - pub max: libc::c_uint, -} -pub type carray = carray_s; #[derive(Copy, Clone)] #[repr(C)] pub struct _mailstream { @@ -765,7 +722,7 @@ pub struct _dc_context { pub ongoing_running: libc::c_int, pub shall_stop_ongoing: libc::c_int, } -pub type dc_lot_t = _dc_lot; +use crate::dc_lot::dc_lot_t; /* * Structure behind dc_lot_t */ #[derive(Copy, Clone)] #[repr(C)] @@ -975,8 +932,6 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -// pub type dc_context_t = _dc_context; -use crate::dc_context::*; /* ** library-private **********************************************************/ //pub type dc_smtp_t = _dc_smtp; #[derive(Copy, Clone)] @@ -1075,7 +1030,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -//pub type dc_sqlite3_t = _dc_sqlite3; +use crate::dc_sqlite3::dc_sqlite3_t; /* * * Library-internal. */ @@ -1487,7 +1442,7 @@ unsafe extern "C" fn dc_suspend_smtp_thread( return; } pthread_mutex_unlock(&mut (*context).smtpidle_condmutex); - usleep((300i32 * 1000i32) as useconds_t); + usleep((300i32 * 1000i32) as libc::useconds_t); } }; } @@ -2223,7 +2178,7 @@ pub unsafe extern "C" fn dc_job_kill_action( } #[no_mangle] pub unsafe extern "C" fn dc_perform_imap_fetch(mut context: *mut dc_context_t) { - let mut start: clock_t = clock(); + let mut start: libc::clock_t = clock(); if 0 == connect_to_inbox(context) { return; } diff --git a/src/dc_jobthread.rs b/src/dc_jobthread.rs index cc20779ac..e9bf9136c 100644 --- a/src/dc_jobthread.rs +++ b/src/dc_jobthread.rs @@ -1,8 +1,14 @@ use c2rust_bitfields::BitfieldStruct; use libc; + +use crate::dc_context::dc_context_t; +use crate::dc_imap::dc_imap_t; +use crate::dc_lot::dc_lot_t; +use crate::dc_smtp::dc_smtp_t; +use crate::dc_sqlite3::dc_sqlite3_t; +use crate::types::*; + extern "C" { - pub type mailstream_cancel; - pub type sqlite3; #[no_mangle] fn usleep(_: useconds_t) -> libc::c_int; #[no_mangle] @@ -453,58 +459,7 @@ pub struct mailimap_connection_info { preferrably, this should be done in the project configuration currently */ //#define DC_USE_RPGP 1 /* Includes that are used frequently. This file may also be used to create predefined headers. */ -/* * Structure behind dc_context_t */ -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_context { - pub magic: uint32_t, - pub userdata: *mut libc::c_void, - pub dbfile: *mut libc::c_char, - pub blobdir: *mut libc::c_char, - pub sql: *mut dc_sqlite3_t, - pub inbox: *mut dc_imap_t, - pub inboxidle_condmutex: pthread_mutex_t, - pub perform_inbox_jobs_needed: libc::c_int, - pub probe_imap_network: libc::c_int, - pub sentbox_thread: dc_jobthread_t, - pub mvbox_thread: dc_jobthread_t, - pub smtp: *mut dc_smtp_t, - pub smtpidle_cond: pthread_cond_t, - pub smtpidle_condmutex: pthread_mutex_t, - pub smtpidle_condflag: libc::c_int, - pub smtp_suspended: libc::c_int, - pub smtp_doing_jobs: libc::c_int, - pub perform_smtp_jobs_needed: libc::c_int, - pub probe_smtp_network: libc::c_int, - pub oauth2_critical: pthread_mutex_t, - pub cb: dc_callback_t, - pub os_name: *mut libc::c_char, - pub cmdline_sel_chat_id: uint32_t, - pub bob_expects: libc::c_int, - pub bobs_status: libc::c_int, - pub bobs_qr_scan: *mut dc_lot_t, - pub bobs_qr_critical: pthread_mutex_t, - pub last_smeared_timestamp: time_t, - pub smear_critical: pthread_mutex_t, - pub ongoing_running: libc::c_int, - pub shall_stop_ongoing: libc::c_int, -} -pub type dc_lot_t = _dc_lot; -/* * Structure behind dc_lot_t */ -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_lot { - pub magic: uint32_t, - pub text1_meaning: libc::c_int, - pub text1: *mut libc::c_char, - pub text2: *mut libc::c_char, - pub timestamp: time_t, - pub state: libc::c_int, - pub id: uint32_t, - pub fingerprint: *mut libc::c_char, - pub invitenumber: *mut libc::c_char, - pub auth: *mut libc::c_char, -} + /* * * Callback function that should be given to dc_context_new(). * @@ -699,28 +654,15 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; + /* ** library-private **********************************************************/ -pub type dc_smtp_t = _dc_smtp; #[derive(Copy, Clone)] #[repr(C)] -pub struct _dc_smtp { - pub etpan: *mut mailsmtp, - pub from: *mut libc::c_char, - pub esmtp: libc::c_int, - pub log_connect_errors: libc::c_int, - pub context: *mut dc_context_t, - pub error: *mut libc::c_char, - pub error_etpan: libc::c_int, -} -pub type dc_jobthread_t = _dc_jobthread; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_jobthread { +pub struct dc_jobthread_t { pub context: *mut dc_context_t, pub name: *mut libc::c_char, pub folder_config_name: *mut libc::c_char, - pub imap: *mut _dc_imap, + pub imap: *mut dc_imap_t, pub mutex: pthread_mutex_t, pub idle_cond: pthread_cond_t, pub idle_condflag: libc::c_int, @@ -728,43 +670,6 @@ pub struct _dc_jobthread { pub suspended: libc::c_int, pub using_handle: libc::c_int, } -/* * - * Library-internal. - */ -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_imap { - pub addr: *mut libc::c_char, - pub imap_server: *mut libc::c_char, - pub imap_port: libc::c_int, - pub imap_user: *mut libc::c_char, - pub imap_pw: *mut libc::c_char, - pub server_flags: libc::c_int, - pub connected: libc::c_int, - pub etpan: *mut mailimap, - pub idle_set_up: libc::c_int, - pub selected_folder: *mut libc::c_char, - pub selected_folder_needs_expunge: libc::c_int, - pub should_reconnect: libc::c_int, - pub can_idle: libc::c_int, - pub has_xlist: libc::c_int, - pub imap_delimiter: libc::c_char, - pub watch_folder: *mut libc::c_char, - pub watch_cond: pthread_cond_t, - pub watch_condmutex: pthread_mutex_t, - pub watch_condflag: libc::c_int, - pub fetch_type_prefetch: *mut mailimap_fetch_type, - pub fetch_type_body: *mut mailimap_fetch_type, - pub fetch_type_flags: *mut mailimap_fetch_type, - pub get_config: dc_get_config_t, - pub set_config: dc_set_config_t, - pub precheck_imf: dc_precheck_imf_t, - pub receive_imf: dc_receive_imf_t, - pub userData: *mut libc::c_void, - pub context: *mut dc_context_t, - pub log_connect_errors: libc::c_int, - pub skip_log_capabilities: libc::c_int, -} pub type dc_receive_imf_t = Option< unsafe extern "C" fn( _: *mut dc_imap_t, @@ -778,7 +683,6 @@ pub type dc_receive_imf_t = Option< /* Purpose: Reading from IMAP servers with no dependencies to the database. dc_context_t is only used for logging and to get information about the online state. */ -pub type dc_imap_t = _dc_imap; pub type dc_precheck_imf_t = Option< unsafe extern "C" fn( _: *mut dc_imap_t, @@ -798,16 +702,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; -/* * - * Library-internal. - */ -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_sqlite3 { - pub cobj: *mut sqlite3, - pub context: *mut dc_context_t, -} + #[no_mangle] pub unsafe extern "C" fn dc_jobthread_init( mut jobthread: *mut dc_jobthread_t, @@ -821,7 +716,7 @@ pub unsafe extern "C" fn dc_jobthread_init( (*jobthread).context = context; (*jobthread).name = dc_strdup(name); (*jobthread).folder_config_name = dc_strdup(folder_config_name); - (*jobthread).imap = 0 as *mut _dc_imap; + (*jobthread).imap = 0 as *mut dc_imap_t; pthread_mutex_init(&mut (*jobthread).mutex, 0 as *const pthread_mutexattr_t); pthread_cond_init(&mut (*jobthread).idle_cond, 0 as *const pthread_condattr_t); (*jobthread).idle_condflag = 0i32; diff --git a/src/dc_key.rs b/src/dc_key.rs index 8d451694c..4dc6dfea1 100644 --- a/src/dc_key.rs +++ b/src/dc_key.rs @@ -537,7 +537,7 @@ pub struct _dc_context { pub ongoing_running: libc::c_int, pub shall_stop_ongoing: libc::c_int, } -pub type dc_lot_t = _dc_lot; +use crate::dc_lot::dc_lot_t; /* * Structure behind dc_lot_t */ #[derive(Copy, Clone)] #[repr(C)] @@ -747,7 +747,7 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; +use crate::dc_context::dc_context_t; /* ** library-private **********************************************************/ pub type dc_smtp_t = _dc_smtp; #[derive(Copy, Clone)] @@ -846,7 +846,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; +use crate::dc_sqlite3::dc_sqlite3_t; /* * * Library-internal. */ diff --git a/src/dc_keyhistory.rs b/src/dc_keyhistory.rs index 31b730991..daf9fdc10 100644 --- a/src/dc_keyhistory.rs +++ b/src/dc_keyhistory.rs @@ -412,7 +412,7 @@ pub struct _dc_context { pub ongoing_running: libc::c_int, pub shall_stop_ongoing: libc::c_int, } -pub type dc_lot_t = _dc_lot; +use crate::dc_lot::dc_lot_t; /* * Structure behind dc_lot_t */ #[derive(Copy, Clone)] #[repr(C)] @@ -622,7 +622,7 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; +use crate::dc_context::dc_context_t; /* ** library-private **********************************************************/ pub type dc_smtp_t = _dc_smtp; #[derive(Copy, Clone)] @@ -721,7 +721,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; +use crate::dc_sqlite3::dc_sqlite3_t; /* * * Library-internal. */ diff --git a/src/dc_keyring.rs b/src/dc_keyring.rs index 51e97114a..408d7ec8e 100644 --- a/src/dc_keyring.rs +++ b/src/dc_keyring.rs @@ -449,7 +449,7 @@ pub struct _dc_context { pub ongoing_running: libc::c_int, pub shall_stop_ongoing: libc::c_int, } -pub type dc_lot_t = _dc_lot; +use crate::dc_lot::dc_lot_t; /* * Structure behind dc_lot_t */ #[derive(Copy, Clone)] #[repr(C)] @@ -659,7 +659,7 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; +use crate::dc_context::dc_context_t; /* ** library-private **********************************************************/ pub type dc_smtp_t = _dc_smtp; #[derive(Copy, Clone)] @@ -758,7 +758,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; +use crate::dc_sqlite3::dc_sqlite3_t; /* * * Library-internal. */ diff --git a/src/dc_location.rs b/src/dc_location.rs index 9d86b0bb6..859569848 100644 --- a/src/dc_location.rs +++ b/src/dc_location.rs @@ -598,7 +598,7 @@ pub struct _dc_context { pub ongoing_running: libc::c_int, pub shall_stop_ongoing: libc::c_int, } -pub type dc_lot_t = _dc_lot; +use crate::dc_lot::dc_lot_t; /* * Structure behind dc_lot_t */ #[derive(Copy, Clone)] #[repr(C)] @@ -808,7 +808,7 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; +use crate::dc_context::dc_context_t; /* ** library-private **********************************************************/ pub type dc_smtp_t = _dc_smtp; #[derive(Copy, Clone)] @@ -907,7 +907,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; +use crate::dc_sqlite3::dc_sqlite3_t; /* * * Library-internal. */ diff --git a/src/dc_log.rs b/src/dc_log.rs index 8fd040481..460046bce 100644 --- a/src/dc_log.rs +++ b/src/dc_log.rs @@ -436,7 +436,7 @@ pub struct _dc_context { pub ongoing_running: libc::c_int, pub shall_stop_ongoing: libc::c_int, } -pub type dc_lot_t = _dc_lot; +use crate::dc_lot::dc_lot_t; /* * Structure behind dc_lot_t */ #[derive(Copy, Clone)] #[repr(C)] @@ -646,7 +646,7 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; +use crate::dc_context::dc_context_t; /* ** library-private **********************************************************/ pub type dc_smtp_t = _dc_smtp; #[derive(Copy, Clone)] @@ -745,7 +745,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; +use crate::dc_sqlite3::dc_sqlite3_t; /* * * Library-internal. */ diff --git a/src/dc_loginparam.rs b/src/dc_loginparam.rs index d39b9192d..5d525fafb 100644 --- a/src/dc_loginparam.rs +++ b/src/dc_loginparam.rs @@ -460,7 +460,7 @@ pub struct _dc_context { pub ongoing_running: libc::c_int, pub shall_stop_ongoing: libc::c_int, } -pub type dc_lot_t = _dc_lot; +use crate::dc_lot::dc_lot_t; /* * Structure behind dc_lot_t */ #[derive(Copy, Clone)] #[repr(C)] @@ -670,7 +670,7 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; +use crate::dc_context::dc_context_t; /* ** library-private **********************************************************/ pub type dc_smtp_t = _dc_smtp; #[derive(Copy, Clone)] @@ -769,7 +769,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; +use crate::dc_sqlite3::dc_sqlite3_t; /* * * Library-internal. */ diff --git a/src/dc_lot.rs b/src/dc_lot.rs index 5a7af339c..fe8802a2b 100644 --- a/src/dc_lot.rs +++ b/src/dc_lot.rs @@ -1,8 +1,14 @@ use c2rust_bitfields::BitfieldStruct; use libc; + +use crate::dc_context::dc_context_t; +use crate::dc_imap::dc_imap_t; +use crate::dc_jobthread::dc_jobthread_t; +use crate::dc_smtp::dc_smtp_t; +use crate::dc_sqlite3::dc_sqlite3_t; +use crate::types::*; + extern "C" { - pub type mailstream_cancel; - pub type sqlite3; #[no_mangle] fn calloc(_: libc::c_ulong, _: libc::c_ulong) -> *mut libc::c_void; #[no_mangle] @@ -652,72 +658,6 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; -/* ** library-private **********************************************************/ -pub type dc_smtp_t = _dc_smtp; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_smtp { - pub etpan: *mut mailsmtp, - pub from: *mut libc::c_char, - pub esmtp: libc::c_int, - pub log_connect_errors: libc::c_int, - pub context: *mut dc_context_t, - pub error: *mut libc::c_char, - pub error_etpan: libc::c_int, -} -pub type dc_jobthread_t = _dc_jobthread; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_jobthread { - pub context: *mut dc_context_t, - pub name: *mut libc::c_char, - pub folder_config_name: *mut libc::c_char, - pub imap: *mut _dc_imap, - pub mutex: pthread_mutex_t, - pub idle_cond: pthread_cond_t, - pub idle_condflag: libc::c_int, - pub jobs_needed: libc::c_int, - pub suspended: libc::c_int, - pub using_handle: libc::c_int, -} -/* * - * Library-internal. - */ -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_imap { - pub addr: *mut libc::c_char, - pub imap_server: *mut libc::c_char, - pub imap_port: libc::c_int, - pub imap_user: *mut libc::c_char, - pub imap_pw: *mut libc::c_char, - pub server_flags: libc::c_int, - pub connected: libc::c_int, - pub etpan: *mut mailimap, - pub idle_set_up: libc::c_int, - pub selected_folder: *mut libc::c_char, - pub selected_folder_needs_expunge: libc::c_int, - pub should_reconnect: libc::c_int, - pub can_idle: libc::c_int, - pub has_xlist: libc::c_int, - pub imap_delimiter: libc::c_char, - pub watch_folder: *mut libc::c_char, - pub watch_cond: pthread_cond_t, - pub watch_condmutex: pthread_mutex_t, - pub watch_condflag: libc::c_int, - pub fetch_type_prefetch: *mut mailimap_fetch_type, - pub fetch_type_body: *mut mailimap_fetch_type, - pub fetch_type_flags: *mut mailimap_fetch_type, - pub get_config: dc_get_config_t, - pub set_config: dc_set_config_t, - pub precheck_imf: dc_precheck_imf_t, - pub receive_imf: dc_receive_imf_t, - pub userData: *mut libc::c_void, - pub context: *mut dc_context_t, - pub log_connect_errors: libc::c_int, - pub skip_log_capabilities: libc::c_int, -} pub type dc_receive_imf_t = Option< unsafe extern "C" fn( _: *mut dc_imap_t, @@ -728,10 +668,6 @@ pub type dc_receive_imf_t = Option< _: uint32_t, ) -> (), >; -/* Purpose: Reading from IMAP servers with no dependencies to the database. -dc_context_t is only used for logging and to get information about -the online state. */ -pub type dc_imap_t = _dc_imap; pub type dc_precheck_imf_t = Option< unsafe extern "C" fn( _: *mut dc_imap_t, @@ -751,16 +687,10 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; + /* * * Library-internal. */ -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_sqlite3 { - pub cobj: *mut sqlite3, - pub context: *mut dc_context_t, -} /* values for the chats.blocked database field */ /* * the structure behind dc_chat_t */ #[derive(Copy, Clone)] diff --git a/src/dc_mimefactory.rs b/src/dc_mimefactory.rs index 862c39a86..49c89e86a 100644 --- a/src/dc_mimefactory.rs +++ b/src/dc_mimefactory.rs @@ -1199,7 +1199,7 @@ pub struct _dc_context { pub ongoing_running: libc::c_int, pub shall_stop_ongoing: libc::c_int, } -pub type dc_lot_t = _dc_lot; +use crate::dc_lot::dc_lot_t; /* * Structure behind dc_lot_t */ #[derive(Copy, Clone)] #[repr(C)] @@ -1409,7 +1409,7 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; +use crate::dc_context::dc_context_t; /* ** library-private **********************************************************/ pub type dc_smtp_t = _dc_smtp; #[derive(Copy, Clone)] @@ -1508,7 +1508,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; +use crate::dc_sqlite3::dc_sqlite3_t; /* * * Library-internal. */ diff --git a/src/dc_mimeparser.rs b/src/dc_mimeparser.rs index 70cd1c683..aa81673c0 100644 --- a/src/dc_mimeparser.rs +++ b/src/dc_mimeparser.rs @@ -1043,7 +1043,7 @@ pub struct _dc_context { pub ongoing_running: libc::c_int, pub shall_stop_ongoing: libc::c_int, } -pub type dc_lot_t = _dc_lot; +use crate::dc_lot::dc_lot_t; /* * Structure behind dc_lot_t */ #[derive(Copy, Clone)] #[repr(C)] @@ -1253,7 +1253,7 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; +use crate::dc_context::dc_context_t; /* ** library-private **********************************************************/ pub type dc_smtp_t = _dc_smtp; #[derive(Copy, Clone)] @@ -1352,7 +1352,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; +use crate::dc_sqlite3::dc_sqlite3_t; /* * * Library-internal. */ diff --git a/src/dc_move.rs b/src/dc_move.rs index 741e20776..6dbe76034 100644 --- a/src/dc_move.rs +++ b/src/dc_move.rs @@ -448,7 +448,7 @@ pub struct _dc_context { pub ongoing_running: libc::c_int, pub shall_stop_ongoing: libc::c_int, } -pub type dc_lot_t = _dc_lot; +use crate::dc_lot::dc_lot_t; /* * Structure behind dc_lot_t */ #[derive(Copy, Clone)] #[repr(C)] @@ -658,7 +658,7 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; +use crate::dc_context::dc_context_t; /* ** library-private **********************************************************/ pub type dc_smtp_t = _dc_smtp; #[derive(Copy, Clone)] @@ -757,7 +757,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; +use crate::dc_sqlite3::dc_sqlite3_t; /* * * Library-internal. */ diff --git a/src/dc_msg.rs b/src/dc_msg.rs index 6873d595b..7967ff952 100644 --- a/src/dc_msg.rs +++ b/src/dc_msg.rs @@ -628,7 +628,7 @@ pub struct _dc_context { pub ongoing_running: libc::c_int, pub shall_stop_ongoing: libc::c_int, } -pub type dc_lot_t = _dc_lot; +use crate::dc_lot::dc_lot_t; /* * Structure behind dc_lot_t */ #[derive(Copy, Clone)] #[repr(C)] @@ -838,7 +838,7 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; +use crate::dc_context::dc_context_t; /* ** library-private **********************************************************/ pub type dc_smtp_t = _dc_smtp; #[derive(Copy, Clone)] @@ -937,7 +937,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; +use crate::dc_sqlite3::dc_sqlite3_t; /* * * Library-internal. */ diff --git a/src/dc_oauth2.rs b/src/dc_oauth2.rs index 935f286c7..bd18bec66 100644 --- a/src/dc_oauth2.rs +++ b/src/dc_oauth2.rs @@ -1,5 +1,13 @@ use c2rust_bitfields::BitfieldStruct; use libc; + +use crate::dc_context::dc_context_t; +use crate::dc_imap::dc_imap_t; +use crate::dc_lot::dc_lot_t; +use crate::dc_smtp::dc_smtp_t; +use crate::dc_sqlite3::dc_sqlite3_t; +use crate::types::*; + extern "C" { pub type mailstream_cancel; pub type sqlite3; @@ -89,431 +97,12 @@ extern "C" { #[no_mangle] fn jsmn_init(parser: *mut jsmn_parser); } -pub type __darwin_size_t = libc::c_ulong; -pub type __darwin_ssize_t = libc::c_long; -pub type __darwin_time_t = libc::c_long; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _opaque_pthread_cond_t { - pub __sig: libc::c_long, - pub __opaque: [libc::c_char; 40], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _opaque_pthread_mutex_t { - pub __sig: libc::c_long, - pub __opaque: [libc::c_char; 56], -} -pub type __darwin_pthread_cond_t = _opaque_pthread_cond_t; -pub type __darwin_pthread_mutex_t = _opaque_pthread_mutex_t; -pub type int64_t = libc::c_longlong; -pub type uintptr_t = libc::c_ulong; -pub type size_t = __darwin_size_t; -pub type uint8_t = libc::c_uchar; -pub type uint32_t = libc::c_uint; -pub type ssize_t = __darwin_ssize_t; -pub type time_t = __darwin_time_t; -pub type pthread_cond_t = __darwin_pthread_cond_t; -pub type pthread_mutex_t = __darwin_pthread_mutex_t; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct carray_s { - pub array: *mut *mut libc::c_void, - pub len: libc::c_uint, - pub max: libc::c_uint, -} -pub type carray = carray_s; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _mailstream { - pub buffer_max_size: size_t, - pub write_buffer: *mut libc::c_char, - pub write_buffer_len: size_t, - pub read_buffer: *mut libc::c_char, - pub read_buffer_len: size_t, - pub low: *mut mailstream_low, - pub idle: *mut mailstream_cancel, - pub idling: libc::c_int, - pub logger: Option< - unsafe extern "C" fn( - _: *mut mailstream, - _: libc::c_int, - _: *const libc::c_char, - _: size_t, - _: *mut libc::c_void, - ) -> (), - >, - pub logger_context: *mut libc::c_void, -} -pub type mailstream = _mailstream; -pub type mailstream_low = _mailstream_low; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _mailstream_low { - pub data: *mut libc::c_void, - pub driver: *mut mailstream_low_driver, - pub privacy: libc::c_int, - pub identifier: *mut libc::c_char, - pub timeout: libc::c_ulong, - pub logger: Option< - unsafe extern "C" fn( - _: *mut mailstream_low, - _: libc::c_int, - _: *const libc::c_char, - _: size_t, - _: *mut libc::c_void, - ) -> (), - >, - pub logger_context: *mut libc::c_void, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailstream_low_driver { - pub mailstream_read: Option< - unsafe extern "C" fn(_: *mut mailstream_low, _: *mut libc::c_void, _: size_t) -> ssize_t, - >, - pub mailstream_write: Option< - unsafe extern "C" fn(_: *mut mailstream_low, _: *const libc::c_void, _: size_t) -> ssize_t, - >, - pub mailstream_close: Option libc::c_int>, - pub mailstream_get_fd: Option libc::c_int>, - pub mailstream_free: Option ()>, - pub mailstream_cancel: Option ()>, - pub mailstream_get_cancel: - Option *mut mailstream_cancel>, - pub mailstream_get_certificate_chain: - Option *mut carray>, - pub mailstream_setup_idle: Option libc::c_int>, - pub mailstream_unsetup_idle: - Option libc::c_int>, - pub mailstream_interrupt_idle: - Option libc::c_int>, -} -pub type progress_function = unsafe extern "C" fn(_: size_t, _: size_t) -> (); -pub type mailprogress_function = - unsafe extern "C" fn(_: size_t, _: size_t, _: *mut libc::c_void) -> (); -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _MMAPString { - pub str_0: *mut libc::c_char, - pub len: size_t, - pub allocated_len: size_t, - pub fd: libc::c_int, - pub mmapped_size: size_t, -} -pub type MMAPString = _MMAPString; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct clistcell_s { - pub data: *mut libc::c_void, - pub previous: *mut clistcell_s, - pub next: *mut clistcell_s, -} -pub type clistcell = clistcell_s; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct clist_s { - pub first: *mut clistcell, - pub last: *mut clistcell, - pub count: libc::c_int, -} -pub type clist = clist_s; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailsmtp { - pub stream: *mut mailstream, - pub progr_rate: size_t, - pub progr_fun: Option ()>, - pub response: *mut libc::c_char, - pub line_buffer: *mut MMAPString, - pub response_buffer: *mut MMAPString, - pub esmtp: libc::c_int, - pub auth: libc::c_int, - pub smtp_sasl: unnamed, - pub smtp_max_msg_size: size_t, - pub smtp_progress_fun: - Option ()>, - pub smtp_progress_context: *mut libc::c_void, - pub response_code: libc::c_int, - pub smtp_timeout: time_t, - pub smtp_logger: Option< - unsafe extern "C" fn( - _: *mut mailsmtp, - _: libc::c_int, - _: *const libc::c_char, - _: size_t, - _: *mut libc::c_void, - ) -> (), - >, - pub smtp_logger_context: *mut libc::c_void, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct unnamed { - pub sasl_conn: *mut libc::c_void, - pub sasl_server_fqdn: *const libc::c_char, - pub sasl_login: *const libc::c_char, - pub sasl_auth_name: *const libc::c_char, - pub sasl_password: *const libc::c_char, - pub sasl_realm: *const libc::c_char, - pub sasl_secret: *mut libc::c_void, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_capability_data { - pub cap_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_msg_att_body_section { - pub sec_section: *mut mailimap_section, - pub sec_origin_octet: uint32_t, - pub sec_body_part: *mut libc::c_char, - pub sec_length: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_section { - pub sec_spec: *mut mailimap_section_spec, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_section_spec { - pub sec_type: libc::c_int, - pub sec_data: unnamed_0, - pub sec_text: *mut mailimap_section_text, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_section_text { - pub sec_type: libc::c_int, - pub sec_msgtext: *mut mailimap_section_msgtext, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_section_msgtext { - pub sec_type: libc::c_int, - pub sec_header_list: *mut mailimap_header_list, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_header_list { - pub hdr_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union unnamed_0 { - pub sec_msgtext: *mut mailimap_section_msgtext, - pub sec_part: *mut mailimap_section_part, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_section_part { - pub sec_id: *mut clist, -} -pub type mailimap_msg_body_handler = unsafe extern "C" fn( - _: libc::c_int, - _: *mut mailimap_msg_att_body_section, - _: *const libc::c_char, - _: size_t, - _: *mut libc::c_void, -) -> bool; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_flag_list { - pub fl_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_mailbox_data_status { - pub st_mailbox: *mut libc::c_char, - pub st_info_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_msg_att { - pub att_list: *mut clist, - pub att_number: uint32_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_fetch_att { - pub att_type: libc::c_int, - pub att_section: *mut mailimap_section, - pub att_offset: uint32_t, - pub att_size: uint32_t, - pub att_extension: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_fetch_type { - pub ft_type: libc::c_int, - pub ft_data: unnamed_1, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union unnamed_1 { - pub ft_fetch_att: *mut mailimap_fetch_att, - pub ft_fetch_att_list: *mut clist, -} -pub type mailimap_msg_att_handler = - unsafe extern "C" fn(_: *mut mailimap_msg_att, _: *mut libc::c_void) -> (); -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap { - pub imap_response: *mut libc::c_char, - pub imap_stream: *mut mailstream, - pub imap_progr_rate: size_t, - pub imap_progr_fun: Option ()>, - pub imap_stream_buffer: *mut MMAPString, - pub imap_response_buffer: *mut MMAPString, - pub imap_state: libc::c_int, - pub imap_tag: libc::c_int, - pub imap_connection_info: *mut mailimap_connection_info, - pub imap_selection_info: *mut mailimap_selection_info, - pub imap_response_info: *mut mailimap_response_info, - pub imap_sasl: unnamed_2, - pub imap_idle_timestamp: time_t, - pub imap_idle_maxdelay: time_t, - pub imap_body_progress_fun: - Option ()>, - pub imap_items_progress_fun: - Option ()>, - pub imap_progress_context: *mut libc::c_void, - pub imap_msg_att_handler: - Option ()>, - pub imap_msg_att_handler_context: *mut libc::c_void, - pub imap_msg_body_handler: Option< - unsafe extern "C" fn( - _: libc::c_int, - _: *mut mailimap_msg_att_body_section, - _: *const libc::c_char, - _: size_t, - _: *mut libc::c_void, - ) -> bool, - >, - pub imap_msg_body_handler_context: *mut libc::c_void, - pub imap_timeout: time_t, - pub imap_logger: Option< - unsafe extern "C" fn( - _: *mut mailimap, - _: libc::c_int, - _: *const libc::c_char, - _: size_t, - _: *mut libc::c_void, - ) -> (), - >, - pub imap_logger_context: *mut libc::c_void, - pub is_163_workaround_enabled: libc::c_int, - pub is_rambler_workaround_enabled: libc::c_int, - pub is_qip_workaround_enabled: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct unnamed_2 { - pub sasl_conn: *mut libc::c_void, - pub sasl_server_fqdn: *const libc::c_char, - pub sasl_login: *const libc::c_char, - pub sasl_auth_name: *const libc::c_char, - pub sasl_password: *const libc::c_char, - pub sasl_realm: *const libc::c_char, - pub sasl_secret: *mut libc::c_void, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_response_info { - pub rsp_alert: *mut libc::c_char, - pub rsp_parse: *mut libc::c_char, - pub rsp_badcharset: *mut clist, - pub rsp_trycreate: libc::c_int, - pub rsp_mailbox_list: *mut clist, - pub rsp_mailbox_lsub: *mut clist, - pub rsp_search_result: *mut clist, - pub rsp_status: *mut mailimap_mailbox_data_status, - pub rsp_expunged: *mut clist, - pub rsp_fetch_list: *mut clist, - pub rsp_extension_list: *mut clist, - pub rsp_atom: *mut libc::c_char, - pub rsp_value: *mut libc::c_char, -} -#[derive(BitfieldStruct, Clone, Copy)] -#[repr(C)] -pub struct mailimap_selection_info { - pub sel_perm_flags: *mut clist, - pub sel_perm: libc::c_int, - pub sel_uidnext: uint32_t, - pub sel_uidvalidity: uint32_t, - pub sel_first_unseen: uint32_t, - pub sel_flags: *mut mailimap_flag_list, - pub sel_exists: uint32_t, - pub sel_recent: uint32_t, - pub sel_unseen: uint32_t, - #[bitfield(name = "sel_has_exists", ty = "uint8_t", bits = "0..=0")] - #[bitfield(name = "sel_has_recent", ty = "uint8_t", bits = "1..=1")] - pub sel_has_exists_sel_has_recent: [u8; 1], - pub _pad: [u8; 3], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_connection_info { - pub imap_capability: *mut mailimap_capability_data, -} + /* define DC_USE_RPGP to enable use of rPGP instead of netpgp where available; preferrably, this should be done in the project configuration currently */ //#define DC_USE_RPGP 1 /* Includes that are used frequently. This file may also be used to create predefined headers. */ -/* * Structure behind dc_context_t */ -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_context { - pub magic: uint32_t, - pub userdata: *mut libc::c_void, - pub dbfile: *mut libc::c_char, - pub blobdir: *mut libc::c_char, - pub sql: *mut dc_sqlite3_t, - pub inbox: *mut dc_imap_t, - pub inboxidle_condmutex: pthread_mutex_t, - pub perform_inbox_jobs_needed: libc::c_int, - pub probe_imap_network: libc::c_int, - pub sentbox_thread: dc_jobthread_t, - pub mvbox_thread: dc_jobthread_t, - pub smtp: *mut dc_smtp_t, - pub smtpidle_cond: pthread_cond_t, - pub smtpidle_condmutex: pthread_mutex_t, - pub smtpidle_condflag: libc::c_int, - pub smtp_suspended: libc::c_int, - pub smtp_doing_jobs: libc::c_int, - pub perform_smtp_jobs_needed: libc::c_int, - pub probe_smtp_network: libc::c_int, - pub oauth2_critical: pthread_mutex_t, - pub cb: dc_callback_t, - pub os_name: *mut libc::c_char, - pub cmdline_sel_chat_id: uint32_t, - pub bob_expects: libc::c_int, - pub bobs_status: libc::c_int, - pub bobs_qr_scan: *mut dc_lot_t, - pub bobs_qr_critical: pthread_mutex_t, - pub last_smeared_timestamp: time_t, - pub smear_critical: pthread_mutex_t, - pub ongoing_running: libc::c_int, - pub shall_stop_ongoing: libc::c_int, -} -pub type dc_lot_t = _dc_lot; -/* * Structure behind dc_lot_t */ -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_lot { - pub magic: uint32_t, - pub text1_meaning: libc::c_int, - pub text1: *mut libc::c_char, - pub text2: *mut libc::c_char, - pub timestamp: time_t, - pub state: libc::c_int, - pub id: uint32_t, - pub fingerprint: *mut libc::c_char, - pub invitenumber: *mut libc::c_char, - pub auth: *mut libc::c_char, -} + /* * * Callback function that should be given to dc_context_new(). * @@ -699,81 +288,7 @@ pub type dc_callback_t = Option< * * See you. */ -/* * - * @class dc_context_t - * - * An object representing a single account. - * - * Each account is linked to an IMAP/SMTP account and uses a separate - * SQLite database for offline functionality and for account-related - * settings. - */ -pub type dc_context_t = _dc_context; -/* ** library-private **********************************************************/ -pub type dc_smtp_t = _dc_smtp; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_smtp { - pub etpan: *mut mailsmtp, - pub from: *mut libc::c_char, - pub esmtp: libc::c_int, - pub log_connect_errors: libc::c_int, - pub context: *mut dc_context_t, - pub error: *mut libc::c_char, - pub error_etpan: libc::c_int, -} -pub type dc_jobthread_t = _dc_jobthread; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_jobthread { - pub context: *mut dc_context_t, - pub name: *mut libc::c_char, - pub folder_config_name: *mut libc::c_char, - pub imap: *mut _dc_imap, - pub mutex: pthread_mutex_t, - pub idle_cond: pthread_cond_t, - pub idle_condflag: libc::c_int, - pub jobs_needed: libc::c_int, - pub suspended: libc::c_int, - pub using_handle: libc::c_int, -} -/* * - * Library-internal. - */ -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_imap { - pub addr: *mut libc::c_char, - pub imap_server: *mut libc::c_char, - pub imap_port: libc::c_int, - pub imap_user: *mut libc::c_char, - pub imap_pw: *mut libc::c_char, - pub server_flags: libc::c_int, - pub connected: libc::c_int, - pub etpan: *mut mailimap, - pub idle_set_up: libc::c_int, - pub selected_folder: *mut libc::c_char, - pub selected_folder_needs_expunge: libc::c_int, - pub should_reconnect: libc::c_int, - pub can_idle: libc::c_int, - pub has_xlist: libc::c_int, - pub imap_delimiter: libc::c_char, - pub watch_folder: *mut libc::c_char, - pub watch_cond: pthread_cond_t, - pub watch_condmutex: pthread_mutex_t, - pub watch_condflag: libc::c_int, - pub fetch_type_prefetch: *mut mailimap_fetch_type, - pub fetch_type_body: *mut mailimap_fetch_type, - pub fetch_type_flags: *mut mailimap_fetch_type, - pub get_config: dc_get_config_t, - pub set_config: dc_set_config_t, - pub precheck_imf: dc_precheck_imf_t, - pub receive_imf: dc_receive_imf_t, - pub userData: *mut libc::c_void, - pub context: *mut dc_context_t, - pub log_connect_errors: libc::c_int, - pub skip_log_capabilities: libc::c_int, -} + pub type dc_receive_imf_t = Option< unsafe extern "C" fn( _: *mut dc_imap_t, @@ -784,10 +299,7 @@ pub type dc_receive_imf_t = Option< _: uint32_t, ) -> (), >; -/* Purpose: Reading from IMAP servers with no dependencies to the database. -dc_context_t is only used for logging and to get information about -the online state. */ -pub type dc_imap_t = _dc_imap; + pub type dc_precheck_imf_t = Option< unsafe extern "C" fn( _: *mut dc_imap_t, @@ -807,7 +319,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; + /* * * Library-internal. */ diff --git a/src/dc_pgp.rs b/src/dc_pgp.rs index 8de534d9a..42a4bb46c 100644 --- a/src/dc_pgp.rs +++ b/src/dc_pgp.rs @@ -551,7 +551,7 @@ pub struct _dc_context { pub ongoing_running: libc::c_int, pub shall_stop_ongoing: libc::c_int, } -pub type dc_lot_t = _dc_lot; +use crate::dc_lot::dc_lot_t; /* * Structure behind dc_lot_t */ #[derive(Copy, Clone)] #[repr(C)] @@ -761,7 +761,7 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; +use crate::dc_context::dc_context_t; /* ** library-private **********************************************************/ pub type dc_smtp_t = _dc_smtp; #[derive(Copy, Clone)] @@ -860,7 +860,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; +use crate::dc_sqlite3::dc_sqlite3_t; /* * * Library-internal. */ diff --git a/src/dc_qr.rs b/src/dc_qr.rs index 468d8f1c1..0cc546083 100644 --- a/src/dc_qr.rs +++ b/src/dc_qr.rs @@ -511,7 +511,7 @@ pub struct _dc_context { pub ongoing_running: libc::c_int, pub shall_stop_ongoing: libc::c_int, } -pub type dc_lot_t = _dc_lot; +use crate::dc_lot::dc_lot_t; /* * Structure behind dc_lot_t */ #[derive(Copy, Clone)] #[repr(C)] @@ -721,7 +721,7 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; +use crate::dc_context::dc_context_t; /* ** library-private **********************************************************/ pub type dc_smtp_t = _dc_smtp; #[derive(Copy, Clone)] @@ -820,7 +820,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; +use crate::dc_sqlite3::dc_sqlite3_t; /* * * Library-internal. */ diff --git a/src/dc_receive_imf.rs b/src/dc_receive_imf.rs index b7f702d0c..04f753486 100644 --- a/src/dc_receive_imf.rs +++ b/src/dc_receive_imf.rs @@ -1268,7 +1268,7 @@ pub struct _dc_context { pub ongoing_running: libc::c_int, pub shall_stop_ongoing: libc::c_int, } -pub type dc_lot_t = _dc_lot; +use crate::dc_lot::dc_lot_t; /* * Structure behind dc_lot_t */ #[derive(Copy, Clone)] #[repr(C)] @@ -1478,7 +1478,7 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; +use crate::dc_context::dc_context_t; /* ** library-private **********************************************************/ pub type dc_smtp_t = _dc_smtp; #[derive(Copy, Clone)] @@ -1577,7 +1577,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; +use crate::dc_sqlite3::dc_sqlite3_t; /* * * Library-internal. */ diff --git a/src/dc_securejoin.rs b/src/dc_securejoin.rs index 16f8f248d..62648b1e0 100644 --- a/src/dc_securejoin.rs +++ b/src/dc_securejoin.rs @@ -1,5 +1,12 @@ use c2rust_bitfields::BitfieldStruct; use libc; + +use crate::dc_context::dc_context_t; +use crate::dc_imap::dc_imap_t; +use crate::dc_lot::dc_lot_t; +use crate::dc_sqlite3::dc_sqlite3_t; +use crate::types::*; + extern "C" { pub type mailstream_cancel; pub type sqlite3; @@ -281,694 +288,7 @@ extern "C" { token: *const libc::c_char, ) -> libc::c_int; } -pub type __uint32_t = libc::c_uint; -pub type __darwin_size_t = libc::c_ulong; -pub type __darwin_ssize_t = libc::c_long; -pub type __darwin_time_t = libc::c_long; -pub type __darwin_useconds_t = __uint32_t; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _opaque_pthread_cond_t { - pub __sig: libc::c_long, - pub __opaque: [libc::c_char; 40], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _opaque_pthread_mutex_t { - pub __sig: libc::c_long, - pub __opaque: [libc::c_char; 56], -} -pub type __darwin_pthread_cond_t = _opaque_pthread_cond_t; -pub type __darwin_pthread_mutex_t = _opaque_pthread_mutex_t; -pub type size_t = __darwin_size_t; -pub type uint32_t = libc::c_uint; -pub type int32_t = libc::c_int; -pub type uintptr_t = libc::c_ulong; -pub type ssize_t = __darwin_ssize_t; -pub type useconds_t = __darwin_useconds_t; -pub type time_t = __darwin_time_t; -pub type uint8_t = libc::c_uchar; -pub type pthread_cond_t = __darwin_pthread_cond_t; -pub type pthread_mutex_t = __darwin_pthread_mutex_t; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct carray_s { - pub array: *mut *mut libc::c_void, - pub len: libc::c_uint, - pub max: libc::c_uint, -} -pub type carray = carray_s; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _mailstream { - pub buffer_max_size: size_t, - pub write_buffer: *mut libc::c_char, - pub write_buffer_len: size_t, - pub read_buffer: *mut libc::c_char, - pub read_buffer_len: size_t, - pub low: *mut mailstream_low, - pub idle: *mut mailstream_cancel, - pub idling: libc::c_int, - pub logger: Option< - unsafe extern "C" fn( - _: *mut mailstream, - _: libc::c_int, - _: *const libc::c_char, - _: size_t, - _: *mut libc::c_void, - ) -> (), - >, - pub logger_context: *mut libc::c_void, -} -pub type mailstream = _mailstream; -pub type mailstream_low = _mailstream_low; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _mailstream_low { - pub data: *mut libc::c_void, - pub driver: *mut mailstream_low_driver, - pub privacy: libc::c_int, - pub identifier: *mut libc::c_char, - pub timeout: libc::c_ulong, - pub logger: Option< - unsafe extern "C" fn( - _: *mut mailstream_low, - _: libc::c_int, - _: *const libc::c_char, - _: size_t, - _: *mut libc::c_void, - ) -> (), - >, - pub logger_context: *mut libc::c_void, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailstream_low_driver { - pub mailstream_read: Option< - unsafe extern "C" fn(_: *mut mailstream_low, _: *mut libc::c_void, _: size_t) -> ssize_t, - >, - pub mailstream_write: Option< - unsafe extern "C" fn(_: *mut mailstream_low, _: *const libc::c_void, _: size_t) -> ssize_t, - >, - pub mailstream_close: Option libc::c_int>, - pub mailstream_get_fd: Option libc::c_int>, - pub mailstream_free: Option ()>, - pub mailstream_cancel: Option ()>, - pub mailstream_get_cancel: - Option *mut mailstream_cancel>, - pub mailstream_get_certificate_chain: - Option *mut carray>, - pub mailstream_setup_idle: Option libc::c_int>, - pub mailstream_unsetup_idle: - Option libc::c_int>, - pub mailstream_interrupt_idle: - Option libc::c_int>, -} -pub type progress_function = unsafe extern "C" fn(_: size_t, _: size_t) -> (); -pub type mailprogress_function = - unsafe extern "C" fn(_: size_t, _: size_t, _: *mut libc::c_void) -> (); -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _MMAPString { - pub str_0: *mut libc::c_char, - pub len: size_t, - pub allocated_len: size_t, - pub fd: libc::c_int, - pub mmapped_size: size_t, -} -pub type MMAPString = _MMAPString; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct clistcell_s { - pub data: *mut libc::c_void, - pub previous: *mut clistcell_s, - pub next: *mut clistcell_s, -} -pub type clistcell = clistcell_s; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct clist_s { - pub first: *mut clistcell, - pub last: *mut clistcell, - pub count: libc::c_int, -} -pub type clist = clist_s; -pub type clistiter = clistcell; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimf_date_time { - pub dt_day: libc::c_int, - pub dt_month: libc::c_int, - pub dt_year: libc::c_int, - pub dt_hour: libc::c_int, - pub dt_min: libc::c_int, - pub dt_sec: libc::c_int, - pub dt_zone: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimf_mailbox_list { - pub mb_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimf_mailbox { - pub mb_display_name: *mut libc::c_char, - pub mb_addr_spec: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimf_address_list { - pub ad_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimf_fields { - pub fld_list: *mut clist, -} -pub type unnamed = libc::c_uint; -pub const MAILIMF_FIELD_OPTIONAL_FIELD: unnamed = 22; -pub const MAILIMF_FIELD_KEYWORDS: unnamed = 21; -pub const MAILIMF_FIELD_COMMENTS: unnamed = 20; -pub const MAILIMF_FIELD_SUBJECT: unnamed = 19; -pub const MAILIMF_FIELD_REFERENCES: unnamed = 18; -pub const MAILIMF_FIELD_IN_REPLY_TO: unnamed = 17; -pub const MAILIMF_FIELD_MESSAGE_ID: unnamed = 16; -pub const MAILIMF_FIELD_BCC: unnamed = 15; -pub const MAILIMF_FIELD_CC: unnamed = 14; -pub const MAILIMF_FIELD_TO: unnamed = 13; -pub const MAILIMF_FIELD_REPLY_TO: unnamed = 12; -pub const MAILIMF_FIELD_SENDER: unnamed = 11; -pub const MAILIMF_FIELD_FROM: unnamed = 10; -pub const MAILIMF_FIELD_ORIG_DATE: unnamed = 9; -pub const MAILIMF_FIELD_RESENT_MSG_ID: unnamed = 8; -pub const MAILIMF_FIELD_RESENT_BCC: unnamed = 7; -pub const MAILIMF_FIELD_RESENT_CC: unnamed = 6; -pub const MAILIMF_FIELD_RESENT_TO: unnamed = 5; -pub const MAILIMF_FIELD_RESENT_SENDER: unnamed = 4; -pub const MAILIMF_FIELD_RESENT_FROM: unnamed = 3; -pub const MAILIMF_FIELD_RESENT_DATE: unnamed = 2; -pub const MAILIMF_FIELD_RETURN_PATH: unnamed = 1; -pub const MAILIMF_FIELD_NONE: unnamed = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimf_field { - pub fld_type: libc::c_int, - pub fld_data: unnamed_0, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union unnamed_0 { - pub fld_return_path: *mut mailimf_return, - pub fld_resent_date: *mut mailimf_orig_date, - pub fld_resent_from: *mut mailimf_from, - pub fld_resent_sender: *mut mailimf_sender, - pub fld_resent_to: *mut mailimf_to, - pub fld_resent_cc: *mut mailimf_cc, - pub fld_resent_bcc: *mut mailimf_bcc, - pub fld_resent_msg_id: *mut mailimf_message_id, - pub fld_orig_date: *mut mailimf_orig_date, - pub fld_from: *mut mailimf_from, - pub fld_sender: *mut mailimf_sender, - pub fld_reply_to: *mut mailimf_reply_to, - pub fld_to: *mut mailimf_to, - pub fld_cc: *mut mailimf_cc, - pub fld_bcc: *mut mailimf_bcc, - pub fld_message_id: *mut mailimf_message_id, - pub fld_in_reply_to: *mut mailimf_in_reply_to, - pub fld_references: *mut mailimf_references, - pub fld_subject: *mut mailimf_subject, - pub fld_comments: *mut mailimf_comments, - pub fld_keywords: *mut mailimf_keywords, - pub fld_optional_field: *mut mailimf_optional_field, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimf_optional_field { - pub fld_name: *mut libc::c_char, - pub fld_value: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimf_keywords { - pub kw_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimf_comments { - pub cm_value: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimf_subject { - pub sbj_value: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimf_references { - pub mid_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimf_in_reply_to { - pub mid_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimf_message_id { - pub mid_value: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimf_bcc { - pub bcc_addr_list: *mut mailimf_address_list, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimf_cc { - pub cc_addr_list: *mut mailimf_address_list, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimf_to { - pub to_addr_list: *mut mailimf_address_list, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimf_reply_to { - pub rt_addr_list: *mut mailimf_address_list, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimf_sender { - pub snd_mb: *mut mailimf_mailbox, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimf_from { - pub frm_mb_list: *mut mailimf_mailbox_list, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimf_orig_date { - pub dt_date_time: *mut mailimf_date_time, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimf_return { - pub ret_path: *mut mailimf_path, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimf_path { - pub pt_addr_spec: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailmime_composite_type { - pub ct_type: libc::c_int, - pub ct_token: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailmime_content { - pub ct_type: *mut mailmime_type, - pub ct_subtype: *mut libc::c_char, - pub ct_parameters: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailmime_type { - pub tp_type: libc::c_int, - pub tp_data: unnamed_1, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union unnamed_1 { - pub tp_discrete_type: *mut mailmime_discrete_type, - pub tp_composite_type: *mut mailmime_composite_type, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailmime_discrete_type { - pub dt_type: libc::c_int, - pub dt_extension: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailmime_fields { - pub fld_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailmime_data { - pub dt_type: libc::c_int, - pub dt_encoding: libc::c_int, - pub dt_encoded: libc::c_int, - pub dt_data: unnamed_2, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union unnamed_2 { - pub dt_text: unnamed_3, - pub dt_filename: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct unnamed_3 { - pub dt_data: *const libc::c_char, - pub dt_length: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailmime { - pub mm_parent_type: libc::c_int, - pub mm_parent: *mut mailmime, - pub mm_multipart_pos: *mut clistiter, - pub mm_type: libc::c_int, - pub mm_mime_start: *const libc::c_char, - pub mm_length: size_t, - pub mm_mime_fields: *mut mailmime_fields, - pub mm_content_type: *mut mailmime_content, - pub mm_body: *mut mailmime_data, - pub mm_data: unnamed_4, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union unnamed_4 { - pub mm_single: *mut mailmime_data, - pub mm_multipart: unnamed_6, - pub mm_message: unnamed_5, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct unnamed_5 { - pub mm_fields: *mut mailimf_fields, - pub mm_msg_mime: *mut mailmime, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct unnamed_6 { - pub mm_preamble: *mut mailmime_data, - pub mm_epilogue: *mut mailmime_data, - pub mm_mp_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailsmtp { - pub stream: *mut mailstream, - pub progr_rate: size_t, - pub progr_fun: Option ()>, - pub response: *mut libc::c_char, - pub line_buffer: *mut MMAPString, - pub response_buffer: *mut MMAPString, - pub esmtp: libc::c_int, - pub auth: libc::c_int, - pub smtp_sasl: unnamed_7, - pub smtp_max_msg_size: size_t, - pub smtp_progress_fun: - Option ()>, - pub smtp_progress_context: *mut libc::c_void, - pub response_code: libc::c_int, - pub smtp_timeout: time_t, - pub smtp_logger: Option< - unsafe extern "C" fn( - _: *mut mailsmtp, - _: libc::c_int, - _: *const libc::c_char, - _: size_t, - _: *mut libc::c_void, - ) -> (), - >, - pub smtp_logger_context: *mut libc::c_void, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct unnamed_7 { - pub sasl_conn: *mut libc::c_void, - pub sasl_server_fqdn: *const libc::c_char, - pub sasl_login: *const libc::c_char, - pub sasl_auth_name: *const libc::c_char, - pub sasl_password: *const libc::c_char, - pub sasl_realm: *const libc::c_char, - pub sasl_secret: *mut libc::c_void, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_capability_data { - pub cap_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_msg_att_body_section { - pub sec_section: *mut mailimap_section, - pub sec_origin_octet: uint32_t, - pub sec_body_part: *mut libc::c_char, - pub sec_length: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_section { - pub sec_spec: *mut mailimap_section_spec, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_section_spec { - pub sec_type: libc::c_int, - pub sec_data: unnamed_8, - pub sec_text: *mut mailimap_section_text, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_section_text { - pub sec_type: libc::c_int, - pub sec_msgtext: *mut mailimap_section_msgtext, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_section_msgtext { - pub sec_type: libc::c_int, - pub sec_header_list: *mut mailimap_header_list, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_header_list { - pub hdr_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union unnamed_8 { - pub sec_msgtext: *mut mailimap_section_msgtext, - pub sec_part: *mut mailimap_section_part, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_section_part { - pub sec_id: *mut clist, -} -pub type mailimap_msg_body_handler = unsafe extern "C" fn( - _: libc::c_int, - _: *mut mailimap_msg_att_body_section, - _: *const libc::c_char, - _: size_t, - _: *mut libc::c_void, -) -> bool; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_flag_list { - pub fl_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_mailbox_data_status { - pub st_mailbox: *mut libc::c_char, - pub st_info_list: *mut clist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_msg_att { - pub att_list: *mut clist, - pub att_number: uint32_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_fetch_att { - pub att_type: libc::c_int, - pub att_section: *mut mailimap_section, - pub att_offset: uint32_t, - pub att_size: uint32_t, - pub att_extension: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_fetch_type { - pub ft_type: libc::c_int, - pub ft_data: unnamed_9, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union unnamed_9 { - pub ft_fetch_att: *mut mailimap_fetch_att, - pub ft_fetch_att_list: *mut clist, -} -pub type mailimap_msg_att_handler = - unsafe extern "C" fn(_: *mut mailimap_msg_att, _: *mut libc::c_void) -> (); -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap { - pub imap_response: *mut libc::c_char, - pub imap_stream: *mut mailstream, - pub imap_progr_rate: size_t, - pub imap_progr_fun: Option ()>, - pub imap_stream_buffer: *mut MMAPString, - pub imap_response_buffer: *mut MMAPString, - pub imap_state: libc::c_int, - pub imap_tag: libc::c_int, - pub imap_connection_info: *mut mailimap_connection_info, - pub imap_selection_info: *mut mailimap_selection_info, - pub imap_response_info: *mut mailimap_response_info, - pub imap_sasl: unnamed_10, - pub imap_idle_timestamp: time_t, - pub imap_idle_maxdelay: time_t, - pub imap_body_progress_fun: - Option ()>, - pub imap_items_progress_fun: - Option ()>, - pub imap_progress_context: *mut libc::c_void, - pub imap_msg_att_handler: - Option ()>, - pub imap_msg_att_handler_context: *mut libc::c_void, - pub imap_msg_body_handler: Option< - unsafe extern "C" fn( - _: libc::c_int, - _: *mut mailimap_msg_att_body_section, - _: *const libc::c_char, - _: size_t, - _: *mut libc::c_void, - ) -> bool, - >, - pub imap_msg_body_handler_context: *mut libc::c_void, - pub imap_timeout: time_t, - pub imap_logger: Option< - unsafe extern "C" fn( - _: *mut mailimap, - _: libc::c_int, - _: *const libc::c_char, - _: size_t, - _: *mut libc::c_void, - ) -> (), - >, - pub imap_logger_context: *mut libc::c_void, - pub is_163_workaround_enabled: libc::c_int, - pub is_rambler_workaround_enabled: libc::c_int, - pub is_qip_workaround_enabled: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct unnamed_10 { - pub sasl_conn: *mut libc::c_void, - pub sasl_server_fqdn: *const libc::c_char, - pub sasl_login: *const libc::c_char, - pub sasl_auth_name: *const libc::c_char, - pub sasl_password: *const libc::c_char, - pub sasl_realm: *const libc::c_char, - pub sasl_secret: *mut libc::c_void, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_response_info { - pub rsp_alert: *mut libc::c_char, - pub rsp_parse: *mut libc::c_char, - pub rsp_badcharset: *mut clist, - pub rsp_trycreate: libc::c_int, - pub rsp_mailbox_list: *mut clist, - pub rsp_mailbox_lsub: *mut clist, - pub rsp_search_result: *mut clist, - pub rsp_status: *mut mailimap_mailbox_data_status, - pub rsp_expunged: *mut clist, - pub rsp_fetch_list: *mut clist, - pub rsp_extension_list: *mut clist, - pub rsp_atom: *mut libc::c_char, - pub rsp_value: *mut libc::c_char, -} -#[derive(BitfieldStruct, Clone, Copy)] -#[repr(C)] -pub struct mailimap_selection_info { - pub sel_perm_flags: *mut clist, - pub sel_perm: libc::c_int, - pub sel_uidnext: uint32_t, - pub sel_uidvalidity: uint32_t, - pub sel_first_unseen: uint32_t, - pub sel_flags: *mut mailimap_flag_list, - pub sel_exists: uint32_t, - pub sel_recent: uint32_t, - pub sel_unseen: uint32_t, - #[bitfield(name = "sel_has_exists", ty = "uint8_t", bits = "0..=0")] - #[bitfield(name = "sel_has_recent", ty = "uint8_t", bits = "1..=1")] - pub sel_has_exists_sel_has_recent: [u8; 1], - pub _pad: [u8; 3], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mailimap_connection_info { - pub imap_capability: *mut mailimap_capability_data, -} -/* define DC_USE_RPGP to enable use of rPGP instead of netpgp where available; -preferrably, this should be done in the project configuration currently */ -//#define DC_USE_RPGP 1 -/* Includes that are used frequently. This file may also be used to create predefined headers. */ -/* * Structure behind dc_context_t */ -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_context { - pub magic: uint32_t, - pub userdata: *mut libc::c_void, - pub dbfile: *mut libc::c_char, - pub blobdir: *mut libc::c_char, - pub sql: *mut dc_sqlite3_t, - pub inbox: *mut dc_imap_t, - pub inboxidle_condmutex: pthread_mutex_t, - pub perform_inbox_jobs_needed: libc::c_int, - pub probe_imap_network: libc::c_int, - pub sentbox_thread: dc_jobthread_t, - pub mvbox_thread: dc_jobthread_t, - pub smtp: *mut dc_smtp_t, - pub smtpidle_cond: pthread_cond_t, - pub smtpidle_condmutex: pthread_mutex_t, - pub smtpidle_condflag: libc::c_int, - pub smtp_suspended: libc::c_int, - pub smtp_doing_jobs: libc::c_int, - pub perform_smtp_jobs_needed: libc::c_int, - pub probe_smtp_network: libc::c_int, - pub oauth2_critical: pthread_mutex_t, - pub cb: dc_callback_t, - pub os_name: *mut libc::c_char, - pub cmdline_sel_chat_id: uint32_t, - pub bob_expects: libc::c_int, - pub bobs_status: libc::c_int, - pub bobs_qr_scan: *mut dc_lot_t, - pub bobs_qr_critical: pthread_mutex_t, - pub last_smeared_timestamp: time_t, - pub smear_critical: pthread_mutex_t, - pub ongoing_running: libc::c_int, - pub shall_stop_ongoing: libc::c_int, -} -pub type dc_lot_t = _dc_lot; -/* * Structure behind dc_lot_t */ -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_lot { - pub magic: uint32_t, - pub text1_meaning: libc::c_int, - pub text1: *mut libc::c_char, - pub text2: *mut libc::c_char, - pub timestamp: time_t, - pub state: libc::c_int, - pub id: uint32_t, - pub fingerprint: *mut libc::c_char, - pub invitenumber: *mut libc::c_char, - pub auth: *mut libc::c_char, -} + /* * * Callback function that should be given to dc_context_new(). * @@ -987,248 +307,6 @@ pub type dc_callback_t = Option< _: uintptr_t, ) -> uintptr_t, >; -/* * - * @mainpage Getting started - * - * This document describes how to handle the Delta Chat core library. - * For general information about Delta Chat itself, - * see and . - * - * Let's start. - * - * First of all, you have to **define an event-handler-function** - * that is called by the library on specific events - * (eg. when the configuration is done or when fresh messages arrive). - * With this function you can create a Delta Chat context then: - * - * ~~~ - * #include - * - * uintptr_t event_handler_func(dc_context_t* context, int event, - * uintptr_t data1, uintptr_t data2) - * { - * return 0; // for unhandled events, it is always safe to return 0 - * } - * - * dc_context_t* context = dc_context_new(event_handler_func, NULL, NULL); - * ~~~ - * - * After that, you should make sure, - * sending and receiving jobs are processed as needed. - * For this purpose, you have to **create two threads:** - * - * ~~~ - * #include - * - * void* imap_thread_func(void* context) - * { - * while (true) { - * dc_perform_imap_jobs(context); - * dc_perform_imap_fetch(context); - * dc_perform_imap_idle(context); - * } - * } - * - * void* smtp_thread_func(void* context) - * { - * while (true) { - * dc_perform_smtp_jobs(context); - * dc_perform_smtp_idle(context); - * } - * } - * - * static pthread_t imap_thread, smtp_thread; - * pthread_create(&imap_thread, NULL, imap_thread_func, context); - * pthread_create(&smtp_thread, NULL, smtp_thread_func, context); - * ~~~ - * - * The example above uses "pthreads", - * however, you can also use anything else for thread handling. - * NB: The deltachat-core library itself does not create any threads on its own, - * however, functions, unless stated otherwise, are thread-safe. - * - * After that you can **define and open a database.** - * The database is a normal sqlite-file and is created as needed: - * - * ~~~ - * dc_open(context, "example.db", NULL); - * ~~~ - * - * Now you can **configure the context:** - * - * ~~~ - * // use some real test credentials here - * dc_set_config(context, "addr", "alice@example.org"); - * dc_set_config(context, "mail_pw", "***"); - * dc_configure(context); - * ~~~ - * - * dc_configure() returns immediately, the configuration itself may take a while - * and is done by a job in the imap-thread you've defined above. - * Once done, the #DC_EVENT_CONFIGURE_PROGRESS reports success - * to the event_handler_func() that is also defined above. - * - * The configuration result is saved in the database, - * on subsequent starts it is not needed to call dc_configure() - * (you can check this using dc_is_configured()). - * - * Now you can **send the first message:** - * - * ~~~ - * // use a real testing address here - * uint32_t contact_id = dc_create_contact(context, NULL, "bob@example.org"); - * uint32_t chat_id = dc_create_chat_by_contact_id(context, contact_id); - * - * dc_send_text_msg(context, chat_id, "Hi, here is my first message!"); - * ~~~ - * - * dc_send_text_msg() returns immediately; - * the sending itself is done by a job in the smtp-thread you've defined above. - * If you check the testing address (bob) - * and you should have received a normal email. - * Answer this email in any email program with "Got it!" - * and the imap-thread you've create above will **receive the message**. - * - * You can then **list all messages** of a chat as follow: - * - * ~~~ - * dc_array_t* msglist = dc_get_chat_msgs(context, chat_id, 0, 0); - * for (int i = 0; i < dc_array_get_cnt(msglist); i++) - * { - * uint32_t msg_id = dc_array_get_id(msglist, i); - * dc_msg_t* msg = dc_get_msg(context, msg_id); - * char* text = dc_msg_get_text(msg); - * - * printf("Message %i: %s\n", i+1, text); - * - * free(text); - * dc_msg_unref(msg); - * } - * dc_array_unref(msglist); - * ~~~ - * - * This will output the following two lines: - * - * ~~~ - * Message 1: Hi, here is my first message! - * Message 2: Got it! - * ~~~ - * - * - * ## Class reference - * - * For a class reference, see the "Classes" link atop. - * - * - * ## Further hints - * - * Here are some additional, unsorted hints that may be useful. - * - * - For `get`-functions, you have to unref the return value in some way. - * - * - Strings in function arguments or return values are usually UTF-8 encoded. - * - * - The issue-tracker for the core library is here: - * - * - * The following points are important mainly - * for the authors of the library itself: - * - * - For indentation, use tabs. - * Alignments that are not placed at the beginning of a line - * should be done with spaces. - * - * - For padding between functions, - * classes etc. use 2 empty lines - * - * - Source files are encoded as UTF-8 with Unix line endings - * (a simple `LF`, `0x0A` or `\n`) - * - * If you need further assistance, - * please do not hesitate to contact us - * through the channels shown at https://delta.chat/en/contribute - * - * Please keep in mind, that your derived work - * must respect the Mozilla Public License 2.0 of libdeltachat - * and the respective licenses of the libraries libdeltachat links with. - * - * See you. - */ -/* * - * @class dc_context_t - * - * An object representing a single account. - * - * Each account is linked to an IMAP/SMTP account and uses a separate - * SQLite database for offline functionality and for account-related - * settings. - */ -pub type dc_context_t = _dc_context; -/* ** library-private **********************************************************/ -pub type dc_smtp_t = _dc_smtp; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_smtp { - pub etpan: *mut mailsmtp, - pub from: *mut libc::c_char, - pub esmtp: libc::c_int, - pub log_connect_errors: libc::c_int, - pub context: *mut dc_context_t, - pub error: *mut libc::c_char, - pub error_etpan: libc::c_int, -} -pub type dc_jobthread_t = _dc_jobthread; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_jobthread { - pub context: *mut dc_context_t, - pub name: *mut libc::c_char, - pub folder_config_name: *mut libc::c_char, - pub imap: *mut _dc_imap, - pub mutex: pthread_mutex_t, - pub idle_cond: pthread_cond_t, - pub idle_condflag: libc::c_int, - pub jobs_needed: libc::c_int, - pub suspended: libc::c_int, - pub using_handle: libc::c_int, -} -/* * - * Library-internal. - */ -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_imap { - pub addr: *mut libc::c_char, - pub imap_server: *mut libc::c_char, - pub imap_port: libc::c_int, - pub imap_user: *mut libc::c_char, - pub imap_pw: *mut libc::c_char, - pub server_flags: libc::c_int, - pub connected: libc::c_int, - pub etpan: *mut mailimap, - pub idle_set_up: libc::c_int, - pub selected_folder: *mut libc::c_char, - pub selected_folder_needs_expunge: libc::c_int, - pub should_reconnect: libc::c_int, - pub can_idle: libc::c_int, - pub has_xlist: libc::c_int, - pub imap_delimiter: libc::c_char, - pub watch_folder: *mut libc::c_char, - pub watch_cond: pthread_cond_t, - pub watch_condmutex: pthread_mutex_t, - pub watch_condflag: libc::c_int, - pub fetch_type_prefetch: *mut mailimap_fetch_type, - pub fetch_type_body: *mut mailimap_fetch_type, - pub fetch_type_flags: *mut mailimap_fetch_type, - pub get_config: dc_get_config_t, - pub set_config: dc_set_config_t, - pub precheck_imf: dc_precheck_imf_t, - pub receive_imf: dc_receive_imf_t, - pub userData: *mut libc::c_void, - pub context: *mut dc_context_t, - pub log_connect_errors: libc::c_int, - pub skip_log_capabilities: libc::c_int, -} pub type dc_receive_imf_t = Option< unsafe extern "C" fn( _: *mut dc_imap_t, @@ -1239,10 +317,6 @@ pub type dc_receive_imf_t = Option< _: uint32_t, ) -> (), >; -/* Purpose: Reading from IMAP servers with no dependencies to the database. -dc_context_t is only used for logging and to get information about -the online state. */ -pub type dc_imap_t = _dc_imap; pub type dc_precheck_imf_t = Option< unsafe extern "C" fn( _: *mut dc_imap_t, @@ -1262,16 +336,11 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; + /* * * Library-internal. */ -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _dc_sqlite3 { - pub cobj: *mut sqlite3, - pub context: *mut dc_context_t, -} + /* * the structure behind dc_array_t */ #[derive(Copy, Clone)] #[repr(C)] diff --git a/src/dc_smtp.rs b/src/dc_smtp.rs index 43ea2201b..831c4e1b6 100644 --- a/src/dc_smtp.rs +++ b/src/dc_smtp.rs @@ -584,7 +584,7 @@ pub struct _dc_context { pub ongoing_running: libc::c_int, pub shall_stop_ongoing: libc::c_int, } -pub type dc_lot_t = _dc_lot; +use crate::dc_lot::dc_lot_t; /* * Structure behind dc_lot_t */ #[derive(Copy, Clone)] #[repr(C)] @@ -794,7 +794,7 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; +use crate::dc_context::dc_context_t; /* ** library-private **********************************************************/ pub type dc_smtp_t = _dc_smtp; #[derive(Copy, Clone)] @@ -893,7 +893,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; +use crate::dc_sqlite3::dc_sqlite3_t; /* * * Library-internal. */ diff --git a/src/dc_sqlite3.rs b/src/dc_sqlite3.rs index 297a89b7e..1951c7507 100644 --- a/src/dc_sqlite3.rs +++ b/src/dc_sqlite3.rs @@ -669,7 +669,7 @@ pub struct _dc_context { pub ongoing_running: libc::c_int, pub shall_stop_ongoing: libc::c_int, } -pub type dc_lot_t = _dc_lot; +use crate::dc_lot::dc_lot_t; /* * Structure behind dc_lot_t */ #[derive(Copy, Clone)] #[repr(C)] @@ -879,7 +879,7 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; +use crate::dc_context::dc_context_t; /* ** library-private **********************************************************/ pub type dc_smtp_t = _dc_smtp; #[derive(Copy, Clone)] diff --git a/src/dc_stock.rs b/src/dc_stock.rs index e2f2d60a4..7f5a8ead3 100644 --- a/src/dc_stock.rs +++ b/src/dc_stock.rs @@ -437,7 +437,7 @@ pub struct _dc_context { pub ongoing_running: libc::c_int, pub shall_stop_ongoing: libc::c_int, } -pub type dc_lot_t = _dc_lot; +use crate::dc_lot::dc_lot_t; /* * Structure behind dc_lot_t */ #[derive(Copy, Clone)] #[repr(C)] @@ -647,7 +647,7 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; +use crate::dc_context::dc_context_t; /* ** library-private **********************************************************/ pub type dc_smtp_t = _dc_smtp; #[derive(Copy, Clone)] @@ -746,7 +746,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; +use crate::dc_sqlite3::dc_sqlite3_t; /* * * Library-internal. */ @@ -791,7 +791,7 @@ unsafe extern "C" fn get_string( 2091i32, id as uintptr_t, qty as uintptr_t, - ) as *mut libc::c_char + ) as *mut libc::c_char; } if ret.is_null() { ret = default_string(id) diff --git a/src/dc_token.rs b/src/dc_token.rs index 82c6f031d..7561bcd2d 100644 --- a/src/dc_token.rs +++ b/src/dc_token.rs @@ -438,7 +438,7 @@ pub struct _dc_context { pub ongoing_running: libc::c_int, pub shall_stop_ongoing: libc::c_int, } -pub type dc_lot_t = _dc_lot; +use crate::dc_lot::dc_lot_t; /* * Structure behind dc_lot_t */ #[derive(Copy, Clone)] #[repr(C)] @@ -648,7 +648,7 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; +use crate::dc_context::dc_context_t; /* ** library-private **********************************************************/ pub type dc_smtp_t = _dc_smtp; #[derive(Copy, Clone)] @@ -747,7 +747,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; +use crate::dc_sqlite3::dc_sqlite3_t; /* * * Library-internal. */ diff --git a/src/dc_tools.rs b/src/dc_tools.rs index e124a92a1..56cc729ac 100644 --- a/src/dc_tools.rs +++ b/src/dc_tools.rs @@ -1,10 +1,11 @@ use c2rust_bitfields::BitfieldStruct; use libc; +use crate::types::*; + extern "C" { - pub type mailstream_cancel; pub type __sFILEX; - pub type sqlite3; + #[no_mangle] static mut _DefaultRuneLocale: _RuneLocale; #[no_mangle] @@ -188,20 +189,6 @@ pub type __darwin_ino64_t = __uint64_t; pub type __darwin_mode_t = __uint16_t; pub type __darwin_off_t = __int64_t; pub type __darwin_uid_t = __uint32_t; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _opaque_pthread_cond_t { - pub __sig: libc::c_long, - pub __opaque: [libc::c_char; 40], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _opaque_pthread_mutex_t { - pub __sig: libc::c_long, - pub __opaque: [libc::c_char; 56], -} -pub type __darwin_pthread_cond_t = _opaque_pthread_cond_t; -pub type __darwin_pthread_mutex_t = _opaque_pthread_mutex_t; pub type size_t = __darwin_size_t; #[derive(Copy, Clone)] #[repr(C)] @@ -765,7 +752,7 @@ pub struct _dc_context { pub ongoing_running: libc::c_int, pub shall_stop_ongoing: libc::c_int, } -pub type dc_lot_t = _dc_lot; +use crate::dc_lot::dc_lot_t; /* * Structure behind dc_lot_t */ #[derive(Copy, Clone)] #[repr(C)] @@ -975,7 +962,7 @@ pub type dc_callback_t = Option< * SQLite database for offline functionality and for account-related * settings. */ -pub type dc_context_t = _dc_context; +use crate::dc_context::dc_context_t; /* ** library-private **********************************************************/ pub type dc_smtp_t = _dc_smtp; #[derive(Copy, Clone)] @@ -1074,7 +1061,7 @@ pub type dc_get_config_t = Option< ) -> *mut libc::c_char, >; /* ** library-private **********************************************************/ -pub type dc_sqlite3_t = _dc_sqlite3; +use crate::dc_sqlite3::dc_sqlite3_t; /* * * Library-internal. */ diff --git a/src/lib.rs b/src/lib.rs index 8b4b0bfda..81a9926a9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -62,27 +62,36 @@ pub mod dc_strencode; pub mod dc_token; pub mod dc_tools; +pub mod types; + #[cfg(test)] mod tests { - use super::*; - 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_job::{dc_perform_imap_fetch, dc_perform_imap_idle, dc_perform_imap_jobs}; + 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 { - let info = if data2 > 0 { - Some(unsafe { CStr::from_ptr(data2 as *const _) }) - } else { - None - }; - - println!("event: {} - {} - {:?}", event, data1, info); - + println!("event: {} ({}, {})", event, data1, data2); + if data2 > 10000 { + println!( + " {}", + unsafe { CStr::from_ptr(data2 as *const _) } + .to_str() + .unwrap() + ); + } 0 } @@ -97,32 +106,71 @@ mod tests { 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); - - let dbfile = CString::new("hello.db").unwrap(); - let blobdir = CString::new("hello").unwrap(); - dc_open(ctx, dbfile.as_ptr(), blobdir.as_ptr()); + println!("info: {}", info_s.to_str().unwrap()); let sendable_ctx = Wrapper(NonNull::new(ctx).unwrap()); - - dc_set_config( - ctx, - CString::new("addr").unwrap().as_ptr(), - CString::new("d@testrun.org").unwrap().as_ptr(), - ); - dc_set_config( - ctx, - CString::new("mail_pw").unwrap().as_ptr(), - CString::new("__").unwrap().as_ptr(), - ); - dc_configure(ctx); - - std::thread::spawn(move || loop { + 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()); - }) - .join(); + }); + + 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()); + + dc_configure(ctx); + + 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()); + + 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); + + 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); + + t1.join().unwrap(); + t2.join().unwrap(); } } } diff --git a/src/types.rs b/src/types.rs new file mode 100644 index 000000000..9630db4ed --- /dev/null +++ b/src/types.rs @@ -0,0 +1,1110 @@ +use c2rust_bitfields::BitfieldStruct; +use libc; + +extern "C" { + pub type mailstream_cancel; + pub type sqlite3; + pub type sqlite3_stmt; +} + +pub type useconds_t = __darwin_useconds_t; +pub type int32_t = libc::c_int; +pub type int64_t = libc::c_longlong; +pub type uintptr_t = libc::c_ulong; +pub type __uint8_t = libc::c_uchar; +pub type __uint16_t = libc::c_ushort; +pub type __int32_t = libc::c_int; +pub type __uint64_t = libc::c_ulonglong; +pub type __darwin_size_t = libc::c_ulong; +pub type __darwin_ssize_t = libc::c_long; +pub type __darwin_time_t = libc::c_long; +pub type __darwin_pid_t = __int32_t; +#[derive(Copy, Clone)] +#[repr(C)] +pub struct __darwin_pthread_handler_rec { + pub __routine: Option ()>, + pub __arg: *mut libc::c_void, + pub __next: *mut __darwin_pthread_handler_rec, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct _opaque_pthread_cond_t { + pub __sig: libc::c_long, + pub __opaque: [libc::c_char; 40], +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct _opaque_pthread_condattr_t { + pub __sig: libc::c_long, + pub __opaque: [libc::c_char; 8], +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct _opaque_pthread_mutex_t { + pub __sig: libc::c_long, + pub __opaque: [libc::c_char; 56], +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct _opaque_pthread_mutexattr_t { + pub __sig: libc::c_long, + pub __opaque: [libc::c_char; 8], +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct _opaque_pthread_t { + pub __sig: libc::c_long, + pub __cleanup_stack: *mut __darwin_pthread_handler_rec, + pub __opaque: [libc::c_char; 8176], +} +pub type __darwin_pthread_cond_t = _opaque_pthread_cond_t; +pub type __darwin_pthread_condattr_t = _opaque_pthread_condattr_t; +pub type __darwin_pthread_mutex_t = _opaque_pthread_mutex_t; +pub type __darwin_pthread_mutexattr_t = _opaque_pthread_mutexattr_t; +pub type __darwin_pthread_t = *mut _opaque_pthread_t; +pub type time_t = __darwin_time_t; +pub type pid_t = __darwin_pid_t; +pub type size_t = __darwin_size_t; +pub type ssize_t = __darwin_ssize_t; +pub type pthread_cond_t = __darwin_pthread_cond_t; +pub type pthread_condattr_t = __darwin_pthread_condattr_t; +pub type pthread_mutex_t = __darwin_pthread_mutex_t; +pub type pthread_mutexattr_t = __darwin_pthread_mutexattr_t; +pub type pthread_t = __darwin_pthread_t; +pub type uint32_t = libc::c_uint; +pub type uint8_t = libc::c_uchar; +pub type uint16_t = libc::c_ushort; + +pub type __uint32_t = libc::c_uint; +pub type __darwin_clock_t = libc::c_ulong; +pub type __darwin_useconds_t = __uint32_t; +#[derive(Copy, Clone)] +#[repr(C)] +pub struct timespec { + pub tv_sec: __darwin_time_t, + pub tv_nsec: libc::c_long, +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct carray_s { + pub array: *mut *mut libc::c_void, + pub len: libc::c_uint, + pub max: libc::c_uint, +} +pub type carray = carray_s; + +pub type mailimap_msg_att_handler = + unsafe extern "C" fn(_: *mut mailimap_msg_att, _: *mut libc::c_void) -> (); +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap { + pub imap_response: *mut libc::c_char, + pub imap_stream: *mut mailstream, + pub imap_progr_rate: size_t, + pub imap_progr_fun: Option ()>, + pub imap_stream_buffer: *mut MMAPString, + pub imap_response_buffer: *mut MMAPString, + pub imap_state: libc::c_int, + pub imap_tag: libc::c_int, + pub imap_connection_info: *mut mailimap_connection_info, + pub imap_selection_info: *mut mailimap_selection_info, + pub imap_response_info: *mut mailimap_response_info, + pub imap_sasl: unnamed_2, + pub imap_idle_timestamp: time_t, + pub imap_idle_maxdelay: time_t, + pub imap_body_progress_fun: + Option ()>, + pub imap_items_progress_fun: + Option ()>, + pub imap_progress_context: *mut libc::c_void, + pub imap_msg_att_handler: + Option ()>, + pub imap_msg_att_handler_context: *mut libc::c_void, + pub imap_msg_body_handler: Option< + unsafe extern "C" fn( + _: libc::c_int, + _: *mut mailimap_msg_att_body_section, + _: *const libc::c_char, + _: size_t, + _: *mut libc::c_void, + ) -> bool, + >, + pub imap_msg_body_handler_context: *mut libc::c_void, + pub imap_timeout: time_t, + pub imap_logger: Option< + unsafe extern "C" fn( + _: *mut mailimap, + _: libc::c_int, + _: *const libc::c_char, + _: size_t, + _: *mut libc::c_void, + ) -> (), + >, + pub imap_logger_context: *mut libc::c_void, + pub is_163_workaround_enabled: libc::c_int, + pub is_rambler_workaround_enabled: libc::c_int, + pub is_qip_workaround_enabled: libc::c_int, +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct _mailstream { + pub buffer_max_size: size_t, + pub write_buffer: *mut libc::c_char, + pub write_buffer_len: size_t, + pub read_buffer: *mut libc::c_char, + pub read_buffer_len: size_t, + pub low: *mut mailstream_low, + pub idle: *mut mailstream_cancel, + pub idling: libc::c_int, + pub logger: Option< + unsafe extern "C" fn( + _: *mut mailstream, + _: libc::c_int, + _: *const libc::c_char, + _: size_t, + _: *mut libc::c_void, + ) -> (), + >, + pub logger_context: *mut libc::c_void, +} +pub type mailstream = _mailstream; +pub type mailstream_low = _mailstream_low; +#[derive(Copy, Clone)] +#[repr(C)] +pub struct _mailstream_low { + pub data: *mut libc::c_void, + pub driver: *mut mailstream_low_driver, + pub privacy: libc::c_int, + pub identifier: *mut libc::c_char, + pub timeout: libc::c_ulong, + pub logger: Option< + unsafe extern "C" fn( + _: *mut mailstream_low, + _: libc::c_int, + _: *const libc::c_char, + _: size_t, + _: *mut libc::c_void, + ) -> (), + >, + pub logger_context: *mut libc::c_void, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailstream_low_driver { + pub mailstream_read: Option< + unsafe extern "C" fn(_: *mut mailstream_low, _: *mut libc::c_void, _: size_t) -> ssize_t, + >, + pub mailstream_write: Option< + unsafe extern "C" fn(_: *mut mailstream_low, _: *const libc::c_void, _: size_t) -> ssize_t, + >, + pub mailstream_close: Option libc::c_int>, + pub mailstream_get_fd: Option libc::c_int>, + pub mailstream_free: Option ()>, + pub mailstream_cancel: Option ()>, + pub mailstream_get_cancel: + Option *mut mailstream_cancel>, + pub mailstream_get_certificate_chain: + Option *mut carray>, + pub mailstream_setup_idle: Option libc::c_int>, + pub mailstream_unsetup_idle: + Option libc::c_int>, + pub mailstream_interrupt_idle: + Option libc::c_int>, +} +pub type progress_function = unsafe extern "C" fn(_: size_t, _: size_t) -> (); +pub type mailprogress_function = + unsafe extern "C" fn(_: size_t, _: size_t, _: *mut libc::c_void) -> (); +pub type unnamed = libc::c_uint; +pub const MAILSTREAM_IDLE_CANCELLED: unnamed = 4; +pub const MAILSTREAM_IDLE_TIMEOUT: unnamed = 3; +pub const MAILSTREAM_IDLE_HASDATA: unnamed = 2; +pub const MAILSTREAM_IDLE_INTERRUPTED: unnamed = 1; +pub const MAILSTREAM_IDLE_ERROR: unnamed = 0; +#[derive(Copy, Clone)] +#[repr(C)] +pub struct _MMAPString { + pub str_0: *mut libc::c_char, + pub len: size_t, + pub allocated_len: size_t, + pub fd: libc::c_int, + pub mmapped_size: size_t, +} +pub type MMAPString = _MMAPString; +#[derive(Copy, Clone)] +#[repr(C)] +pub struct clistcell_s { + pub data: *mut libc::c_void, + pub previous: *mut clistcell_s, + pub next: *mut clistcell_s, +} +pub type clistcell = clistcell_s; +#[derive(Copy, Clone)] +#[repr(C)] +pub struct clist_s { + pub first: *mut clistcell, + pub last: *mut clistcell, + pub count: libc::c_int, +} +pub type clist = clist_s; +pub type clistiter = clistcell; +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailsmtp { + pub stream: *mut mailstream, + pub progr_rate: size_t, + pub progr_fun: Option ()>, + pub response: *mut libc::c_char, + pub line_buffer: *mut MMAPString, + pub response_buffer: *mut MMAPString, + pub esmtp: libc::c_int, + pub auth: libc::c_int, + pub smtp_sasl: unnamed_0, + pub smtp_max_msg_size: size_t, + pub smtp_progress_fun: + Option ()>, + pub smtp_progress_context: *mut libc::c_void, + pub response_code: libc::c_int, + pub smtp_timeout: time_t, + pub smtp_logger: Option< + unsafe extern "C" fn( + _: *mut mailsmtp, + _: libc::c_int, + _: *const libc::c_char, + _: size_t, + _: *mut libc::c_void, + ) -> (), + >, + pub smtp_logger_context: *mut libc::c_void, +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct unnamed_0 { + pub sasl_conn: *mut libc::c_void, + pub sasl_server_fqdn: *const libc::c_char, + pub sasl_login: *const libc::c_char, + pub sasl_auth_name: *const libc::c_char, + pub sasl_password: *const libc::c_char, + pub sasl_realm: *const libc::c_char, + pub sasl_secret: *mut libc::c_void, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_body { + pub bd_type: libc::c_int, + pub bd_data: unnamed_1, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub union unnamed_1 { + pub bd_body_1part: *mut mailimap_body_type_1part, + pub bd_body_mpart: *mut mailimap_body_type_mpart, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_body_type_mpart { + pub bd_list: *mut clist, + pub bd_media_subtype: *mut libc::c_char, + pub bd_ext_mpart: *mut mailimap_body_ext_mpart, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_body_ext_mpart { + pub bd_parameter: *mut mailimap_body_fld_param, + pub bd_disposition: *mut mailimap_body_fld_dsp, + pub bd_language: *mut mailimap_body_fld_lang, + pub bd_loc: *mut libc::c_char, + pub bd_extension_list: *mut clist, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_body_fld_lang { + pub lg_type: libc::c_int, + pub lg_data: unnamed_2, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub union unnamed_2 { + pub lg_single: *mut libc::c_char, + pub lg_list: *mut clist, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_body_fld_dsp { + pub dsp_type: *mut libc::c_char, + pub dsp_attributes: *mut mailimap_body_fld_param, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_body_fld_param { + pub pa_list: *mut clist, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_body_type_1part { + pub bd_type: libc::c_int, + pub bd_data: unnamed_3, + pub bd_ext_1part: *mut mailimap_body_ext_1part, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_body_ext_1part { + pub bd_md5: *mut libc::c_char, + pub bd_disposition: *mut mailimap_body_fld_dsp, + pub bd_language: *mut mailimap_body_fld_lang, + pub bd_loc: *mut libc::c_char, + pub bd_extension_list: *mut clist, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub union unnamed_3 { + pub bd_type_basic: *mut mailimap_body_type_basic, + pub bd_type_msg: *mut mailimap_body_type_msg, + pub bd_type_text: *mut mailimap_body_type_text, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_body_type_text { + pub bd_media_text: *mut libc::c_char, + pub bd_fields: *mut mailimap_body_fields, + pub bd_lines: uint32_t, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_body_fields { + pub bd_parameter: *mut mailimap_body_fld_param, + pub bd_id: *mut libc::c_char, + pub bd_description: *mut libc::c_char, + pub bd_encoding: *mut mailimap_body_fld_enc, + pub bd_size: uint32_t, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_body_fld_enc { + pub enc_type: libc::c_int, + pub enc_value: *mut libc::c_char, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_body_type_msg { + pub bd_fields: *mut mailimap_body_fields, + pub bd_envelope: *mut mailimap_envelope, + pub bd_body: *mut mailimap_body, + pub bd_lines: uint32_t, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_envelope { + pub env_date: *mut libc::c_char, + pub env_subject: *mut libc::c_char, + pub env_from: *mut mailimap_env_from, + pub env_sender: *mut mailimap_env_sender, + pub env_reply_to: *mut mailimap_env_reply_to, + pub env_to: *mut mailimap_env_to, + pub env_cc: *mut mailimap_env_cc, + pub env_bcc: *mut mailimap_env_bcc, + pub env_in_reply_to: *mut libc::c_char, + pub env_message_id: *mut libc::c_char, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_env_bcc { + pub bcc_list: *mut clist, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_env_cc { + pub cc_list: *mut clist, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_env_to { + pub to_list: *mut clist, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_env_reply_to { + pub rt_list: *mut clist, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_env_sender { + pub snd_list: *mut clist, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_env_from { + pub frm_list: *mut clist, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_body_type_basic { + pub bd_media_basic: *mut mailimap_media_basic, + pub bd_fields: *mut mailimap_body_fields, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_media_basic { + pub med_type: libc::c_int, + pub med_basic_type: *mut libc::c_char, + pub med_subtype: *mut libc::c_char, +} +pub type unnamed_4 = libc::c_uint; +pub const MAILIMAP_CAPABILITY_NAME: unnamed_4 = 1; +pub const MAILIMAP_CAPABILITY_AUTH_TYPE: unnamed_4 = 0; +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_capability { + pub cap_type: libc::c_int, + pub cap_data: unnamed_5, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub union unnamed_5 { + pub cap_auth_type: *mut libc::c_char, + pub cap_name: *mut libc::c_char, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_capability_data { + pub cap_list: *mut clist, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_extension_data { + pub ext_extension: *mut mailimap_extension_api, + pub ext_type: libc::c_int, + pub ext_data: *mut libc::c_void, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_extension_api { + pub ext_name: *mut libc::c_char, + pub ext_id: libc::c_int, + pub ext_parser: Option< + unsafe extern "C" fn( + _: libc::c_int, + _: *mut mailstream, + _: *mut MMAPString, + _: *mut mailimap_parser_context, + _: *mut size_t, + _: *mut *mut mailimap_extension_data, + _: size_t, + _: Option ()>, + ) -> libc::c_int, + >, + pub ext_free: Option ()>, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_parser_context { + pub is_rambler_workaround_enabled: libc::c_int, + pub is_qip_workaround_enabled: libc::c_int, + pub msg_body_handler: Option< + unsafe extern "C" fn( + _: libc::c_int, + _: *mut mailimap_msg_att_body_section, + _: *const libc::c_char, + _: size_t, + _: *mut libc::c_void, + ) -> bool, + >, + pub msg_body_handler_context: *mut libc::c_void, + pub msg_body_section: *mut mailimap_msg_att_body_section, + pub msg_body_att_type: libc::c_int, + pub msg_body_parse_in_progress: bool, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_msg_att_body_section { + pub sec_section: *mut mailimap_section, + pub sec_origin_octet: uint32_t, + pub sec_body_part: *mut libc::c_char, + pub sec_length: size_t, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_section { + pub sec_spec: *mut mailimap_section_spec, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_section_spec { + pub sec_type: libc::c_int, + pub sec_data: unnamed_6, + pub sec_text: *mut mailimap_section_text, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_section_text { + pub sec_type: libc::c_int, + pub sec_msgtext: *mut mailimap_section_msgtext, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_section_msgtext { + pub sec_type: libc::c_int, + pub sec_header_list: *mut mailimap_header_list, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_header_list { + pub hdr_list: *mut clist, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub union unnamed_6 { + pub sec_msgtext: *mut mailimap_section_msgtext, + pub sec_part: *mut mailimap_section_part, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_section_part { + pub sec_id: *mut clist, +} +pub type mailimap_msg_body_handler = unsafe extern "C" fn( + _: libc::c_int, + _: *mut mailimap_msg_att_body_section, + _: *const libc::c_char, + _: size_t, + _: *mut libc::c_void, +) -> bool; +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_date_time { + pub dt_day: libc::c_int, + pub dt_month: libc::c_int, + pub dt_year: libc::c_int, + pub dt_hour: libc::c_int, + pub dt_min: libc::c_int, + pub dt_sec: libc::c_int, + pub dt_zone: libc::c_int, +} +pub type unnamed_7 = libc::c_uint; +pub const MAILIMAP_FLAG_EXTENSION: unnamed_7 = 6; +pub const MAILIMAP_FLAG_KEYWORD: unnamed_7 = 5; +pub const MAILIMAP_FLAG_DRAFT: unnamed_7 = 4; +pub const MAILIMAP_FLAG_SEEN: unnamed_7 = 3; +pub const MAILIMAP_FLAG_DELETED: unnamed_7 = 2; +pub const MAILIMAP_FLAG_FLAGGED: unnamed_7 = 1; +pub const MAILIMAP_FLAG_ANSWERED: unnamed_7 = 0; +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_flag { + pub fl_type: libc::c_int, + pub fl_data: unnamed_8, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub union unnamed_8 { + pub fl_keyword: *mut libc::c_char, + pub fl_extension: *mut libc::c_char, +} +pub type unnamed_9 = libc::c_uint; +pub const MAILIMAP_FLAG_FETCH_OTHER: unnamed_9 = 2; +pub const MAILIMAP_FLAG_FETCH_RECENT: unnamed_9 = 1; +pub const MAILIMAP_FLAG_FETCH_ERROR: unnamed_9 = 0; +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_flag_fetch { + pub fl_type: libc::c_int, + pub fl_flag: *mut mailimap_flag, +} +pub type unnamed_10 = libc::c_uint; +pub const MAILIMAP_FLAG_PERM_ALL: unnamed_10 = 2; +pub const MAILIMAP_FLAG_PERM_FLAG: unnamed_10 = 1; +pub const MAILIMAP_FLAG_PERM_ERROR: unnamed_10 = 0; +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_flag_perm { + pub fl_type: libc::c_int, + pub fl_flag: *mut mailimap_flag, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_flag_list { + pub fl_list: *mut clist, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_mailbox_data_status { + pub st_mailbox: *mut libc::c_char, + pub st_info_list: *mut clist, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_msg_att { + pub att_list: *mut clist, + pub att_number: uint32_t, +} +pub type unnamed_11 = libc::c_uint; +pub const MAILIMAP_MSG_ATT_ITEM_EXTENSION: unnamed_11 = 3; +pub const MAILIMAP_MSG_ATT_ITEM_STATIC: unnamed_11 = 2; +pub const MAILIMAP_MSG_ATT_ITEM_DYNAMIC: unnamed_11 = 1; +pub const MAILIMAP_MSG_ATT_ITEM_ERROR: unnamed_11 = 0; +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_msg_att_item { + pub att_type: libc::c_int, + pub att_data: unnamed_12, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub union unnamed_12 { + pub att_dyn: *mut mailimap_msg_att_dynamic, + pub att_static: *mut mailimap_msg_att_static, + pub att_extension_data: *mut mailimap_extension_data, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_msg_att_static { + pub att_type: libc::c_int, + pub att_data: unnamed_13, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub union unnamed_13 { + pub att_env: *mut mailimap_envelope, + pub att_internal_date: *mut mailimap_date_time, + pub att_rfc822: unnamed_16, + pub att_rfc822_header: unnamed_15, + pub att_rfc822_text: unnamed_14, + pub att_rfc822_size: uint32_t, + pub att_bodystructure: *mut mailimap_body, + pub att_body: *mut mailimap_body, + pub att_body_section: *mut mailimap_msg_att_body_section, + pub att_uid: uint32_t, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct unnamed_14 { + pub att_content: *mut libc::c_char, + pub att_length: size_t, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct unnamed_15 { + pub att_content: *mut libc::c_char, + pub att_length: size_t, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct unnamed_16 { + pub att_content: *mut libc::c_char, + pub att_length: size_t, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_msg_att_dynamic { + pub att_list: *mut clist, +} +pub type unnamed_17 = libc::c_uint; +pub const MAILIMAP_MSG_ATT_UID: unnamed_17 = 10; +pub const MAILIMAP_MSG_ATT_BODY_SECTION: unnamed_17 = 9; +pub const MAILIMAP_MSG_ATT_BODYSTRUCTURE: unnamed_17 = 8; +pub const MAILIMAP_MSG_ATT_BODY: unnamed_17 = 7; +pub const MAILIMAP_MSG_ATT_RFC822_SIZE: unnamed_17 = 6; +pub const MAILIMAP_MSG_ATT_RFC822_TEXT: unnamed_17 = 5; +pub const MAILIMAP_MSG_ATT_RFC822_HEADER: unnamed_17 = 4; +pub const MAILIMAP_MSG_ATT_RFC822: unnamed_17 = 3; +pub const MAILIMAP_MSG_ATT_INTERNALDATE: unnamed_17 = 2; +pub const MAILIMAP_MSG_ATT_ENVELOPE: unnamed_17 = 1; +pub const MAILIMAP_MSG_ATT_ERROR: unnamed_17 = 0; +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_set_item { + pub set_first: uint32_t, + pub set_last: uint32_t, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_set { + pub set_list: *mut clist, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_fetch_att { + pub att_type: libc::c_int, + pub att_section: *mut mailimap_section, + pub att_offset: uint32_t, + pub att_size: uint32_t, + pub att_extension: *mut libc::c_char, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_fetch_type { + pub ft_type: libc::c_int, + pub ft_data: unnamed_18, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub union unnamed_18 { + pub ft_fetch_att: *mut mailimap_fetch_att, + pub ft_fetch_att_list: *mut clist, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_store_att_flags { + pub fl_sign: libc::c_int, + pub fl_silent: libc::c_int, + pub fl_flag_list: *mut mailimap_flag_list, +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct unnamed_19 { + pub sasl_conn: *mut libc::c_void, + pub sasl_server_fqdn: *const libc::c_char, + pub sasl_login: *const libc::c_char, + pub sasl_auth_name: *const libc::c_char, + pub sasl_password: *const libc::c_char, + pub sasl_realm: *const libc::c_char, + pub sasl_secret: *mut libc::c_void, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_response_info { + pub rsp_alert: *mut libc::c_char, + pub rsp_parse: *mut libc::c_char, + pub rsp_badcharset: *mut clist, + pub rsp_trycreate: libc::c_int, + pub rsp_mailbox_list: *mut clist, + pub rsp_mailbox_lsub: *mut clist, + pub rsp_search_result: *mut clist, + pub rsp_status: *mut mailimap_mailbox_data_status, + pub rsp_expunged: *mut clist, + pub rsp_fetch_list: *mut clist, + pub rsp_extension_list: *mut clist, + pub rsp_atom: *mut libc::c_char, + pub rsp_value: *mut libc::c_char, +} +#[derive(BitfieldStruct, Clone, Copy)] +#[repr(C)] +pub struct mailimap_selection_info { + pub sel_perm_flags: *mut clist, + pub sel_perm: libc::c_int, + pub sel_uidnext: uint32_t, + pub sel_uidvalidity: uint32_t, + pub sel_first_unseen: uint32_t, + pub sel_flags: *mut mailimap_flag_list, + pub sel_exists: uint32_t, + pub sel_recent: uint32_t, + pub sel_unseen: uint32_t, + #[bitfield(name = "sel_has_exists", ty = "uint8_t", bits = "0..=0")] + #[bitfield(name = "sel_has_recent", ty = "uint8_t", bits = "1..=1")] + pub sel_has_exists_sel_has_recent: [u8; 1], + pub _pad: [u8; 3], +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimap_connection_info { + pub imap_capability: *mut mailimap_capability_data, +} +pub type unnamed_20 = libc::c_uint; +pub const MAILIMAP_ERROR_CLIENTID: unnamed_20 = 46; +pub const MAILIMAP_ERROR_CUSTOM_COMMAND: unnamed_20 = 45; +pub const MAILIMAP_ERROR_NEEDS_MORE_DATA: unnamed_20 = 44; +pub const MAILIMAP_ERROR_SSL: unnamed_20 = 43; +pub const MAILIMAP_ERROR_SASL: unnamed_20 = 42; +pub const MAILIMAP_ERROR_EXTENSION: unnamed_20 = 41; +pub const MAILIMAP_ERROR_INVAL: unnamed_20 = 40; +pub const MAILIMAP_ERROR_STARTTLS: unnamed_20 = 39; +pub const MAILIMAP_ERROR_UNSUBSCRIBE: unnamed_20 = 38; +pub const MAILIMAP_ERROR_SUBSCRIBE: unnamed_20 = 37; +pub const MAILIMAP_ERROR_UID_STORE: unnamed_20 = 36; +pub const MAILIMAP_ERROR_STORE: unnamed_20 = 35; +pub const MAILIMAP_ERROR_STATUS: unnamed_20 = 34; +pub const MAILIMAP_ERROR_SELECT: unnamed_20 = 33; +pub const MAILIMAP_ERROR_UID_SEARCH: unnamed_20 = 32; +pub const MAILIMAP_ERROR_SEARCH: unnamed_20 = 31; +pub const MAILIMAP_ERROR_RENAME: unnamed_20 = 30; +pub const MAILIMAP_ERROR_LSUB: unnamed_20 = 29; +pub const MAILIMAP_ERROR_LOGIN: unnamed_20 = 28; +pub const MAILIMAP_ERROR_LIST: unnamed_20 = 27; +pub const MAILIMAP_ERROR_UID_FETCH: unnamed_20 = 26; +pub const MAILIMAP_ERROR_FETCH: unnamed_20 = 25; +pub const MAILIMAP_ERROR_EXAMINE: unnamed_20 = 24; +pub const MAILIMAP_ERROR_DELETE: unnamed_20 = 23; +pub const MAILIMAP_ERROR_CREATE: unnamed_20 = 22; +pub const MAILIMAP_ERROR_UID_MOVE: unnamed_20 = 21; +pub const MAILIMAP_ERROR_MOVE: unnamed_20 = 20; +pub const MAILIMAP_ERROR_UID_COPY: unnamed_20 = 19; +pub const MAILIMAP_ERROR_COPY: unnamed_20 = 18; +pub const MAILIMAP_ERROR_EXPUNGE: unnamed_20 = 17; +pub const MAILIMAP_ERROR_CLOSE: unnamed_20 = 16; +pub const MAILIMAP_ERROR_CHECK: unnamed_20 = 15; +pub const MAILIMAP_ERROR_CAPABILITY: unnamed_20 = 14; +pub const MAILIMAP_ERROR_LOGOUT: unnamed_20 = 13; +pub const MAILIMAP_ERROR_NOOP: unnamed_20 = 12; +pub const MAILIMAP_ERROR_APPEND: unnamed_20 = 11; +pub const MAILIMAP_ERROR_DONT_ACCEPT_CONNECTION: unnamed_20 = 10; +pub const MAILIMAP_ERROR_PROTOCOL: unnamed_20 = 9; +pub const MAILIMAP_ERROR_FATAL: unnamed_20 = 8; +pub const MAILIMAP_ERROR_MEMORY: unnamed_20 = 7; +pub const MAILIMAP_ERROR_CONNECTION_REFUSED: unnamed_20 = 6; +pub const MAILIMAP_ERROR_PARSE: unnamed_20 = 5; +pub const MAILIMAP_ERROR_STREAM: unnamed_20 = 4; +pub const MAILIMAP_ERROR_BAD_STATE: unnamed_20 = 3; +pub const MAILIMAP_NO_ERROR_NON_AUTHENTICATED: unnamed_20 = 2; +pub const MAILIMAP_NO_ERROR_AUTHENTICATED: unnamed_20 = 1; +pub const MAILIMAP_NO_ERROR: unnamed_20 = 0; + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimf_fields { + pub fld_list: *mut clist, +} + +pub const MAILIMF_FIELD_OPTIONAL_FIELD: unnamed = 22; +pub const MAILIMF_FIELD_KEYWORDS: unnamed = 21; +pub const MAILIMF_FIELD_COMMENTS: unnamed = 20; +pub const MAILIMF_FIELD_SUBJECT: unnamed = 19; +pub const MAILIMF_FIELD_REFERENCES: unnamed = 18; +pub const MAILIMF_FIELD_IN_REPLY_TO: unnamed = 17; +pub const MAILIMF_FIELD_MESSAGE_ID: unnamed = 16; +pub const MAILIMF_FIELD_BCC: unnamed = 15; +pub const MAILIMF_FIELD_CC: unnamed = 14; +pub const MAILIMF_FIELD_TO: unnamed = 13; +pub const MAILIMF_FIELD_REPLY_TO: unnamed = 12; +pub const MAILIMF_FIELD_SENDER: unnamed = 11; +pub const MAILIMF_FIELD_FROM: unnamed = 10; +pub const MAILIMF_FIELD_ORIG_DATE: unnamed = 9; +pub const MAILIMF_FIELD_RESENT_MSG_ID: unnamed = 8; +pub const MAILIMF_FIELD_RESENT_BCC: unnamed = 7; +pub const MAILIMF_FIELD_RESENT_CC: unnamed = 6; +pub const MAILIMF_FIELD_RESENT_TO: unnamed = 5; +pub const MAILIMF_FIELD_RESENT_SENDER: unnamed = 4; +pub const MAILIMF_FIELD_RESENT_FROM: unnamed = 3; +pub const MAILIMF_FIELD_RESENT_DATE: unnamed = 2; +pub const MAILIMF_FIELD_RETURN_PATH: unnamed = 1; +pub const MAILIMF_FIELD_NONE: unnamed = 0; +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimf_field { + pub fld_type: libc::c_int, + pub fld_data: field_data, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub union field_data { + pub fld_return_path: *mut mailimf_return, + pub fld_resent_date: *mut mailimf_orig_date, + pub fld_resent_from: *mut mailimf_from, + pub fld_resent_sender: *mut mailimf_sender, + pub fld_resent_to: *mut mailimf_to, + pub fld_resent_cc: *mut mailimf_cc, + pub fld_resent_bcc: *mut mailimf_bcc, + pub fld_resent_msg_id: *mut mailimf_message_id, + pub fld_orig_date: *mut mailimf_orig_date, + pub fld_from: *mut mailimf_from, + pub fld_sender: *mut mailimf_sender, + pub fld_reply_to: *mut mailimf_reply_to, + pub fld_to: *mut mailimf_to, + pub fld_cc: *mut mailimf_cc, + pub fld_bcc: *mut mailimf_bcc, + pub fld_message_id: *mut mailimf_message_id, + pub fld_in_reply_to: *mut mailimf_in_reply_to, + pub fld_references: *mut mailimf_references, + pub fld_subject: *mut mailimf_subject, + pub fld_comments: *mut mailimf_comments, + pub fld_keywords: *mut mailimf_keywords, + pub fld_optional_field: *mut mailimf_optional_field, +} + +pub const MAILMIME_MESSAGE: unnamed_11 = 3; +pub const MAILMIME_MULTIPLE: unnamed_11 = 2; +pub const MAILMIME_SINGLE: unnamed_11 = 1; +pub const MAILMIME_NONE: unnamed_11 = 0; +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailmime { + pub mm_parent_type: libc::c_int, + pub mm_parent: *mut mailmime, + pub mm_multipart_pos: *mut clistiter, + pub mm_type: libc::c_int, + pub mm_mime_start: *const libc::c_char, + pub mm_length: size_t, + pub mm_mime_fields: *mut mailmime_fields, + pub mm_content_type: *mut mailmime_content, + pub mm_body: *mut mailmime_data, + pub mm_data: unnamed_12, +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailmime_fields { + pub fld_list: *mut clist, +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailmime_content { + pub ct_type: *mut mailmime_type, + pub ct_subtype: *mut libc::c_char, + pub ct_parameters: *mut clist, +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailmime_data { + pub dt_type: libc::c_int, + pub dt_encoding: libc::c_int, + pub dt_encoded: libc::c_int, + pub dt_data: unnamed_9n, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub union unnamed_9n { + pub dt_text: unnamed_10n, + pub dt_filename: *mut libc::c_char, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct unnamed_10n { + pub dt_data: *const libc::c_char, + pub dt_length: size_t, +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailmime_type { + pub tp_type: libc::c_int, + pub tp_data: unnamed_3n, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub union unnamed_3n { + pub tp_discrete_type: *mut mailmime_discrete_type, + pub tp_composite_type: *mut mailmime_composite_type, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailmime_discrete_type { + pub dt_type: libc::c_int, + pub dt_extension: *mut libc::c_char, +} + +pub const MAILMIME_COMPOSITE_TYPE_EXTENSION: libc::c_int = 3; +pub const MAILMIME_COMPOSITE_TYPE_MULTIPART: libc::c_int = 2; +pub const MAILMIME_COMPOSITE_TYPE_MESSAGE: libc::c_int = 1; +pub const MAILMIME_COMPOSITE_TYPE_ERROR: libc::c_int = 0; +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailmime_composite_type { + pub ct_type: libc::c_int, + pub ct_token: *mut libc::c_char, +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimf_optional_field { + pub fld_name: *mut libc::c_char, + pub fld_value: *mut libc::c_char, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimf_keywords { + pub kw_list: *mut clist, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimf_comments { + pub cm_value: *mut libc::c_char, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimf_subject { + pub sbj_value: *mut libc::c_char, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimf_references { + pub mid_list: *mut clist, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimf_in_reply_to { + pub mid_list: *mut clist, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimf_message_id { + pub mid_value: *mut libc::c_char, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimf_bcc { + pub bcc_addr_list: *mut mailimf_address_list, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimf_cc { + pub cc_addr_list: *mut mailimf_address_list, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimf_to { + pub to_addr_list: *mut mailimf_address_list, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimf_reply_to { + pub rt_addr_list: *mut mailimf_address_list, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimf_sender { + pub snd_mb: *mut mailimf_mailbox, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimf_from { + pub frm_mb_list: *mut mailimf_mailbox_list, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimf_orig_date { + pub dt_date_time: *mut mailimf_date_time, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimf_return { + pub ret_path: *mut mailimf_path, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimf_path { + pub pt_addr_spec: *mut libc::c_char, +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimf_mailbox { + pub mb_display_name: *mut libc::c_char, + pub mb_addr_spec: *mut libc::c_char, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimf_address_list { + pub ad_list: *mut clist, +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimf_mailbox_list { + pub mb_list: *mut clist, +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mailimf_date_time { + pub dt_day: libc::c_int, + pub dt_month: libc::c_int, + pub dt_year: libc::c_int, + pub dt_hour: libc::c_int, + pub dt_min: libc::c_int, + pub dt_sec: libc::c_int, + pub dt_zone: libc::c_int, +}