summaryrefslogtreecommitdiffstats
path: root/server/user.go
diff options
context:
space:
mode:
authorbt <bt@rctt.net>2026-05-26 12:13:46 +0200
committerbt <bt@rctt.net>2026-05-26 12:13:46 +0200
commitaf6ccd597024aa867a5742a5c6771c9a11c18c9f (patch)
treed24acf3999d8a930dbca52bf995b4f75010731de /server/user.go
parent5d689490cc90f0698802a01d2d058cfdc382a382 (diff)
downloadsolec-0.5.2.tar.gz
solec-0.5.2.zip
[daemon] Fix users historyv0.5.2
Diffstat (limited to 'server/user.go')
-rw-r--r--server/user.go14
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})