From 81ae0cc889c7813ee0a3a1da39abfba9678d4022 Mon Sep 17 00:00:00 2001 From: jesopo Date: Mon, 18 Feb 2019 23:16:47 +0000 Subject: [PATCH] Add `make_batch` and `send_batch` to IRCServer --- src/IRCServer.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/IRCServer.py b/src/IRCServer.py index 4f110e51..c3a3e5ca 100644 --- a/src/IRCServer.py +++ b/src/IRCServer.py @@ -351,3 +351,14 @@ class Server(IRCObject.Object): def send_whox(self, mask: str, filter: str, fields: str, label: str=None ) -> IRCLine.Line: return self.send(utils.irc.protocol.whox(mask, filter, fields, label)) + + def make_batch(self, identifier: str, batch_type: str, tags: dict=None): + return utils.irc.IRCSendBatch(identifier, batch_type, tags) + def send_batch(self, batch: utils.irc.IRCSendBatch): + self.send(utils.irc.protocol.batch_start(batch.id, batch.type, + batch.tags)) + + for line in batch.lines: + self.send(line) + + return self.send(utils.irc.protocol.batch_end(batch.id))