From 139eabba6a6aada61b35cca8895e12fe7d3f99f7 Mon Sep 17 00:00:00 2001 From: Maurice O'Neal Date: Sat, 14 Sep 2019 13:31:27 -0400 Subject: [PATCH] Converted a Async command to client receivable The ASYNC_USER_DELETED async command will now be forwarded to the client if needed so clients can now be notified if the user account gets deleted. 1.0.1 --> 1.0.2 --- docs/Async.md | 4 ++-- src/common.h | 2 +- src/db.h | 2 +- src/session.cpp | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/Async.md b/docs/Async.md index 714e059..f88a25c 100644 --- a/docs/Async.md +++ b/docs/Async.md @@ -14,7 +14,7 @@ These are considered "virtual" commands because there is no defined command obje #define ASYNC_CAST 5 // internal only #define ASYNC_MAXSES 6 // internal only #define ASYNC_LOGOUT 7 // internal only -#define ASYNC_USER_DELETED 8 // internal only +#define ASYNC_USER_DELETED 8 #define ASYNC_GROUP_RENAMED 9 // internal only #define ASYNC_DISP_RENAMED 10 // internal only #define ASYNC_GRP_TRANS 11 // internal only @@ -76,7 +76,7 @@ Internal only async command that is used by internal commands to send a ```BYTES This internal only async command doesn't carry any data. This is just used to notify the main process ```Session``` object that the user has logged out and should not attempt to restore authentication in case of a session crash. This doesn't actually do the logout. ```ASYNC_USER_DELETED (8)``` -This internal only async command carry ```TEXT``` data that is the user name of the user account that was deleted from the host database. All ```Session``` objects that get this command must read and match this to the user name that is currently logged in for that object. If the user name matches, the ```Session``` object must logout since the user account no longer exists. +This async command carry ```TEXT``` data that is the user name of the user account that was deleted from the host database. All ```Session``` objects that get this command must read and match this to the user name that is currently logged in for that object. If the user name matches, the ```Session``` object must logout and forward this to the client since the user account no longer exists. ```ASYNC_GROUP_RENAMED (9)``` Internal only async command that carry ```TEXT``` command line arguments to notify all ```Session``` objects that the a host group name has changed. Example: ```-src "old_group_name" -dst "new_group_name"```. All ```Session``` objects that have matching current group names to ```old_group_name``` must update that group name to ```new_group_name``` and also send a ```ASYNC_SYS_MSG``` containing an updated ```MY_INFO```. diff --git a/src/common.h b/src/common.h index 0a38490..55938dc 100644 --- a/src/common.h +++ b/src/common.h @@ -92,7 +92,7 @@ #define ASYNC_CAST 5 // internal only #define ASYNC_MAXSES 6 // internal only #define ASYNC_LOGOUT 7 // internal only -#define ASYNC_USER_DELETED 8 // internal only +#define ASYNC_USER_DELETED 8 #define ASYNC_GROUP_RENAMED 9 // internal only #define ASYNC_DISP_RENAMED 10 // internal only #define ASYNC_GRP_TRANS 11 // internal only diff --git a/src/db.h b/src/db.h index 135e3da..b2c57c8 100644 --- a/src/db.h +++ b/src/db.h @@ -37,7 +37,7 @@ #include "shell.h" #define APP_NAME "MRCI" -#define APP_VER "1.0.1" +#define APP_VER "1.0.2" #define APP_TARGET "mrci" #ifdef Q_OS_WIN diff --git a/src/session.cpp b/src/session.cpp index 498f95a..20d9b5d 100644 --- a/src/session.cpp +++ b/src/session.cpp @@ -944,6 +944,7 @@ void Session::backendDataIn(quint16 cmdId, const QByteArray &data) { logout(); dataToClient(ASYNC_SYS_MSG, toTEXT("\nsystem: your session was forced to logout because your account was deleted.\n"), TEXT); + dataToClient(ASYNC_USER_DELETED, data, TEXT); } } }