summaryrefslogtreecommitdiff
path: root/domestic/session/server_handling/system.py
diff options
context:
space:
mode:
Diffstat (limited to 'domestic/session/server_handling/system.py')
-rw-r--r--domestic/session/server_handling/system.py29
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