This commit is contained in:
koplenov 2026-05-08 00:51:26 +03:00
parent 17913397e6
commit e3d16753f6

View file

@ -1,4 +1,4 @@
namespace $.$$ { namespace $.$$ {
type Xmpp_contact = { type Xmpp_contact = {
jid: string jid: string
@ -267,7 +267,7 @@ private _getBody(el: Element): string | null {
`<field var="end"><value>${ this._esc(new Date(before_time - 1).toISOString()) }</value></field>` + `<field var="end"><value>${ this._esc(new Date(before_time - 1).toISOString()) }</value></field>` +
`</x>` `</x>`
: '' : ''
const before = before_id ? `<before>${ this._esc(before_id) }</before>` : `<before/>` const before = before_id ? `<before>${ this._esc(before_id) }</before>` : ``
this._send( this._send(
`<iq to="${ this._esc(room_jid) }" type="set" id="${ id }">` + `<iq to="${ this._esc(room_jid) }" type="set" id="${ id }">` +
`<query xmlns="urn:xmpp:mam:2" queryid="${ qid }">` + `<query xmlns="urn:xmpp:mam:2" queryid="${ qid }">` +
@ -285,7 +285,7 @@ private _getBody(el: Element): string | null {
const qid = this._id() const qid = this._id()
const id = this._id() const id = this._id()
this._mam_iqs.set(id, with_jid) this._mam_iqs.set(id, with_jid)
const before = before_id ? `<before>${ this._esc(before_id) }</before>` : `<before/>` const before = before_id ? `<before>${ this._esc(before_id) }</before>` : ``
this._send( this._send(
`<iq type="set" id="${ id }">` + `<iq type="set" id="${ id }">` +
`<query xmlns="urn:xmpp:mam:2" queryid="${ qid }">` + `<query xmlns="urn:xmpp:mam:2" queryid="${ qid }">` +
@ -627,11 +627,11 @@ private _handle_message(el: Element) {
private _last_displayed_sent = new Map<string, number>() // peer/room jid → time of last msg we marked displayed private _last_displayed_sent = new Map<string, number>() // peer/room jid → time of last msg we marked displayed
// XEP-0084 avatars // XEP-0084 avatars
private _avatars = new Map<string, string>() // bare jid data: URI private _avatars = new Map<string, string>() // bare jid в†’ data: URI
private _avatar_loading = new Set<string>() private _avatar_loading = new Set<string>()
// Suppress notifications during the first 5s after a fresh connection // Suppress notifications during the first 5s after a fresh connection
// covers servers that replay offline messages without proper <delay>. // — covers servers that replay offline messages without proper <delay>.
private _connect_at = 0 private _connect_at = 0
// IndexedDB for persistent message history (via $mol_db). // IndexedDB for persistent message history (via $mol_db).
@ -664,7 +664,7 @@ private _handle_message(el: Element) {
@ $mol_mem @ $mol_mem
contacts(next?: Xmpp_contact[]) { return next ?? [] } contacts(next?: Xmpp_contact[]) { return next ?? [] }
// Version counter incremented on every new message to trigger reactive re-renders. // Version counter — incremented on every new message to trigger reactive re-renders.
// Necessary because _msgs is a plain (non-reactive) array mutated in WebSocket callbacks. // Necessary because _msgs is a plain (non-reactive) array mutated in WebSocket callbacks.
@ $mol_mem @ $mol_mem
messages_ver(next?: number) { return next ?? 0 } messages_ver(next?: number) { return next ?? 0 }
@ -741,7 +741,7 @@ private _handle_message(el: Element) {
@ $mol_mem_key @ $mol_mem_key
recording(_jid: string, next?: boolean) { return next ?? false } recording(_jid: string, next?: boolean) { return next ?? false }
// ── Panes (Telegram-like 3-column layout) ───────────────────────────── // в”Ђв”Ђ Panes (Telegram-like 3-column layout) в”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђв”Ђ
panes() { panes() {
this._apply_theme() this._apply_theme()
@ -760,12 +760,12 @@ private _handle_message(el: Element) {
do_open_settings() { this.settings_open(true) } do_open_settings() { this.settings_open(true) }
do_close_settings() { this.settings_open(false) } do_close_settings() { this.settings_open(false) }
// Per-chat reactive flag true when scroll is near the bottom of Messages_list. // Per-chat reactive flag — true when scroll is near the bottom of Messages_list.
@ $mol_mem_key @ $mol_mem_key
scroll_at_bottom(_jid: string, next?: boolean) { return next ?? true } scroll_at_bottom(_jid: string, next?: boolean) { return next ?? true }
scroll_down_hidden(jid: string): string { scroll_down_hidden(jid: string): string | null {
return this.scroll_at_bottom(jid) ? 'hidden' : '' return this.scroll_at_bottom(jid) ? 'hidden' : null
} }
do_scroll_down(jid: string) { do_scroll_down(jid: string) {
@ -1838,7 +1838,7 @@ private _handle_message(el: Element) {
if (!account) return if (!account) return
try { try {
const db = await this._ensure_db() const db = await this._ensure_db()
const range = this.$.$mol_dom_context.IDBKeyRange.bound([account, ''], [account, '￿']) const range = this.$.$mol_dom_context.IDBKeyRange.bound([account, ''], [account, 'пїї'])
const docs = await db.read('Messages').Messages.select(range, 100_000) const docs = await db.read('Messages').Messages.select(range, 100_000)
if (!docs?.length) return if (!docs?.length) return
this._loading_persisted = true this._loading_persisted = true