From 2e925a685359c3a99d3794ff1d43dfbf2c1cf319 Mon Sep 17 00:00:00 2001 From: jesopo Date: Tue, 12 Feb 2019 17:07:39 +0000 Subject: `user` is null when we sent a NOTICE non-echo-message (line_handler.py) --- modules/line_handler.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'modules/line_handler.py') diff --git a/modules/line_handler.py b/modules/line_handler.py index 351c786d..da69888d 100644 --- a/modules/line_handler.py +++ b/modules/line_handler.py @@ -544,22 +544,27 @@ class Module(ModuleManager.BaseModule): context = "channel" if channel else "private" hook = self.events.on(direction).on("notice").on(context) + user_nickname = None + if user: + user_nickname = None if from_self else user.nickname + kwargs = {"message": message, "message_split": message_split, "server": event["server"], "tags": event["tags"]} if channel: hook.call(user=user, channel=channel, **kwargs) - channel.buffer.add_notice(user.nickname, message, event["tags"], + channel.buffer.add_notice(user_nickname, message, event["tags"], user==None) elif event["server"].is_own_nickname(target): hook.call(user=user, **kwargs) - user.buffer.add_notice(user.nickname, message, event["tags"], + user.buffer.add_notice(user_nickname, message, event["tags"], False) elif not "prefix" in event: # a notice we've sent to a user user = event["server"].get_user(target) hook.call(user=user, **kwargs) - user.buffer.add_message(None, message, event["tags"], True) + user.buffer.add_notice(user_nickname, message, event["tags"], + True) # IRCv3 TAGMSG, used to send tags without any other information @utils.hook("raw.received.tagmsg") -- cgit v1.3.1-10-gc9f91