diff --git a/ircrobots/interface.py b/ircrobots/interface.py index f407493..dc8a313 100644 --- a/ircrobots/interface.py +++ b/ircrobots/interface.py @@ -98,7 +98,7 @@ class IServer(Server): async def sts_policy(self, sts: STSPolicy): pass - async def next_line(self) -> Optional[Tuple[Line, List[Emit]]]: + async def next_line(self) -> Optional[Tuple[Line, Optional[Emit]]]: pass def cap_agreed(self, capability: ICapability) -> bool: diff --git a/ircrobots/server.py b/ircrobots/server.py index f2ff9aa..058a7d4 100644 --- a/ircrobots/server.py +++ b/ircrobots/server.py @@ -44,7 +44,7 @@ class Server(IServer): self._write_queue: PriorityQueue[SentLine] = PriorityQueue() self.desired_caps: Set[ICapability] = set([]) - self._read_queue: Deque[Tuple[Line, List[Emit]]] = deque() + self._read_queue: Deque[Tuple[Line, Optional[Emit]]] = deque() def hostmask(self) -> str: hostmask = self.nickname @@ -149,7 +149,7 @@ class Server(IServer): if line.command == "PING": await self.send(build("PONG", line.params)) - async def next_line(self) -> Tuple[Line, List[Emit]]: + async def next_line(self) -> Tuple[Line, Optional[Emit]]: if self._read_queue: both = self._read_queue.popleft() else: @@ -166,8 +166,8 @@ class Server(IServer): both = lines[0] break - line, emits = both - for emit in emits: + line, emit = both + if emit is not None: await self._on_read_emit(line, emit) await self._on_read_line(line) await self.line_read(line) @@ -179,7 +179,7 @@ class Server(IServer): self._wait_for.append((our_fut, response)) while self._wait_for: both = await self.next_line() - line, emits = both + line, emit = both for i, (fut, waiting) in enumerate(self._wait_for): if waiting.match(self, line): @@ -193,8 +193,8 @@ class Server(IServer): if (line.command == "PRIVMSG" and not self.cap_agreed(CAP_ECHO)): new_line = line.with_source(self.hostmask()) - emits = self.parse_tokens(new_line) - self._read_queue.append((new_line, emits)) + emit = self.parse_tokens(new_line) + self._read_queue.append((new_line, emit)) async def _write_lines(self) -> List[Line]: lines: List[SentLine] = [] diff --git a/requirements.txt b/requirements.txt index 750517a..d4ebe13 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ anyio ==1.3.0 asyncio-throttle ==1.0.1 dataclasses ==0.6 -ircstates ==0.9.4 +ircstates ==0.9.5 async_stagger ==0.3.0