From 9b0b1df3dceb5986d8b479c8301a4fdccae3bad4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Sat, 8 Sep 2007 18:16:19 +0000 Subject: [PATCH] * restart logic for the "Shutdown Citadel" menu. The ui is sort of 3rd class so far, but does its job. --- webcit/mainmenu.c | 75 +++++++++++++++++++++++++++++++++++++++++++++-- webcit/webcit.c | 2 ++ webcit/webcit.h | 1 + 3 files changed, 76 insertions(+), 2 deletions(-) diff --git a/webcit/mainmenu.c b/webcit/mainmenu.c index cb5909e04..7842e50b9 100644 --- a/webcit/mainmenu.c +++ b/webcit/mainmenu.c @@ -199,8 +199,6 @@ void display_aide_menu(void) - - /** * \brief Display the screen to enter a generic server command */ @@ -338,4 +336,77 @@ void display_menubar(int as_single_page) { } +/** + * \brief Display the wait / input dialog while restarting the server. + */ +void display_shutdown(void) +{ + char buf[SIZ]; + char *when; + + when=bstr("when"); + if (!strcmp(when, "now")){ + serv_printf("DOWN 1"); + serv_getln(buf, sizeof buf); + if (atol(buf) == 500) + { /* upsie. maybe the server is not running as daemon? */ + wprintf("Attention: %s", &buf[4]); + + } + else { + wprintf("\n" + "\n" + "\n" + "\n" + "\n" + "Please wait while the citadel server is restarted... " + "\n\n" + ); + } + } + else if (!strcmp(when, "page")) { + char *message; + + message = bstr("message"); + if ((message == NULL) || (IsEmptyStr(message))) + { + wprintf("\n" + "\n" + "\n" + "\n" + "
\n" + "\n" + "\n" + "\n" + "
\n" + "\n\n" + ); + + } + else + { + // TODO: page the users... wait longer... + wprintf("\n" + "\n" + "\n" + "\n" + "\n" + "Please wait while your users are being paged, the citadel server will be restarted after that... " + "\n\n" + ); + + } + } + else if (!strcmp(when, "idle")) { + serv_printf("SCDN 3"); + serv_getln(buf, sizeof buf); + if (atol(buf) == 500) + { /* upsie. maybe the server is not running as daemon? */ + wprintf("Attention: %s", &buf[4]); + + } + } +} + + /*@}*/ diff --git a/webcit/webcit.c b/webcit/webcit.c index 54001abb3..d1070569d 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -1505,6 +1505,8 @@ void session_loop(struct httprequest *req) url_do_template(); } else if (!strcasecmp(action, "display_aide_menu")) { display_aide_menu(); + } else if (!strcasecmp(action, "server_shutdown")) { + display_shutdown(); } else if (!strcasecmp(action, "display_main_menu")) { display_main_menu(); } else if (!strcasecmp(action, "who")) { diff --git a/webcit/webcit.h b/webcit/webcit.h index ea572159a..c76709cd4 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -453,6 +453,7 @@ void do_welcome(void); void do_logout(void); void display_main_menu(void); void display_aide_menu(void); +void display_shutdown(void); void display_advanced_menu(void); void slrp_highest(void); void gotonext(void); -- 2.39.2