Browse Source

fix timestamp syntax in MARKREAD

tags/v2.10.0-rc2
Shivaram Lingamneni 2 years ago
parent
commit
c3d4be45f1
2 changed files with 4 additions and 3 deletions
  1. 2
    1
      irc/getters.go
  2. 2
    2
      irc/handlers.go

+ 2
- 1
irc/getters.go View File

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

+ 2
- 2
irc/handlers.go View File

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

Loading…
Cancel
Save