mirror of
https://github.com/chatmail/core.git
synced 2026-04-26 01:46:34 +03:00
refactor(chat): rename dc_chat to chat
This commit is contained in:
@@ -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, T>(s: S) -> Option<T>
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user