diff options
| author | 2020-01-23 13:10:45 +0000 | |
|---|---|---|
| committer | 2020-01-23 13:10:45 +0000 | |
| commit | d919e5c3451413194600c7ec904c5fc0f1c0cd21 (patch) | |
| tree | d7e0920f1547cbfdcb6d29aa05ccd5cf1cbbbf97 /src/core_modules/line_handler/message.py | |
| parent | set_own_nickname before sending self.nick event (diff) | |
| signature | ||
simplify snotice detection, handle as normal NOTICE
Diffstat (limited to 'src/core_modules/line_handler/message.py')
| -rw-r--r-- | src/core_modules/line_handler/message.py | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/src/core_modules/line_handler/message.py b/src/core_modules/line_handler/message.py index 944c73a2..87b91c9e 100644 --- a/src/core_modules/line_handler/message.py +++ b/src/core_modules/line_handler/message.py @@ -1,5 +1,5 @@ import uuid -from src import IRCBuffer, utils +from src import IRCBuffer, IRCLine, utils def _from_self(server, source): if source: @@ -20,28 +20,22 @@ def message(events, event): if len(event["line"].args) > 1: message = event["line"].args[1] - if not from_self and ( - not event["line"].source or - not event["server"].name or - event["line"].source.hostmask == event["server"].name or - target_str == "*"): - if event["line"].source: + source = event["line"].source + if (not event["server"].nickname + or not source + or source.hostmask == event["server"].name): + if source: event["server"].name = event["line"].source.hostmask - - source = (event["server"].name or - event["server"].connection_params.hostname) - - events.on("received.server-notice").call(message=message, - message_split=message.split(" "), server=event["server"], - source=source) - return + else: + source = IRCLine.parse_hostmask(event["server"].name) + target_str = event["server"].nickname or "*" if from_self: user = event["server"].get_user(event["server"].nickname) else: - user = event["server"].get_user(event["line"].source.nickname, - username=event["line"].source.username, - hostname=event["line"].source.hostname) + user = event["server"].get_user(source.nickname, + username=source.username, + hostname=source.hostname) # strip prefix_symbols from the start of target, for when people use # e.g. 'PRIVMSG +#channel :hi' which would send a message to only |
