Make sure more than one hook can catch preprocess.send
but still respect any
that return a change to the output (src/IRCServer.py)
This commit is contained in:
parent
ed44e6f78b
commit
8dcd6b2937
1 changed files with 5 additions and 2 deletions
|
@ -297,9 +297,12 @@ class Server(IRCObject.Object):
|
||||||
return self.until_read_timeout == 0
|
return self.until_read_timeout == 0
|
||||||
|
|
||||||
def send(self, line: str):
|
def send(self, line: str):
|
||||||
returned = self.events.on("preprocess.send").call_unsafe_for_result(
|
results = self.events.on("preprocess.send").call_unsafe(
|
||||||
server=self, line=line)
|
server=self, line=line)
|
||||||
line = returned or line
|
for result in results:
|
||||||
|
if result:
|
||||||
|
line = result
|
||||||
|
break
|
||||||
|
|
||||||
encoded = line.split("\n")[0].strip("\r").encode("utf8")
|
encoded = line.split("\n")[0].strip("\r").encode("utf8")
|
||||||
if len(encoded) > 450:
|
if len(encoded) > 450:
|
||||||
|
|
Loading…
Reference in a new issue