diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/papod.clj | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/src/papod.clj b/src/papod.clj index 1b6dcf5..27dfad0 100644 --- a/src/papod.clj +++ b/src/papod.clj @@ -2781,7 +2781,8 @@ nick (client-target client)] (cond (empty? params) - [(numeric-reply client "461" "MARKREAD :Not enough parameters")] + [(str "FAIL MARKREAD NEED_MORE_PARAMS" + " :Missing parameters")] :else (let [handle (first params) @@ -2795,15 +2796,29 @@ (re-matches ts-rgx timestamp)) (let [ts-only (second (re-matches ts-rgx timestamp)) - _ (when (and conn chan-eid) - @(d/transact conn - [{:papod.read-marker/channel - chan-eid - :papod.read-marker/nick nick - :papod.read-marker/timestamp - ts-only}]))] + stored (when (and db chan-eid) + (ffirst + (d/q '{:find [?ts] + :in [$ ?ch ?nick] + :where + [[?r :papod.read-marker/channel + ?ch] + [?r :papod.read-marker/nick + ?nick] + [?r :papod.read-marker/timestamp + ?ts]]} + db chan-eid nick))) + advance? (or (nil? stored) + (pos? (compare ts-only stored)))] + (when (and advance? conn chan-eid) + @(d/transact conn + [{:papod.read-marker/channel chan-eid + :papod.read-marker/nick nick + :papod.read-marker/timestamp + ts-only}])) [(str ":" +server-name+ " MARKREAD " handle - " " timestamp)]) + " timestamp=" + (if advance? ts-only stored))]) ;; SET with bad timestamp shape: reject (and timestamp |
