Handle autosetup and tell packets correctly.
This commit is contained in:
parent
c18937d3ba
commit
2d6ef25081
2 changed files with 36 additions and 9 deletions
|
|
@ -2,7 +2,7 @@
|
|||
Session manager, handles connected players.
|
||||
"""
|
||||
import time
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from src.config.models import ConfigValue
|
||||
from src import logger
|
||||
from src.util import functions_general
|
||||
|
|
@ -10,6 +10,17 @@ from src.util import functions_general
|
|||
# Our list of connected sessions.
|
||||
session_list = []
|
||||
|
||||
def find_sessions_from_username(username):
|
||||
"""
|
||||
Given a username, return any matching sessions.
|
||||
"""
|
||||
try:
|
||||
uobj = User.objects.get(username=username)
|
||||
uid = uobj.id
|
||||
return [session for session in session_list if session.uid == uid]
|
||||
except User.DoesNotExist:
|
||||
return None
|
||||
|
||||
def add_session(session):
|
||||
"""
|
||||
Adds a session to the session list.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue