aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar jesopo2019-06-02 10:13:51 +0100
committerGravatar jesopo2019-06-02 10:13:51 +0100
commitf9f637e084b54f1b800db66499d44f7ec30d604b (patch)
treee1098b0a64ec458387b9414232e273d945406787 /src
parentUpdate CHANGELOG (diff)
signature
Remove IRCSendBatch, fix some batch-related type hints
Diffstat (limited to 'src')
-rw-r--r--src/IRCServer.py14
-rw-r--r--src/utils/irc/__init__.py16
2 files changed, 6 insertions, 24 deletions
diff --git a/src/IRCServer.py b/src/IRCServer.py
index d94963e5..1d5357ec 100644
--- a/src/IRCServer.py
+++ b/src/IRCServer.py
@@ -31,7 +31,7 @@ class Server(IRCObject.Object):
self._capabilities_waiting = set([]) # type: typing.Set[str]
self.agreed_capabilities = set([]) # type: typing.Set[str]
self.server_capabilities = {} # type: typing.Dict[str, str]
- self.batches = {} # type: typing.Dict[str, IRCLine.ParsedLine]
+ self.batches = {} # type: typing.Dict[str, utils.irc.IRCBatch]
self.cap_started = False
self.users = {} # type: typing.Dict[str, IRCUser.User]
@@ -362,15 +362,3 @@ class Server(IRCObject.Object):
def send_whox(self, mask: str, filter: str, fields: str, label: str=None
) -> IRCLine.SentLine:
return self.send(utils.irc.protocol.whox(mask, filter, fields, label))
-
- def make_batch(self, identifier: str, batch_type: str,
- tags: typing.Dict[str, str]={}) -> utils.irc.IRCSendBatch:
- return utils.irc.IRCSendBatch(identifier, batch_type, tags)
- def send_batch(self, batch: utils.irc.IRCSendBatch) -> IRCLine.SentLine:
- 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))
diff --git a/src/utils/irc/__init__.py b/src/utils/irc/__init__.py
index 3be9b279..67eb6b7e 100644
--- a/src/utils/irc/__init__.py
+++ b/src/utils/irc/__init__.py
@@ -263,17 +263,11 @@ class IRCBatch(object):
self.id = identifier
self.type = batch_type
self.tags = tags
- self.lines = [] # type: typing.List[IRCLine.ParsedLine]
-class IRCRecvBatch(IRCBatch):
- pass
-class IRCSendBatch(IRCBatch):
- def _add_line(self, line: IRCLine.ParsedLine):
- line.tags["batch"] = self.id
- self.lines.append(line)
- def message(self, target: str, message: str, tags: dict={}):
- self._add_line(utils.irc.protocol.message(target, message, tags))
- def notice(self, target: str, message: str, tags: dict={}):
- self._add_line(utils.irc.protocol.notice(target, message, tags))
+ self._lines = [] # type: typing.List[IRCLine.ParsedLine]
+ def add_line(self, line: IRCLine.ParsedLine):
+ self._lines.append(line)
+ def get_lines(self) -> typing.List[IRCLine.ParsedLine]:
+ return self._lines
class Capability(object):
def __init__(self, name, draft_name=None):