chore: isolate ffi functions

This commit is contained in:
kaichaosun 2026-02-03 14:53:55 +08:00
parent 2e48e49a9a
commit 0ca0bb9548
No known key found for this signature in database
GPG Key ID: 223E0F992F4F03BF
9 changed files with 15 additions and 14 deletions

View File

@ -1,7 +1,7 @@
use std::{collections::HashMap, rc::Rc, sync::Arc};
use crate::{
dm::common::{HasConversationId, OutboundSession, SessionRegistry},
common::{HasConversationId, OutboundSession, SessionRegistry},
errors::ChatError,
identity::Identity,
inbox::Inbox,

View File

@ -1,2 +1 @@
pub mod common;
pub mod privatev1;

View File

@ -6,7 +6,7 @@ use crypto::SecretKey;
use prost::{Message, bytes::Bytes};
use crate::{
dm::common::{HasConversationId, OutboundSession, SessionId},
common::{HasConversationId, OutboundSession, SessionId},
errors::ChatError,
types::AddressedEncryptedPayload,
utils::timestamp_millis,

View File

@ -0,0 +1 @@
pub mod api;

View File

@ -7,8 +7,8 @@ use std::rc::Rc;
use crypto::{PrekeyBundle, SecretKey};
use crate::common::{HasConversationId, InboundSessionHandler, OutboundSession, SessionId};
use crate::context::Introduction;
use crate::dm::common::{HasConversationId, InboundSessionHandler, OutboundSession, SessionId};
use crate::dm::privatev1::PrivateV1Convo;
use crate::errors::ChatError;
use crate::identity::Identity;

View File

@ -1,20 +1,23 @@
mod api;
mod context;
pub mod common;
pub mod dm;
mod errors;
mod group;
mod identity;
pub mod ffi;
pub mod group;
pub mod inbox;
mod context;
mod errors;
mod identity;
mod proto;
mod types;
mod utils;
pub use api::*;
#[cfg(test)]
mod tests {
use super::*;
use crate::ffi::api::{
create_context, create_intro_bundle, create_new_private_convo, destroy_context,
handle_payload,
};
use std::str::FromStr;
#[test]

View File

@ -1,7 +1,5 @@
use crate::proto::{self, Message};
// FFI Type definitions
// This struct represents Outbound data.
// It wraps an encoded payload with a delivery address, so it can be handled by the delivery service.
pub struct AddressedEnvelope {