mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 01:16:31 +03:00
fix ffi and bindings, error is already logged in core
This commit is contained in:
@@ -1068,7 +1068,7 @@ pub unsafe extern "C" fn dc_set_chat_protection(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
let ctx = &*context;
|
let ctx = &*context;
|
||||||
let protect = if let Some(s) = contact::ProtectionStatus::from_i32(protect) {
|
let protect = if let Some(s) = ProtectionStatus::from_i32(protect) {
|
||||||
s
|
s
|
||||||
} else {
|
} else {
|
||||||
eprintln!("bad protect-value for dc_set_chat_protection()");
|
eprintln!("bad protect-value for dc_set_chat_protection()");
|
||||||
@@ -1078,10 +1078,7 @@ pub unsafe extern "C" fn dc_set_chat_protection(
|
|||||||
block_on(async move {
|
block_on(async move {
|
||||||
match ChatId::new(chat_id).set_protection(&ctx, protect).await {
|
match ChatId::new(chat_id).set_protection(&ctx, protect).await {
|
||||||
Ok(()) => 1,
|
Ok(()) => 1,
|
||||||
Err(err) => {
|
Err(_) => 0,
|
||||||
error!(ctx, "Cannot protect chat. Are all members verified?");
|
|
||||||
0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -1207,7 +1204,7 @@ pub unsafe extern "C" fn dc_create_group_chat(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
let ctx = &*context;
|
let ctx = &*context;
|
||||||
let protect = if let Some(s) = contact::ProtectionStatus::from_i32(protect) {
|
let protect = if let Some(s) = ProtectionStatus::from_i32(protect) {
|
||||||
s
|
s
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -57,10 +57,7 @@ class Chat(object):
|
|||||||
|
|
||||||
:returns: True if chat is a group-chat, false if it's a contact 1:1 chat.
|
:returns: True if chat is a group-chat, false if it's a contact 1:1 chat.
|
||||||
"""
|
"""
|
||||||
return lib.dc_chat_get_type(self._dc_chat) in (
|
return lib.dc_chat_get_type(self._dc_chat) == const.DC_CHAT_TYPE_GROUP
|
||||||
const.DC_CHAT_TYPE_GROUP,
|
|
||||||
const.DC_CHAT_TYPE_VERIFIED_GROUP
|
|
||||||
)
|
|
||||||
|
|
||||||
def is_deaddrop(self):
|
def is_deaddrop(self):
|
||||||
""" return true if this chat is a deaddrop chat.
|
""" return true if this chat is a deaddrop chat.
|
||||||
@@ -86,9 +83,9 @@ class Chat(object):
|
|||||||
return not lib.dc_chat_is_unpromoted(self._dc_chat)
|
return not lib.dc_chat_is_unpromoted(self._dc_chat)
|
||||||
|
|
||||||
def is_protected(self):
|
def is_protected(self):
|
||||||
""" return True if this chat is a verified group.
|
""" return True if this chat is a protected chat.
|
||||||
|
|
||||||
:returns: True if chat is verified, False otherwise.
|
:returns: True if chat is protected, False otherwise.
|
||||||
"""
|
"""
|
||||||
return lib.dc_chat_is_protected(self._dc_chat)
|
return lib.dc_chat_is_protected(self._dc_chat)
|
||||||
|
|
||||||
|
|||||||
@@ -1144,7 +1144,7 @@ pub struct ChatInfo {
|
|||||||
///
|
///
|
||||||
/// On the C API this number is one of the
|
/// On the C API this number is one of the
|
||||||
/// `DC_CHAT_TYPE_UNDEFINED`, `DC_CHAT_TYPE_SINGLE`,
|
/// `DC_CHAT_TYPE_UNDEFINED`, `DC_CHAT_TYPE_SINGLE`,
|
||||||
/// `DC_CHAT_TYPE_GROUP` or `DC_CHAT_TYPE_VERIFIED_GROUP`
|
/// or `DC_CHAT_TYPE_GROUP`
|
||||||
/// constants.
|
/// constants.
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
pub type_: u32,
|
pub type_: u32,
|
||||||
|
|||||||
Reference in New Issue
Block a user