summaryrefslogtreecommitdiff
path: root/server/channel/command.go
diff options
context:
space:
mode:
authorraven <citrons@mondecitronne.com>2025-10-20 20:08:15 -0500
committerraven <citrons@mondecitronne.com>2025-10-20 20:08:15 -0500
commitc74096ad2e849442542a64e5bfbe8f2c170b0069 (patch)
tree46fa92bb7b8d76c9147c1da7c3e56555e373c778 /server/channel/command.go
parente82b94b04d5ab5a471f365156ced5c65c94a7937 (diff)
persistent message history
Diffstat (limited to 'server/channel/command.go')
-rw-r--r--server/channel/command.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/server/channel/command.go b/server/channel/command.go
index 1184a5a..04e45a2 100644
--- a/server/channel/command.go
+++ b/server/channel/command.go
@@ -21,7 +21,7 @@ func (c *Channel) SendRequest(r session.Request) {
switch k {
case "":
case "reply":
- _, ok := c.byId[v]
+ _, ok := c.MessageIndex(v)
if !ok {
r.Reply(proto.Fail{"bad-reply", "", nil}.Cmd())
return
@@ -141,7 +141,7 @@ func (c *Channel) SendRequest(r session.Request) {
var max int
switch h.Kind {
case "latest":
- max = len(c.messages)
+ max = c.HistorySize()
min = max - 20
case "before", "around", "after", "at":
var id string
@@ -154,7 +154,7 @@ func (c *Channel) SendRequest(r session.Request) {
return
}
}
- i, ok := c.byId[id]
+ i, ok := c.MessageIndex(id)
if !ok {
r.Reply(proto.Fail{"bad-target", "", nil}.Cmd())
return
@@ -180,8 +180,8 @@ func (c *Channel) SendRequest(r session.Request) {
if min < 0 {
min = 0
}
- if max > len(c.messages) {
- max = len(c.messages)
+ if max > c.HistorySize() {
+ max = c.HistorySize()
}
p := c.GetMembership(r.From.UserId)
@@ -190,7 +190,7 @@ func (c *Channel) SendRequest(r session.Request) {
return
}
cmd := proto.NewCmd("history", c.id)
- cmd.Args = c.messages[min:max]
+ cmd.Args = c.History(min, max)
r.Reply(cmd)
case "membership":