update ircstates, now only one (maybe Optional) Emit
This commit is contained in:
parent
739b039d50
commit
d51fcf0987
3 changed files with 9 additions and 9 deletions
|
@ -98,7 +98,7 @@ class IServer(Server):
|
||||||
async def sts_policy(self, sts: STSPolicy):
|
async def sts_policy(self, sts: STSPolicy):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
async def next_line(self) -> Optional[Tuple[Line, List[Emit]]]:
|
async def next_line(self) -> Optional[Tuple[Line, Optional[Emit]]]:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def cap_agreed(self, capability: ICapability) -> bool:
|
def cap_agreed(self, capability: ICapability) -> bool:
|
||||||
|
|
|
@ -44,7 +44,7 @@ class Server(IServer):
|
||||||
self._write_queue: PriorityQueue[SentLine] = PriorityQueue()
|
self._write_queue: PriorityQueue[SentLine] = PriorityQueue()
|
||||||
self.desired_caps: Set[ICapability] = set([])
|
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:
|
def hostmask(self) -> str:
|
||||||
hostmask = self.nickname
|
hostmask = self.nickname
|
||||||
|
@ -149,7 +149,7 @@ class Server(IServer):
|
||||||
if line.command == "PING":
|
if line.command == "PING":
|
||||||
await self.send(build("PONG", line.params))
|
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:
|
if self._read_queue:
|
||||||
both = self._read_queue.popleft()
|
both = self._read_queue.popleft()
|
||||||
else:
|
else:
|
||||||
|
@ -166,8 +166,8 @@ class Server(IServer):
|
||||||
both = lines[0]
|
both = lines[0]
|
||||||
break
|
break
|
||||||
|
|
||||||
line, emits = both
|
line, emit = both
|
||||||
for emit in emits:
|
if emit is not None:
|
||||||
await self._on_read_emit(line, emit)
|
await self._on_read_emit(line, emit)
|
||||||
await self._on_read_line(line)
|
await self._on_read_line(line)
|
||||||
await self.line_read(line)
|
await self.line_read(line)
|
||||||
|
@ -179,7 +179,7 @@ class Server(IServer):
|
||||||
self._wait_for.append((our_fut, response))
|
self._wait_for.append((our_fut, response))
|
||||||
while self._wait_for:
|
while self._wait_for:
|
||||||
both = await self.next_line()
|
both = await self.next_line()
|
||||||
line, emits = both
|
line, emit = both
|
||||||
|
|
||||||
for i, (fut, waiting) in enumerate(self._wait_for):
|
for i, (fut, waiting) in enumerate(self._wait_for):
|
||||||
if waiting.match(self, line):
|
if waiting.match(self, line):
|
||||||
|
@ -193,8 +193,8 @@ class Server(IServer):
|
||||||
if (line.command == "PRIVMSG" and
|
if (line.command == "PRIVMSG" and
|
||||||
not self.cap_agreed(CAP_ECHO)):
|
not self.cap_agreed(CAP_ECHO)):
|
||||||
new_line = line.with_source(self.hostmask())
|
new_line = line.with_source(self.hostmask())
|
||||||
emits = self.parse_tokens(new_line)
|
emit = self.parse_tokens(new_line)
|
||||||
self._read_queue.append((new_line, emits))
|
self._read_queue.append((new_line, emit))
|
||||||
|
|
||||||
async def _write_lines(self) -> List[Line]:
|
async def _write_lines(self) -> List[Line]:
|
||||||
lines: List[SentLine] = []
|
lines: List[SentLine] = []
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
anyio ==1.3.0
|
anyio ==1.3.0
|
||||||
asyncio-throttle ==1.0.1
|
asyncio-throttle ==1.0.1
|
||||||
dataclasses ==0.6
|
dataclasses ==0.6
|
||||||
ircstates ==0.9.4
|
ircstates ==0.9.5
|
||||||
async_stagger ==0.3.0
|
async_stagger ==0.3.0
|
||||||
|
|
Loading…
Reference in a new issue