diff options
| author | EuAndreh <eu@euandre.org> | 2026-05-01 08:00:15 -0300 |
|---|---|---|
| committer | EuAndreh <eu@euandre.org> | 2026-05-01 08:00:15 -0300 |
| commit | 381f36ed6e78c3dfec3ddcf20547f08e289535b2 (patch) | |
| tree | 8c44d64e8b60a36e28d22ec6b7baa2d3849de64b /src | |
| parent | Fix JOIN race: pin NAMES/broadcast to atomic membership snapshot (diff) | |
| download | papod-381f36ed6e78c3dfec3ddcf20547f08e289535b2.tar.gz papod-381f36ed6e78c3dfec3ddcf20547f08e289535b2.tar.xz | |
Record topic setter + set-time so 333 reports the truth
RPL_TOPICWHOTIME (333) was emitted on JOIN with the *joiner's*
nick as the setter and System/currentTimeMillis as the set-time —
neither of which has any relationship to who actually set the
topic when.
Add :papod.channel/topic-set-by (string) and :papod.channel/topic-
set-at (long unix seconds) to the schema, populate them in the
TOPIC handler, and read them in join-one!'s 333 emission (falling
back to nick / now if absent, e.g. an empty channel snapshot
imported without the new attrs).
Surfaced by the chat.papo.im differential test (333 line diverged
between fake-ircd's correctly-tracked setter and papod's broken
output).
Diffstat (limited to 'src')
| -rw-r--r-- | src/papod.clj | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/papod.clj b/src/papod.clj index d4272f1..ca2a5df 100644 --- a/src/papod.clj +++ b/src/papod.clj @@ -168,6 +168,12 @@ {:db/ident :papod.channel/topic :db/valueType :db.type/string :db/cardinality :db.cardinality/one} + {:db/ident :papod.channel/topic-set-by + :db/valueType :db.type/string + :db/cardinality :db.cardinality/one} + {:db/ident :papod.channel/topic-set-at + :db/valueType :db.type/long + :db/cardinality :db.cardinality/one} {:db/ident :papod.channel/last-event-seq :db/valueType :db.type/long :db/cardinality :db.cardinality/one} @@ -3025,15 +3031,19 @@ ent (when ch-eid' (d/entity db' ch-eid')) topic (:papod.channel/topic ent) + topic-by (:papod.channel/topic-set-by ent) + topic-at (:papod.channel/topic-set-at ent) topic-lines (when (seq topic) [(str ":" +server-name+ " 332 " nick " " handle " :" topic) (str ":" +server-name+ " 333 " nick - " " handle " " nick " " - (quot - (System/currentTimeMillis) - 1000))]) + " " handle " " + (or topic-by nick) " " + (or topic-at + (quot + (System/currentTimeMillis) + 1000)))]) markread-line (when (contains? my-caps "draft/read-marker") @@ -4341,6 +4351,10 @@ @(d/transact conn [[:db/add ch-eid :papod.channel/topic new-topic] + [:db/add ch-eid :papod.channel/topic-set-by + nick] + [:db/add ch-eid :papod.channel/topic-set-at + (quot (.getTime msg-at) 1000)] {:db/ensure :papod.event/attrs :db/id "topic-event" :papod.event/id msg-id |
