From df4273e98615e4c0000e1ca2bb2c6b4da355a42c Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Wed, 23 Oct 2019 14:03:08 +0200 Subject: [PATCH] fix logic error: adding a member to a group is okay if a real contact exists or for SELF --- src/chat.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/chat.rs b/src/chat.rs index cc9b5734f..a68bd5abb 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -1366,8 +1366,8 @@ pub(crate) fn add_contact_to_chat_ex( chat_id ); ensure!( - Contact::real_exists_by_id(context, contact_id) && contact_id != DC_CONTACT_ID_SELF, - "invalid contact_id {} for removal in group", + Contact::real_exists_by_id(context, contact_id) || contact_id == DC_CONTACT_ID_SELF, + "invalid contact_id {} for adding to group", contact_id ); @@ -1387,10 +1387,10 @@ pub(crate) fn add_contact_to_chat_ex( .get_config(Config::ConfiguredAddr) .unwrap_or_default(); if contact.get_addr() == &self_addr { + // ourself is added using DC_CONTACT_ID_SELF, do not add this address explicitly. + // if SELF is not in the group, members cannot be added at all. bail!("invalid attempt to add self e-mail address to group"); } - // ourself is added using DC_CONTACT_ID_SELF, do not add it explicitly. - // if SELF is not in the group, members cannot be added at all. if is_contact_in_chat(context, chat_id, contact_id) { if !from_handshake {