diff options
| author | EuAndreh <eu@euandre.org> | 2026-04-25 14:18:57 -0300 |
|---|---|---|
| committer | EuAndreh <eu@euandre.org> | 2026-04-25 14:18:57 -0300 |
| commit | 9e8e2d59c1564c9b5c7d99cac43ca2faccae815a (patch) | |
| tree | 76b69c35b76000413b08931dbdd8aa61b4ee9b57 /tests | |
| parent | Fix CAP LS 301 format and add userhost-in-names capability (diff) | |
| download | papod-9e8e2d59c1564c9b5c7d99cac43ca2faccae815a.tar.gz papod-9e8e2d59c1564c9b5c7d99cac43ca2faccae815a.tar.xz | |
Implement channel modes, labeled-response, chathistory BATCH
Channel modes (MODE command):
- +o/-o: grant/revoke operator, broadcast to channel
- +v/-v: voice mode, broadcast to channel
- +n/+t/+m/+i/+s: simple flag modes, tracked in :chan-modes atom
- +l: channel limit mode
- +k: channel key mode
- +b (no arg): ban list query returns 368
- Mode changes require channel operator status (482)
- MODE query returns tracked modes (324) + creation time (329)
Labeled-response (IRCv3):
- Commands with @label=X tag get responses wrapped:
- Single reply: label tag added directly
- No replies: ACK with label
- Multiple replies: BATCH labeled-response wrapper
Chathistory (IRCv3 draft/chathistory):
- Rewritten to use BATCH wrapping (BATCH +id chathistory #chan)
- Messages inside batch have batch=id tag
- Supports LATEST, BEFORE, AFTER, BETWEEN, AROUND subcommands
- Advertised via draft/chathistory capability
Other:
- Auto-op triggers for first joiner to empty channel (not just
new channels), fixing stale-Datomic-state issue
- Added userhost-in-names, multi-prefix, draft/chathistory to CAP
irctest: 232 passed, 410 failed, 218 skipped (up from 223).
Unit: 261 assertions, Integration: 38 assertions — all pass.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/integration.clj | 3 | ||||
| -rw-r--r-- | tests/unit.clj | 16 |
2 files changed, 12 insertions, 7 deletions
diff --git a/tests/integration.clj b/tests/integration.clj index ed70e4e..b92f85d 100644 --- a/tests/integration.clj +++ b/tests/integration.clj @@ -44,7 +44,8 @@ :net-id net-id :clients (atom {}) :channels (atom {}) - :ops (atom {})})) + :ops (atom {}) + :chan-modes (atom {})})) (defn- make-client "Creates a simulated client connection using piped streams. diff --git a/tests/unit.clj b/tests/unit.clj index f6a74de..d172e2a 100644 --- a/tests/unit.clj +++ b/tests/unit.clj @@ -111,7 +111,7 @@ :papod.process/started-at (java.util.Date.)}]) {:conn conn :cracha cracha-state :process-id proc-id :clients (atom {}) :channels (atom {}) - :ops (atom {})}))) + :ops (atom {}) :chan-modes (atom {})}))) (defn test-network! [conn] @@ -1472,11 +1472,15 @@ alice components) (replies-for! {:command "PRIVMSG" :params ["" "#test" ":msg2"]} alice components) - (let [replies (handle-chathistory ["#test" "1" "10"] alice components)] - (is (= 2 (count replies))) - (is (string/includes? (first replies) "msg1")) - (is (string/includes? (second replies) "msg2")) - (is (every? #(string/includes? % "@msgid=") replies))))) + (let [replies (handle-chathistory + ["LATEST" "#test" "*" "10"] + alice components)] + ;; BATCH +id chathistory #test ... BATCH -id + (is (string/includes? (first replies) "BATCH +")) + (is (string/includes? (first replies) "chathistory")) + (is (some #(string/includes? % "msg1") replies)) + (is (some #(string/includes? % "msg2") replies)) + (is (string/includes? (last replies) "BATCH -"))))) (testing "EDIT persists and notifies (draft/message-editing)" (let [alice-out (java.io.ByteArrayOutputStream.) bob-out (java.io.ByteArrayOutputStream.) |
