mirror of
https://github.com/logos-messaging/libchat.git
synced 2026-03-27 14:43:06 +00:00
32 lines
695 B
Rust
32 lines
695 B
Rust
|
|
use crate::conversation::{ChatError, ConversationId, Convo};
|
||
|
|
|
||
|
|
#[derive(Debug)]
|
||
|
|
pub struct Inbox {
|
||
|
|
address: String,
|
||
|
|
}
|
||
|
|
|
||
|
|
impl Inbox {
|
||
|
|
pub fn new(address: impl Into<String>) -> Self {
|
||
|
|
Self {
|
||
|
|
address: address.into(),
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
impl Convo for Inbox {
|
||
|
|
fn id(&self) -> ConversationId {
|
||
|
|
self.address.as_ref()
|
||
|
|
}
|
||
|
|
|
||
|
|
fn send_frame(&mut self, _message: &[u8]) -> Result<(), ChatError> {
|
||
|
|
todo!("Not Implemented")
|
||
|
|
}
|
||
|
|
|
||
|
|
fn handle_frame(&mut self, message: &[u8]) -> Result<(), ChatError> {
|
||
|
|
if message.len() == 0 {
|
||
|
|
return Err(ChatError::Protocol("Example error".into()));
|
||
|
|
}
|
||
|
|
todo!("Not Implemented")
|
||
|
|
}
|
||
|
|
}
|