summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/papod.clj30
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))