diff options
| author | EuAndreh <eu@euandre.org> | 2026-04-25 16:23:34 -0300 |
|---|---|---|
| committer | EuAndreh <eu@euandre.org> | 2026-04-25 16:23:34 -0300 |
| commit | 9788e2bcada5fff2956fe22e69ac9e50872b7f1f (patch) | |
| tree | 25f0dc09317d7438643721c139b19ab8dd55f775 | |
| parent | Enforce +i, +k, +l on JOIN; add @ symbol for secret channels (diff) | |
| download | papod-9788e2bcada5fff2956fe22e69ac9e50872b7f1f.tar.gz papod-9788e2bcada5fff2956fe22e69ac9e50872b7f1f.tar.xz | |
Make NICK to same nick a no-op; add WHOIS channels/idle
A registered client running NICK with their current nick now
returns no replies and skips the broadcast. Previously we sent
a redundant ":nick NICK nick" line to the user and every
channel-mate, which trips irctest's regression suite.
WHOIS now returns RPL_WHOISCHANNELS (319) listing all channels
the target shares with their op/voice prefix, and
RPL_WHOISIDLE (317) with a placeholder idle time and the current
signon timestamp. This rounds out the standard WHOIS reply set
so clients can render the user's presence properly.
| -rw-r--r-- | src/papod.clj | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/src/papod.clj b/src/papod.clj index 2c05a0a..96b3572 100644 --- a/src/papod.clj +++ b/src/papod.clj @@ -1025,6 +1025,10 @@ [(numeric-reply client "433" (str new-nick " :Nickname is already in use"))] + (and (:registered? @client) + (= new-nick (:nick @client))) + [] + :else (if (:registered? @client) ;; Post-registration nick change: broadcast @@ -2798,7 +2802,28 @@ u (:user st) uname (or (:username u) found-nick) rname (or (:realname u) found-nick) - away (:away st)] + away (:away st) + ops (:ops components) + voiced (:voiced components) + chans + (when (:channels components) + (for [[ch members] + @(:channels components) + :when (contains? members + found-nick) + :let + [op? (and ops + (contains? + (get @ops ch) + found-nick)) + v? (and voiced + (contains? + (get @voiced ch) + found-nick))]] + (str (cond op? "@" + v? "+" + :else "") + ch)))] (cond-> [(numeric-reply client "311" (str found-nick " " uname @@ -2813,6 +2838,18 @@ away (conj (numeric-reply client "301" (str found-nick " :" away))) + (seq chans) + (conj (numeric-reply client "319" + (str found-nick " :" + (string/join " " + chans)))) + true + (conj (numeric-reply client "317" + (str found-nick " 0 " + (quot + (System/currentTimeMillis) + 1000) + " :seconds idle, signon time"))) true (conj (numeric-reply client "318" (str found-nick |
