Move ContactId constants to struct.

This makes the APIs much more Rust-like and keep contact IDs clearer
and in one place.
This commit is contained in:
Floris Bruynooghe
2022-04-03 14:08:27 +02:00
parent 918ee47c79
commit 35c0434dc7
20 changed files with 243 additions and 267 deletions

View File

@@ -670,7 +670,7 @@ mod tests {
use crate::chat::{
get_chat_contacts, get_chat_msgs, send_msg, set_muted, Chat, ChatId, MuteDuration,
};
use crate::constants::DC_CONTACT_ID_SELF;
use crate::contact::ContactId;
use crate::dc_receive_imf::dc_receive_imf;
use crate::dc_tools::dc_create_outgoing_rfc724_mid;
use crate::message::{Message, Viewtype};
@@ -956,7 +956,7 @@ mod tests {
#[async_std::test]
async fn test_search_msgs() -> Result<()> {
let alice = TestContext::new_alice().await;
let self_talk = ChatId::create_for_contact(&alice, DC_CONTACT_ID_SELF).await?;
let self_talk = ChatId::create_for_contact(&alice, ContactId::SELF).await?;
let chat = alice
.create_chat_with_contact("Bob", "bob@example.org")
.await;