diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index 08be95a45..7d78fcb37 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -322,7 +322,7 @@ pub unsafe extern "C" fn dc_create_chat_by_msg_id(context: *mut dc_context_t, ms assert!(!context.is_null()); let context = &*context; - dc_chat::dc_create_chat_by_msg_id(context, msg_id) + chat::dc_create_chat_by_msg_id(context, msg_id) } #[no_mangle] @@ -333,7 +333,7 @@ pub unsafe extern "C" fn dc_create_chat_by_contact_id( assert!(!context.is_null()); let context = &*context; - dc_chat::dc_create_chat_by_contact_id(context, contact_id) + chat::dc_create_chat_by_contact_id(context, contact_id) } #[no_mangle] @@ -344,7 +344,7 @@ pub unsafe extern "C" fn dc_get_chat_id_by_contact_id( assert!(!context.is_null()); let context = &*context; - dc_chat::dc_get_chat_id_by_contact_id(context, contact_id) + chat::dc_get_chat_id_by_contact_id(context, contact_id) } #[no_mangle] @@ -357,7 +357,7 @@ pub unsafe extern "C" fn dc_prepare_msg( assert!(!msg.is_null()); let context = &*context; - dc_chat::dc_prepare_msg(context, chat_id, msg) + chat::dc_prepare_msg(context, chat_id, msg) } #[no_mangle] @@ -370,7 +370,7 @@ pub unsafe extern "C" fn dc_send_msg( assert!(!msg.is_null()); let context = &*context; - dc_chat::dc_send_msg(context, chat_id, msg) + chat::dc_send_msg(context, chat_id, msg) } #[no_mangle] @@ -384,7 +384,7 @@ pub unsafe extern "C" fn dc_send_text_msg( let context = &*context; let text_to_send = dc_tools::to_string_lossy(text_to_send); - dc_chat::dc_send_text_msg(context, chat_id, text_to_send) + chat::dc_send_text_msg(context, chat_id, text_to_send) } #[no_mangle] @@ -396,7 +396,7 @@ pub unsafe extern "C" fn dc_set_draft( assert!(!context.is_null()); let context = &*context; - dc_chat::dc_set_draft(context, chat_id, msg) + chat::dc_set_draft(context, chat_id, msg) } #[no_mangle] @@ -407,7 +407,7 @@ pub unsafe extern "C" fn dc_get_draft<'a>( assert!(!context.is_null()); let context = &*context; - dc_chat::dc_get_draft(context, chat_id) + chat::dc_get_draft(context, chat_id) } #[no_mangle] @@ -420,7 +420,7 @@ pub unsafe extern "C" fn dc_get_chat_msgs( assert!(!context.is_null()); let context = &*context; - dc_chat::dc_get_chat_msgs(context, chat_id, flags, marker1before) + chat::dc_get_chat_msgs(context, chat_id, flags, marker1before) } #[no_mangle] @@ -428,7 +428,7 @@ pub unsafe extern "C" fn dc_get_msg_cnt(context: *mut dc_context_t, chat_id: u32 assert!(!context.is_null()); let context = &*context; - dc_chat::dc_get_msg_cnt(context, chat_id) + chat::dc_get_msg_cnt(context, chat_id) } #[no_mangle] @@ -439,7 +439,7 @@ pub unsafe extern "C" fn dc_get_fresh_msg_cnt( assert!(!context.is_null()); let context = &*context; - dc_chat::dc_get_fresh_msg_cnt(context, chat_id) + chat::dc_get_fresh_msg_cnt(context, chat_id) } #[no_mangle] @@ -457,7 +457,7 @@ pub unsafe extern "C" fn dc_marknoticed_chat(context: *mut dc_context_t, chat_id assert!(!context.is_null()); let context = &*context; - dc_chat::dc_marknoticed_chat(context, chat_id); + chat::dc_marknoticed_chat(context, chat_id); } #[no_mangle] @@ -465,7 +465,7 @@ pub unsafe extern "C" fn dc_marknoticed_all_chats(context: *mut dc_context_t) { assert!(!context.is_null()); let context = &*context; - dc_chat::dc_marknoticed_all_chats(context); + chat::dc_marknoticed_all_chats(context); } fn from_prim(s: S) -> Option @@ -493,7 +493,7 @@ pub unsafe extern "C" fn dc_get_chat_media( let or_msg_type3 = from_prim(or_msg_type3).expect(&format!("incorrect or_msg_type3 = {}", or_msg_type3)); - dc_chat::dc_get_chat_media(context, chat_id, msg_type, or_msg_type2, or_msg_type3) + chat::dc_get_chat_media(context, chat_id, msg_type, or_msg_type2, or_msg_type3) } #[no_mangle] @@ -514,7 +514,7 @@ pub unsafe extern "C" fn dc_get_next_media( let or_msg_type3 = from_prim(or_msg_type3).expect(&format!("incorrect or_msg_type3 = {}", or_msg_type3)); - dc_chat::dc_get_next_media(context, msg_id, dir, msg_type, or_msg_type2, or_msg_type3) + chat::dc_get_next_media(context, msg_id, dir, msg_type, or_msg_type2, or_msg_type3) } #[no_mangle] @@ -526,7 +526,7 @@ pub unsafe extern "C" fn dc_archive_chat( assert!(!context.is_null()); let context = &*context; - dc_chat::dc_archive_chat(context, chat_id, archive); + chat::dc_archive_chat(context, chat_id, archive); } #[no_mangle] @@ -535,7 +535,7 @@ pub unsafe extern "C" fn dc_delete_chat(context: *mut dc_context_t, chat_id: u32 let context = &*context; // TODO: update to indicate public api success/failure of deletion - dc_chat::dc_delete_chat(context, chat_id); + chat::dc_delete_chat(context, chat_id); } #[no_mangle] @@ -546,7 +546,7 @@ pub unsafe extern "C" fn dc_get_chat_contacts( assert!(!context.is_null()); let context = &*context; - dc_array_t::from(dc_chat::dc_get_chat_contacts(context, chat_id)).into_raw() + dc_array_t::from(chat::dc_get_chat_contacts(context, chat_id)).into_raw() } #[no_mangle] @@ -570,7 +570,7 @@ pub unsafe extern "C" fn dc_get_chat<'a>( assert!(!context.is_null()); let context = &*context; - dc_chat::dc_get_chat(context, chat_id) + chat::dc_get_chat(context, chat_id) } #[no_mangle] @@ -583,7 +583,7 @@ pub unsafe extern "C" fn dc_create_group_chat( assert!(!name.is_null()); let context = &*context; - dc_chat::dc_create_group_chat(context, verified, name) + chat::dc_create_group_chat(context, verified, name) } #[no_mangle] @@ -595,7 +595,7 @@ pub unsafe extern "C" fn dc_is_contact_in_chat( assert!(!context.is_null()); let context = &*context; - dc_chat::dc_is_contact_in_chat(context, chat_id, contact_id) + chat::dc_is_contact_in_chat(context, chat_id, contact_id) } #[no_mangle] @@ -607,7 +607,7 @@ pub unsafe extern "C" fn dc_add_contact_to_chat( assert!(!context.is_null()); let context = &*context; - dc_chat::dc_add_contact_to_chat(context, chat_id, contact_id) + chat::dc_add_contact_to_chat(context, chat_id, contact_id) } #[no_mangle] @@ -619,7 +619,7 @@ pub unsafe extern "C" fn dc_remove_contact_from_chat( assert!(!context.is_null()); let context = &*context; - dc_chat::dc_remove_contact_from_chat(context, chat_id, contact_id) + chat::dc_remove_contact_from_chat(context, chat_id, contact_id) } #[no_mangle] @@ -633,7 +633,7 @@ pub unsafe extern "C" fn dc_set_chat_name( assert!(chat_id > constants::DC_CHAT_ID_LAST_SPECIAL as u32); let context = &*context; - dc_chat::dc_set_chat_name(context, chat_id, name) + chat::dc_set_chat_name(context, chat_id, name) } #[no_mangle] @@ -646,7 +646,7 @@ pub unsafe extern "C" fn dc_set_chat_profile_image( assert!(chat_id > constants::DC_CHAT_ID_LAST_SPECIAL as u32); let context = &*context; - dc_chat::dc_set_chat_profile_image(context, chat_id, image) + chat::dc_set_chat_profile_image(context, chat_id, image) } #[no_mangle] @@ -698,7 +698,7 @@ pub unsafe extern "C" fn dc_forward_msgs( assert!(chat_id > constants::DC_CHAT_ID_LAST_SPECIAL as u32); let context = &*context; - dc_chat::dc_forward_msgs(context, msg_ids, msg_cnt, chat_id) + chat::dc_forward_msgs(context, msg_ids, msg_cnt, chat_id) } #[no_mangle] @@ -1256,90 +1256,90 @@ pub unsafe extern "C" fn dc_chatlist_get_context( // dc_chat_t #[no_mangle] -pub type dc_chat_t<'a> = dc_chat::Chat<'a>; +pub type dc_chat_t<'a> = chat::Chat<'a>; #[no_mangle] pub unsafe extern "C" fn dc_chat_unref(chat: *mut dc_chat_t) { assert!(!chat.is_null()); - dc_chat::dc_chat_unref(chat) + chat::dc_chat_unref(chat) } #[no_mangle] pub unsafe extern "C" fn dc_chat_get_id(chat: *mut dc_chat_t) -> u32 { assert!(!chat.is_null()); - dc_chat::dc_chat_get_id(chat) + chat::dc_chat_get_id(chat) } #[no_mangle] pub unsafe extern "C" fn dc_chat_get_type(chat: *mut dc_chat_t) -> libc::c_int { assert!(!chat.is_null()); - dc_chat::dc_chat_get_type(chat) as libc::c_int + chat::dc_chat_get_type(chat) as libc::c_int } #[no_mangle] pub unsafe extern "C" fn dc_chat_get_name(chat: *mut dc_chat_t) -> *mut libc::c_char { assert!(!chat.is_null()); - dc_chat::dc_chat_get_name(chat) + chat::dc_chat_get_name(chat) } #[no_mangle] pub unsafe extern "C" fn dc_chat_get_subtitle(chat: *mut dc_chat_t) -> *mut libc::c_char { assert!(!chat.is_null()); - dc_chat::dc_chat_get_subtitle(chat) + chat::dc_chat_get_subtitle(chat) } #[no_mangle] pub unsafe extern "C" fn dc_chat_get_profile_image(chat: *mut dc_chat_t) -> *mut libc::c_char { assert!(!chat.is_null()); - dc_chat::dc_chat_get_profile_image(chat) + chat::dc_chat_get_profile_image(chat) } #[no_mangle] pub unsafe extern "C" fn dc_chat_get_color(chat: *mut dc_chat_t) -> u32 { assert!(!chat.is_null()); - dc_chat::dc_chat_get_color(chat) + chat::dc_chat_get_color(chat) } #[no_mangle] pub unsafe extern "C" fn dc_chat_get_archived(chat: *mut dc_chat_t) -> libc::c_int { assert!(!chat.is_null()); - dc_chat::dc_chat_get_archived(chat) as libc::c_int + chat::dc_chat_get_archived(chat) as libc::c_int } #[no_mangle] pub unsafe extern "C" fn dc_chat_is_unpromoted(chat: *mut dc_chat_t) -> libc::c_int { assert!(!chat.is_null()); - dc_chat::dc_chat_is_unpromoted(chat) + chat::dc_chat_is_unpromoted(chat) } #[no_mangle] pub unsafe extern "C" fn dc_chat_is_self_talk(chat: *mut dc_chat_t) -> libc::c_int { assert!(!chat.is_null()); - dc_chat::dc_chat_is_self_talk(chat) + chat::dc_chat_is_self_talk(chat) } #[no_mangle] pub unsafe extern "C" fn dc_chat_is_verified(chat: *mut dc_chat_t) -> libc::c_int { assert!(!chat.is_null()); - dc_chat::dc_chat_is_verified(chat) + chat::dc_chat_is_verified(chat) } #[no_mangle] pub unsafe extern "C" fn dc_chat_is_sending_locations(chat: *mut dc_chat_t) -> libc::c_int { assert!(!chat.is_null()); - dc_chat::dc_chat_is_sending_locations(chat) as libc::c_int + chat::dc_chat_is_sending_locations(chat) as libc::c_int } // dc_msg_t diff --git a/examples/repl/cmdline.rs b/examples/repl/cmdline.rs index a3b70fd04..2b3c9afb1 100644 --- a/examples/repl/cmdline.rs +++ b/examples/repl/cmdline.rs @@ -1,13 +1,13 @@ use std::ffi::CString; use std::str::FromStr; +use deltachat::chat::*; use deltachat::chatlist::*; use deltachat::config; use deltachat::constants::*; use deltachat::contact::*; use deltachat::context::*; use deltachat::dc_array::*; -use deltachat::dc_chat::*; use deltachat::dc_configure::*; use deltachat::dc_imex::*; use deltachat::dc_job::*; diff --git a/examples/simple.rs b/examples/simple.rs index 628414c93..48c7db7d8 100644 --- a/examples/simple.rs +++ b/examples/simple.rs @@ -5,12 +5,12 @@ use std::sync::{Arc, RwLock}; use std::{thread, time}; use tempfile::tempdir; +use deltachat::chat::*; use deltachat::chatlist::*; use deltachat::config; use deltachat::constants::Event; use deltachat::contact::*; use deltachat::context::*; -use deltachat::dc_chat::*; use deltachat::dc_configure::*; use deltachat::dc_job::{ dc_perform_imap_fetch, dc_perform_imap_idle, dc_perform_imap_jobs, dc_perform_smtp_idle, diff --git a/src/dc_chat.rs b/src/chat.rs similarity index 100% rename from src/dc_chat.rs rename to src/chat.rs diff --git a/src/chatlist.rs b/src/chatlist.rs index 1d9eb67d1..631177ef1 100644 --- a/src/chatlist.rs +++ b/src/chatlist.rs @@ -1,7 +1,7 @@ +use crate::chat::*; use crate::constants::*; use crate::contact::*; use crate::context::*; -use crate::dc_chat::*; use crate::dc_lot::*; use crate::dc_msg::*; use crate::dc_tools::*; diff --git a/src/context.rs b/src/context.rs index 9ca80c361..8f2b8e87b 100644 --- a/src/context.rs +++ b/src/context.rs @@ -1,9 +1,9 @@ use std::sync::{Arc, Condvar, Mutex, RwLock}; +use crate::chat::*; use crate::constants::*; use crate::contact::*; use crate::dc_array::*; -use crate::dc_chat::*; use crate::dc_job::*; use crate::dc_jobthread::*; use crate::dc_loginparam::*; diff --git a/src/dc_imex.rs b/src/dc_imex.rs index 4f8d80c3d..aff4dec8d 100644 --- a/src/dc_imex.rs +++ b/src/dc_imex.rs @@ -6,10 +6,10 @@ use mmime::mmapstring::*; use mmime::other::*; use rand::{thread_rng, Rng}; +use crate::chat::*; use crate::config::Config; use crate::constants::*; use crate::context::Context; -use crate::dc_chat::*; use crate::dc_configure::*; use crate::dc_e2ee::*; use crate::dc_job::*; diff --git a/src/dc_job.rs b/src/dc_job.rs index 8da295ed5..5b7f9bdd3 100644 --- a/src/dc_job.rs +++ b/src/dc_job.rs @@ -6,9 +6,9 @@ use std::time::Duration; use rand::{thread_rng, Rng}; +use crate::chat::*; use crate::constants::*; use crate::context::Context; -use crate::dc_chat::*; use crate::dc_configure::*; use crate::dc_imex::*; use crate::dc_jobthread::*; diff --git a/src/dc_location.rs b/src/dc_location.rs index 5c15c1ca5..bb3804b82 100644 --- a/src/dc_location.rs +++ b/src/dc_location.rs @@ -3,10 +3,10 @@ use std::ffi::CString; use quick_xml; use quick_xml::events::{BytesEnd, BytesStart, BytesText}; +use crate::chat::*; use crate::constants::Event; use crate::constants::*; use crate::context::*; -use crate::dc_chat::*; use crate::dc_job::*; use crate::dc_msg::*; use crate::dc_tools::*; diff --git a/src/dc_lot.rs b/src/dc_lot.rs index c9e7d072c..8b914aa17 100644 --- a/src/dc_lot.rs +++ b/src/dc_lot.rs @@ -1,7 +1,7 @@ +use crate::chat::*; use crate::constants::Chattype; use crate::contact::*; use crate::context::Context; -use crate::dc_chat::*; use crate::dc_msg::*; use crate::dc_tools::*; use crate::stock::StockMessage; diff --git a/src/dc_mimefactory.rs b/src/dc_mimefactory.rs index d51aede75..bc6f8ab7f 100644 --- a/src/dc_mimefactory.rs +++ b/src/dc_mimefactory.rs @@ -10,10 +10,10 @@ use mmime::mailmime_write_mem::*; use mmime::mmapstring::*; use mmime::other::*; +use crate::chat::*; use crate::constants::*; use crate::contact::*; use crate::context::{dc_get_version_str, Context}; -use crate::dc_chat::*; use crate::dc_e2ee::*; use crate::dc_location::*; use crate::dc_msg::*; diff --git a/src/dc_msg.rs b/src/dc_msg.rs index 6f4c11dad..ec043f6c2 100644 --- a/src/dc_msg.rs +++ b/src/dc_msg.rs @@ -1,10 +1,10 @@ use std::ffi::CString; use std::path::Path; +use crate::chat::*; use crate::constants::*; use crate::contact::*; use crate::context::*; -use crate::dc_chat::*; use crate::dc_job::*; use crate::dc_lot::dc_lot_t; use crate::dc_lot::*; diff --git a/src/dc_qr.rs b/src/dc_qr.rs index a1ac9535f..b5d46e8cc 100644 --- a/src/dc_qr.rs +++ b/src/dc_qr.rs @@ -1,9 +1,9 @@ use percent_encoding::percent_decode_str; +use crate::chat::*; use crate::constants::Blocked; use crate::contact::*; use crate::context::Context; -use crate::dc_chat::*; use crate::dc_lot::*; use crate::dc_strencode::*; use crate::dc_tools::*; diff --git a/src/dc_receive_imf.rs b/src/dc_receive_imf.rs index 1fed9da38..f6a53c2eb 100644 --- a/src/dc_receive_imf.rs +++ b/src/dc_receive_imf.rs @@ -1,5 +1,6 @@ -use itertools::join; +use std::ptr; +use itertools::join; use mmime::mailimf::*; use mmime::mailimf_types::*; use mmime::mailmime::*; @@ -8,12 +9,11 @@ use mmime::mailmime_types::*; use mmime::mmapstring::*; use mmime::other::*; use sha2::{Digest, Sha256}; -use std::ptr; +use crate::chat::*; use crate::constants::*; use crate::contact::*; use crate::context::Context; -use crate::dc_chat::*; use crate::dc_job::*; use crate::dc_location::*; use crate::dc_mimeparser::*; diff --git a/src/dc_securejoin.rs b/src/dc_securejoin.rs index afe0d328e..5ee3b9da8 100644 --- a/src/dc_securejoin.rs +++ b/src/dc_securejoin.rs @@ -4,10 +4,10 @@ use mmime::mailimf_types::*; use percent_encoding::{utf8_percent_encode, NON_ALPHANUMERIC}; use crate::aheader::EncryptPreference; +use crate::chat::*; use crate::constants::*; use crate::contact::*; use crate::context::Context; -use crate::dc_chat::*; use crate::dc_configure::*; use crate::dc_e2ee::*; use crate::dc_lot::*; diff --git a/src/lib.rs b/src/lib.rs index b2d7b4888..299e63cd6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -23,6 +23,7 @@ mod log; mod error; mod aheader; +pub mod chat; pub mod chatlist; pub mod config; pub mod constants; @@ -42,7 +43,6 @@ pub mod types; pub mod x; pub mod dc_array; -pub mod dc_chat; pub mod dc_configure; mod dc_dehtml; mod dc_e2ee; diff --git a/src/peerstate.rs b/src/peerstate.rs index 4f6ba5406..a2d2a74ec 100644 --- a/src/peerstate.rs +++ b/src/peerstate.rs @@ -4,9 +4,9 @@ use std::fmt; use num_traits::FromPrimitive; use crate::aheader::*; +use crate::chat::*; use crate::constants::*; use crate::context::Context; -use crate::dc_chat::*; use crate::key::*; use crate::sql::{self, Sql}; diff --git a/tests/stress.rs b/tests/stress.rs index 90b93aec6..351d09637 100644 --- a/tests/stress.rs +++ b/tests/stress.rs @@ -6,11 +6,11 @@ use std::ffi::CString; use mmime::mailimf_types::*; use tempfile::{tempdir, TempDir}; +use deltachat::chat::*; use deltachat::config; use deltachat::constants::*; use deltachat::contact::*; use deltachat::context::*; -use deltachat::dc_chat::*; use deltachat::dc_configure::*; use deltachat::dc_imex::*; use deltachat::dc_lot::*;