Skip to content

Commit 0299543

Browse files
committed
api(jsonrpc): Add CommandApi::create_group_chat_unencrypted() (#6927)
1 parent d3908d6 commit 0299543

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

deltachat-jsonrpc/src/api.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,7 @@ impl CommandApi {
953953
Ok(contacts.iter().map(|id| id.to_u32()).collect::<Vec<u32>>())
954954
}
955955

956-
/// Create a new group chat.
956+
/// Create a new encrypted group chat (with key-contacts).
957957
///
958958
/// After creation,
959959
/// the group has one member with the ID DC_CONTACT_ID_SELF
@@ -971,14 +971,24 @@ impl CommandApi {
971971
///
972972
/// @param protect If set to 1 the function creates group with protection initially enabled.
973973
/// Only verified members are allowed in these groups
974-
/// and end-to-end-encryption is always enabled.
975974
async fn create_group_chat(&self, account_id: u32, name: String, protect: bool) -> Result<u32> {
976975
let ctx = self.get_context(account_id).await?;
977976
let protect = match protect {
978977
true => ProtectionStatus::Protected,
979978
false => ProtectionStatus::Unprotected,
980979
};
981-
chat::create_group_chat(&ctx, protect, &name)
980+
chat::create_group_ex(&ctx, Some(protect), &name)
981+
.await
982+
.map(|id| id.to_u32())
983+
}
984+
985+
/// Create a new unencrypted group chat.
986+
///
987+
/// Same as [`Self::create_group_chat`], but the chat is unencrypted and can only have
988+
/// address-contacts.
989+
async fn create_group_chat_unencrypted(&self, account_id: u32, name: String) -> Result<u32> {
990+
let ctx = self.get_context(account_id).await?;
991+
chat::create_group_ex(&ctx, None, &name)
982992
.await
983993
.map(|id| id.to_u32())
984994
}

0 commit comments

Comments
 (0)