aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/commands/outs.py8
-rw-r--r--src/IRCLine.py8
2 files changed, 7 insertions, 9 deletions
diff --git a/modules/commands/outs.py b/modules/commands/outs.py
index 067a872b..659774ba 100644
--- a/modules/commands/outs.py
+++ b/modules/commands/outs.py
@@ -44,13 +44,11 @@ class Out(object):
if self._assured:
line.assure()
- valid, truncated = line.truncate(self.server.hostmask())
+ valid, truncated = line.truncate(self.server.hostmask(),
+ margin=STR_MORE_LEN)
if truncated:
- truncated = valid[-STR_MORE_LEN:]+truncated
- new_line = valid[:-STR_MORE_LEN]+STR_MORE
- line = utils.irc.parse_line(new_line)
-
+ line = utils.irc.parse_line(valid+STR_MORE)
self._text = "%s%s" % (STR_CONTINUED, truncated)
else:
self._text = ""
diff --git a/src/IRCLine.py b/src/IRCLine.py
index f713eecd..5aae1f53 100644
--- a/src/IRCLine.py
+++ b/src/IRCLine.py
@@ -111,13 +111,13 @@ class ParsedLine(object):
else:
return line
- def _line_max(self, hostmask: str) -> int:
- return LINE_MAX-len((":%s " % hostmask).encode("utf8"))
- def truncate(self, hostmask: str) -> typing.Tuple[str, str]:
+ def _line_max(self, hostmask: str, margin: int) -> int:
+ return LINE_MAX-len((":%s " % hostmask).encode("utf8"))-margin
+ def truncate(self, hostmask: str, margin: int=0) -> typing.Tuple[str, str]:
valid_bytes = b""
valid_index = -1
- line_max = self._line_max(hostmask)
+ line_max = self._line_max(hostmask, margin)
tags_formatted, line_formatted = self._format()
for i, char in enumerate(line_formatted):