aboutsummaryrefslogtreecommitdiff
path: root/diplomacy/server/users.py
diff options
context:
space:
mode:
authorSatya Ortiz-Gagne <satya.ortiz-gagne@mila.quebec>2019-06-10 10:12:45 -0400
committerPhilip Paquette <pcpaquette@gmail.com>2019-06-14 15:08:29 -0400
commit4979f43baba8c7377471bbf65e7b5c003bf65406 (patch)
treec7c188edfbbb2a061a50ce0ec976b86d079e0dff /diplomacy/server/users.py
parenta47a787bbc15fc01a20fef7df05437fd3ce7eae8 (diff)
DAIDE - Implemented notifications and notification_managers
- MAP = MapNameNotification - HLO = HelloNotification - SCO = SupplyCenterNotification - NOW = CurrentPositionNotification - MIS = MissingOrdersNotification - ORD = OrderResultNotification - TME = TimeToDeadlineNotification - CCD = PowerInCivilDisorderNotification - OUT = PowerIsEliminatedNotification - DRW = DrawNotification - FRM = MessageFromNotification - SLO = SoloNotification - SMR = SummaryNotification - OFF = TurnOffNotification
Diffstat (limited to 'diplomacy/server/users.py')
-rw-r--r--diplomacy/server/users.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/diplomacy/server/users.py b/diplomacy/server/users.py
index d1c8ca0..d63df3e 100644
--- a/diplomacy/server/users.py
+++ b/diplomacy/server/users.py
@@ -116,6 +116,10 @@ class Users(Jsonable):
""" Return username of given token. """
return self.token_to_username[token]
+ def get_user(self, username):
+ """ Returns user linked to username """
+ return self.users.get(username, None)
+
def get_connection_handler(self, token):
""" Return connection handler associated to given token, or None if no handler currently associated. """
return self.token_to_connection_handler.get(token, None)
@@ -145,6 +149,10 @@ class Users(Jsonable):
self.users[username] = user
return user
+ def replace_user(self, username, new_user):
+ """ Replaces user object with a new user """
+ self.users[username] = new_user
+
def remove_user(self, username):
""" Remove user related to given username. """
user = self.users.pop(username)