resync translations with launchpad
[citadel.git] / webcit / mainmenu.c
index 67bffacca95551081f1698f7ff46fbe914977e12..31aec39861201d1ab941a9dc5b0ebc399d66a754 100644 (file)
@@ -1,7 +1,3 @@
-/*
- * $Id$
- */
-
 #include "webcit.h"
 
 /*
@@ -45,7 +41,6 @@ void do_generic(void)
                return;
        }
 
-        memset(&SubTP, 0, sizeof(WCTemplputParams));
        Buf = NewStrBuf();
        serv_puts(bstr("g_cmd"));
        StrBuf_ServGetln(Buf);
@@ -62,7 +57,8 @@ void do_generic(void)
                LineBuf = NewStrBuf();
                StrBufAppendBufPlain(Buf, HKEY("\n"), 0);
                while (!Done) {
-                       StrBuf_ServGetln(LineBuf);
+                       if (StrBuf_ServGetln(LineBuf) < 0)
+                               break;
                        if ( (StrLength(LineBuf)==3) && 
                             !strcmp(ChrPtr(LineBuf), "000")) {
                                Done = 1;
@@ -94,11 +90,11 @@ void do_generic(void)
        begin_burst();
        output_headers(1, 0, 0, 0, 1, 0);
 
-        SubTP.Filter.ContextType = CTX_STRBUF;
-        SubTP.Context = Buf;
-
-        DoTemplate(HKEY("aide_display_generic_result"), NULL, &SubTP);
-
+       StackContext(NULL, &SubTP, Buf, CTX_STRBUF, 0, NULL);
+       {
+               DoTemplate(HKEY("aide_display_generic_result"), NULL, &SubTP);
+       }
+       UnStackContext(&SubTP);
         wDumpContent(1);
 
        FreeStrBuf(&Buf);
@@ -109,20 +105,16 @@ void do_generic(void)
  */
 void display_shutdown(void)
 {
-       char buf[SIZ];
+       StrBuf *Line;
        char *when;
        
+       Line = NewStrBuf();
        when=bstr("when");
        if (strcmp(when, "now") == 0){
                serv_printf("DOWN 1");
-               serv_getln(buf, sizeof buf);
-               if (atol(buf) == 500)
-               { /* upsie. maybe the server is not running as daemon? */
-                       
-                       safestrncpy(WC->ImportantMessage,
-                                   &buf[4],
-                                   sizeof WC->ImportantMessage);
-               }
+               StrBuf_ServGetln(Line);
+               GetServerStatusMsg(Line, NULL, 1, 5);
+
                begin_burst();
                output_headers(1, 0, 0, 0, 1, 0);
                DoTemplate(HKEY("aide_display_serverrestart"), NULL, &NoCtx);
@@ -146,7 +138,9 @@ void display_shutdown(void)
                else
                {
                        serv_printf("SEXP broadcast|%s", message);
-                       serv_getln(buf, sizeof buf); /* TODO: should we care? */
+                       StrBuf_ServGetln(Line);
+                       GetServerStatusMsg(Line, NULL, 1, 0);
+
                        begin_burst();
                        output_headers(1, 0, 0, 0, 1, 0);
                        DoTemplate(HKEY("aide_display_serverrestart_page"), NULL, &NoCtx);
@@ -155,19 +149,15 @@ void display_shutdown(void)
        }
        else if (!strcmp(when, "idle")) {
                serv_printf("SCDN 3");
-               serv_getln(buf, sizeof buf);
+               StrBuf_ServGetln(Line);
+               GetServerStatusMsg(Line, NULL, 1, 2);
 
-               if (atol(buf) == 500)
-               { /* upsie. maybe the server is not running as daemon? */
-                       safestrncpy(WC->ImportantMessage,
-                                   &buf[4],
-                                   sizeof WC->ImportantMessage);
-               }
                begin_burst();
                output_headers(1, 0, 0, 0, 1, 0);
                DoTemplate(HKEY("aide_display_menu"), NULL, &NoCtx);
                end_burst();                    
        }
+       FreeStrBuf(&Line);
 }
 
 void