summaryrefslogtreecommitdiff
path: root/src/messagehandler.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2013-12-05 15:37:09 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2013-12-05 15:37:09 +0100
commitc513e4db1cd7fdbecd59c6d385bc5f970827401e (patch)
tree9ad3b55e30bbfc04d879e35ee8158410886d333b /src/messagehandler.cc
parent4781ca61960a86f2cae8191c0bdcbdae0acb5d1d (diff)
Add login/logout.
Diffstat (limited to 'src/messagehandler.cc')
-rw-r--r--src/messagehandler.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/messagehandler.cc b/src/messagehandler.cc
index d3c3420..c946bbe 100644
--- a/src/messagehandler.cc
+++ b/src/messagehandler.cc
@@ -44,6 +44,13 @@ MessageList handle_msg(MessageList msgList, clientid_t wsi) {
it++) {
message_t &m = *it;
+ if(m.cmd == cmd::login) {
+ connection_handler.login(wsi, m.login.user, m.login.password);
+ }
+
+ // If client is not authenticated; do not continue beyond this point...
+ if(!connection_handler.authenticated(wsi)) continue;
+
switch(m.cmd) {
case cmd::create:
{
@@ -166,6 +173,14 @@ MessageList handle_msg(MessageList msgList, clientid_t wsi) {
}
break;
+ case cmd::login:
+ // Already handled, before this switch ... case
+ break;
+
+ case cmd::logout:
+ connection_handler.logout(wsi);
+ break;
+
case cmd::error:
ERR(messagehandler, "An error occurred.\n");
break;