summaryrefslogtreecommitdiff
path: root/server/channel/command.go
diff options
context:
space:
mode:
authorraven <citrons@mondecitronne.com>2026-02-10 17:22:58 -0600
committerraven <citrons@mondecitronne.com>2026-02-10 17:22:58 -0600
commit8024722bd5db50bc3ec602b807819a87bd65035e (patch)
tree0aa9585878c5f4a3fa8f16ec059314661aa1578d /server/channel/command.go
parent159773c277a4067f42037d1cbac31659de776382 (diff)
channel read status
Diffstat (limited to 'server/channel/command.go')
-rw-r--r--server/channel/command.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/server/channel/command.go b/server/channel/command.go
index 92ae2cc..23acccb 100644
--- a/server/channel/command.go
+++ b/server/channel/command.go
@@ -260,6 +260,26 @@ func (c *Channel) SendRequest(r session.Request) {
r.ReplyInvalid()
}
+ case "read":
+ if len(r.Cmd.Args) != 0 {
+ r.ReplyInvalid()
+ return
+ }
+ if !c.GetMembership(r.From.UserId).See {
+ r.Reply(proto.Fail{"forbidden", "", nil}.Cmd())
+ return
+ }
+ c.SetRead(r.From.UserId)
+
+ u := c.kind.world.GetObject(r.From.UserId).(*user.User)
+ for s := range u.PrivateStream.Subscribers {
+ if s != r.From {
+ s.Event(proto.NewCmd("read", c.id))
+ }
+ }
+
+ r.ReplyOk()
+
default:
r.ReplyInvalid()
}