|
@@ -193,6 +193,9 @@ func (rb *ResponseBuffer) sendBatchEnd(blocking bool) {
|
193
|
193
|
// Starts a nested batch (see the ResponseBuffer struct definition for a description of
|
194
|
194
|
// how this works)
|
195
|
195
|
func (rb *ResponseBuffer) StartNestedBatch(batchType string, params ...string) (batchID string) {
|
|
196
|
+ if !rb.session.capabilities.Has(caps.Batch) {
|
|
197
|
+ return
|
|
198
|
+ }
|
196
|
199
|
batchID = rb.session.generateBatchID()
|
197
|
200
|
msgParams := make([]string, len(params)+2)
|
198
|
201
|
msgParams[0] = "+" + batchID
|
|
@@ -219,19 +222,6 @@ func (rb *ResponseBuffer) EndNestedBatch(batchID string) {
|
219
|
222
|
rb.AddMessage(ircmsg.MakeMessage(nil, rb.target.server.name, "BATCH", "-"+batchID))
|
220
|
223
|
}
|
221
|
224
|
|
222
|
|
-// Convenience to start a nested batch for history lines, at the highest level
|
223
|
|
-// supported by the client (`history`, `chathistory`, or no batch, in descending order).
|
224
|
|
-func (rb *ResponseBuffer) StartNestedHistoryBatch(params ...string) (batchID string) {
|
225
|
|
- var batchType string
|
226
|
|
- if rb.session.capabilities.Has(caps.Batch) {
|
227
|
|
- batchType = "chathistory"
|
228
|
|
- }
|
229
|
|
- if batchType != "" {
|
230
|
|
- batchID = rb.StartNestedBatch(batchType, params...)
|
231
|
|
- }
|
232
|
|
- return
|
233
|
|
-}
|
234
|
|
-
|
235
|
225
|
// Send sends all messages in the buffer to the client.
|
236
|
226
|
// Afterwards, the buffer is in an undefined state and MUST NOT be used further.
|
237
|
227
|
// If `blocking` is true you MUST be sending to the client from its own goroutine.
|