mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 04:46:29 +03:00
reduce code duplication (round 1)
This commit is contained in:
535
src/dc_imap.rs
535
src/dc_imap.rs
@@ -2,462 +2,13 @@ use c2rust_bitfields::BitfieldStruct;
|
||||
use libc;
|
||||
|
||||
use crate::dc_context::dc_context_t;
|
||||
use crate::dc_sqlite3::dc_sqlite3_t;
|
||||
use crate::types::*;
|
||||
use crate::x::*;
|
||||
|
||||
extern "C" {
|
||||
#[no_mangle]
|
||||
fn calloc(_: libc::c_ulong, _: libc::c_ulong) -> *mut libc::c_void;
|
||||
#[no_mangle]
|
||||
fn free(_: *mut libc::c_void);
|
||||
#[no_mangle]
|
||||
fn atol(_: *const libc::c_char) -> libc::c_long;
|
||||
#[no_mangle]
|
||||
fn exit(_: libc::c_int) -> !;
|
||||
#[no_mangle]
|
||||
fn time(_: *mut time_t) -> time_t;
|
||||
#[no_mangle]
|
||||
fn mailstream_close(s: *mut mailstream) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn mailstream_wait_idle(s: *mut mailstream, max_idle_delay: libc::c_int) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn mailstream_setup_idle(s: *mut mailstream) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn mailstream_unsetup_idle(s: *mut mailstream);
|
||||
#[no_mangle]
|
||||
fn mailstream_interrupt_idle(s: *mut mailstream);
|
||||
#[no_mangle]
|
||||
fn mailimap_section_new(sec_spec: *mut mailimap_section_spec) -> *mut mailimap_section;
|
||||
#[no_mangle]
|
||||
fn mailimap_set_free(set: *mut mailimap_set);
|
||||
#[no_mangle]
|
||||
fn mailimap_fetch_type_free(fetch_type: *mut mailimap_fetch_type);
|
||||
#[no_mangle]
|
||||
fn mailimap_store_att_flags_free(store_att_flags: *mut mailimap_store_att_flags);
|
||||
#[no_mangle]
|
||||
fn mailimap_set_new_interval(first: uint32_t, last: uint32_t) -> *mut mailimap_set;
|
||||
#[no_mangle]
|
||||
fn mailimap_set_new_single(indx: uint32_t) -> *mut mailimap_set;
|
||||
#[no_mangle]
|
||||
fn mailimap_fetch_att_new_envelope() -> *mut mailimap_fetch_att;
|
||||
#[no_mangle]
|
||||
fn mailimap_fetch_att_new_flags() -> *mut mailimap_fetch_att;
|
||||
#[no_mangle]
|
||||
fn mailimap_fetch_att_new_uid() -> *mut mailimap_fetch_att;
|
||||
#[no_mangle]
|
||||
fn mailimap_fetch_att_new_body_peek_section(
|
||||
section: *mut mailimap_section,
|
||||
) -> *mut mailimap_fetch_att;
|
||||
#[no_mangle]
|
||||
fn mailimap_fetch_type_new_fetch_att_list_empty() -> *mut mailimap_fetch_type;
|
||||
#[no_mangle]
|
||||
fn mailimap_fetch_type_new_fetch_att_list_add(
|
||||
fetch_type: *mut mailimap_fetch_type,
|
||||
fetch_att: *mut mailimap_fetch_att,
|
||||
) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn mailimap_store_att_flags_new_add_flags(
|
||||
flags: *mut mailimap_flag_list,
|
||||
) -> *mut mailimap_store_att_flags;
|
||||
#[no_mangle]
|
||||
fn mailimap_flag_list_new_empty() -> *mut mailimap_flag_list;
|
||||
#[no_mangle]
|
||||
fn mailimap_flag_list_add(
|
||||
flag_list: *mut mailimap_flag_list,
|
||||
f: *mut mailimap_flag,
|
||||
) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn mailimap_flag_new_deleted() -> *mut mailimap_flag;
|
||||
#[no_mangle]
|
||||
fn mailimap_flag_new_seen() -> *mut mailimap_flag;
|
||||
#[no_mangle]
|
||||
fn mailimap_flag_new_flag_keyword(flag_keyword: *mut libc::c_char) -> *mut mailimap_flag;
|
||||
#[no_mangle]
|
||||
fn mailimap_socket_connect(
|
||||
f: *mut mailimap,
|
||||
server: *const libc::c_char,
|
||||
port: uint16_t,
|
||||
) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn mailimap_socket_starttls(f: *mut mailimap) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn mailimap_ssl_connect(
|
||||
f: *mut mailimap,
|
||||
server: *const libc::c_char,
|
||||
port: uint16_t,
|
||||
) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn mailimap_uidplus_uid_copy(
|
||||
session: *mut mailimap,
|
||||
set: *mut mailimap_set,
|
||||
mb: *const libc::c_char,
|
||||
uidvalidity_result: *mut uint32_t,
|
||||
source_result: *mut *mut mailimap_set,
|
||||
dest_result: *mut *mut mailimap_set,
|
||||
) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn mailimap_uidplus_uid_move(
|
||||
session: *mut mailimap,
|
||||
set: *mut mailimap_set,
|
||||
mb: *const libc::c_char,
|
||||
uidvalidity_result: *mut uint32_t,
|
||||
source_result: *mut *mut mailimap_set,
|
||||
dest_result: *mut *mut mailimap_set,
|
||||
) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn mailimap_idle(session: *mut mailimap) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn mailimap_idle_done(session: *mut mailimap) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn mailimap_has_idle(session: *mut mailimap) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn mailimap_has_xlist(session: *mut mailimap) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn mailimap_oauth2_authenticate(
|
||||
session: *mut mailimap,
|
||||
auth_user: *const libc::c_char,
|
||||
access_token: *const libc::c_char,
|
||||
) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn mailimap_close(session: *mut mailimap) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn mailimap_fetch(
|
||||
session: *mut mailimap,
|
||||
set: *mut mailimap_set,
|
||||
fetch_type: *mut mailimap_fetch_type,
|
||||
result: *mut *mut clist,
|
||||
) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn mailimap_uid_fetch(
|
||||
session: *mut mailimap,
|
||||
set: *mut mailimap_set,
|
||||
fetch_type: *mut mailimap_fetch_type,
|
||||
result: *mut *mut clist,
|
||||
) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn mailimap_fetch_list_free(fetch_list: *mut clist);
|
||||
#[no_mangle]
|
||||
fn mailimap_login(
|
||||
session: *mut mailimap,
|
||||
userid: *const libc::c_char,
|
||||
password: *const libc::c_char,
|
||||
) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn mailimap_select(session: *mut mailimap, mb: *const libc::c_char) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn mailimap_uid_store(
|
||||
session: *mut mailimap,
|
||||
set: *mut mailimap_set,
|
||||
store_att_flags: *mut mailimap_store_att_flags,
|
||||
) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn mailimap_new(
|
||||
imap_progr_rate: size_t,
|
||||
imap_progr_fun: Option<unsafe extern "C" fn(_: size_t, _: size_t) -> ()>,
|
||||
) -> *mut mailimap;
|
||||
#[no_mangle]
|
||||
fn mailimap_free(session: *mut mailimap);
|
||||
#[no_mangle]
|
||||
fn mailimap_set_timeout(session: *mut mailimap, timeout: time_t);
|
||||
#[no_mangle]
|
||||
fn memset(_: *mut libc::c_void, _: libc::c_int, _: libc::c_ulong) -> *mut libc::c_void;
|
||||
#[no_mangle]
|
||||
fn strchr(_: *const libc::c_char, _: libc::c_int) -> *mut libc::c_char;
|
||||
#[no_mangle]
|
||||
fn strcmp(_: *const libc::c_char, _: *const libc::c_char) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn strlen(_: *const libc::c_char) -> libc::c_ulong;
|
||||
#[no_mangle]
|
||||
fn strcasecmp(_: *const libc::c_char, _: *const libc::c_char) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn pthread_cond_destroy(_: *mut pthread_cond_t) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn pthread_cond_init(_: *mut pthread_cond_t, _: *const pthread_condattr_t) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn pthread_cond_signal(_: *mut pthread_cond_t) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn pthread_cond_timedwait(
|
||||
_: *mut pthread_cond_t,
|
||||
_: *mut pthread_mutex_t,
|
||||
_: *const timespec,
|
||||
) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn pthread_mutex_destroy(_: *mut pthread_mutex_t) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn pthread_mutex_init(_: *mut pthread_mutex_t, _: *const pthread_mutexattr_t) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn pthread_mutex_lock(_: *mut pthread_mutex_t) -> libc::c_int;
|
||||
#[no_mangle]
|
||||
fn pthread_mutex_unlock(_: *mut pthread_mutex_t) -> libc::c_int;
|
||||
/* string tools */
|
||||
#[no_mangle]
|
||||
fn dc_strdup(_: *const libc::c_char) -> *mut libc::c_char;
|
||||
#[no_mangle]
|
||||
fn dc_trim(_: *mut libc::c_char);
|
||||
#[no_mangle]
|
||||
fn dc_mprintf(format: *const libc::c_char, _: ...) -> *mut libc::c_char;
|
||||
#[no_mangle]
|
||||
fn dc_strbuilder_init(_: *mut dc_strbuilder_t, init_bytes: libc::c_int);
|
||||
#[no_mangle]
|
||||
fn dc_strbuilder_cat(_: *mut dc_strbuilder_t, text: *const libc::c_char) -> *mut libc::c_char;
|
||||
#[no_mangle]
|
||||
fn dc_strbuilder_catf(_: *mut dc_strbuilder_t, format: *const libc::c_char, _: ...);
|
||||
/* Replaces the first `%1$s` in the given String-ID by the given value.
|
||||
The result must be free()'d! */
|
||||
#[no_mangle]
|
||||
fn dc_stock_str_repl_string(
|
||||
_: *mut dc_context_t,
|
||||
id: libc::c_int,
|
||||
value: *const libc::c_char,
|
||||
) -> *mut libc::c_char;
|
||||
/* Replaces the first `%1$s` and `%2$s` in the given String-ID by the two given strings.
|
||||
The result must be free()'d! */
|
||||
#[no_mangle]
|
||||
fn dc_stock_str_repl_string2(
|
||||
_: *mut dc_context_t,
|
||||
id: libc::c_int,
|
||||
_: *const libc::c_char,
|
||||
_: *const libc::c_char,
|
||||
) -> *mut libc::c_char;
|
||||
#[no_mangle]
|
||||
fn dc_log_info(_: *mut dc_context_t, data1: libc::c_int, msg: *const libc::c_char, _: ...);
|
||||
#[no_mangle]
|
||||
fn dc_log_event(
|
||||
_: *mut dc_context_t,
|
||||
event_code: libc::c_int,
|
||||
data1: libc::c_int,
|
||||
msg: *const libc::c_char,
|
||||
_: ...
|
||||
);
|
||||
#[no_mangle]
|
||||
fn dc_log_event_seq(
|
||||
_: *mut dc_context_t,
|
||||
event_code: libc::c_int,
|
||||
sequence_start: *mut libc::c_int,
|
||||
msg: *const libc::c_char,
|
||||
_: ...
|
||||
);
|
||||
// the following function may block due http-requests;
|
||||
// must not be called from the main thread or by the ui!
|
||||
#[no_mangle]
|
||||
fn dc_get_oauth2_access_token(
|
||||
_: *mut dc_context_t,
|
||||
addr: *const libc::c_char,
|
||||
code: *const libc::c_char,
|
||||
flags: libc::c_int,
|
||||
) -> *mut libc::c_char;
|
||||
#[no_mangle]
|
||||
fn dc_log_warning(_: *mut dc_context_t, data1: libc::c_int, msg: *const libc::c_char, _: ...);
|
||||
#[no_mangle]
|
||||
fn dc_log_error(_: *mut dc_context_t, data1: libc::c_int, msg: *const libc::c_char, _: ...);
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
|
||||
/* *
|
||||
* Callback function that should be given to dc_context_new().
|
||||
*
|
||||
* @memberof dc_context_t
|
||||
* @param context The context object as returned by dc_context_new().
|
||||
* @param event one of the @ref DC_EVENT constants
|
||||
* @param data1 depends on the event parameter
|
||||
* @param data2 depends on the event parameter
|
||||
* @return return 0 unless stated otherwise in the event parameter documentation
|
||||
*/
|
||||
pub type dc_callback_t = Option<
|
||||
unsafe extern "C" fn(
|
||||
_: *mut dc_context_t,
|
||||
_: libc::c_int,
|
||||
_: uintptr_t,
|
||||
_: 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 <https://delta.chat> and <https://github.com/deltachat>.
|
||||
*
|
||||
* 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 <deltachat.h>
|
||||
*
|
||||
* 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 <pthread.h>
|
||||
*
|
||||
* 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:
|
||||
* <https://github.com/deltachat/deltachat-core/issues>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
/* ** library-private **********************************************************/
|
||||
|
||||
/* *
|
||||
* Library-internal.
|
||||
*/
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct _dc_imap {
|
||||
pub struct dc_imap_t {
|
||||
pub addr: *mut libc::c_char,
|
||||
pub imap_server: *mut libc::c_char,
|
||||
pub imap_port: libc::c_int,
|
||||
@@ -489,81 +40,7 @@ pub struct _dc_imap {
|
||||
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,
|
||||
_: *const libc::c_char,
|
||||
_: size_t,
|
||||
_: *const libc::c_char,
|
||||
_: uint32_t,
|
||||
_: 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,
|
||||
_: *const libc::c_char,
|
||||
_: *const libc::c_char,
|
||||
_: uint32_t,
|
||||
) -> libc::c_int,
|
||||
>;
|
||||
pub type dc_set_config_t = Option<
|
||||
unsafe extern "C" fn(_: *mut dc_imap_t, _: *const libc::c_char, _: *const libc::c_char) -> (),
|
||||
>;
|
||||
pub type dc_get_config_t = Option<
|
||||
unsafe extern "C" fn(
|
||||
_: *mut dc_imap_t,
|
||||
_: *const libc::c_char,
|
||||
_: *const libc::c_char,
|
||||
) -> *mut libc::c_char,
|
||||
>;
|
||||
/* ** library-private **********************************************************/
|
||||
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,
|
||||
}
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct _dc_strbuilder {
|
||||
pub buf: *mut libc::c_char,
|
||||
pub allocated: libc::c_int,
|
||||
pub free: libc::c_int,
|
||||
pub eos: *mut libc::c_char,
|
||||
}
|
||||
pub type dc_strbuilder_t = _dc_strbuilder;
|
||||
/* *
|
||||
* Library-internal.
|
||||
*/
|
||||
#[derive(Copy, Clone)]
|
||||
#[repr(C)]
|
||||
pub struct _dc_loginparam {
|
||||
pub addr: *mut libc::c_char,
|
||||
pub mail_server: *mut libc::c_char,
|
||||
pub mail_user: *mut libc::c_char,
|
||||
pub mail_pw: *mut libc::c_char,
|
||||
pub mail_port: uint16_t,
|
||||
pub send_server: *mut libc::c_char,
|
||||
pub send_user: *mut libc::c_char,
|
||||
pub send_pw: *mut libc::c_char,
|
||||
pub send_port: libc::c_int,
|
||||
pub server_flags: libc::c_int,
|
||||
}
|
||||
pub type dc_loginparam_t = _dc_loginparam;
|
||||
pub type dc_imap_res = libc::c_uint;
|
||||
pub const DC_SUCCESS: dc_imap_res = 3;
|
||||
pub const DC_ALREADY_DONE: dc_imap_res = 2;
|
||||
pub const DC_RETRY_LATER: dc_imap_res = 1;
|
||||
pub const DC_FAILED: dc_imap_res = 0;
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn dc_imap_new(
|
||||
mut get_config: dc_get_config_t,
|
||||
@@ -732,7 +209,7 @@ pub unsafe extern "C" fn dc_imap_connect(
|
||||
.is_null()
|
||||
{
|
||||
(*imap).skip_log_capabilities = 1i32;
|
||||
let mut capinfostr: dc_strbuilder_t = _dc_strbuilder {
|
||||
let mut capinfostr: dc_strbuilder_t = dc_strbuilder_t {
|
||||
buf: 0 as *mut libc::c_char,
|
||||
allocated: 0,
|
||||
free: 0,
|
||||
@@ -957,7 +434,7 @@ unsafe extern "C" fn get_error_msg(
|
||||
mut code: libc::c_int,
|
||||
) -> *mut libc::c_char {
|
||||
let mut stock: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||
let mut msg: dc_strbuilder_t = _dc_strbuilder {
|
||||
let mut msg: dc_strbuilder_t = dc_strbuilder_t {
|
||||
buf: 0 as *mut libc::c_char,
|
||||
allocated: 0,
|
||||
free: 0,
|
||||
|
||||
Reference in New Issue
Block a user