voelin-core: files, avatars, icons, pokes, offline messages, contacts
The new UI needs a channel file browser, avatars and icons, pokes, direct messages to anyone, the offline message inbox and a friends list. The voice connection can do all of it; the engine did not offer it. Files (module files): ListFiles, DownloadFile (to disk as <path>.part, renamed when complete, resumable, or into memory), DownloadChatFile for a FileRef from a chat message, UploadFile, CancelTransfer, DeleteFiles, RenameFile, CreateDirectory. Transfers stream in 64 KiB pieces and report Requested/Started/Progress (files.progress_interval_ms)/Done/ Failed/Cancelled; requests and transfers carry an id the caller picks. Avatars and icons are fetched by themselves (cache.fetch_images) into a content-addressed disk cache (module cache: avatars by MD5, icons by id, LRU bounded by cache.max_mb, 0 = no limit, use times kept as file times, concurrent downloads of one file deduplicated across sessions) and reported as AvatarReady / IconReady. SetAvatar uploads ours and announces its hash, or removes it. Pokes are a command and a distinct event (they were stored as private messages before). A failing voice command (e.g. a private message to a client who left) is now an error event instead of ending the connection. Offline messages (module offline) list, read, send, delete and mark. Contacts (module contacts) are engine-wide and stored in the client database: SetContact / RemoveContact, ContactsChanged, FriendPresence across all sessions, last seen time and server, per-person volume and mute applied in every session, blocked authors flagged in chat and their pokes and private messages hidden or flagged (privacy.block_mode), and stream.permissions = friends lets friends watch without asking. ServerDetails and Groups events report the server's details and groups when they change. The book mapping moved to its own module. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
This commit is contained in:
1 parent
1eb3c5ecd5
commit
f24da42aab
16 files changed
+3119
-388
No files matched your search
@@ -1044,8 +1044,8 @@ pub static STREAM_HARDWARE_ACCELERATION: Key<bool> = Key::new(
|
||||
pub enum StreamPermissions {
|
||||
/// Every join request is accepted.
|
||||
Everyone,
|
||||
/// Friends are accepted. Until there are contacts, every request is
|
||||
/// shown to the user ([`crate::Event::StreamViewerRequest`]).
|
||||
/// Friends (contacts marked friend) are accepted; others are shown to
|
||||
/// the user ([`crate::Event::StreamViewerRequest`]).
|
||||
Friends,
|
||||
/// Clients in our channel are accepted, others denied.
|
||||
#[default]
|
||||
@@ -1096,8 +1096,53 @@ pub static CHAT_RETENTION_DAYS: Key<u32> = Key::new(
|
||||
|| 0,
|
||||
);
|
||||
|
||||
/// Size of the avatar and icon cache in MiB; the least recently used files
|
||||
/// go first. 0: no limit.
|
||||
pub static CACHE_MAX_MB: Key<u64> = Key::new(
|
||||
"cache.max_mb",
|
||||
Kind::UInt { min: 0 },
|
||||
"Size of the avatar and icon cache in MiB (0: no limit).",
|
||||
|| 256,
|
||||
);
|
||||
|
||||
/// Download the avatars and icons of servers we are on by themselves.
|
||||
pub static CACHE_FETCH_IMAGES: Key<bool> = Key::new(
|
||||
"cache.fetch_images",
|
||||
Kind::Bool,
|
||||
"Download avatars and icons of the servers we are on.",
|
||||
|| true,
|
||||
);
|
||||
|
||||
/// How often a file transfer reports its progress (ms); 0: after every
|
||||
/// piece received or sent.
|
||||
pub static FILES_PROGRESS_MS: Key<u32> = Key::new(
|
||||
"files.progress_interval_ms",
|
||||
Kind::UInt { min: 0 },
|
||||
"How often a file transfer reports its progress, in ms (0: continuously).",
|
||||
|| 250,
|
||||
);
|
||||
|
||||
/// What happens to private messages and pokes of blocked contacts (their
|
||||
/// channel and server messages are always shown, flagged).
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum BlockMode {
|
||||
/// Dropped: neither reported nor stored.
|
||||
#[default]
|
||||
Hide,
|
||||
/// Reported and stored with `blocked` set.
|
||||
Flag,
|
||||
}
|
||||
|
||||
pub static PRIVACY_BLOCK_MODE: Key<BlockMode> = Key::new(
|
||||
"privacy.block_mode",
|
||||
Kind::Choice(&["hide", "flag"]),
|
||||
"Private messages and pokes of blocked contacts: hide them, or show them flagged.",
|
||||
BlockMode::default,
|
||||
);
|
||||
|
||||
/// The keys every [`Settings`] knows from the start.
|
||||
pub fn builtin_keys() -> [&'static dyn Setting; 15] {
|
||||
pub fn builtin_keys() -> [&'static dyn Setting; 19] {
|
||||
[
|
||||
&CRASH_REPORTS,
|
||||
&AUDIO,
|
||||
@@ -1114,6 +1159,10 @@ pub fn builtin_keys() -> [&'static dyn Setting; 15] {
|
||||
&CHAT_HISTORY_PAGE,
|
||||
&CHAT_DEDUPE_TOLERANCE_MS,
|
||||
&CHAT_RETENTION_DAYS,
|
||||
&CACHE_MAX_MB,
|
||||
&CACHE_FETCH_IMAGES,
|
||||
&FILES_PROGRESS_MS,
|
||||
&PRIVACY_BLOCK_MODE,
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user