move markread into its own module file

This commit is contained in:
Jean Chevronnet 2026-08-08 22:47:10 +00:00
parent 50a95c6686
commit 768435d810
4 changed files with 106 additions and 64 deletions

View file

@ -164,7 +164,6 @@ pub struct Server {
// output primitives are `&self`.
pub label_capture: RefCell<Option<(Uid, Vec<String>)>>,
pub history: HashMap<String, VecDeque<HistMsg>>, // channel key -> recent messages (CHATHISTORY)
pub read_markers: HashMap<String, HashMap<String, u64>>, // identity -> target -> read ts (MARKREAD)
pub mline: HashMap<Uid, MlineBatch>, // in-progress inbound multiline batches
pub event_tx: Sender<Event>, // self-inject events (DNS results)
pub conn_counter: Arc<AtomicU64>, // mints connection uids (for CONNECT dials)
@ -214,7 +213,6 @@ impl Server {
webirc: cfg.webirc,
label_capture: RefCell::new(None),
history: HashMap::new(),
read_markers: HashMap::new(),
mline: HashMap::new(),
event_tx,
conn_counter,
@ -329,16 +327,6 @@ impl Server {
Some((mb.target, mb.notice, lines))
}
/// The read-marker identity for `uid`: their account when logged in (so markers
/// are shared across their devices and survive reconnects), else a per-session
/// key. `remove_user` prunes the session key on disconnect.
pub fn marker_id(&self, uid: Uid) -> String {
self.users
.get(&uid)
.and_then(|u| u.account.clone())
.unwrap_or_else(|| format!("~{uid}"))
}
// --- connection lifecycle ------------------------------------------------
pub fn add_conn(
@ -516,7 +504,6 @@ impl Server {
return;
};
self.uuid_local.remove(&user.uuid);
self.read_markers.remove(&format!("~{uid}")); // session read-markers (kept if account-keyed)
self.mline.remove(&uid); // any half-open multiline batch
if user.registered {
self.push_whowas(