print lines as soon as they're read, don't wait for _post_send
This commit is contained in:
parent
f96378ac07
commit
05fcb33ff7
2 changed files with 12 additions and 9 deletions
|
@ -256,7 +256,7 @@ class Bot(object):
|
||||||
server = self.servers[fd]
|
server = self.servers[fd]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
lines = server.socket._send()
|
lines = server._send()
|
||||||
except:
|
except:
|
||||||
self.log.error("Failed to write to %s", [str(server)])
|
self.log.error("Failed to write to %s", [str(server)])
|
||||||
raise
|
raise
|
||||||
|
|
|
@ -240,6 +240,17 @@ class Server(IRCObject.Object):
|
||||||
|
|
||||||
return lines
|
return lines
|
||||||
|
|
||||||
|
def _send(self) -> typing.List[IRCLine.SentLine]:
|
||||||
|
lines = self.socket._send()
|
||||||
|
for line in lines:
|
||||||
|
self.bot.log.debug("%s (raw send) | %s", [
|
||||||
|
str(self), line.parsed_line.format()])
|
||||||
|
return lines
|
||||||
|
def _post_send(self, lines: typing.List[IRCLine.SentLine]):
|
||||||
|
for line in lines:
|
||||||
|
self.events.on("raw.send").call_unsafe(server=self,
|
||||||
|
line=line.parsed_line)
|
||||||
|
|
||||||
def send(self, line_parsed: IRCLine.ParsedLine, immediate: bool=False):
|
def send(self, line_parsed: IRCLine.ParsedLine, immediate: bool=False):
|
||||||
if not self.send_enabled:
|
if not self.send_enabled:
|
||||||
return None
|
return None
|
||||||
|
@ -263,14 +274,6 @@ class Server(IRCObject.Object):
|
||||||
def send_raw(self, line: str):
|
def send_raw(self, line: str):
|
||||||
return self.send(utils.irc.parse_line(line))
|
return self.send(utils.irc.parse_line(line))
|
||||||
|
|
||||||
|
|
||||||
def _post_send(self, lines: typing.List[IRCLine.SentLine]):
|
|
||||||
for line in lines:
|
|
||||||
self.bot.log.debug("%s (raw send) | %s", [
|
|
||||||
str(self), line.parsed_line.format()])
|
|
||||||
self.events.on("raw.send").call_unsafe(server=self,
|
|
||||||
line=line.parsed_line)
|
|
||||||
|
|
||||||
def send_user(self, username: str, realname: str) -> IRCLine.SentLine:
|
def send_user(self, username: str, realname: str) -> IRCLine.SentLine:
|
||||||
return self.send(utils.irc.protocol.user(username, realname))
|
return self.send(utils.irc.protocol.user(username, realname))
|
||||||
def send_nick(self, nickname: str) -> IRCLine.SentLine:
|
def send_nick(self, nickname: str) -> IRCLine.SentLine:
|
||||||
|
|
Loading…
Reference in a new issue