Ask for the backlog on the phone, as the desktop does
A room on the APK only ever showed lines said after you connected. freeq
re-joins an authenticated user's channels at registration and leaves the
backlog for the client to ask for, and the phone never asked: its 366
branch called members/names-done and stopped there, where frq.state sends
CHATHISTORY LATEST on the same numeric when the buffer is empty.
Same request, same condition. Nothing else was needed — neither half
handles BATCH, so the replayed lines come back as ordinary PRIVMSGs the
branch below already folds.
They still render untimed: the PRIVMSG branch keeps {:from :text} and
drops the time tag, so a week-old line reads as having just been said.
That is the message shape, and a separate change.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>7dff3cf parent: 939d2ac modified
flutter/src/frq/main.cljd +17 -1 | @@ -50,6 +50,10 @@ | ||
| 50 | 50 | |
| 51 | 51 | (defonce ^:private last-line (atom nil)) |
| 52 | 52 | |
| 53 | +(def ^:private history-limit | |
| 54 | + "How many lines of backlog to ask a room for, as `frq.state` asks for them." | |
| 55 | + 100) | |
| 56 | + | |
| 53 | 57 | (defn- room! |
| 54 | 58 | "The little of `frq.state/apply-msg!` the conversation list needs: the two |
| 55 | 59 | messages that make a room appear and give it a last line, and everything |
| @@ -84,7 +88,19 @@ | ||
| 84 | 88 | |
| 85 | 89 | (= "366" cmd) |
| 86 | 90 | (let [name (nth params 1 nil)] |
| 87 | - (when name (swap! cells/channels members/names-done name))) | |
| 91 | + (when name | |
| 92 | + (swap! cells/channels members/names-done name) | |
| 93 | + ;; End of NAMES, and the only moment this client knows a room is | |
| 94 | + ;; fully arrived. freeq re-joins an authenticated user's channels at | |
| 95 | + ;; registration and leaves the backlog for the client to ask for, so | |
| 96 | + ;; a room that reaches here with an empty buffer has no history | |
| 97 | + ;; coming unless we ask — which is why nothing but new lines ever | |
| 98 | + ;; appeared here. Same request `frq.state` makes on 366, and the | |
| 99 | + ;; replayed lines come back as ordinary PRIVMSGs the branch below | |
| 100 | + ;; already folds. | |
| 101 | + (when (and @conn (empty? (get-in @cells/channels [name :messages]))) | |
| 102 | + (net/send-line! @conn | |
| 103 | + (str "CHATHISTORY LATEST " name " * " history-limit))))) | |
| 88 | 104 | |
| 89 | 105 | (= "PART" cmd) |
| 90 | 106 | (swap! cells/channels members/remove-user (first params) who) |
| @@ -50,6 +50,10 @@ | |||
| 50 | 50 | ||
| 51 | (defonce ^:private last-line (atom nil)) | 51 | (defonce ^:private last-line (atom nil)) |
| 52 | 52 | ||
| 53 | +(def ^:private history-limit | ||
| 54 | + "How many lines of backlog to ask a room for, as `frq.state` asks for them." | ||
| 55 | + 100) | ||
| 56 | + | ||
| 53 | (defn- room! | 57 | (defn- room! |
| 54 | "The little of `frq.state/apply-msg!` the conversation list needs: the two | 58 | "The little of `frq.state/apply-msg!` the conversation list needs: the two |
| 55 | messages that make a room appear and give it a last line, and everything | 59 | messages that make a room appear and give it a last line, and everything |
| @@ -84,7 +88,19 @@ | |||
| 84 | 88 | ||
| 85 | (= "366" cmd) | 89 | (= "366" cmd) |
| 86 | (let [name (nth params 1 nil)] | 90 | (let [name (nth params 1 nil)] |
| 87 | - (when name (swap! cells/channels members/names-done name))) | 91 | + (when name |
| 92 | + (swap! cells/channels members/names-done name) | ||
| 93 | + ;; End of NAMES, and the only moment this client knows a room is | ||
| 94 | + ;; fully arrived. freeq re-joins an authenticated user's channels at | ||
| 95 | + ;; registration and leaves the backlog for the client to ask for, so | ||
| 96 | + ;; a room that reaches here with an empty buffer has no history | ||
| 97 | + ;; coming unless we ask — which is why nothing but new lines ever | ||
| 98 | + ;; appeared here. Same request `frq.state` makes on 366, and the | ||
| 99 | + ;; replayed lines come back as ordinary PRIVMSGs the branch below | ||
| 100 | + ;; already folds. | ||
| 101 | + (when (and @conn (empty? (get-in @cells/channels [name :messages]))) | ||
| 102 | + (net/send-line! @conn | ||
| 103 | + (str "CHATHISTORY LATEST " name " * " history-limit))))) | ||
| 88 | 104 | ||
| 89 | (= "PART" cmd) | 105 | (= "PART" cmd) |
| 90 | (swap! cells/channels members/remove-user (first params) who) | 106 | (swap! cells/channels members/remove-user (first params) who) |