summaryrefslogtreecommitdiff
path: root/server/channel/command.go
diff options
context:
space:
mode:
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":