refactor: turn DC_CHAT_ID_* into ChatId::* associated constants

We already have it done for ContactId.
This commit is contained in:
link2xt
2026-08-22 00:55:07 +00:00
committed by l
parent 0b2ff5d0e2
commit fe25e93d6c
19 changed files with 98 additions and 116 deletions

View File

@@ -1774,8 +1774,7 @@ pub unsafe extern "C" fn dc_set_chat_name(
chat_id: u32,
name: *const libc::c_char,
) -> libc::c_int {
if context.is_null() || chat_id <= constants::DC_CHAT_ID_LAST_SPECIAL.to_u32() || name.is_null()
{
if context.is_null() || chat_id <= ChatId::LAST_SPECIAL.to_u32() || name.is_null() {
eprintln!("ignoring careless call to dc_set_chat_name()");
return 0;
}
@@ -1796,7 +1795,7 @@ pub unsafe extern "C" fn dc_set_chat_profile_image(
chat_id: u32,
image: *const libc::c_char,
) -> libc::c_int {
if context.is_null() || chat_id <= constants::DC_CHAT_ID_LAST_SPECIAL.to_u32() {
if context.is_null() || chat_id <= ChatId::LAST_SPECIAL.to_u32() {
eprintln!("ignoring careless call to dc_set_chat_profile_image()");
return 0;
}
@@ -1958,7 +1957,7 @@ pub unsafe extern "C" fn dc_forward_msgs(
if context.is_null()
|| msg_ids.is_null()
|| msg_cnt <= 0
|| chat_id <= constants::DC_CHAT_ID_LAST_SPECIAL.to_u32()
|| chat_id <= ChatId::LAST_SPECIAL.to_u32()
{
eprintln!("ignoring careless call to dc_forward_msgs()");
return;
@@ -2462,7 +2461,7 @@ pub unsafe extern "C" fn dc_send_locations_to_chat(
chat_id: u32,
seconds: libc::c_int,
) {
if context.is_null() || chat_id <= constants::DC_CHAT_ID_LAST_SPECIAL.to_u32() || seconds < 0 {
if context.is_null() || chat_id <= ChatId::LAST_SPECIAL.to_u32() || seconds < 0 {
eprintln!("ignoring careless call to dc_send_locations_to_chat()");
return;
}