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:
parent
67b2f4ccd2
commit
c3d4be45f1
@ -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 "*"
|
||||
}
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user