mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 12:56:30 +03:00
@@ -485,12 +485,14 @@ unsafe fn dc_job_do_DC_JOB_MOVE_MSG(context: &Context, job: &mut dc_job_t) {
|
|||||||
0 as *const libc::c_char,
|
0 as *const libc::c_char,
|
||||||
);
|
);
|
||||||
|
|
||||||
let server_folder = CStr::from_ptr((*msg).server_folder).to_str().unwrap();
|
if !dest_folder.is_null() {
|
||||||
|
let server_folder = to_str((*msg).server_folder);
|
||||||
|
|
||||||
match inbox.mv(
|
match inbox.mv(
|
||||||
context,
|
context,
|
||||||
server_folder,
|
server_folder,
|
||||||
(*msg).server_uid,
|
(*msg).server_uid,
|
||||||
CStr::from_ptr(dest_folder).to_str().unwrap(),
|
to_str(dest_folder),
|
||||||
&mut dest_uid,
|
&mut dest_uid,
|
||||||
) as libc::c_uint
|
) as libc::c_uint
|
||||||
{
|
{
|
||||||
@@ -530,6 +532,7 @@ unsafe fn dc_job_do_DC_JOB_MOVE_MSG(context: &Context, job: &mut dc_job_t) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
free(dest_folder as *mut libc::c_void);
|
free(dest_folder as *mut libc::c_void);
|
||||||
@@ -589,12 +592,13 @@ unsafe fn dc_job_do_DC_JOB_MARKSEEN_MDN_ON_IMAP(context: &Context, job: &mut dc_
|
|||||||
b"configured_mvbox_folder\x00" as *const u8 as *const libc::c_char,
|
b"configured_mvbox_folder\x00" as *const u8 as *const libc::c_char,
|
||||||
0 as *const libc::c_char,
|
0 as *const libc::c_char,
|
||||||
);
|
);
|
||||||
let dest_folder = CStr::from_ptr(dest_folder).to_str().unwrap();
|
if !dest_folder.is_null() {
|
||||||
match inbox.mv(context, folder, uid, dest_folder, &mut dest_uid) as libc::c_uint {
|
let dest_folder = to_str(dest_folder);
|
||||||
1 => {
|
if 1 == inbox.mv(context, folder, uid, dest_folder, &mut dest_uid)
|
||||||
dc_job_try_again_later(job, 3i32, 0 as *const libc::c_char);
|
as libc::c_uint
|
||||||
|
{
|
||||||
|
dc_job_try_again_later(job, 3, 0 as *const libc::c_char);
|
||||||
}
|
}
|
||||||
0 | _ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -208,10 +208,12 @@ pub unsafe fn dc_join_securejoin(context: &Context, qr: *const libc::c_char) ->
|
|||||||
.shall_stop_ongoing)
|
.shall_stop_ongoing)
|
||||||
{
|
{
|
||||||
join_vg = ((*qr_scan).state == 202i32) as libc::c_int;
|
join_vg = ((*qr_scan).state == 202i32) as libc::c_int;
|
||||||
|
{
|
||||||
let bob_a = context.bob.clone();
|
let bob_a = context.bob.clone();
|
||||||
let mut bob = bob_a.write().unwrap();
|
let mut bob = bob_a.write().unwrap();
|
||||||
bob.status = 0;
|
bob.status = 0;
|
||||||
bob.qr_scan = qr_scan;
|
bob.qr_scan = qr_scan;
|
||||||
|
}
|
||||||
if 0 != fingerprint_equals_sender(context, (*qr_scan).fingerprint, contact_chat_id)
|
if 0 != fingerprint_equals_sender(context, (*qr_scan).fingerprint, contact_chat_id)
|
||||||
{
|
{
|
||||||
dc_log_info(
|
dc_log_info(
|
||||||
@@ -219,7 +221,7 @@ pub unsafe fn dc_join_securejoin(context: &Context, qr: *const libc::c_char) ->
|
|||||||
0i32,
|
0i32,
|
||||||
b"Taking protocol shortcut.\x00" as *const u8 as *const libc::c_char,
|
b"Taking protocol shortcut.\x00" as *const u8 as *const libc::c_char,
|
||||||
);
|
);
|
||||||
bob.expects = 6;
|
context.bob.clone().write().unwrap().expects = 6;
|
||||||
(context.cb)(
|
(context.cb)(
|
||||||
context,
|
context,
|
||||||
Event::SECUREJOIN_JOINER_PROGRESS,
|
Event::SECUREJOIN_JOINER_PROGRESS,
|
||||||
@@ -245,7 +247,7 @@ pub unsafe fn dc_join_securejoin(context: &Context, qr: *const libc::c_char) ->
|
|||||||
);
|
);
|
||||||
free(own_fingerprint as *mut libc::c_void);
|
free(own_fingerprint as *mut libc::c_void);
|
||||||
} else {
|
} else {
|
||||||
bob.expects = 2;
|
context.bob.clone().write().unwrap().expects = 2;
|
||||||
send_handshake_msg(
|
send_handshake_msg(
|
||||||
context,
|
context,
|
||||||
contact_chat_id,
|
contact_chat_id,
|
||||||
@@ -259,6 +261,7 @@ pub unsafe fn dc_join_securejoin(context: &Context, qr: *const libc::c_char) ->
|
|||||||
0 as *const libc::c_char,
|
0 as *const libc::c_char,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bob -> Alice
|
// Bob -> Alice
|
||||||
while !(context
|
while !(context
|
||||||
.running_state
|
.running_state
|
||||||
@@ -267,7 +270,7 @@ pub unsafe fn dc_join_securejoin(context: &Context, qr: *const libc::c_char) ->
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
.shall_stop_ongoing)
|
.shall_stop_ongoing)
|
||||||
{
|
{
|
||||||
std::thread::sleep(std::time::Duration::from_micros(300 * 1000));
|
std::thread::sleep(std::time::Duration::new(0, 3_000_000));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -495,11 +498,14 @@ pub unsafe fn dc_handle_securejoin_handshake(
|
|||||||
b"vc-auth-required\x00" as *const u8 as *const libc::c_char,
|
b"vc-auth-required\x00" as *const u8 as *const libc::c_char,
|
||||||
) == 0i32
|
) == 0i32
|
||||||
{
|
{
|
||||||
|
let cond = {
|
||||||
let bob_a = context.bob.clone();
|
let bob_a = context.bob.clone();
|
||||||
let bob = bob_a.read().unwrap();
|
let bob = bob_a.read().unwrap();
|
||||||
let scan = bob.qr_scan;
|
let scan = bob.qr_scan;
|
||||||
if scan.is_null() || bob.expects != 2i32 || 0 != join_vg && (*scan).state != 202i32
|
scan.is_null() || bob.expects != 2 || 0 != join_vg && (*scan).state != 202
|
||||||
{
|
};
|
||||||
|
|
||||||
|
if cond {
|
||||||
dc_log_warning(
|
dc_log_warning(
|
||||||
context,
|
context,
|
||||||
0i32,
|
0i32,
|
||||||
@@ -509,11 +515,14 @@ pub unsafe fn dc_handle_securejoin_handshake(
|
|||||||
// no error, just aborted somehow or a mail from another handshake
|
// no error, just aborted somehow or a mail from another handshake
|
||||||
current_block = 4378276786830486580;
|
current_block = 4378276786830486580;
|
||||||
} else {
|
} else {
|
||||||
|
{
|
||||||
|
let scan = context.bob.clone().read().unwrap().qr_scan;
|
||||||
scanned_fingerprint_of_alice = dc_strdup((*scan).fingerprint);
|
scanned_fingerprint_of_alice = dc_strdup((*scan).fingerprint);
|
||||||
auth = dc_strdup((*scan).auth);
|
auth = dc_strdup((*scan).auth);
|
||||||
if 0 != join_vg {
|
if 0 != join_vg {
|
||||||
grpid = dc_strdup((*scan).text2)
|
grpid = dc_strdup((*scan).text2)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if 0 == encrypted_and_signed(mimeparser, scanned_fingerprint_of_alice) {
|
if 0 == encrypted_and_signed(mimeparser, scanned_fingerprint_of_alice) {
|
||||||
could_not_establish_secure_connection(
|
could_not_establish_secure_connection(
|
||||||
context,
|
context,
|
||||||
@@ -735,8 +744,11 @@ pub unsafe fn dc_handle_securejoin_handshake(
|
|||||||
);
|
);
|
||||||
current_block = 4378276786830486580;
|
current_block = 4378276786830486580;
|
||||||
} else {
|
} else {
|
||||||
|
let cond = {
|
||||||
let scan = context.bob.clone().read().unwrap().qr_scan;
|
let scan = context.bob.clone().read().unwrap().qr_scan;
|
||||||
if scan.is_null() || 0 != join_vg && (*scan).state != 202i32 {
|
scan.is_null() || 0 != join_vg && (*scan).state != 202
|
||||||
|
};
|
||||||
|
if cond {
|
||||||
dc_log_warning(
|
dc_log_warning(
|
||||||
context,
|
context,
|
||||||
0i32,
|
0i32,
|
||||||
@@ -745,10 +757,13 @@ pub unsafe fn dc_handle_securejoin_handshake(
|
|||||||
);
|
);
|
||||||
current_block = 4378276786830486580;
|
current_block = 4378276786830486580;
|
||||||
} else {
|
} else {
|
||||||
|
{
|
||||||
|
let scan = context.bob.clone().read().unwrap().qr_scan;
|
||||||
scanned_fingerprint_of_alice = dc_strdup((*scan).fingerprint);
|
scanned_fingerprint_of_alice = dc_strdup((*scan).fingerprint);
|
||||||
if 0 != join_vg {
|
if 0 != join_vg {
|
||||||
grpid = dc_strdup((*scan).text2)
|
grpid = dc_strdup((*scan).text2)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
let mut vg_expect_encrypted: libc::c_int = 1i32;
|
let mut vg_expect_encrypted: libc::c_int = 1i32;
|
||||||
if 0 != join_vg {
|
if 0 != join_vg {
|
||||||
let mut is_verified_group: libc::c_int = 0i32;
|
let mut is_verified_group: libc::c_int = 0i32;
|
||||||
|
|||||||
@@ -1299,23 +1299,19 @@ pub unsafe fn dc_sqlite3_set_config_int64(
|
|||||||
ret
|
ret
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn dc_sqlite3_get_config_int64(
|
pub fn dc_sqlite3_get_config_int64(
|
||||||
context: &Context,
|
context: &Context,
|
||||||
sql: &dc_sqlite3_t,
|
sql: &dc_sqlite3_t,
|
||||||
key: *const libc::c_char,
|
key: *const libc::c_char,
|
||||||
def: int64_t,
|
def: i64,
|
||||||
) -> int64_t {
|
) -> i64 {
|
||||||
let str = dc_sqlite3_get_config(context, sql, key, 0 as *const libc::c_char);
|
let s = unsafe { dc_sqlite3_get_config(context, sql, key, 0 as *const libc::c_char) };
|
||||||
if str.is_null() {
|
if s.is_null() {
|
||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
let mut ret = 0 as int64_t;
|
|
||||||
sscanf(
|
let ret: i64 = to_str(s).parse().unwrap_or_default();
|
||||||
str,
|
unsafe { free(s as *mut libc::c_void) };
|
||||||
b"%lld\x00" as *const u8 as *const libc::c_char,
|
|
||||||
&mut ret as *mut int64_t,
|
|
||||||
);
|
|
||||||
free(str as *mut libc::c_void);
|
|
||||||
ret
|
ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -334,14 +334,12 @@ fn set_config_int64(context: &Context, key: &str, value: i64) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn is_expired(context: &Context) -> bool {
|
fn is_expired(context: &Context) -> bool {
|
||||||
let expire_timestamp = unsafe {
|
let expire_timestamp = dc_sqlite3_get_config_int64(
|
||||||
dc_sqlite3_get_config_int64(
|
|
||||||
context,
|
context,
|
||||||
&context.sql.clone().read().unwrap(),
|
&context.sql.clone().read().unwrap(),
|
||||||
b"oauth2_timestamp_expires\x00" as *const u8 as *const libc::c_char,
|
b"oauth2_timestamp_expires\x00" as *const u8 as *const libc::c_char,
|
||||||
0i32 as int64_t,
|
0i32 as int64_t,
|
||||||
)
|
);
|
||||||
} as i64;
|
|
||||||
|
|
||||||
if expire_timestamp <= 0 {
|
if expire_timestamp <= 0 {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
4
src/x.rs
4
src/x.rs
@@ -4,8 +4,8 @@ use crate::types::*;
|
|||||||
pub use libc::{
|
pub use libc::{
|
||||||
atoi, calloc, close, closedir, exit, fclose, fgets, fopen, fread, free, fseek, ftell, fwrite,
|
atoi, calloc, close, closedir, exit, fclose, fgets, fopen, fread, free, fseek, ftell, fwrite,
|
||||||
malloc, memcmp, memcpy, memmove, memset, mkdir, open, opendir, printf, read, readdir, realloc,
|
malloc, memcmp, memcpy, memmove, memset, mkdir, open, opendir, printf, read, readdir, realloc,
|
||||||
remove, sprintf, sscanf, strcat, strchr, strcmp, strcpy, strcspn, strlen, strncmp, strncpy,
|
remove, sprintf, strcat, strchr, strcmp, strcpy, strcspn, strlen, strncmp, strncpy, strrchr,
|
||||||
strrchr, strspn, strstr, strtol, system, tolower, write,
|
strspn, strstr, strtol, system, tolower, write,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub unsafe fn strdup(s: *const libc::c_char) -> *mut libc::c_char {
|
pub unsafe fn strdup(s: *const libc::c_char) -> *mut libc::c_char {
|
||||||
|
|||||||
Reference in New Issue
Block a user