diff options
| author | AL-LCL <alvin@alvinhavel.com> | 2023-05-19 11:01:49 +0200 | 
|---|---|---|
| committer | AL-LCL <alvin@alvinhavel.com> | 2023-05-19 11:01:49 +0200 | 
| commit | 20dbeb2f38684c65ff0a4b99012c161295708e88 (patch) | |
| tree | a5b8445f55da2fbbb92443b68e9d7354a290c598 /domestic/session/server_handling/system.py | |
Diffstat (limited to 'domestic/session/server_handling/system.py')
| -rw-r--r-- | domestic/session/server_handling/system.py | 29 | 
1 files changed, 29 insertions, 0 deletions
| diff --git a/domestic/session/server_handling/system.py b/domestic/session/server_handling/system.py new file mode 100644 index 0000000..f505dbf --- /dev/null +++ b/domestic/session/server_handling/system.py @@ -0,0 +1,29 @@ +from domestic.parse.error_exception_handling import * +from domestic.utility.validate_dict_key import * +from domestic.session.session_message import * +from domestic.global_state import * + + +@error_exception_handling +def system(message): +  shutdown = validate_dict_key(message, 'shutdown') +  restart = validate_dict_key(message, 'restart') +  logout = validate_dict_key(message, 'logout') +  standby = validate_dict_key(message, 'standby') + +  if shutdown: +    message['action_type'] = 'shutdown' +    del message['shutdown'] +  elif restart: +    message['action_type'] = 'restart' +    del message['restart'] +  elif logout: +    message['action_type'] = 'logout' +    del message['logout'] +  elif standby: +    message['action_type'] = 'standby' +    del message['standby'] +  else: +    raise Exception('Error message') +   +  session_message(message)
\ No newline at end of file | 
