mirror of
https://github.com/evennia/evennia.git
synced 2026-03-20 14:56:30 +01:00
Cleaned up the logging of connect/disconnect.
This commit is contained in:
parent
1e07b8ca34
commit
efc078b78c
1 changed files with 27 additions and 20 deletions
|
|
@ -191,21 +191,6 @@ class ServerSessionHandler(SessionHandler):
|
|||
data="")
|
||||
# server-side access methods
|
||||
|
||||
def disconnect(self, session, reason=""):
|
||||
"""
|
||||
Called from server side to remove session and inform portal
|
||||
of this fact.
|
||||
"""
|
||||
session = self.sessions.get(session.sessid)
|
||||
if session:
|
||||
session.at_disconnect()
|
||||
sessid = session.sessid
|
||||
del self.sessions[sessid]
|
||||
# inform portal that session should be closed.
|
||||
self.server.amp_protocol.call_remote_PortalAdmin(sessid,
|
||||
operation=SDISCONN,
|
||||
data=reason)
|
||||
|
||||
def login(self, session, player):
|
||||
"""
|
||||
Log in the previously unloggedin session and the player we by
|
||||
|
|
@ -232,15 +217,14 @@ class ServerSessionHandler(SessionHandler):
|
|||
|
||||
player.at_pre_login()
|
||||
|
||||
session.log(_('Logged in: %(self)s') % {'self': player})
|
||||
|
||||
# start (persistent) scripts on this object
|
||||
#ScriptDB.objects.validate(obj=self.player.character)
|
||||
|
||||
if MULTISESSION_MODE == 0:
|
||||
# disconnect all previous sessions.
|
||||
self.disconnect_duplicate_sessions(session)
|
||||
|
||||
nsess = len(self.sessions_from_player(player))
|
||||
totalstring = "%i session%s total" % (nsess, nsess > 1 and "s" or "")
|
||||
session.log(_('Logged in: %s %s (%s)' % (player, session.address, totalstring)))
|
||||
|
||||
session.logged_in = True
|
||||
# sync the portal to the session
|
||||
sessdata = session.get_sync_data()
|
||||
|
|
@ -249,6 +233,29 @@ class ServerSessionHandler(SessionHandler):
|
|||
data=sessdata)
|
||||
player.at_post_login()
|
||||
|
||||
def disconnect(self, session, reason=""):
|
||||
"""
|
||||
Called from server side to remove session and inform portal
|
||||
of this fact.
|
||||
"""
|
||||
session = self.sessions.get(session.sessid)
|
||||
if not session:
|
||||
return
|
||||
|
||||
if hasattr(session, "player") and session.player:
|
||||
# only log accounts logging off
|
||||
nsess = len(self.sessions_from_player(session.player)) - 1
|
||||
remaintext = nsess and "%i session%s remaining" % (nsess, nsess > 1 and "s" or "") or "no more sessions"
|
||||
session.log(_('Logged out: %s %s (%s)' % (session.player, session.address, remaintext)))
|
||||
|
||||
session.at_disconnect()
|
||||
sessid = session.sessid
|
||||
del self.sessions[sessid]
|
||||
# inform portal that session should be closed.
|
||||
self.server.amp_protocol.call_remote_PortalAdmin(sessid,
|
||||
operation=SDISCONN,
|
||||
data=reason)
|
||||
|
||||
def all_sessions_portal_sync(self):
|
||||
"""
|
||||
This is called by the server when it reboots. It syncs all session data
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue