diff options
| author | EuAndreh <eu@euandre.org> | 2026-04-26 09:49:25 -0300 |
|---|---|---|
| committer | EuAndreh <eu@euandre.org> | 2026-04-26 09:49:25 -0300 |
| commit | 88330d89875b0649af2b78e0bf8cc073f798f68a (patch) | |
| tree | 25c144e076211bfc50c11a0d75438c6865650934 /src | |
| parent | Implement user mode +i (invisible) (diff) | |
| download | papod-88330d89875b0649af2b78e0bf8cc073f798f68a.tar.gz papod-88330d89875b0649af2b78e0bf8cc073f798f68a.tar.xz | |
Implement user mode +T (no CTCP)
Users with +T set no longer receive direct CTCP messages. Channel
messages still pass through. Add T to the user-modes string in
RPL_MYINFO.
Diffstat (limited to 'src')
| -rw-r--r-- | src/papod.clj | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/papod.clj b/src/papod.clj index 59c80f7..6e53997 100644 --- a/src/papod.clj +++ b/src/papod.clj @@ -976,7 +976,7 @@ ":This server was created recently") (numeric-reply client "004" (str +server-name+ " " +version+ - " io" ;; user modes + " ioT" ;; user modes " nt" ;; channel modes )) (numeric-reply client "005" @@ -2004,6 +2004,11 @@ raw (str ":" nick " PRIVMSG " target " " content) tagged (tag-line-with msg-id out-tags raw) + text (cond-> content + (string/starts-with? content ":") + (subs 1)) + ctcp? (and (seq text) + (= \u0001 (first text))) deliver! (fn [m] (let [ca (:client-atom m) caps (when ca @@ -2012,9 +2017,13 @@ (or (caps "message-tags") (caps "server-time"))) tagged - raw)] - (deliver-to-client! - (:w m) line)))] + raw) + no-ctcp? (and ca + (:no-ctcp? @ca))] + (when-not (and ctcp? no-ctcp? + (not chan?)) + (deliver-to-client! + (:w m) line))))] (if chan? (doseq [mn (get @channels target) :when (not= mn nick) @@ -3056,7 +3065,8 @@ (= 1 (count params)) (let [modes (str "+" (when (:invisible? @client) "i") - (when (:oper? @client) "o"))] + (when (:oper? @client) "o") + (when (:no-ctcp? @client) "T"))] [(numeric-reply client "221" modes)]) :else @@ -3069,13 +3079,11 @@ (doseq [c chars] (case c \i (swap! client assoc :invisible? adding?) + \T (swap! client assoc :no-ctcp? adding?) nil)) - (let [modes (str "+" - (when (:invisible? @client) "i") - (when (:oper? @client) "o"))] - [(str ":" (client-target client) - " MODE " (client-target client) - " " mode-str)]))) + [(str ":" (client-target client) + " MODE " (client-target client) + " " mode-str)])) ;; Channel mode query: MODE #channel (= 1 (count params)) |
