mirror of
https://github.com/chatmail/core.git
synced 2026-05-05 14:26:30 +03:00
refactor: start using rust for allocations & locks
This commit is contained in:
@@ -793,11 +793,6 @@ pub unsafe fn dc_get_contact_encrinfo(
|
|||||||
dc_strbuilder_cat(&mut ret, p);
|
dc_strbuilder_cat(&mut ret, p);
|
||||||
free(p as *mut libc::c_void);
|
free(p as *mut libc::c_void);
|
||||||
if (*self_key).binary.is_null() {
|
if (*self_key).binary.is_null() {
|
||||||
dc_pgp_rand_seed(
|
|
||||||
context,
|
|
||||||
(*peerstate).addr as *const libc::c_void,
|
|
||||||
strlen((*peerstate).addr),
|
|
||||||
);
|
|
||||||
dc_ensure_secret_key_exists(context);
|
dc_ensure_secret_key_exists(context);
|
||||||
dc_key_load_self_public(self_key, (*loginparam).addr, (*context).sql);
|
dc_key_load_self_public(self_key, (*loginparam).addr, (*context).sql);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -527,17 +527,6 @@ unsafe fn load_or_generate_self_public_key(
|
|||||||
} else {
|
} else {
|
||||||
key_creation_here = 1i32;
|
key_creation_here = 1i32;
|
||||||
s_in_key_creation = 1i32;
|
s_in_key_creation = 1i32;
|
||||||
/* seed the random generator */
|
|
||||||
let mut seed: [uintptr_t; 4] = [0; 4];
|
|
||||||
seed[0usize] = time(0 as *mut time_t) as uintptr_t;
|
|
||||||
seed[1usize] = seed.as_mut_ptr() as uintptr_t;
|
|
||||||
seed[2usize] = public_key as uintptr_t;
|
|
||||||
seed[3usize] = pthread_self() as uintptr_t;
|
|
||||||
dc_pgp_rand_seed(
|
|
||||||
context,
|
|
||||||
seed.as_mut_ptr() as *const libc::c_void,
|
|
||||||
::std::mem::size_of::<[uintptr_t; 4]>(),
|
|
||||||
);
|
|
||||||
if !random_data_mime.is_null() {
|
if !random_data_mime.is_null() {
|
||||||
let mut random_data_mmap: *mut MMAPString = 0 as *mut MMAPString;
|
let mut random_data_mmap: *mut MMAPString = 0 as *mut MMAPString;
|
||||||
let mut col: libc::c_int = 0i32;
|
let mut col: libc::c_int = 0i32;
|
||||||
@@ -546,11 +535,6 @@ unsafe fn load_or_generate_self_public_key(
|
|||||||
current_block = 10496152961502316708;
|
current_block = 10496152961502316708;
|
||||||
} else {
|
} else {
|
||||||
mailmime_write_mem(random_data_mmap, &mut col, random_data_mime);
|
mailmime_write_mem(random_data_mmap, &mut col, random_data_mime);
|
||||||
dc_pgp_rand_seed(
|
|
||||||
context,
|
|
||||||
(*random_data_mmap).str_0 as *const libc::c_void,
|
|
||||||
(*random_data_mmap).len,
|
|
||||||
);
|
|
||||||
mmap_string_free(random_data_mmap);
|
mmap_string_free(random_data_mmap);
|
||||||
current_block = 26972500619410423;
|
current_block = 26972500619410423;
|
||||||
}
|
}
|
||||||
|
|||||||
105
src/dc_imap.rs
105
src/dc_imap.rs
@@ -1,4 +1,5 @@
|
|||||||
use libc;
|
use libc;
|
||||||
|
use std::sync::{Condvar, Mutex};
|
||||||
|
|
||||||
use crate::constants::Event;
|
use crate::constants::Event;
|
||||||
use crate::dc_context::dc_context_t;
|
use crate::dc_context::dc_context_t;
|
||||||
@@ -11,28 +12,25 @@ use crate::dc_tools::*;
|
|||||||
use crate::types::*;
|
use crate::types::*;
|
||||||
use crate::x::*;
|
use crate::x::*;
|
||||||
|
|
||||||
#[derive(Copy, Clone)]
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct dc_imap_t {
|
pub struct dc_imap_t {
|
||||||
pub addr: *mut libc::c_char,
|
pub addr: *mut libc::c_char,
|
||||||
pub imap_server: *mut libc::c_char,
|
pub imap_server: *mut libc::c_char,
|
||||||
pub imap_port: libc::c_int,
|
pub imap_port: i32,
|
||||||
pub imap_user: *mut libc::c_char,
|
pub imap_user: *mut libc::c_char,
|
||||||
pub imap_pw: *mut libc::c_char,
|
pub imap_pw: *mut libc::c_char,
|
||||||
pub server_flags: libc::c_int,
|
pub server_flags: i32,
|
||||||
pub connected: libc::c_int,
|
pub connected: i32,
|
||||||
pub etpan: *mut mailimap,
|
pub etpan: *mut mailimap,
|
||||||
pub idle_set_up: libc::c_int,
|
pub idle_set_up: i32,
|
||||||
pub selected_folder: *mut libc::c_char,
|
pub selected_folder: *mut libc::c_char,
|
||||||
pub selected_folder_needs_expunge: libc::c_int,
|
pub selected_folder_needs_expunge: i32,
|
||||||
pub should_reconnect: libc::c_int,
|
pub should_reconnect: i32,
|
||||||
pub can_idle: libc::c_int,
|
pub can_idle: i32,
|
||||||
pub has_xlist: libc::c_int,
|
pub has_xlist: i32,
|
||||||
pub imap_delimiter: libc::c_char,
|
pub imap_delimiter: libc::c_char,
|
||||||
pub watch_folder: *mut libc::c_char,
|
pub watch_folder: *mut libc::c_char,
|
||||||
pub watch_cond: pthread_cond_t,
|
pub watch: (Mutex<bool>, Condvar),
|
||||||
pub watch_condmutex: pthread_mutex_t,
|
|
||||||
pub watch_condflag: libc::c_int,
|
|
||||||
pub fetch_type_prefetch: *mut mailimap_fetch_type,
|
pub fetch_type_prefetch: *mut mailimap_fetch_type,
|
||||||
pub fetch_type_body: *mut mailimap_fetch_type,
|
pub fetch_type_body: *mut mailimap_fetch_type,
|
||||||
pub fetch_type_flags: *mut mailimap_fetch_type,
|
pub fetch_type_flags: *mut mailimap_fetch_type,
|
||||||
@@ -40,66 +38,75 @@ pub struct dc_imap_t {
|
|||||||
pub set_config: dc_set_config_t,
|
pub set_config: dc_set_config_t,
|
||||||
pub precheck_imf: dc_precheck_imf_t,
|
pub precheck_imf: dc_precheck_imf_t,
|
||||||
pub receive_imf: dc_receive_imf_t,
|
pub receive_imf: dc_receive_imf_t,
|
||||||
pub userData: *mut libc::c_void,
|
// TODO: remove
|
||||||
pub context: *mut dc_context_t,
|
pub context: *mut dc_context_t,
|
||||||
pub log_connect_errors: libc::c_int,
|
pub log_connect_errors: i32,
|
||||||
pub skip_log_capabilities: libc::c_int,
|
pub skip_log_capabilities: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn dc_imap_new(
|
pub unsafe fn dc_imap_new(
|
||||||
mut get_config: dc_get_config_t,
|
get_config: dc_get_config_t,
|
||||||
mut set_config: dc_set_config_t,
|
set_config: dc_set_config_t,
|
||||||
mut precheck_imf: dc_precheck_imf_t,
|
precheck_imf: dc_precheck_imf_t,
|
||||||
mut receive_imf: dc_receive_imf_t,
|
receive_imf: dc_receive_imf_t,
|
||||||
mut userData: *mut libc::c_void,
|
) -> dc_imap_t {
|
||||||
mut context: *mut dc_context_t,
|
let mut imap = dc_imap_t {
|
||||||
) -> *mut dc_imap_t {
|
addr: std::ptr::null_mut(),
|
||||||
let mut imap: *mut dc_imap_t = 0 as *mut dc_imap_t;
|
imap_server: std::ptr::null_mut(),
|
||||||
imap = calloc(1, ::std::mem::size_of::<dc_imap_t>()) as *mut dc_imap_t;
|
imap_port: 0,
|
||||||
if imap.is_null() {
|
imap_user: std::ptr::null_mut(),
|
||||||
exit(25i32);
|
imap_pw: std::ptr::null_mut(),
|
||||||
}
|
server_flags: 0,
|
||||||
(*imap).log_connect_errors = 1i32;
|
connected: 0,
|
||||||
(*imap).context = context;
|
etpan: std::ptr::null_mut(),
|
||||||
(*imap).get_config = get_config;
|
idle_set_up: 0,
|
||||||
(*imap).set_config = set_config;
|
selected_folder: calloc(1, 1) as *mut libc::c_char,
|
||||||
(*imap).precheck_imf = precheck_imf;
|
selected_folder_needs_expunge: 0,
|
||||||
(*imap).receive_imf = receive_imf;
|
should_reconnect: 0,
|
||||||
(*imap).userData = userData;
|
can_idle: 0,
|
||||||
pthread_mutex_init(
|
has_xlist: 0,
|
||||||
&mut (*imap).watch_condmutex,
|
imap_delimiter: 0 as libc::c_char,
|
||||||
0 as *const pthread_mutexattr_t,
|
watch_folder: calloc(1, 1) as *mut libc::c_char,
|
||||||
);
|
watch: (Mutex::new(false), Condvar::new()),
|
||||||
pthread_cond_init(&mut (*imap).watch_cond, 0 as *const pthread_condattr_t);
|
fetch_type_prefetch: mailimap_fetch_type_new_fetch_att_list_empty(),
|
||||||
(*imap).watch_folder = calloc(1, 1) as *mut libc::c_char;
|
fetch_type_body: mailimap_fetch_type_new_fetch_att_list_empty(),
|
||||||
(*imap).selected_folder = calloc(1, 1) as *mut libc::c_char;
|
fetch_type_flags: mailimap_fetch_type_new_fetch_att_list_empty(),
|
||||||
(*imap).fetch_type_prefetch = mailimap_fetch_type_new_fetch_att_list_empty();
|
get_config,
|
||||||
|
set_config,
|
||||||
|
precheck_imf,
|
||||||
|
receive_imf,
|
||||||
|
// TODO: remove
|
||||||
|
context: std::ptr::null_mut(),
|
||||||
|
log_connect_errors: 1,
|
||||||
|
skip_log_capabilities: 0,
|
||||||
|
};
|
||||||
mailimap_fetch_type_new_fetch_att_list_add(
|
mailimap_fetch_type_new_fetch_att_list_add(
|
||||||
(*imap).fetch_type_prefetch,
|
imap.fetch_type_prefetch,
|
||||||
mailimap_fetch_att_new_uid(),
|
mailimap_fetch_att_new_uid(),
|
||||||
);
|
);
|
||||||
mailimap_fetch_type_new_fetch_att_list_add(
|
mailimap_fetch_type_new_fetch_att_list_add(
|
||||||
(*imap).fetch_type_prefetch,
|
imap.fetch_type_prefetch,
|
||||||
mailimap_fetch_att_new_envelope(),
|
mailimap_fetch_att_new_envelope(),
|
||||||
);
|
);
|
||||||
(*imap).fetch_type_body = mailimap_fetch_type_new_fetch_att_list_empty();
|
|
||||||
mailimap_fetch_type_new_fetch_att_list_add(
|
mailimap_fetch_type_new_fetch_att_list_add(
|
||||||
(*imap).fetch_type_body,
|
imap.fetch_type_body,
|
||||||
mailimap_fetch_att_new_flags(),
|
mailimap_fetch_att_new_flags(),
|
||||||
);
|
);
|
||||||
mailimap_fetch_type_new_fetch_att_list_add(
|
mailimap_fetch_type_new_fetch_att_list_add(
|
||||||
(*imap).fetch_type_body,
|
imap.fetch_type_body,
|
||||||
mailimap_fetch_att_new_body_peek_section(mailimap_section_new(
|
mailimap_fetch_att_new_body_peek_section(mailimap_section_new(
|
||||||
0 as *mut mailimap_section_spec,
|
0 as *mut mailimap_section_spec,
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
(*imap).fetch_type_flags = mailimap_fetch_type_new_fetch_att_list_empty();
|
|
||||||
mailimap_fetch_type_new_fetch_att_list_add(
|
mailimap_fetch_type_new_fetch_att_list_add(
|
||||||
(*imap).fetch_type_flags,
|
(*imap).fetch_type_flags,
|
||||||
mailimap_fetch_att_new_flags(),
|
mailimap_fetch_att_new_flags(),
|
||||||
);
|
);
|
||||||
return imap;
|
|
||||||
|
imap
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn dc_imap_unref(mut imap: *mut dc_imap_t) {
|
pub unsafe fn dc_imap_unref(mut imap: *mut dc_imap_t) {
|
||||||
if imap.is_null() {
|
if imap.is_null() {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -51,11 +51,13 @@ pub unsafe fn dc_perform_imap_jobs(mut context: *mut dc_context_t) {
|
|||||||
0i32,
|
0i32,
|
||||||
b"INBOX-jobs started...\x00" as *const u8 as *const libc::c_char,
|
b"INBOX-jobs started...\x00" as *const u8 as *const libc::c_char,
|
||||||
);
|
);
|
||||||
pthread_mutex_lock(&mut (*context).inboxidle_condmutex);
|
|
||||||
|
let l = (*context).inboxidle_condmutex.lock().unwrap();
|
||||||
let mut probe_imap_network: libc::c_int = (*context).probe_imap_network;
|
let mut probe_imap_network: libc::c_int = (*context).probe_imap_network;
|
||||||
(*context).probe_imap_network = 0i32;
|
(*context).probe_imap_network = 0i32;
|
||||||
(*context).perform_inbox_jobs_needed = 0i32;
|
(*context).perform_inbox_jobs_needed = 0i32;
|
||||||
pthread_mutex_unlock(&mut (*context).inboxidle_condmutex);
|
drop(l);
|
||||||
|
|
||||||
dc_job_perform(context, 100i32, probe_imap_network);
|
dc_job_perform(context, 100i32, probe_imap_network);
|
||||||
dc_log_info(
|
dc_log_info(
|
||||||
context,
|
context,
|
||||||
@@ -934,9 +936,9 @@ pub unsafe fn dc_interrupt_imap_idle(mut context: *mut dc_context_t) {
|
|||||||
0i32,
|
0i32,
|
||||||
b"Interrupting IMAP-IDLE...\x00" as *const u8 as *const libc::c_char,
|
b"Interrupting IMAP-IDLE...\x00" as *const u8 as *const libc::c_char,
|
||||||
);
|
);
|
||||||
pthread_mutex_lock(&mut (*context).inboxidle_condmutex);
|
let l = (*context).inboxidle_condmutex.lock().unwrap();
|
||||||
(*context).perform_inbox_jobs_needed = 1i32;
|
(*context).perform_inbox_jobs_needed = 1i32;
|
||||||
pthread_mutex_unlock(&mut (*context).inboxidle_condmutex);
|
drop(l);
|
||||||
dc_imap_interrupt_idle((*context).inbox);
|
dc_imap_interrupt_idle((*context).inbox);
|
||||||
}
|
}
|
||||||
unsafe fn dc_job_do_DC_JOB_DELETE_MSG_ON_IMAP(
|
unsafe fn dc_job_do_DC_JOB_DELETE_MSG_ON_IMAP(
|
||||||
@@ -1058,7 +1060,7 @@ pub unsafe fn dc_perform_imap_idle(mut context: *mut dc_context_t) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
connect_to_inbox(context);
|
connect_to_inbox(context);
|
||||||
pthread_mutex_lock(&mut (*context).inboxidle_condmutex);
|
let l = (*context).inboxidle_condmutex.lock().unwrap();
|
||||||
if 0 != (*context).perform_inbox_jobs_needed {
|
if 0 != (*context).perform_inbox_jobs_needed {
|
||||||
dc_log_info(
|
dc_log_info(
|
||||||
context,
|
context,
|
||||||
@@ -1066,10 +1068,10 @@ pub unsafe fn dc_perform_imap_idle(mut context: *mut dc_context_t) {
|
|||||||
b"INBOX-IDLE will not be started because of waiting jobs.\x00" as *const u8
|
b"INBOX-IDLE will not be started because of waiting jobs.\x00" as *const u8
|
||||||
as *const libc::c_char,
|
as *const libc::c_char,
|
||||||
);
|
);
|
||||||
pthread_mutex_unlock(&mut (*context).inboxidle_condmutex);
|
drop(l);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&mut (*context).inboxidle_condmutex);
|
drop(l);
|
||||||
dc_log_info(
|
dc_log_info(
|
||||||
context,
|
context,
|
||||||
0i32,
|
0i32,
|
||||||
@@ -1251,9 +1253,9 @@ pub unsafe fn dc_maybe_network(mut context: *mut dc_context_t) {
|
|||||||
pthread_mutex_lock(&mut (*context).smtpidle_condmutex);
|
pthread_mutex_lock(&mut (*context).smtpidle_condmutex);
|
||||||
(*context).probe_smtp_network = 1i32;
|
(*context).probe_smtp_network = 1i32;
|
||||||
pthread_mutex_unlock(&mut (*context).smtpidle_condmutex);
|
pthread_mutex_unlock(&mut (*context).smtpidle_condmutex);
|
||||||
pthread_mutex_lock(&mut (*context).inboxidle_condmutex);
|
let l = (*context).inboxidle_condmutex.lock().unwrap();
|
||||||
(*context).probe_imap_network = 1i32;
|
(*context).probe_imap_network = 1i32;
|
||||||
pthread_mutex_unlock(&mut (*context).inboxidle_condmutex);
|
drop(l);
|
||||||
dc_interrupt_smtp_idle(context);
|
dc_interrupt_smtp_idle(context);
|
||||||
dc_interrupt_imap_idle(context);
|
dc_interrupt_imap_idle(context);
|
||||||
dc_interrupt_mvbox_idle(context);
|
dc_interrupt_mvbox_idle(context);
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
use std::sync::{Condvar, Mutex};
|
||||||
|
|
||||||
use libc;
|
use libc;
|
||||||
|
|
||||||
use crate::dc_configure::*;
|
use crate::dc_configure::*;
|
||||||
@@ -10,52 +12,47 @@ use crate::dc_tools::*;
|
|||||||
use crate::types::*;
|
use crate::types::*;
|
||||||
use crate::x::*;
|
use crate::x::*;
|
||||||
|
|
||||||
#[derive(Copy, Clone)]
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct dc_jobthread_t {
|
pub struct dc_jobthread_t {
|
||||||
|
// TODO: remove
|
||||||
pub context: *mut dc_context_t,
|
pub context: *mut dc_context_t,
|
||||||
pub name: *mut libc::c_char,
|
pub name: *mut libc::c_char,
|
||||||
pub folder_config_name: *mut libc::c_char,
|
pub folder_config_name: *mut libc::c_char,
|
||||||
pub imap: *mut dc_imap_t,
|
pub imap: *mut dc_imap_t,
|
||||||
pub mutex: pthread_mutex_t,
|
pub idle: (Mutex<bool>, Condvar),
|
||||||
pub idle_cond: pthread_cond_t,
|
|
||||||
pub idle_condflag: libc::c_int,
|
|
||||||
pub jobs_needed: libc::c_int,
|
pub jobs_needed: libc::c_int,
|
||||||
pub suspended: libc::c_int,
|
pub suspended: libc::c_int,
|
||||||
pub using_handle: libc::c_int,
|
pub using_handle: libc::c_int,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn dc_jobthread_init(
|
pub unsafe fn dc_jobthread_init(
|
||||||
mut jobthread: *mut dc_jobthread_t,
|
name: *const libc::c_char,
|
||||||
mut context: *mut dc_context_t,
|
folder_config_name: *const libc::c_char,
|
||||||
mut name: *const libc::c_char,
|
imap: *mut dc_imap_t,
|
||||||
mut folder_config_name: *const libc::c_char,
|
) -> dc_jobthread_t {
|
||||||
) {
|
dc_jobthread_t {
|
||||||
if jobthread.is_null() || context.is_null() || name.is_null() {
|
context: std::ptr::null_mut(),
|
||||||
return;
|
name: dc_strdup(name),
|
||||||
|
folder_config_name: dc_strdup(folder_config_name),
|
||||||
|
imap,
|
||||||
|
idle: (Mutex::new(false), Condvar::new()),
|
||||||
|
jobs_needed: 0i32,
|
||||||
|
suspended: 0i32,
|
||||||
|
using_handle: 0i32,
|
||||||
}
|
}
|
||||||
(*jobthread).context = context;
|
|
||||||
(*jobthread).name = dc_strdup(name);
|
|
||||||
(*jobthread).folder_config_name = dc_strdup(folder_config_name);
|
|
||||||
(*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;
|
|
||||||
(*jobthread).jobs_needed = 0i32;
|
|
||||||
(*jobthread).suspended = 0i32;
|
|
||||||
(*jobthread).using_handle = 0i32;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn dc_jobthread_exit(mut jobthread: *mut dc_jobthread_t) {
|
pub unsafe fn dc_jobthread_exit(mut jobthread: *mut dc_jobthread_t) {
|
||||||
if jobthread.is_null() {
|
if jobthread.is_null() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pthread_cond_destroy(&mut (*jobthread).idle_cond);
|
|
||||||
pthread_mutex_destroy(&mut (*jobthread).mutex);
|
|
||||||
free((*jobthread).name as *mut libc::c_void);
|
free((*jobthread).name as *mut libc::c_void);
|
||||||
(*jobthread).name = 0 as *mut libc::c_char;
|
(*jobthread).name = 0 as *mut libc::c_char;
|
||||||
free((*jobthread).folder_config_name as *mut libc::c_void);
|
free((*jobthread).folder_config_name as *mut libc::c_void);
|
||||||
(*jobthread).folder_config_name = 0 as *mut libc::c_char;
|
(*jobthread).folder_config_name = 0 as *mut libc::c_char;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn dc_jobthread_suspend(mut jobthread: *mut dc_jobthread_t, mut suspend: libc::c_int) {
|
pub unsafe fn dc_jobthread_suspend(mut jobthread: *mut dc_jobthread_t, mut suspend: libc::c_int) {
|
||||||
if jobthread.is_null() {
|
if jobthread.is_null() {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -10,17 +10,7 @@ use crate::pgp as rpgp;
|
|||||||
use crate::types::*;
|
use crate::types::*;
|
||||||
use crate::x::*;
|
use crate::x::*;
|
||||||
|
|
||||||
/* ** library-private **********************************************************/
|
|
||||||
/* validation errors */
|
|
||||||
/* misc. */
|
|
||||||
pub unsafe fn dc_pgp_init() {}
|
|
||||||
pub unsafe fn dc_pgp_exit() {}
|
pub unsafe fn dc_pgp_exit() {}
|
||||||
pub unsafe fn dc_pgp_rand_seed(
|
|
||||||
_context: *mut dc_context_t,
|
|
||||||
_buf: *const libc::c_void,
|
|
||||||
_bytes: size_t,
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
pub unsafe fn dc_split_armored_data(
|
pub unsafe fn dc_split_armored_data(
|
||||||
mut buf: *mut libc::c_char,
|
mut buf: *mut libc::c_char,
|
||||||
|
|||||||
@@ -25,12 +25,12 @@ use crate::types::*;
|
|||||||
use crate::x::*;
|
use crate::x::*;
|
||||||
|
|
||||||
pub unsafe fn dc_receive_imf(
|
pub unsafe fn dc_receive_imf(
|
||||||
mut context: *mut dc_context_t,
|
context: &dc_context_t,
|
||||||
mut imf_raw_not_terminated: *const libc::c_char,
|
imf_raw_not_terminated: *const libc::c_char,
|
||||||
mut imf_raw_bytes: size_t,
|
imf_raw_bytes: size_t,
|
||||||
mut server_folder: *const libc::c_char,
|
server_folder: *const libc::c_char,
|
||||||
mut server_uid: uint32_t,
|
server_uid: uint32_t,
|
||||||
mut flags: uint32_t,
|
flags: uint32_t,
|
||||||
) {
|
) {
|
||||||
let mut current_block: u64;
|
let mut current_block: u64;
|
||||||
/* the function returns the number of created messages in the database */
|
/* the function returns the number of created messages in the database */
|
||||||
|
|||||||
@@ -16,21 +16,24 @@ pub struct dc_smtp_t {
|
|||||||
pub from: *mut libc::c_char,
|
pub from: *mut libc::c_char,
|
||||||
pub esmtp: libc::c_int,
|
pub esmtp: libc::c_int,
|
||||||
pub log_connect_errors: libc::c_int,
|
pub log_connect_errors: libc::c_int,
|
||||||
|
// TODO: Remvoe
|
||||||
pub context: *mut dc_context_t,
|
pub context: *mut dc_context_t,
|
||||||
pub error: *mut libc::c_char,
|
pub error: *mut libc::c_char,
|
||||||
pub error_etpan: libc::c_int,
|
pub error_etpan: libc::c_int,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn dc_smtp_new(mut context: *mut dc_context_t) -> *mut dc_smtp_t {
|
pub fn dc_smtp_new() -> dc_smtp_t {
|
||||||
let mut smtp: *mut dc_smtp_t = 0 as *mut dc_smtp_t;
|
dc_smtp_t {
|
||||||
smtp = calloc(1, ::std::mem::size_of::<dc_smtp_t>()) as *mut dc_smtp_t;
|
etpan: std::ptr::null_mut(),
|
||||||
if smtp.is_null() {
|
from: std::ptr::null_mut(),
|
||||||
exit(29i32);
|
esmtp: 0,
|
||||||
|
log_connect_errors: 1,
|
||||||
|
context: std::ptr::null_mut(),
|
||||||
|
error: std::ptr::null_mut(),
|
||||||
|
error_etpan: 0,
|
||||||
}
|
}
|
||||||
(*smtp).log_connect_errors = 1i32;
|
|
||||||
(*smtp).context = context;
|
|
||||||
return smtp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn dc_smtp_unref(mut smtp: *mut dc_smtp_t) {
|
pub unsafe fn dc_smtp_unref(mut smtp: *mut dc_smtp_t) {
|
||||||
if smtp.is_null() {
|
if smtp.is_null() {
|
||||||
return;
|
return;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user