Made msg() properly trigger the at_msg_receive hook, as per #506.
This commit is contained in:
parent
4ab5e2aa22
commit
5d1b74ea17
1 changed files with 10 additions and 1 deletions
|
|
@ -473,6 +473,9 @@ class ObjectDB(TypedObject):
|
||||||
sessid (int): sessid to relay to, if any.
|
sessid (int): sessid to relay to, if any.
|
||||||
If set to 0 (default), use either from_obj.sessid (if set) or self.sessid automatically
|
If set to 0 (default), use either from_obj.sessid (if set) or self.sessid automatically
|
||||||
If None, echo to all connected sessions
|
If None, echo to all connected sessions
|
||||||
|
|
||||||
|
When this message is called, from_obj.at_msg_send and self.at_msg_receive are called.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
global _SESSIONS
|
global _SESSIONS
|
||||||
if not _SESSIONS:
|
if not _SESSIONS:
|
||||||
|
|
@ -492,7 +495,13 @@ class ObjectDB(TypedObject):
|
||||||
try:
|
try:
|
||||||
_GA(from_obj, "at_msg_send")(text=text, to_obj=self, **kwargs)
|
_GA(from_obj, "at_msg_send")(text=text, to_obj=self, **kwargs)
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
logger.log_trace()
|
||||||
|
try:
|
||||||
|
if not _GA(_GA(self, "typeclass"), "at_msg_receive")(text=text, **kwargs):
|
||||||
|
# if at_msg_receive returns false, we abort message to this object
|
||||||
|
return
|
||||||
|
except Exception:
|
||||||
|
logger.log_trace()
|
||||||
|
|
||||||
session = _SESSIONS.session_from_sessid(sessid if sessid else _GA(self, "sessid"))
|
session = _SESSIONS.session_from_sessid(sessid if sessid else _GA(self, "sessid"))
|
||||||
if session:
|
if session:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue