summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2026-04-26 17:52:09 -0300
committerEuAndreh <eu@euandre.org>2026-04-26 17:52:09 -0300
commitf84134962e2adfc2a96599978ff7f8ee78c22daf (patch)
tree74aa3d81a02786f7243a25928d11d27c3c554ec3 /src
parentHonor +n (no external messages) and +m (moderated) on PRIVMSG (diff)
downloadpapod-f84134962e2adfc2a96599978ff7f8ee78c22daf.tar.gz
papod-f84134962e2adfc2a96599978ff7f8ee78c22daf.tar.xz
Hide +s/+p channels from LIST for non-members
LIST now skips channels with the +s (secret) or +p (private) flag when the requesting client is not a member, matching Modern's secret-channel rule.
Diffstat (limited to 'src')
-rw-r--r--src/papod.clj20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/papod.clj b/src/papod.clj
index 83301fb..14957eb 100644
--- a/src/papod.clj
+++ b/src/papod.clj
@@ -3887,11 +3887,31 @@
"TAGMSG" (handle-tagmsg message client components)
"MARKREAD" (handle-markread params client components)
"LIST" (let [filter-ch (first params)
+ self (client-target client)
chans (when (:channels components)
@(:channels components))
+ modes-of (fn [ch]
+ (or (get
+ @(:chan-modes
+ components)
+ ch)
+ "+nt"))
+ hidden? (fn [ch members]
+ (and (not
+ (contains?
+ members self))
+ (let [m (modes-of
+ ch)]
+ (or
+ (string/includes?
+ m "s")
+ (string/includes?
+ m "p")))))
active (filter
(fn [[ch members]]
(and (seq members)
+ (not (hidden?
+ ch members))
(or (nil? filter-ch)
(= ch filter-ch))))
chans)]