This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository e16.

View the commit online.

commit f0a3f894b452377112c3d3f7c7352d5a65d3174c
Author: Kim Woelders <k...@woelders.dk>
AuthorDate: Fri Mar 15 15:57:24 2024 +0100

    session: Introduce SessionLogout()
---
 src/ipc.c     |  6 +++---
 src/session.c | 46 ++++++++++++++++++++++++++++------------------
 src/session.h | 13 +++++++------
 3 files changed, 38 insertions(+), 27 deletions(-)

diff --git a/src/ipc.c b/src/ipc.c
index 00e7321c..5650c46c 100644
--- a/src/ipc.c
+++ b/src/ipc.c
@@ -1097,16 +1097,16 @@ IPC_Exit(const char *params)
 
     if (!param1[0])
         SessionExit(EEXIT_EXIT, NULL);
-    else if (!strcmp(param1, "logout"))
-        SessionExit(EEXIT_LOGOUT, NULL);
     else if (!strcmp(param1, "restart"))
         SessionExit(EEXIT_RESTART, NULL);
     else if (!strcmp(param1, "theme"))
         SessionExit(EEXIT_THEME, p2);
     else if (!strcmp(param1, "exec"))
         SessionExit(EEXIT_EXEC, p2);
+    else if (!strcmp(param1, "logout"))
+        SessionLogout(ESESSION_LOGOUT);
     else if (!strcmp(param1, "shutdown"))
-        SessionExit(EEXIT_SHUTDOWN, NULL);
+        SessionLogout(ESESSION_SHUTDOWN);
 }
 
 #if ENABLE_DIALOGS
diff --git a/src/session.c b/src/session.c
index 69baf122..3854a694 100644
--- a/src/session.c
+++ b/src/session.c
@@ -714,24 +714,6 @@ SessionExit(int mode, const char *param)
         Eprintf("%s: already in progress ... now exiting\n", __func__);
         exit(1);
         break;
-
-    case EEXIT_LOGOUT:
-#if ENABLE_DIALOGS
-        if (Conf.session.enable_logout_dialog)
-            _SessionLogoutConfirm();
-        else
-#endif
-            _SessionLogout();
-        return;
-
-    case EEXIT_SHUTDOWN:
-#if ENABLE_DIALOGS
-        if (Conf.session.enable_logout_dialog)
-            _SessionLogoutConfirm();
-        else
-#endif
-            _SessionLogout();
-        return;
     }
 
   done:
@@ -739,6 +721,34 @@ SessionExit(int mode, const char *param)
     doSMExit(mode, param);
 }
 
+void
+SessionLogout(int mode)
+{
+    switch (mode)
+    {
+    default:                   /* We should not go here - ignore */
+        break;
+
+    case ESESSION_LOGOUT:
+#if ENABLE_DIALOGS
+        if (Conf.session.enable_logout_dialog)
+            _SessionLogoutConfirm();
+        else
+#endif
+            _SessionLogout();
+        break;
+
+    case ESESSION_SHUTDOWN:
+#if ENABLE_DIALOGS
+        if (Conf.session.enable_logout_dialog)
+            _SessionLogoutConfirm();
+        else
+#endif
+            _SessionLogout();
+        break;
+    }
+}
+
 static void
 _SessionRunProg(const char *prog, const char *params)
 {
diff --git a/src/session.h b/src/session.h
index 7e6d9081..c7b748b8 100644
--- a/src/session.h
+++ b/src/session.h
@@ -24,15 +24,15 @@
 #ifndef _SESSION_H_
 #define _SESSION_H_
 
-/* session.c */
 #define EEXIT_QUIT      0
 #define EEXIT_EXIT      1
 #define EEXIT_ERROR     2
-#define EEXIT_LOGOUT    3
-#define EEXIT_RESTART   4
-#define EEXIT_THEME     5
-#define EEXIT_EXEC      6
-#define EEXIT_SHUTDOWN  7
+#define EEXIT_RESTART   3
+#define EEXIT_THEME     4
+#define EEXIT_EXEC      5
+
+#define ESESSION_LOGOUT    0
+#define ESESSION_SHUTDOWN  1
 
 #define ESESSHLP_INIT   0
 #define ESESSHLP_START  1
@@ -40,6 +40,7 @@
 
 void            SessionInit(void);
 void            SessionExit(int mode, const char *params);
+void            SessionLogout(int mode);
 void            SessionHelper(int when);
 
 #endif                          /* _SESSION_H_ */

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to