mirror of
https://github.com/chatmail/core.git
synced 2026-04-24 17:06:28 +03:00
Merge pull request #1410 from deltachat/remove_addremove
remove all member_added/remove_events
This commit is contained in:
20
src/chat.rs
20
src/chat.rs
@@ -1796,7 +1796,6 @@ pub fn create_group_chat(
|
||||
}
|
||||
|
||||
/// add a contact to the chats_contact table
|
||||
/// on success emit MemberAdded event and return true
|
||||
pub(crate) fn add_to_chat_contacts_table(
|
||||
context: &Context,
|
||||
chat_id: ChatId,
|
||||
@@ -1808,14 +1807,7 @@ pub(crate) fn add_to_chat_contacts_table(
|
||||
"INSERT INTO chats_contacts (chat_id, contact_id) VALUES(?, ?)",
|
||||
params![chat_id, contact_id as i32],
|
||||
) {
|
||||
Ok(()) => {
|
||||
context.call_cb(Event::MemberAdded {
|
||||
chat_id,
|
||||
contact_id,
|
||||
});
|
||||
|
||||
true
|
||||
}
|
||||
Ok(()) => true,
|
||||
Err(err) => {
|
||||
error!(
|
||||
context,
|
||||
@@ -1828,7 +1820,6 @@ pub(crate) fn add_to_chat_contacts_table(
|
||||
}
|
||||
|
||||
/// remove a contact from the chats_contact table
|
||||
/// on success emit MemberRemoved event and return true
|
||||
pub(crate) fn remove_from_chat_contacts_table(
|
||||
context: &Context,
|
||||
chat_id: ChatId,
|
||||
@@ -1840,14 +1831,7 @@ pub(crate) fn remove_from_chat_contacts_table(
|
||||
"DELETE FROM chats_contacts WHERE chat_id=? AND contact_id=?",
|
||||
params![chat_id, contact_id as i32],
|
||||
) {
|
||||
Ok(()) => {
|
||||
context.call_cb(Event::MemberRemoved {
|
||||
chat_id,
|
||||
contact_id,
|
||||
});
|
||||
|
||||
true
|
||||
}
|
||||
Ok(()) => true,
|
||||
Err(_) => {
|
||||
warn!(
|
||||
context,
|
||||
|
||||
@@ -201,22 +201,4 @@ pub enum Event {
|
||||
/// (Bob has verified alice and waits until Alice does the same for him)
|
||||
#[strum(props(id = "2061"))]
|
||||
SecurejoinJoinerProgress { contact_id: u32, progress: usize },
|
||||
|
||||
/// This event is sent out to the inviter when a joiner successfully joined a group.
|
||||
/// @param data1 (int) chat_id
|
||||
/// @param data2 (int) contact_id
|
||||
#[strum(props(id = "2062"))]
|
||||
SecurejoinMemberAdded { chat_id: ChatId, contact_id: u32 },
|
||||
|
||||
/// This event is sent for each contact added to a chat.
|
||||
/// @param data1 (int) chat_id
|
||||
/// @param data2 (int) contact_id
|
||||
#[strum(props(id = "2063"))]
|
||||
MemberAdded { chat_id: ChatId, contact_id: u32 },
|
||||
|
||||
/// This event is sent for each contact removed from a chat.
|
||||
/// @param data1 (int) chat_id
|
||||
/// @param data2 (int) contact_id
|
||||
#[strum(props(id = "2064"))]
|
||||
MemberRemoved { chat_id: ChatId, contact_id: u32 },
|
||||
}
|
||||
|
||||
@@ -753,17 +753,12 @@ pub(crate) fn handle_securejoin_handshake(
|
||||
.get(HeaderDef::SecureJoinGroup)
|
||||
.map(|s| s.as_str())
|
||||
.unwrap_or_else(|| "");
|
||||
let (group_chat_id, _, _) = chat::get_chat_id_by_grpid(context, &field_grpid)
|
||||
.map_err(|err| {
|
||||
if let Err(err) = chat::get_chat_id_by_grpid(context, &field_grpid) {
|
||||
warn!(context, "Failed to lookup chat_id from grpid: {}", err);
|
||||
HandshakeError::ChatNotFound {
|
||||
return Err(HandshakeError::ChatNotFound {
|
||||
group: field_grpid.to_string(),
|
||||
}
|
||||
})?;
|
||||
context.call_cb(Event::MemberAdded {
|
||||
chat_id: group_chat_id,
|
||||
contact_id,
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
Ok(HandshakeMessage::Ignore) // "Done" deletes the message and breaks multi-device
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user