user
is null when we're sending a message non-echo-mesasge (line_handler.py)
This commit is contained in:
parent
e573f9de51
commit
44df8240cc
1 changed files with 8 additions and 4 deletions
|
@ -442,7 +442,6 @@ class Module(ModuleManager.BaseModule):
|
|||
from_self = False
|
||||
|
||||
user = None
|
||||
user_nickname = None
|
||||
if "prefix" in event:
|
||||
user = event["server"].get_user(event["prefix"].nickname)
|
||||
|
||||
|
@ -484,19 +483,24 @@ class Module(ModuleManager.BaseModule):
|
|||
context = "channel" if channel else "private"
|
||||
hook = self.events.on(direction).on(event_type).on(context)
|
||||
|
||||
user_nickname = None
|
||||
if user:
|
||||
user_nickname = None if from_self else user.nickname
|
||||
|
||||
if channel:
|
||||
hook.call(user=user, channel=channel, statusmsg=statusmsg, **kwargs)
|
||||
channel.buffer.add_message(user.nickname, message, action,
|
||||
channel.buffer.add_message(user_nickname, message, action,
|
||||
event["tags"], user==None)
|
||||
elif event["server"].is_own_nickname(target):
|
||||
hook.call(user=user, **kwargs)
|
||||
user.buffer.add_message(user.nickname, message, action,
|
||||
user.buffer.add_message(user_nickname, message, action,
|
||||
event["tags"], False)
|
||||
elif not "prefix" in event:
|
||||
# a message we've sent to a user
|
||||
user = event["server"].get_user(target)
|
||||
hook.call(user=user, **kwargs)
|
||||
user.buffer.add_message(None, message, action, event["tags"], True)
|
||||
user.buffer.add_message(user_nickname, message, action,
|
||||
event["tags"], True)
|
||||
|
||||
# we've received/sent a notice
|
||||
@utils.hook("raw.received.notice")
|
||||
|
|
Loading…
Reference in a new issue