Skip to content

Commit b1bdfbb

Browse files
committed
api(jsonrpc): Add CommandApi::create_group_chat_unencrypted() (#6927)
1 parent 3c86af0 commit b1bdfbb

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
@@ -945,7 +945,7 @@ impl CommandApi {
945945
Ok(contacts.iter().map(|id| id.to_u32()).collect::<Vec<u32>>())
946946
}
947947

948-
/// Create a new group chat.
948+
/// Create a new encrypted group chat (with PGP contacts).
949949
///
950950
/// After creation,
951951
/// the group has one member with the ID DC_CONTACT_ID_SELF
@@ -963,14 +963,24 @@ impl CommandApi {
963963
///
964964
/// @param protect If set to 1 the function creates group with protection initially enabled.
965965
/// Only verified members are allowed in these groups
966-
/// and end-to-end-encryption is always enabled.
967966
async fn create_group_chat(&self, account_id: u32, name: String, protect: bool) -> Result<u32> {
968967
let ctx = self.get_context(account_id).await?;
969968
let protect = match protect {
970969
true => ProtectionStatus::Protected,
971970
false => ProtectionStatus::Unprotected,
972971
};
973-
chat::create_group_chat(&ctx, protect, &name)
972+
chat::create_group_ex(&ctx, Some(protect), &name)
973+
.await
974+
.map(|id| id.to_u32())
975+
}
976+
977+
/// Create a new unencrypted group chat.
978+
///
979+
/// Same as [`Self::create_group_chat`], but the chat is unencrypted and can only have address
980+
/// contacts.
981+
async fn create_group_chat_unencrypted(&self, account_id: u32, name: String) -> Result<u32> {
982+
let ctx = self.get_context(account_id).await?;
983+
chat::create_group_ex(&ctx, None, &name)
974984
.await
975985
.map(|id| id.to_u32())
976986
}

0 commit comments

Comments
 (0)