]> code.citadel.org Git - citadel.git/blobdiff - webcit/webcit.c
Cleanup of previous commit
[citadel.git] / webcit / webcit.c
index f49d4ea3da23ac033264943c78b4da15f04f880e..f533760a4d7366348fd2ad7919ab9d53a3741266 100644 (file)
@@ -186,7 +186,7 @@ void output_headers(        int do_httpheaders,     /* 1 = output HTTP headers                        */
                        wc_printf("<div id=\"important_message\">\n"
                                "<span class=\"imsg\">");
                        StrEscAppend(WCC->WBuf, NULL, WCC->ImportantMessage, 0, 0);
-                       wc_printf("</span><br />\n"
+                       wc_printf("</span><br>\n"
                                "</div>\n"
                        );
                        StrBufAppendBufPlain(WCC->trailing_javascript,
@@ -199,7 +199,7 @@ void output_headers(        int do_httpheaders,     /* 1 = output HTTP headers                        */
                        wc_printf("<div id=\"important_message\">\n"
                                "<span class=\"imsg\">");
                        StrEscAppend(WCC->WBuf, WCC->ImportantMsg, NULL, 0, 0);
-                       wc_printf("</span><br />\n"
+                       wc_printf("</span><br>\n"
                                "</div>\n"
                        );
                        StrBufAppendBufPlain(WCC->trailing_javascript,
@@ -647,15 +647,22 @@ void session_loop(void)
        }
 
        /*
-        * If we're not connected to a Citadel server, try to hook up the
-        * connection now.
+        * If we're not connected to a Citadel server, try to hook up the connection now.
         */
        if (!WCC->connected) {
-               if (GetConnected ())
+               if (GetConnected()) {
+                       hprintf("HTTP/1.1 503 Service Unavailable\r\n");
+                       hprintf("Content-Type: text/plain\r\n");
+                       begin_burst();
+                       wc_printf(_("This program was unable to connect or stay "
+                               "connected to the Citadel server.  Please report "
+                               "this problem to your system administrator.")
+                       );
+                       end_burst();
                        goto SKIP_ALL_THIS_CRAP;
+               }
        }
 
-
        /*
         * If we're not logged in, but we have authentication data (either from
         * a cookie or from http-auth), try logging in to Citadel using that.
@@ -742,7 +749,7 @@ void session_loop(void)
                                end_ajax_response();
                }
        }
-       /* When all else fails, display the main menu. */
+       /* When all else fails, display the default landing page or a main menu. */
        else {
                /* 
                 * ordinary browser users get a nice login screen, DAV etc. requsets
@@ -752,14 +759,8 @@ void session_loop(void)
                        if (xhttp) {
                                authorization_required();
                        }
-                       else if (WCC->serv_info->serv_supports_guest) {
-                               /* default action.  probably revisit this. */
-                               StrBuf *teh_lobby = NewStrBufPlain(HKEY("_BASEROOM_"));
-                               smart_goto(teh_lobby);
-                               FreeStrBuf(&teh_lobby);
-                       }
                        else {
-                               display_login();
+                               display_default_landing_page();
                        }
                }
                /*
@@ -779,6 +780,23 @@ SKIP_ALL_THIS_CRAP:
 }
 
 
+
+/*
+ * Display the appropriate landing page for this site.
+ */
+void display_default_landing_page(void) {
+       if (WC->serv_info->serv_supports_guest) {
+               /* default action.  probably revisit this. */
+               StrBuf *teh_lobby = NewStrBufPlain(HKEY("_BASEROOM_"));
+               smart_goto(teh_lobby);
+               FreeStrBuf(&teh_lobby);
+       }
+       else {
+               display_login();
+       }
+}
+
+
 /*
  * Replacement for sleep() that uses select() in order to avoid SIGALRM
  */