Refactored signals with better names and more of them. Put them after hook calls.
This commit is contained in:
parent
11dc2ee561
commit
72faf039cf
6 changed files with 79 additions and 30 deletions
|
|
@ -20,13 +20,12 @@ from django.conf import settings
|
|||
from evennia.commands.cmdhandler import CMD_LOGINSTART
|
||||
from evennia.utils.logger import log_trace
|
||||
from evennia.utils.utils import (variable_from_module, is_iter,
|
||||
to_str, make_iter, delay, callables_from_module)
|
||||
from evennia.utils.signals import ACCOUNT_LOGIN
|
||||
make_iter, delay, callables_from_module)
|
||||
from evennia.server.signals import SIGNAL_ACCOUNT_POST_LOGIN, SIGNAL_ACCOUNT_POST_LOGOUT
|
||||
from evennia.server.signals import SIGNAL_ACCOUNT_POST_CONNECT, SIGNAL_ACCOUNT_POST_DISCONNECT
|
||||
from evennia.utils.inlinefuncs import parse_inlinefunc
|
||||
from codecs import decode as codecs_decode
|
||||
|
||||
import pickle
|
||||
|
||||
_INLINEFUNC_ENABLED = settings.INLINEFUNC_ENABLED
|
||||
|
||||
# delayed imports
|
||||
|
|
@ -518,9 +517,10 @@ class ServerSessionHandler(SessionHandler):
|
|||
operation=SLOGIN,
|
||||
sessiondata={"logged_in": True,
|
||||
"uid": session.uid})
|
||||
if nsess < 2:
|
||||
ACCOUNT_LOGIN.send(sender=account, session=session)
|
||||
account.at_post_login(session=session)
|
||||
if nsess < 2:
|
||||
SIGNAL_ACCOUNT_POST_LOGIN.send(sender=account, session=session)
|
||||
SIGNAL_ACCOUNT_POST_CONNECT.send(sender=account, session=session)
|
||||
|
||||
def disconnect(self, session, reason="", sync_portal=True):
|
||||
"""
|
||||
|
|
@ -547,7 +547,11 @@ class ServerSessionHandler(SessionHandler):
|
|||
string = string.format(reason=sreason, account=session.account, address=session.address, nsessions=nsess)
|
||||
session.log(string)
|
||||
|
||||
if nsess == 0:
|
||||
SIGNAL_ACCOUNT_POST_LOGOUT.send(sender=session.account, session=session)
|
||||
|
||||
session.at_disconnect(reason)
|
||||
SIGNAL_ACCOUNT_POST_DISCONNECT.send(sender=session.account, session=session)
|
||||
sessid = session.sessid
|
||||
if sessid in self and not hasattr(self, "_disconnect_all"):
|
||||
del self[sessid]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue