summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/papod.clj34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/papod.clj b/src/papod.clj
index a63e5b5..83301fb 100644
--- a/src/papod.clj
+++ b/src/papod.clj
@@ -1991,7 +1991,7 @@
(try (java.util.UUID/fromString r)
(catch Exception _ nil)))]
(cond
- (and chan? (not (get @channels target)))
+ (and chan? (empty? (get @channels target)))
[(numeric-reply client "403"
(str target " :No such channel"))]
@@ -2000,6 +2000,38 @@
[(numeric-reply client "401"
(str target " :No such nick/channel"))]
+ ;; +n: no external messages
+ (and chan?
+ (string/includes?
+ (or (get @(:chan-modes components)
+ target)
+ "+nt")
+ "n")
+ (not (contains?
+ (get @channels target) nick)))
+ [(numeric-reply client "404"
+ (str target
+ " :Cannot send to channel"))]
+
+ ;; +m: moderated — only ops/voiced may speak
+ (and chan?
+ (string/includes?
+ (or (get @(:chan-modes components)
+ target)
+ "+nt")
+ "m")
+ (not (and (:ops components)
+ (contains?
+ (get @(:ops components) target)
+ nick)))
+ (not (and (:voiced components)
+ (contains?
+ (get @(:voiced components) target)
+ nick))))
+ [(numeric-reply client "404"
+ (str target
+ " :Cannot send to channel"))]
+
:else
(do
;; PERSIST FIRST