mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-22 10:42:52 +01:00
set the time of a multiline message at BATCH -
This commit is contained in:
parent
5d662742b9
commit
6e2b2a44b8
@ -352,8 +352,6 @@ func batchHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Res
|
||||
} else {
|
||||
rb.session.batch.target = msg.Params[2]
|
||||
// save the response label for later
|
||||
// XXX changing the label inside a handler is a bit dodgy, but it works here
|
||||
// because there's no way we could have triggered a flush up to this point
|
||||
rb.session.batch.responseLabel = rb.Label
|
||||
rb.Label = ""
|
||||
}
|
||||
@ -366,12 +364,15 @@ func batchHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Res
|
||||
} else {
|
||||
batch := rb.session.batch
|
||||
rb.session.batch = MultilineBatch{}
|
||||
// time tag should correspond to the time when the message was completed
|
||||
batch.message.SetTime()
|
||||
histType, err := msgCommandToHistType(batch.command)
|
||||
if err != nil {
|
||||
histType = history.Privmsg
|
||||
batch.command = "PRIVMSG"
|
||||
}
|
||||
// see previous caution about modifying ResponseBuffer.Label
|
||||
// XXX changing the label inside a handler is a bit dodgy, but it works here
|
||||
// because there's no way we could have triggered a flush up to this point
|
||||
rb.Label = batch.responseLabel
|
||||
dispatchMessageToTarget(client, batch.tags, histType, batch.command, batch.target, batch.message, rb)
|
||||
}
|
||||
|
@ -42,9 +42,6 @@ func MakeMessage(original string) (result SplitMessage) {
|
||||
}
|
||||
|
||||
func (sm *SplitMessage) Append(message string, concat bool) {
|
||||
if sm.Time.IsZero() {
|
||||
sm.Time = time.Now().UTC()
|
||||
}
|
||||
if sm.Msgid == "" {
|
||||
sm.Msgid = GenerateSecretToken()
|
||||
}
|
||||
@ -54,6 +51,10 @@ func (sm *SplitMessage) Append(message string, concat bool) {
|
||||
})
|
||||
}
|
||||
|
||||
func (sm *SplitMessage) SetTime() {
|
||||
sm.Time = time.Now().UTC()
|
||||
}
|
||||
|
||||
func (sm *SplitMessage) LenLines() int {
|
||||
if sm.Split == nil {
|
||||
if sm.Message == "" {
|
||||
|
Loading…
Reference in New Issue
Block a user