diff options
| author | bt <bt@rctt.net> | 2026-05-26 12:13:46 +0200 |
|---|---|---|
| committer | bt <bt@rctt.net> | 2026-05-26 12:13:46 +0200 |
| commit | af6ccd597024aa867a5742a5c6771c9a11c18c9f (patch) | |
| tree | d24acf3999d8a930dbca52bf995b4f75010731de /server/user.go | |
| parent | 5d689490cc90f0698802a01d2d058cfdc382a382 (diff) | |
| download | solec-af6ccd597024aa867a5742a5c6771c9a11c18c9f.tar.gz solec-af6ccd597024aa867a5742a5c6771c9a11c18c9f.zip | |
[daemon] Fix users historyv0.5.2
Diffstat (limited to 'server/user.go')
| -rw-r--r-- | server/user.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/server/user.go b/server/user.go index 9a0a71b..69b7ced 100644 --- a/server/user.go +++ b/server/user.go @@ -161,7 +161,7 @@ func (s *Server) handleUsermode(user *User, conn net.Conn, mode core.Usermode) e // TODO: Better errors func (s *Server) handleHistory(user *User, conn net.Conn, hist core.History) error { - _, err := core.ReadAddr(hist.Channel) + addr, err := core.ReadAddr(hist.Channel) if err != nil { fmt.Println("cannot parse address:", err) return user.Send(conn, core.Error{core.ErrorNotFound}) @@ -178,7 +178,17 @@ func (s *Server) handleHistory(user *User, conn net.Conn, hist core.History) err return user.Send(conn, core.Error{core.ErrorNotFound}) } - messages, err := s.Storage.GetHistory(hist.Channel, hist.Since, int(hist.Count), int(hist.Offset)) + var messages []core.Message + count := int(hist.Count) + offset := int(hist.Offset) + + if addr.Type == core.AddrUser { + messages, err = s.Storage.GetHistoryUser(user.Addr, hist.Channel, hist.Since, count, offset) + + } else { + messages, err = s.Storage.GetHistory(hist.Channel, hist.Since, count, offset) + } + if err != nil { fmt.Println("cannot get message history:", err) return user.Send(conn, core.Error{core.ErrorNotFound}) |
