Add make_batch and send_batch to IRCServer

This commit is contained in:
jesopo 2019-02-18 23:16:47 +00:00
parent b76b153672
commit 81ae0cc889

View file

@ -351,3 +351,14 @@ class Server(IRCObject.Object):
def send_whox(self, mask: str, filter: str, fields: str, label: str=None def send_whox(self, mask: str, filter: str, fields: str, label: str=None
) -> IRCLine.Line: ) -> IRCLine.Line:
return self.send(utils.irc.protocol.whox(mask, filter, fields, label)) 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))