mirror of https://github.com/jesopo/ircrobots
create a fake echo-message when we have not CAP negotiated echo-message
This commit is contained in:
parent
b88fa51907
commit
0e2a2bcd00
|
@ -166,6 +166,13 @@ class Server(IServer):
|
||||||
|
|
||||||
async def line_send(self, line: Line):
|
async def line_send(self, line: Line):
|
||||||
pass
|
pass
|
||||||
|
async def _on_write_line(self, line: Line):
|
||||||
|
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))
|
||||||
|
|
||||||
async def _write_lines(self) -> List[Line]:
|
async def _write_lines(self) -> List[Line]:
|
||||||
lines: List[SentLine] = []
|
lines: List[SentLine] = []
|
||||||
|
|
||||||
|
@ -183,6 +190,7 @@ class Server(IServer):
|
||||||
|
|
||||||
for line in lines:
|
for line in lines:
|
||||||
line.future.set_result(line)
|
line.future.set_result(line)
|
||||||
|
await self._on_write_line(line.line)
|
||||||
await self.line_send(line.line)
|
await self.line_send(line.line)
|
||||||
|
|
||||||
return [l.line for l in lines]
|
return [l.line for l in lines]
|
||||||
|
|
Loading…
Reference in New Issue