mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-22 03:49:27 +01:00
responsebuffer: Handle sending early properly
This commit is contained in:
parent
3680a3fe9a
commit
470109461b
@ -75,6 +75,11 @@ func (rb *ResponseBuffer) AddSplitMessageFromClient(msgid string, from *Client,
|
||||
|
||||
// Send sends the message to our target client.
|
||||
func (rb *ResponseBuffer) Send() error {
|
||||
// fall out if no messages to send
|
||||
if len(rb.messages) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
// make batch and all if required
|
||||
var batch *Batch
|
||||
useLabel := rb.target.capabilities.Has(caps.LabeledResponse) && rb.Label != ""
|
||||
@ -116,5 +121,8 @@ func (rb *ResponseBuffer) Send() error {
|
||||
batch.End(rb.target)
|
||||
}
|
||||
|
||||
// clear out any existing messages
|
||||
rb.messages = []ircmsg.IrcMessage{}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user