diff --git a/src/constants.rs b/src/constants.rs index bfb2fbaf7..56b01ec18 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -19,20 +19,20 @@ pub enum MoveState { } // some defaults -pub const DC_E2EE_DEFAULT_ENABLED: i32 = 1; +const DC_E2EE_DEFAULT_ENABLED: i32 = 1; pub const DC_MDNS_DEFAULT_ENABLED: i32 = 1; -pub const DC_INBOX_WATCH_DEFAULT: i32 = 1; -pub const DC_SENTBOX_WATCH_DEFAULT: i32 = 1; -pub const DC_MVBOX_WATCH_DEFAULT: i32 = 1; -pub const DC_MVBOX_MOVE_DEFAULT: i32 = 1; +const DC_INBOX_WATCH_DEFAULT: i32 = 1; +const DC_SENTBOX_WATCH_DEFAULT: i32 = 1; +const DC_MVBOX_WATCH_DEFAULT: i32 = 1; +const DC_MVBOX_MOVE_DEFAULT: i32 = 1; pub const DC_CHAT_NOT_BLOCKED: i32 = 0; -pub const DC_CHAT_MANUALLY_BLOCKED: i32 = 1; +const DC_CHAT_MANUALLY_BLOCKED: i32 = 1; pub const DC_CHAT_DEADDROP_BLOCKED: i32 = 2; pub const DC_IMAP_SEEN: u32 = 0x1; -pub const DC_HANDSHAKE_CONTINUE_NORMAL_PROCESSING: i32 = 0x01; +const DC_HANDSHAKE_CONTINUE_NORMAL_PROCESSING: i32 = 0x01; pub const DC_HANDSHAKE_STOP_NORMAL_PROCESSING: i32 = 0x02; pub const DC_HANDSHAKE_ADD_DELETE_JOB: i32 = 0x04; @@ -40,47 +40,47 @@ pub const DC_GCL_ARCHIVED_ONLY: usize = 0x01; pub const DC_GCL_NO_SPECIALS: usize = 0x02; pub const DC_GCL_ADD_ALLDONE_HINT: usize = 0x04; -pub const DC_GCM_ADDDAYMARKER: usize = 0x01; +const DC_GCM_ADDDAYMARKER: usize = 0x01; -pub const DC_GCL_VERIFIED_ONLY: usize = 0x01; +const DC_GCL_VERIFIED_ONLY: usize = 0x01; pub const DC_GCL_ADD_SELF: usize = 0x02; /// param1 is a directory where the keys are written to -pub const DC_IMEX_EXPORT_SELF_KEYS: usize = 1; +const DC_IMEX_EXPORT_SELF_KEYS: usize = 1; /// param1 is a directory where the keys are searched in and read from -pub const DC_IMEX_IMPORT_SELF_KEYS: usize = 2; +const DC_IMEX_IMPORT_SELF_KEYS: usize = 2; /// param1 is a directory where the backup is written to -pub const DC_IMEX_EXPORT_BACKUP: usize = 11; +const DC_IMEX_EXPORT_BACKUP: usize = 11; /// param1 is the file with the backup to import -pub const DC_IMEX_IMPORT_BACKUP: usize = 12; +const DC_IMEX_IMPORT_BACKUP: usize = 12; /// id=contact -pub const DC_QR_ASK_VERIFYCONTACT: usize = 200; +const DC_QR_ASK_VERIFYCONTACT: usize = 200; /// text1=groupname -pub const DC_QR_ASK_VERIFYGROUP: usize = 202; +const DC_QR_ASK_VERIFYGROUP: usize = 202; /// id=contact -pub const DC_QR_FPR_OK: usize = 210; +const DC_QR_FPR_OK: usize = 210; /// id=contact -pub const DC_QR_FPR_MISMATCH: usize = 220; +const DC_QR_FPR_MISMATCH: usize = 220; /// test1=formatted fingerprint -pub const DC_QR_FPR_WITHOUT_ADDR: usize = 230; +const DC_QR_FPR_WITHOUT_ADDR: usize = 230; /// id=contact -pub const DC_QR_ADDR: usize = 320; +const DC_QR_ADDR: usize = 320; /// text1=text -pub const DC_QR_TEXT: usize = 330; +const DC_QR_TEXT: usize = 330; /// text1=URL -pub const DC_QR_URL: usize = 332; +const DC_QR_URL: usize = 332; /// text1=error string -pub const DC_QR_ERROR: usize = 400; +const DC_QR_ERROR: usize = 400; /// virtual chat showing all messages belonging to chats flagged with chats.blocked=2 -pub const DC_CHAT_ID_DEADDROP: usize = 1; +const DC_CHAT_ID_DEADDROP: usize = 1; /// messages that should be deleted get this chat_id; the messages are deleted from the working thread later then. This is also needed as rfc724_mid should be preset as long as the message is not deleted on the server (otherwise it is downloaded again) pub const DC_CHAT_ID_TRASH: usize = 3; /// a message is just in creation but not yet assigned to a chat (eg. we may need the message ID to set up blobs; this avoids unready message to be sent and shown) -pub const DC_CHAT_ID_MSGS_IN_CREATION: usize = 4; +const DC_CHAT_ID_MSGS_IN_CREATION: usize = 4; /// virtual chat showing all messages flagged with msgs.starred=2 -pub const DC_CHAT_ID_STARRED: usize = 5; +const DC_CHAT_ID_STARRED: usize = 5; /// only an indicator in a chatlist pub const DC_CHAT_ID_ARCHIVED_LINK: usize = 6; /// only an indicator in a chatlist @@ -88,16 +88,16 @@ pub const DC_CHAT_ID_ALLDONE_HINT: usize = 7; /// larger chat IDs are "real" chats, their messages are "real" messages. pub const DC_CHAT_ID_LAST_SPECIAL: usize = 9; -pub const DC_CHAT_TYPE_UNDEFINED: i32 = 0; +const DC_CHAT_TYPE_UNDEFINED: i32 = 0; pub const DC_CHAT_TYPE_SINGLE: i32 = 100; pub const DC_CHAT_TYPE_GROUP: i32 = 120; pub const DC_CHAT_TYPE_VERIFIED_GROUP: i32 = 130; pub const DC_MSG_ID_MARKER1: usize = 1; -pub const DC_MSG_ID_DAYMARKER: usize = 9; +const DC_MSG_ID_DAYMARKER: usize = 9; pub const DC_MSG_ID_LAST_SPECIAL: usize = 9; -pub const DC_STATE_UNDEFINED: i32 = 0; +const DC_STATE_UNDEFINED: i32 = 0; pub const DC_STATE_IN_FRESH: i32 = 10; pub const DC_STATE_IN_NOTICED: i32 = 13; pub const DC_STATE_IN_SEEN: i32 = 16; @@ -110,18 +110,18 @@ pub const DC_STATE_OUT_DELIVERED: i32 = 26; pub const DC_STATE_OUT_MDN_RCVD: i32 = 28; /// approx. max. length returned by dc_msg_get_text() -pub const DC_MAX_GET_TEXT_LEN: usize = 30000; +const DC_MAX_GET_TEXT_LEN: usize = 30000; /// approx. max. length returned by dc_get_msg_info() -pub const DC_MAX_GET_INFO_LEN: usize = 100000; +const DC_MAX_GET_INFO_LEN: usize = 100000; pub const DC_CONTACT_ID_UNDEFINED: usize = 0; pub const DC_CONTACT_ID_SELF: usize = 1; -pub const DC_CONTACT_ID_DEVICE: usize = 2; +const DC_CONTACT_ID_DEVICE: usize = 2; pub const DC_CONTACT_ID_LAST_SPECIAL: usize = 9; -pub const DC_TEXT1_DRAFT: usize = 1; -pub const DC_TEXT1_USERNAME: usize = 2; -pub const DC_TEXT1_SELF: usize = 3; +const DC_TEXT1_DRAFT: usize = 1; +const DC_TEXT1_USERNAME: usize = 2; +const DC_TEXT1_SELF: usize = 3; pub const DC_CREATE_MVBOX: usize = 1; @@ -137,7 +137,7 @@ pub const DC_LP_AUTH_OAUTH2: usize = 0x2; /// Force NORMAL authorization, this is the default. /// If this flag is set, automatic configuration is skipped. -pub const DC_LP_AUTH_NORMAL: usize = 0x4; +const DC_LP_AUTH_NORMAL: usize = 0x4; /// Connect to IMAP via STARTTLS. /// If this flag is set, automatic configuration is skipped. @@ -145,7 +145,7 @@ pub const DC_LP_IMAP_SOCKET_STARTTLS: usize = 0x100; /// Connect to IMAP via SSL. /// If this flag is set, automatic configuration is skipped. -pub const DC_LP_IMAP_SOCKET_SSL: usize = 0x200; +const DC_LP_IMAP_SOCKET_SSL: usize = 0x200; /// Connect to IMAP unencrypted, this should not be used. /// If this flag is set, automatic configuration is skipped. @@ -157,19 +157,19 @@ pub const DC_LP_SMTP_SOCKET_STARTTLS: usize = 0x10000; /// Connect to SMTP via SSL. /// If this flag is set, automatic configuration is skipped. -pub const DC_LP_SMTP_SOCKET_SSL: usize = 0x20000; +const DC_LP_SMTP_SOCKET_SSL: usize = 0x20000; /// Connect to SMTP unencrypted, this should not be used. /// If this flag is set, automatic configuration is skipped. pub const DC_LP_SMTP_SOCKET_PLAIN: usize = 0x40000; /// if none of these flags are set, the default is chosen -pub const DC_LP_AUTH_FLAGS: usize = (DC_LP_AUTH_OAUTH2 | DC_LP_AUTH_NORMAL); +const DC_LP_AUTH_FLAGS: usize = (DC_LP_AUTH_OAUTH2 | DC_LP_AUTH_NORMAL); /// if none of these flags are set, the default is chosen -pub const DC_LP_IMAP_SOCKET_FLAGS: usize = +const DC_LP_IMAP_SOCKET_FLAGS: usize = (DC_LP_IMAP_SOCKET_STARTTLS | DC_LP_IMAP_SOCKET_SSL | DC_LP_IMAP_SOCKET_PLAIN); /// if none of these flags are set, the default is chosen -pub const DC_LP_SMTP_SOCKET_FLAGS: usize = +const DC_LP_SMTP_SOCKET_FLAGS: usize = (DC_LP_SMTP_SOCKET_STARTTLS | DC_LP_SMTP_SOCKET_SSL | DC_LP_SMTP_SOCKET_PLAIN); #[derive(Debug, Display, Clone, Copy, PartialEq, Eq, FromPrimitive, ToPrimitive, FromSql, ToSql)] @@ -468,65 +468,65 @@ pub enum Event { GET_STRING = 2091, } -pub const DC_EVENT_FILE_COPIED: usize = 2055; // deprecated; -pub const DC_EVENT_IS_OFFLINE: usize = 2081; // deprecated; -pub const DC_ERROR_SEE_STRING: usize = 0; // deprecated; -pub const DC_ERROR_SELF_NOT_IN_GROUP: usize = 1; // deprecated; -pub const DC_STR_SELFNOTINGRP: usize = 21; // deprecated; +const DC_EVENT_FILE_COPIED: usize = 2055; // deprecated; +const DC_EVENT_IS_OFFLINE: usize = 2081; // deprecated; +const DC_ERROR_SEE_STRING: usize = 0; // deprecated; +const DC_ERROR_SELF_NOT_IN_GROUP: usize = 1; // deprecated; +const DC_STR_SELFNOTINGRP: usize = 21; // deprecated; /// Values for dc_get|set_config("show_emails") -pub const DC_SHOW_EMAILS_OFF: usize = 0; -pub const DC_SHOW_EMAILS_ACCEPTED_CONTACTS: usize = 1; -pub const DC_SHOW_EMAILS_ALL: usize = 2; +const DC_SHOW_EMAILS_OFF: usize = 0; +const DC_SHOW_EMAILS_ACCEPTED_CONTACTS: usize = 1; +const DC_SHOW_EMAILS_ALL: usize = 2; // TODO: Strings need some doumentation about used placeholders. // These constants are used to request strings using #DC_EVENT_GET_STRING. -pub const DC_STR_NOMESSAGES: usize = 1; -pub const DC_STR_SELF: usize = 2; -pub const DC_STR_DRAFT: usize = 3; -pub const DC_STR_MEMBER: usize = 4; -pub const DC_STR_CONTACT: usize = 6; -pub const DC_STR_VOICEMESSAGE: usize = 7; -pub const DC_STR_DEADDROP: usize = 8; -pub const DC_STR_IMAGE: usize = 9; -pub const DC_STR_VIDEO: usize = 10; -pub const DC_STR_AUDIO: usize = 11; -pub const DC_STR_FILE: usize = 12; -pub const DC_STR_STATUSLINE: usize = 13; -pub const DC_STR_NEWGROUPDRAFT: usize = 14; -pub const DC_STR_MSGGRPNAME: usize = 15; -pub const DC_STR_MSGGRPIMGCHANGED: usize = 16; -pub const DC_STR_MSGADDMEMBER: usize = 17; -pub const DC_STR_MSGDELMEMBER: usize = 18; -pub const DC_STR_MSGGROUPLEFT: usize = 19; -pub const DC_STR_GIF: usize = 23; -pub const DC_STR_ENCRYPTEDMSG: usize = 24; -pub const DC_STR_E2E_AVAILABLE: usize = 25; -pub const DC_STR_ENCR_TRANSP: usize = 27; -pub const DC_STR_ENCR_NONE: usize = 28; -pub const DC_STR_CANTDECRYPT_MSG_BODY: usize = 29; -pub const DC_STR_FINGERPRINTS: usize = 30; -pub const DC_STR_READRCPT: usize = 31; -pub const DC_STR_READRCPT_MAILBODY: usize = 32; -pub const DC_STR_MSGGRPIMGDELETED: usize = 33; -pub const DC_STR_E2E_PREFERRED: usize = 34; -pub const DC_STR_CONTACT_VERIFIED: usize = 35; -pub const DC_STR_CONTACT_NOT_VERIFIED: usize = 36; -pub const DC_STR_CONTACT_SETUP_CHANGED: usize = 37; -pub const DC_STR_ARCHIVEDCHATS: usize = 40; -pub const DC_STR_STARREDMSGS: usize = 41; -pub const DC_STR_AC_SETUP_MSG_SUBJECT: usize = 42; -pub const DC_STR_AC_SETUP_MSG_BODY: usize = 43; -pub const DC_STR_SELFTALK_SUBTITLE: usize = 50; -pub const DC_STR_CANNOT_LOGIN: usize = 60; -pub const DC_STR_SERVER_RESPONSE: usize = 61; -pub const DC_STR_MSGACTIONBYUSER: usize = 62; -pub const DC_STR_MSGACTIONBYME: usize = 63; -pub const DC_STR_MSGLOCATIONENABLED: usize = 64; -pub const DC_STR_MSGLOCATIONDISABLED: usize = 65; -pub const DC_STR_LOCATION: usize = 66; -pub const DC_STR_COUNT: usize = 66; +const DC_STR_NOMESSAGES: usize = 1; +const DC_STR_SELF: usize = 2; +const DC_STR_DRAFT: usize = 3; +const DC_STR_MEMBER: usize = 4; +const DC_STR_CONTACT: usize = 6; +const DC_STR_VOICEMESSAGE: usize = 7; +const DC_STR_DEADDROP: usize = 8; +const DC_STR_IMAGE: usize = 9; +const DC_STR_VIDEO: usize = 10; +const DC_STR_AUDIO: usize = 11; +const DC_STR_FILE: usize = 12; +const DC_STR_STATUSLINE: usize = 13; +const DC_STR_NEWGROUPDRAFT: usize = 14; +const DC_STR_MSGGRPNAME: usize = 15; +const DC_STR_MSGGRPIMGCHANGED: usize = 16; +const DC_STR_MSGADDMEMBER: usize = 17; +const DC_STR_MSGDELMEMBER: usize = 18; +const DC_STR_MSGGROUPLEFT: usize = 19; +const DC_STR_GIF: usize = 23; +const DC_STR_ENCRYPTEDMSG: usize = 24; +const DC_STR_E2E_AVAILABLE: usize = 25; +const DC_STR_ENCR_TRANSP: usize = 27; +const DC_STR_ENCR_NONE: usize = 28; +const DC_STR_CANTDECRYPT_MSG_BODY: usize = 29; +const DC_STR_FINGERPRINTS: usize = 30; +const DC_STR_READRCPT: usize = 31; +const DC_STR_READRCPT_MAILBODY: usize = 32; +const DC_STR_MSGGRPIMGDELETED: usize = 33; +const DC_STR_E2E_PREFERRED: usize = 34; +const DC_STR_CONTACT_VERIFIED: usize = 35; +const DC_STR_CONTACT_NOT_VERIFIED: usize = 36; +const DC_STR_CONTACT_SETUP_CHANGED: usize = 37; +const DC_STR_ARCHIVEDCHATS: usize = 40; +const DC_STR_STARREDMSGS: usize = 41; +const DC_STR_AC_SETUP_MSG_SUBJECT: usize = 42; +const DC_STR_AC_SETUP_MSG_BODY: usize = 43; +const DC_STR_SELFTALK_SUBTITLE: usize = 50; +const DC_STR_CANNOT_LOGIN: usize = 60; +const DC_STR_SERVER_RESPONSE: usize = 61; +const DC_STR_MSGACTIONBYUSER: usize = 62; +const DC_STR_MSGACTIONBYME: usize = 63; +const DC_STR_MSGLOCATIONENABLED: usize = 64; +const DC_STR_MSGLOCATIONDISABLED: usize = 65; +const DC_STR_LOCATION: usize = 66; +const DC_STR_COUNT: usize = 66; pub const DC_JOB_DELETE_MSG_ON_IMAP: i32 = 110; @@ -542,6 +542,6 @@ pub const DC_CMD_GROUPIMAGE_CHANGED: libc::c_int = 3; pub const DC_CMD_MEMBER_ADDED_TO_GROUP: libc::c_int = 4; pub const DC_CMD_MEMBER_REMOVED_FROM_GROUP: libc::c_int = 5; pub const DC_CMD_AUTOCRYPT_SETUP_MESSAGE: libc::c_int = 6; -pub const DC_CMD_SECUREJOIN_MESSAGE: libc::c_int = 7; +const DC_CMD_SECUREJOIN_MESSAGE: libc::c_int = 7; pub const DC_CMD_LOCATION_STREAMING_ENABLED: libc::c_int = 8; -pub const DC_CMD_LOCATION_ONLY: libc::c_int = 9; +const DC_CMD_LOCATION_ONLY: libc::c_int = 9; diff --git a/src/contact.rs b/src/contact.rs index 9b2f9da5b..62024bcd2 100644 --- a/src/contact.rs +++ b/src/contact.rs @@ -903,7 +903,7 @@ impl<'a> Contact<'a> { } } -pub fn get_first_name<'a>(full_name: &'a str) -> &'a str { +fn get_first_name<'a>(full_name: &'a str) -> &'a str { full_name.splitn(2, ' ').next().unwrap_or_default() } diff --git a/src/dc_array.rs b/src/dc_array.rs index 4faa2c14e..dffa9d2ef 100644 --- a/src/dc_array.rs +++ b/src/dc_array.rs @@ -259,11 +259,11 @@ pub fn dc_array_new(initsize: size_t) -> *mut dc_array_t { dc_array_t::new(initsize).into_raw() } -pub fn dc_array_new_locations(initsize: size_t) -> *mut dc_array_t { +fn dc_array_new_locations(initsize: size_t) -> *mut dc_array_t { dc_array_t::new_locations(initsize).into_raw() } -pub unsafe fn dc_array_empty(array: *mut dc_array_t) { +unsafe fn dc_array_empty(array: *mut dc_array_t) { assert!(!array.is_null()); (*array).clear() diff --git a/src/dc_chat.rs b/src/dc_chat.rs index 0bd8ad03e..4d89e5dce 100644 --- a/src/dc_chat.rs +++ b/src/dc_chat.rs @@ -88,7 +88,7 @@ pub unsafe fn dc_chat_unref(chat: *mut Chat) { Box::from_raw(chat); } -pub unsafe fn dc_chat_empty(mut chat: *mut Chat) { +unsafe fn dc_chat_empty(mut chat: *mut Chat) { if chat.is_null() { return; } @@ -107,7 +107,7 @@ pub unsafe fn dc_unblock_chat(context: &Context, chat_id: uint32_t) { dc_block_chat(context, chat_id, 0i32); } -pub fn dc_block_chat(context: &Context, chat_id: u32, new_blocking: libc::c_int) -> bool { +fn dc_block_chat(context: &Context, chat_id: u32, new_blocking: libc::c_int) -> bool { sql::execute( context, &context.sql, @@ -1756,7 +1756,7 @@ pub unsafe fn dc_remove_contact_from_chat( } // Should return Result -pub fn dc_set_group_explicitly_left(context: &Context, grpid: *const libc::c_char) { +fn dc_set_group_explicitly_left(context: &Context, grpid: *const libc::c_char) { if 0 == dc_is_group_explicitly_left(context, grpid) { sql::execute( context, diff --git a/src/dc_configure.rs b/src/dc_configure.rs index 4a0f4ba0f..45f68d1c7 100644 --- a/src/dc_configure.rs +++ b/src/dc_configure.rs @@ -33,7 +33,7 @@ macro_rules! progress { ******************************************************************************/ #[derive(Copy, Clone)] #[repr(C)] -pub struct dc_imapfolder_t { +struct dc_imapfolder_t { pub name_to_select: *mut libc::c_char, pub name_utf8: *mut libc::c_char, pub meaning: libc::c_int, @@ -43,7 +43,7 @@ pub struct dc_imapfolder_t { ******************************************************************************/ /* documentation: https://developer.mozilla.org/en-US/docs/Mozilla/Thunderbird/Autoconfiguration */ #[repr(C)] -pub struct moz_autoconfigure_t<'a> { +struct moz_autoconfigure_t<'a> { pub in_0: &'a dc_loginparam_t, pub in_emaildomain: *mut libc::c_char, pub in_emaillocalpart: *mut libc::c_char, @@ -58,7 +58,7 @@ pub struct moz_autoconfigure_t<'a> { * Outlook's Autodiscover ******************************************************************************/ #[repr(C)] -pub struct outlk_autodiscover_t<'a> { +struct outlk_autodiscover_t<'a> { pub in_0: &'a dc_loginparam_t, pub out: dc_loginparam_t, pub out_imap_set: libc::c_int, @@ -80,7 +80,7 @@ pub unsafe fn dc_configure(context: &Context) { dc_job_add(context, 900, 0, Params::new(), 0); } -pub unsafe fn dc_has_ongoing(context: &Context) -> libc::c_int { +unsafe fn dc_has_ongoing(context: &Context) -> libc::c_int { let s_a = context.running_state.clone(); let s = s_a.read().unwrap(); diff --git a/src/dc_job.rs b/src/dc_job.rs index 9143f9d22..8da295ed5 100644 --- a/src/dc_job.rs +++ b/src/dc_job.rs @@ -389,7 +389,7 @@ unsafe fn dc_job_do_DC_JOB_SEND(context: &Context, job: &mut dc_job_t) { } // this value does not increase the number of tries -pub unsafe fn dc_job_try_again_later( +unsafe fn dc_job_try_again_later( job: &mut dc_job_t, try_again: libc::c_int, pending_error: *const libc::c_char, diff --git a/src/dc_mimefactory.rs b/src/dc_mimefactory.rs index 5b1cbb06a..71d170124 100644 --- a/src/dc_mimefactory.rs +++ b/src/dc_mimefactory.rs @@ -52,8 +52,8 @@ pub struct dc_mimefactory_t<'a> { } #[allow(non_camel_case_types)] -pub type dc_mimefactory_loaded_t = libc::c_uint; -pub const DC_MF_MDN_LOADED: dc_mimefactory_loaded_t = 2; +type dc_mimefactory_loaded_t = libc::c_uint; +const DC_MF_MDN_LOADED: dc_mimefactory_loaded_t = 2; pub const DC_MF_MSG_LOADED: dc_mimefactory_loaded_t = 1; pub const DC_MF_NOTHING_LOADED: dc_mimefactory_loaded_t = 0; diff --git a/src/dc_mimeparser.rs b/src/dc_mimeparser.rs index 806f74841..978963133 100644 --- a/src/dc_mimeparser.rs +++ b/src/dc_mimeparser.rs @@ -62,7 +62,7 @@ pub struct dc_mimeparser_t<'a> { } // deprecated -pub unsafe fn dc_no_compound_msgs() { +unsafe fn dc_no_compound_msgs() { S_GENERATE_COMPOUND_MSGS = 0i32; } @@ -93,7 +93,7 @@ pub unsafe fn dc_mimeparser_unref(mimeparser: &mut dc_mimeparser_t) { dc_mimeparser_empty(mimeparser); } -pub unsafe fn dc_mimeparser_empty(mimeparser: &mut dc_mimeparser_t) { +unsafe fn dc_mimeparser_empty(mimeparser: &mut dc_mimeparser_t) { for part in mimeparser.parts.drain(..) { dc_mimepart_unref(part); } diff --git a/src/dc_msg.rs b/src/dc_msg.rs index c71adb469..3aa6010ca 100644 --- a/src/dc_msg.rs +++ b/src/dc_msg.rs @@ -546,7 +546,7 @@ pub unsafe fn dc_delete_msgs(context: &Context, msg_ids: *const uint32_t, msg_cn }; } -pub fn dc_update_msg_chat_id(context: &Context, msg_id: u32, chat_id: u32) -> bool { +fn dc_update_msg_chat_id(context: &Context, msg_id: u32, chat_id: u32) -> bool { sql::execute( context, &context.sql, diff --git a/src/dc_saxparser.rs b/src/dc_saxparser.rs index 2c7b669d7..570b56ac9 100644 --- a/src/dc_saxparser.rs +++ b/src/dc_saxparser.rs @@ -13,13 +13,13 @@ pub struct dc_saxparser_t { /* len is only informational, text is already null-terminated */ #[allow(non_camel_case_types)] -pub type dc_saxparser_text_cb_t = +type dc_saxparser_text_cb_t = Option ()>; #[allow(non_camel_case_types)] -pub type dc_saxparser_endtag_cb_t = +type dc_saxparser_endtag_cb_t = Option ()>; #[allow(non_camel_case_types)] -pub type dc_saxparser_starttag_cb_t = Option< +type dc_saxparser_starttag_cb_t = Option< unsafe fn(_: *mut libc::c_void, _: *const libc::c_char, _: *mut *mut libc::c_char) -> (), >; diff --git a/src/dc_strencode.rs b/src/dc_strencode.rs index 26800471b..1afd9cb3c 100644 --- a/src/dc_strencode.rs +++ b/src/dc_strencode.rs @@ -10,7 +10,7 @@ use crate::types::*; use crate::x::*; #[inline] -pub fn isalnum(c: libc::c_int) -> libc::c_int { +fn isalnum(c: libc::c_int) -> libc::c_int { if c < std::u8::MAX as libc::c_int { (c as u8 as char).is_ascii_alphanumeric() as libc::c_int } else { @@ -331,7 +331,7 @@ pub unsafe fn dc_decode_header_words(in_0: *const libc::c_char) -> *mut libc::c_ out } -pub unsafe fn dc_encode_modified_utf7( +unsafe fn dc_encode_modified_utf7( mut to_encode: *const libc::c_char, change_spaces: libc::c_int, ) -> *mut libc::c_char { @@ -481,7 +481,7 @@ static mut BASE64CHARS: [libc::c_char; 65] = [ 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 44, 0, ]; -pub unsafe fn dc_decode_modified_utf7( +unsafe fn dc_decode_modified_utf7( to_decode: *const libc::c_char, change_spaces: libc::c_int, ) -> *mut libc::c_char { diff --git a/src/dc_token.rs b/src/dc_token.rs index 8db5eae34..1ec2fdad2 100644 --- a/src/dc_token.rs +++ b/src/dc_token.rs @@ -4,7 +4,7 @@ use crate::sql; // Token namespaces #[allow(non_camel_case_types)] -pub type dc_tokennamespc_t = usize; +type dc_tokennamespc_t = usize; pub const DC_TOKEN_AUTH: dc_tokennamespc_t = 110; pub const DC_TOKEN_INVITENUMBER: dc_tokennamespc_t = 100; diff --git a/src/dc_tools.rs b/src/dc_tools.rs index d42915845..f93e9da10 100644 --- a/src/dc_tools.rs +++ b/src/dc_tools.rs @@ -120,7 +120,7 @@ pub unsafe fn dc_ftoa(f: libc::c_double) -> *mut libc::c_char { str } -pub unsafe fn dc_ltrim(buf: *mut libc::c_char) { +unsafe fn dc_ltrim(buf: *mut libc::c_char) { let mut len: size_t; let mut cur: *const libc::c_uchar; if !buf.is_null() && 0 != *buf as libc::c_int { @@ -140,7 +140,7 @@ pub unsafe fn dc_ltrim(buf: *mut libc::c_char) { }; } -pub unsafe fn dc_rtrim(buf: *mut libc::c_char) { +unsafe fn dc_rtrim(buf: *mut libc::c_char) { let mut len: size_t; let mut cur: *mut libc::c_uchar; if !buf.is_null() && 0 != *buf as libc::c_int { @@ -193,7 +193,7 @@ pub unsafe fn dc_null_terminate( out } -pub unsafe fn dc_binary_to_uc_hex(buf: *const uint8_t, bytes: size_t) -> *mut libc::c_char { +unsafe fn dc_binary_to_uc_hex(buf: *const uint8_t, bytes: size_t) -> *mut libc::c_char { if buf.is_null() || bytes == 0 { return std::ptr::null_mut(); } @@ -225,7 +225,7 @@ pub unsafe fn dc_remove_cr_chars(buf: *mut libc::c_char) { *p2 = 0 as libc::c_char; } -pub unsafe fn dc_unify_lineends(buf: *mut libc::c_char) { +unsafe fn dc_unify_lineends(buf: *mut libc::c_char) { dc_remove_cr_chars(buf); } @@ -295,7 +295,7 @@ pub unsafe fn dc_replace_bad_utf8_chars(buf: *mut libc::c_char) { } } -pub unsafe fn dc_utf8_strlen(s: *const libc::c_char) -> size_t { +unsafe fn dc_utf8_strlen(s: *const libc::c_char) -> size_t { if s.is_null() { return 0; } @@ -413,7 +413,7 @@ pub unsafe fn dc_free_splitted_lines(lines: Vec<*mut libc::c_char>) { } /* insert a break every n characters, the return must be free()'d */ -pub unsafe fn dc_insert_breaks( +unsafe fn dc_insert_breaks( in_0: *const libc::c_char, break_every: libc::c_int, break_chars: *const libc::c_char, @@ -816,7 +816,7 @@ pub unsafe fn dc_extract_grpid_from_rfc724_mid_list(list: *const clist) -> *mut } #[allow(non_snake_case)] -pub unsafe fn dc_ensure_no_slash(pathNfilename: *mut libc::c_char) { +unsafe fn dc_ensure_no_slash(pathNfilename: *mut libc::c_char) { let path_len = strlen(pathNfilename); if path_len > 0 && *pathNfilename.add(path_len - 1) as libc::c_int == '/' as i32 || *pathNfilename.add(path_len - 1) as libc::c_int == '\\' as i32 @@ -832,7 +832,7 @@ pub fn dc_ensure_no_slash_safe(path: &str) -> &str { path } -pub unsafe fn dc_validate_filename(filename: *mut libc::c_char) { +unsafe fn dc_validate_filename(filename: *mut libc::c_char) { /* function modifies the given buffer and replaces all characters not valid in filenames by a "-" */ let mut p1: *mut libc::c_char = filename; while 0 != *p1 { @@ -862,7 +862,7 @@ pub unsafe fn dc_get_filename(pathNfilename: *const libc::c_char) -> *mut libc:: // the case of the suffix is preserved #[allow(non_snake_case)] -pub unsafe fn dc_split_filename( +unsafe fn dc_split_filename( pathNfilename: *const libc::c_char, ret_basename: *mut *mut libc::c_char, ret_all_suffixes_incl_dot: *mut *mut libc::c_char, @@ -1162,7 +1162,7 @@ pub unsafe fn dc_is_blobdir_path(context: &Context, path: *const libc::c_char) - || strncmp(path, b"$BLOBDIR\x00" as *const u8 as *const libc::c_char, 8) == 0 } -pub unsafe fn dc_make_rel_path(context: &Context, path: *mut *mut libc::c_char) { +unsafe fn dc_make_rel_path(context: &Context, path: *mut *mut libc::c_char) { if path.is_null() || (*path).is_null() { return; } @@ -1387,7 +1387,7 @@ pub fn as_str<'a>(s: *const libc::c_char) -> &'a str { as_str_safe(s).unwrap_or_else(|err| panic!("{}", err)) } -pub fn as_str_safe<'a>(s: *const libc::c_char) -> Result<&'a str, Error> { +fn as_str_safe<'a>(s: *const libc::c_char) -> Result<&'a str, Error> { assert!(!s.is_null(), "cannot be used on null pointers"); let cstr = unsafe { CStr::from_ptr(s) }; diff --git a/src/imap.rs b/src/imap.rs index c1c84c97b..a477205c8 100644 --- a/src/imap.rs +++ b/src/imap.rs @@ -13,13 +13,13 @@ use crate::dc_tools::CStringExt; use crate::oauth2::dc_get_oauth2_access_token; use crate::types::*; -pub const DC_IMAP_SEEN: usize = 0x0001; -pub const DC_REGENERATE: usize = 0x01; +const DC_IMAP_SEEN: usize = 0x0001; +const DC_REGENERATE: usize = 0x01; -pub const DC_SUCCESS: usize = 3; -pub const DC_ALREADY_DONE: usize = 2; -pub const DC_RETRY_LATER: usize = 1; -pub const DC_FAILED: usize = 0; +const DC_SUCCESS: usize = 3; +const DC_ALREADY_DONE: usize = 2; +const DC_RETRY_LATER: usize = 1; +const DC_FAILED: usize = 0; const PREFETCH_FLAGS: &str = "(UID ENVELOPE)"; const BODY_FLAGS: &str = "(FLAGS BODY.PEEK[])"; @@ -60,13 +60,13 @@ impl imap::Authenticator for OAuth2 { } #[derive(Debug)] -pub enum FolderMeaning { +enum FolderMeaning { Unknown, SentObjects, Other, } -pub enum Client { +enum Client { Secure( imap::Client>, net::TcpStream, @@ -74,12 +74,12 @@ pub enum Client { Insecure(imap::Client, net::TcpStream), } -pub enum Session { +enum Session { Secure(imap::Session>), Insecure(imap::Session), } -pub enum IdleHandle<'a> { +enum IdleHandle<'a> { Secure(imap::extensions::idle::Handle<'a, native_tls::TlsStream>), Insecure(imap::extensions::idle::Handle<'a, net::TcpStream>), } @@ -308,7 +308,7 @@ impl Session { } } -pub struct ImapConfig { +struct ImapConfig { pub addr: String, pub imap_server: String, pub imap_port: u16, diff --git a/src/key.rs b/src/key.rs index bb7ac3115..84138adc5 100644 --- a/src/key.rs +++ b/src/key.rs @@ -306,7 +306,7 @@ pub fn dc_key_save_self_keypair( } /// Make a fingerprint human-readable, in hex format. -pub fn dc_format_fingerprint(fingerprint: &str) -> String { +fn dc_format_fingerprint(fingerprint: &str) -> String { // split key into chunks of 4 with space, and 20 newline let mut res = String::new(); diff --git a/src/lib.rs b/src/lib.rs index afbdad728..8ac561b2b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -20,52 +20,52 @@ extern crate strum_macros; #[macro_use] mod log; #[macro_use] -pub mod error; +mod error; -pub mod aheader; +mod aheader; pub mod chatlist; pub mod config; pub mod constants; pub mod contact; pub mod context; -pub mod imap; +mod imap; pub mod key; pub mod keyring; pub mod oauth2; -pub mod param; +mod param; pub mod peerstate; pub mod pgp; -pub mod smtp; +mod smtp; pub mod sql; -pub mod stock; +mod stock; pub mod types; pub mod x; pub mod dc_array; pub mod dc_chat; pub mod dc_configure; -pub mod dc_dehtml; -pub mod dc_e2ee; +mod dc_dehtml; +mod dc_e2ee; pub mod dc_imex; pub mod dc_job; -pub mod dc_jobthread; +mod dc_jobthread; pub mod dc_location; -pub mod dc_loginparam; +mod dc_loginparam; pub mod dc_lot; -pub mod dc_mimefactory; +mod dc_mimefactory; pub mod dc_mimeparser; -pub mod dc_move; +mod dc_move; pub mod dc_msg; pub mod dc_qr; pub mod dc_receive_imf; pub mod dc_saxparser; pub mod dc_securejoin; -pub mod dc_simplify; -pub mod dc_strencode; -pub mod dc_token; +mod dc_simplify; +mod dc_strencode; +mod dc_token; pub mod dc_tools; -pub use self::constants::*; +use self::constants::*; #[cfg(test)] -pub mod test_utils; +mod test_utils; diff --git a/src/oauth2.rs b/src/oauth2.rs index 04d3deb6a..0cd1cad71 100644 --- a/src/oauth2.rs +++ b/src/oauth2.rs @@ -23,7 +23,7 @@ const OAUTH2_YANDEX: Oauth2 = Oauth2 { }; #[derive(Debug, Clone, PartialEq, Eq)] -pub struct Oauth2 { +struct Oauth2 { client_id: &'static str, get_code: &'static str, init_token: &'static str, diff --git a/src/peerstate.rs b/src/peerstate.rs index de0e01abe..4f6ba5406 100644 --- a/src/peerstate.rs +++ b/src/peerstate.rs @@ -85,7 +85,7 @@ pub enum DegradeEvent { } #[derive(Debug, Copy, Clone, PartialEq, Eq)] -pub enum VerifiedKey { +enum VerifiedKey { Gossip, Public, None, diff --git a/src/types.rs b/src/types.rs index 9bffd2514..93fbd973d 100644 --- a/src/types.rs +++ b/src/types.rs @@ -34,14 +34,14 @@ pub type dc_precheck_imf_t = pub type dc_set_config_t = fn(_: &Context, _: &str, _: Option<&str>) -> (); pub type dc_get_config_t = fn(_: &Context, _: &str) -> Option; -pub type sqlite_int64 = i64; -pub type sqlite3_int64 = sqlite_int64; +type sqlite_int64 = i64; +type sqlite3_int64 = sqlite_int64; pub type int32_t = i32; -pub type int64_t = i64; +type int64_t = i64; pub type uintptr_t = libc::uintptr_t; pub type size_t = libc::size_t; -pub type ssize_t = libc::ssize_t; +type ssize_t = libc::ssize_t; pub type uint32_t = libc::c_uint; pub type uint8_t = libc::c_uchar; pub type uint16_t = libc::c_ushort;