pub struct Chat {Show 15 fields
pub id: String,
pub chat_type: ChatType,
pub participants: Vec<u16>,
pub messages: CompactMessageVec,
pub last_read: [u8; 32],
pub created_at: u64,
pub metadata: ChatMetadata,
pub muted: bool,
pub typing_participants: Vec<(u16, u64)>,
pub wallpaper_path: String,
pub wallpaper_ts: u64,
pub wallpaper_blur: u8,
pub wallpaper_dim: u8,
pub wallpaper_url: String,
pub wallpaper_uploader: String,
}Fields§
§id: String§chat_type: ChatType§participants: Vec<u16>§messages: CompactMessageVec§last_read: [u8; 32]§created_at: u64§metadata: ChatMetadata§muted: bool§typing_participants: Vec<(u16, u64)>§wallpaper_path: StringLocal cached file path for the per-DM wallpaper, or empty when unset. Populated from the most recent kind-30078 d=vector-wallpaper rumor received for this chat (the encrypted Blossom file is fetched and decrypted to this path).
wallpaper_ts: u64Rumor created_at (Unix seconds) that produced the current wallpaper. Used as the latest-write-wins tiebreaker on concurrent sets.
wallpaper_blur: u8Blur amount in pixels applied to the wallpaper background layer (0..=30, clamped on read). 0 means no blur.
wallpaper_dim: u8Brightness percent applied to the wallpaper background layer (0..=100, clamped on read). 100 means no darkening; 0 is fully dim. Default 70 keeps text readable on photographic wallpapers.
wallpaper_url: StringBlossom URL of the encrypted wallpaper blob currently in effect. Used to DELETE the previous blob when we (or our other device) replace the wallpaper, so stale uploads don’t linger on servers.
wallpaper_uploader: Stringnpub (bech32) of whichever account uploaded the current wallpaper. Gate on this before issuing the Blossom DELETE — only the original uploader’s signature satisfies the server’s auth challenge.
Implementations§
Source§impl Chat
impl Chat
pub fn new(id: String, chat_type: ChatType, participants: Vec<u16>) -> Self
pub fn new_dm(their_npub: String, interner: &mut NpubInterner) -> Self
Sourcepub fn new_community_channel(
channel_id: String,
participants: Vec<String>,
interner: &mut NpubInterner,
) -> Self
pub fn new_community_channel( channel_id: String, participants: Vec<String>, interner: &mut NpubInterner, ) -> Self
A Community channel chat (GROUP_PROTOCOL.md). channel_id is the channel’s
stable random id (hex); participants are the members known so far.
pub fn message_count(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn last_message_time(&self) -> Option<u64>
pub fn has_message(&self, id: &str) -> bool
pub fn get_compact_message(&self, id: &str) -> Option<&CompactMessage>
pub fn get_compact_message_mut( &mut self, id: &str, ) -> Option<&mut CompactMessage>
pub fn get_message(&self, id: &str, interner: &NpubInterner) -> Option<Message>
pub fn iter_compact(&self) -> Iter<'_, CompactMessage>
pub fn get_all_messages(&self, interner: &NpubInterner) -> Vec<Message>
pub fn get_last_messages( &self, n: usize, interner: &NpubInterner, ) -> Vec<Message>
pub fn add_message( &mut self, message: Message, interner: &mut NpubInterner, ) -> bool
pub fn add_compact_message(&mut self, message: CompactMessage) -> bool
pub fn set_as_read(&mut self) -> bool
pub fn internal_add_message( &mut self, message: Message, interner: &mut NpubInterner, ) -> bool
pub fn get_message_mut(&mut self, id: &str) -> Option<&mut CompactMessage>
pub fn to_serializable(&self, interner: &NpubInterner) -> SerializableChat
pub fn to_serializable_with_last_n( &self, n: usize, interner: &NpubInterner, ) -> SerializableChat
pub fn get_other_participant( &self, my_npub: &str, interner: &NpubInterner, ) -> Option<String>
pub fn is_dm_with(&self, npub: &str, interner: &NpubInterner) -> bool
pub fn is_community(&self) -> bool
pub fn has_participant(&self, npub: &str, interner: &NpubInterner) -> bool
pub fn get_active_typers(&self, interner: &NpubInterner) -> Vec<String>
pub fn update_typing_participant(&mut self, handle: u16, expires_at: u64)
pub fn id(&self) -> &String
pub fn chat_type(&self) -> &ChatType
pub fn participants(&self) -> &[u16]
pub fn last_read(&self) -> &[u8; 32]
pub fn created_at(&self) -> u64
pub fn metadata(&self) -> &ChatMetadata
pub fn muted(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Chat
impl RefUnwindSafe for Chat
impl Send for Chat
impl Sync for Chat
impl Unpin for Chat
impl UnsafeUnpin for Chat
impl UnwindSafe for Chat
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more