3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-15 00:19:29 +01:00

fix timestamp syntax in MARKREAD

This commit is contained in:
Shivaram Lingamneni 2022-05-20 01:32:39 -04:00
parent 67b2f4ccd2
commit c3d4be45f1
2 changed files with 4 additions and 3 deletions

View File

@ -4,6 +4,7 @@
package irc
import (
"fmt"
"net"
"sync/atomic"
"time"
@ -493,7 +494,7 @@ func (client *Client) GetReadMarker(cfname string) (result string) {
t, ok := client.readMarkers[cfname]
client.stateMutex.RUnlock()
if ok {
return t.Format(IRCv3TimestampFormat)
return fmt.Sprintf("timestamp=%s", t.Format(IRCv3TimestampFormat))
}
return "*"
}

View File

@ -2770,14 +2770,14 @@ func markReadHandler(server *Server, client *Client, msg ircmsg.Message, rb *Res
}
// "MARKREAD client set command": MARKREAD <target> <timestamp>
readTimestamp := msg.Params[1]
readTimestamp := strings.TrimPrefix(msg.Params[1], "timestamp=")
readTime, err := time.Parse(IRCv3TimestampFormat, readTimestamp)
if err != nil {
rb.Add(nil, server.name, "FAIL", "MARKREAD", "INVALID_PARAMS", utils.SafeErrorParam(readTimestamp), client.t("Invalid timestamp"))
return
}
result := client.SetReadMarker(cftarget, readTime)
readTimestamp = result.Format(IRCv3TimestampFormat)
readTimestamp = fmt.Sprintf("timestamp=%s", result.Format(IRCv3TimestampFormat))
// inform the originating session whether it was a success or a no-op:
rb.Add(nil, server.name, "MARKREAD", unfoldedTarget, readTimestamp)
if result.Equal(readTime) {