~gjabell/goirc

49e3d2dd8bf3a34007bd4cdee3dfce6867693fd4 — Galen Abell 2 months ago bbbcc9a
Add support for READ
1 files changed, 8 insertions(+), 0 deletions(-)

M client/commands.go
M client/commands.go => client/commands.go +8 -0
@@ 3,6 3,7 @@ package client
import (
	"fmt"
	"strings"
	"time"
)

const (


@@ 27,6 28,7 @@ const (
	PING         = "PING"
	PONG         = "PONG"
	PRIVMSG      = "PRIVMSG"
	READ         = "READ"
	QUIT         = "QUIT"
	TOPIC        = "TOPIC"
	USER         = "USER"


@@ 37,6 39,8 @@ const (
	defaultSplit = 450
)

const ServerTimeLayout = "2006-01-02T15:04:05.000Z"

// cutNewLines() pares down a string to the part before the first "\r" or "\n".
func cutNewLines(s string) string {
	r := strings.SplitN(s, "\r", 2)


@@ 322,3 326,7 @@ func (conn *Conn) Cap(subcommmand string, capabilities ...string) {
		}
	}
}

func (conn *Conn) Read(target string, timestamp time.Time) {
	conn.Raw(READ + " " + target + " timestamp=" + timestamp.Format(ServerTimeLayout))
}