mirror of
https://github.com/logos-messaging/libchat.git
synced 2026-08-25 07:01:08 +00:00
feat: expose ConversationClass (serde derive + rename Private→Dm) (#214)
This commit is contained in:
Generated
+1
@@ -3359,6 +3359,7 @@ dependencies = [
|
||||
"prost",
|
||||
"rand 0.9.4",
|
||||
"rand_core 0.6.4",
|
||||
"serde",
|
||||
"shared-traits",
|
||||
"storage",
|
||||
"tempfile",
|
||||
|
||||
@@ -30,6 +30,7 @@ openmls_traits = "0.5.0"
|
||||
prost = "0.14.1"
|
||||
rand = "0.9"
|
||||
rand_core = { version = "0.6" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
thiserror = "2.0.17"
|
||||
tracing = "0.1.44"
|
||||
x25519-dalek = { version = "2.0.1", features = [
|
||||
|
||||
@@ -122,7 +122,7 @@ impl InboxV2 {
|
||||
|
||||
/// The convo built from an invite, paired with the display class its invite
|
||||
/// type implies: `InviteType::GroupV1` carries the pairwise DirectV1 welcome,
|
||||
/// so it is `Private`; `InviteType::GroupV2` is a real group.
|
||||
/// so it is `Dm`; `InviteType::GroupV2` is a real group.
|
||||
#[instrument(name = "inboxV2.handle_frame", skip_all, fields(user_id = %service_ctx.mls_identity.display_name()))]
|
||||
pub fn handle_frame<S: ExternalServices>(
|
||||
&self,
|
||||
@@ -143,7 +143,7 @@ impl InboxV2 {
|
||||
match payload {
|
||||
InviteType::GroupV1(inv) => {
|
||||
let convo = self.handle_heavy_invite(service_ctx, inv)?;
|
||||
Ok(Some((Box::new(convo), ConversationClass::Private)))
|
||||
Ok(Some((Box::new(convo), ConversationClass::Dm)))
|
||||
}
|
||||
InviteType::GroupV2(welcome_bytes) => {
|
||||
info!("Process WelcomeMessage");
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
//! initial [`ConvoOutcome`].
|
||||
//! - [`PayloadOutcome`] — the union of the above, plus `Empty`.
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use storage::ConversationKind;
|
||||
|
||||
use crate::conversation::ConversationId;
|
||||
@@ -68,9 +69,9 @@ impl From<InboxOutcome> for PayloadOutcome {
|
||||
}
|
||||
|
||||
/// Stable across protocol versions of the same conversation shape.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum ConversationClass {
|
||||
Private,
|
||||
Dm,
|
||||
Group,
|
||||
}
|
||||
|
||||
|
||||
@@ -189,7 +189,7 @@ fn direct_v1_by_account_address() {
|
||||
// though its welcome rides the InboxV2 (GroupV1 invite) path.
|
||||
let raya_convo_id = expect_event(&raya_events, "ConversationStarted", |e| match e {
|
||||
Event::ConversationStarted { convo_id, class } => {
|
||||
assert_eq!(class, ConversationClass::Private);
|
||||
assert_eq!(class, ConversationClass::Dm);
|
||||
Ok(convo_id)
|
||||
}
|
||||
other => Err(other),
|
||||
|
||||
Reference in New Issue
Block a user