mirror of
https://github.com/chatmail/core.git
synced 2026-05-03 13:26:28 +03:00
Use bool for from_id_blocked flag
This commit is contained in:
committed by
holger krekel
parent
0889467c7b
commit
a99b96e36e
@@ -861,14 +861,14 @@ impl Contact {
|
|||||||
.unwrap_or_default() as usize
|
.unwrap_or_default() as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_origin_by_id(context: &Context, contact_id: u32, ret_blocked: &mut i32) -> Origin {
|
pub fn get_origin_by_id(context: &Context, contact_id: u32, ret_blocked: &mut bool) -> Origin {
|
||||||
let mut ret = Origin::Unknown;
|
let mut ret = Origin::Unknown;
|
||||||
*ret_blocked = 0;
|
*ret_blocked = false;
|
||||||
|
|
||||||
if let Ok(contact) = Contact::load_from_db(context, contact_id) {
|
if let Ok(contact) = Contact::load_from_db(context, contact_id) {
|
||||||
/* we could optimize this by loading only the needed fields */
|
/* we could optimize this by loading only the needed fields */
|
||||||
if contact.blocked {
|
if contact.blocked {
|
||||||
*ret_blocked = 1;
|
*ret_blocked = true;
|
||||||
} else {
|
} else {
|
||||||
ret = contact.origin;
|
ret = contact.origin;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ pub fn dc_receive_imf(
|
|||||||
let mut incoming_origin = Origin::Unknown;
|
let mut incoming_origin = Origin::Unknown;
|
||||||
let mut to_self = false;
|
let mut to_self = false;
|
||||||
let mut from_id = 0u32;
|
let mut from_id = 0u32;
|
||||||
let mut from_id_blocked = 0;
|
let mut from_id_blocked = false;
|
||||||
let mut to_id = 0u32;
|
let mut to_id = 0u32;
|
||||||
let mut chat_id = 0;
|
let mut chat_id = 0;
|
||||||
let mut hidden = false;
|
let mut hidden = false;
|
||||||
@@ -285,7 +285,7 @@ fn add_parts(
|
|||||||
rfc724_mid: &str,
|
rfc724_mid: &str,
|
||||||
sent_timestamp: &mut i64,
|
sent_timestamp: &mut i64,
|
||||||
from_id: &mut u32,
|
from_id: &mut u32,
|
||||||
from_id_blocked: i32,
|
from_id_blocked: bool,
|
||||||
hidden: &mut bool,
|
hidden: &mut bool,
|
||||||
chat_id: &mut u32,
|
chat_id: &mut u32,
|
||||||
to_id: &mut u32,
|
to_id: &mut u32,
|
||||||
@@ -677,7 +677,7 @@ fn add_parts(
|
|||||||
if *chat_id == DC_CHAT_ID_TRASH {
|
if *chat_id == DC_CHAT_ID_TRASH {
|
||||||
*create_event_to_send = None;
|
*create_event_to_send = None;
|
||||||
} else if incoming && state == MessageState::InFresh {
|
} else if incoming && state == MessageState::InFresh {
|
||||||
if 0 != from_id_blocked {
|
if from_id_blocked {
|
||||||
*create_event_to_send = None;
|
*create_event_to_send = None;
|
||||||
} else if Blocked::Not != chat_id_blocked {
|
} else if Blocked::Not != chat_id_blocked {
|
||||||
*create_event_to_send = Some(CreateEvent::MsgsChanged);
|
*create_event_to_send = Some(CreateEvent::MsgsChanged);
|
||||||
|
|||||||
Reference in New Issue
Block a user