diff options
| author | 2019-10-28 10:56:33 +0000 | |
|---|---|---|
| committer | 2019-10-28 10:56:33 +0000 | |
| commit | 7ee65f8f8ca9da93174284450db891346ea9daaf (patch) | |
| tree | ef74117b4262d1f5a4e18f6d568b5ef8d13aeb14 /modules/commands/outs.py | |
| parent | Revert "remove unneeded import" (diff) | |
remove src/utils/irc/protocol.py
Diffstat (limited to 'modules/commands/outs.py')
| -rw-r--r-- | modules/commands/outs.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/modules/commands/outs.py b/modules/commands/outs.py index 9098df63..0fd8db7d 100644 --- a/modules/commands/outs.py +++ b/modules/commands/outs.py @@ -6,6 +6,14 @@ STR_MORE_LEN = len(STR_MORE.encode("utf8")) STR_CONTINUED = "(...continued) " WORD_BOUNDARY = ' ' +def _mesage_factory(command): + if not command in ["PRIVMSG", "NOTICE"]: + raise ValueError("Unknown command method '%s'" % method) + + def _(target, message): + return IRCLine.ParsedLine(command, [target, message]) + return _ + class Out(object): def __init__(self, server, module_name, target, target_str, tags): self.server = server @@ -39,15 +47,9 @@ class Out(object): text = text.replace("\n\n", "\n") full_text = "%s%s" % (prefix, text) - line_factory = None - if method == "PRIVMSG": - line_factory = utils.irc.protocol.privmsg - elif method == "NOTICE": - line_factory = utils.irc.protocol.notice - else: - raise ValueError("Unknown command method '%s'" % method) + message_factory = _mess_factory(method) - line = line_factory(self._target_str, full_text, tags=self._tags) + line = message_factory(self._target_str, full_text, tags=self._tags) if self._assured: line.assure() |
