user
is null when we sent a NOTICE non-echo-message (line_handler.py)
This commit is contained in:
parent
44df8240cc
commit
2e925a6853
1 changed files with 8 additions and 3 deletions
|
@ -544,22 +544,27 @@ class Module(ModuleManager.BaseModule):
|
||||||
context = "channel" if channel else "private"
|
context = "channel" if channel else "private"
|
||||||
hook = self.events.on(direction).on("notice").on(context)
|
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,
|
kwargs = {"message": message, "message_split": message_split,
|
||||||
"server": event["server"], "tags": event["tags"]}
|
"server": event["server"], "tags": event["tags"]}
|
||||||
|
|
||||||
if channel:
|
if channel:
|
||||||
hook.call(user=user, channel=channel, **kwargs)
|
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)
|
user==None)
|
||||||
elif event["server"].is_own_nickname(target):
|
elif event["server"].is_own_nickname(target):
|
||||||
hook.call(user=user, **kwargs)
|
hook.call(user=user, **kwargs)
|
||||||
user.buffer.add_notice(user.nickname, message, event["tags"],
|
user.buffer.add_notice(user_nickname, message, event["tags"],
|
||||||
False)
|
False)
|
||||||
elif not "prefix" in event:
|
elif not "prefix" in event:
|
||||||
# a notice we've sent to a user
|
# a notice we've sent to a user
|
||||||
user = event["server"].get_user(target)
|
user = event["server"].get_user(target)
|
||||||
hook.call(user=user, **kwargs)
|
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
|
# IRCv3 TAGMSG, used to send tags without any other information
|
||||||
@utils.hook("raw.received.tagmsg")
|
@utils.hook("raw.received.tagmsg")
|
||||||
|
|
Loading…
Reference in a new issue