]> code.citadel.org Git - citadel.git/blobdiff - webcit/webcit.c
Fixed bug 301. /listsub operations do not require a
[citadel.git] / webcit / webcit.c
index d1070569dc18dee4272bea0938a7fa8f3868b9b6..c65fd7f3ddeaea800ab6dd787f16c3032216c3c7 100644 (file)
@@ -11,7 +11,6 @@
 #include "webcit.h"
 #include "groupdav.h"
 #include "webserver.h"
-#include "mime_parser.h"
 
 #include <stdio.h>
 #include <stdarg.h>
@@ -23,7 +22,7 @@
  */
 static char *unset = "; expires=28-May-1971 18:10:00 GMT";
 
-/**
+/**   
  * \brief remove escaped strings from i.e. the url string (like %20 for blanks)
  * \param buf the buffer to examine
  */
@@ -304,7 +303,7 @@ void escputs(char *strbuf)
 void urlesc(char *outbuf, char *strbuf)
 {
        int a, b, c, len, eclen, olen;
-       char *ec = " #&;`'|*?-~<>^()[]{}/$\"\\";
+       char *ec = " +#&;`'|*?-~<>^()[]{}/$\"\\";
 
        strcpy(outbuf, "");
        len = strlen(strbuf);
@@ -466,7 +465,7 @@ void output_headers(        int do_httpheaders,     /**< 1 = output HTTP headers
                wprintf("Content-type: text/html; charset=utf-8\r\n"
                        "Server: %s / %s\n"
                        "Connection: close\r\n",
-                       SERVER, serv_info.serv_software
+                       PACKAGE_STRING, serv_info.serv_software
                );
        }
 
@@ -571,7 +570,7 @@ void http_transmit_thing(char *thing, size_t length, char *content_type,
                "Server: %s\r\n"
                "Connection: close\r\n",
                content_type,
-               SERVER);
+               PACKAGE_STRING);
 
 #ifdef HAVE_ZLIB
        /** If we can send the data out compressed, please do so. */
@@ -740,7 +739,9 @@ void output_image()
                 * Instead of an ugly 404, send a 1x1 transparent GIF
                 * when there's no such image on the server.
                 */
-               output_static("static/blank.gif");
+               char blank_gif[SIZ];
+               snprintf (blank_gif, SIZ, "%s%s", static_dirs[0], "/blank.gif");
+               output_static(blank_gif);
        }
 
 
@@ -998,7 +999,7 @@ void begin_ajax_response(void) {
                 "Cache-Control: no-cache\r\n"
                "Expires: -1\r\n"
                ,
-                SERVER);
+                PACKAGE_STRING);
         begin_burst();
 }
 
@@ -1309,7 +1310,7 @@ void session_loop(struct httprequest *req)
                        wprintf("HTTP/1.1 404 Security check failed\r\n");
                        wprintf("Content-Type: text/plain\r\n");
                        wprintf("\r\n");
-                       wprintf("Security check failed.\r\n");
+                       wprintf("You have sent a malformed or invalid request.\r\n");
                }
                goto SKIP_ALL_THIS_CRAP;        /* Don't try to connect */
        }
@@ -1533,6 +1534,10 @@ void session_loop(struct httprequest *req)
                begin_ajax_response();
                calendar_section();
                end_ajax_response();
+       } else if (!strcasecmp(action, "mini_calendar")) {
+               begin_ajax_response();
+               ajax_mini_calendar();
+               end_ajax_response();
        } else if (!strcasecmp(action, "iconbar_ajax_menu")) {
                begin_ajax_response();
                do_iconbar();
@@ -1763,6 +1768,10 @@ void session_loop(struct httprequest *req)
                display_sieve();
        } else if (!strcasecmp(action, "save_sieve")) {
                save_sieve();
+       } else if (!strcasecmp(action, "display_pushemail")) {
+               display_pushemail();
+       } else if (!strcasecmp(action, "save_pushemail")) {
+               save_pushemail();
        } else if (!strcasecmp(action, "display_add_remove_scripts")) {
                display_add_remove_scripts(NULL);
        } else if (!strcasecmp(action, "create_script")) {
@@ -1825,5 +1834,18 @@ SKIP_ALL_THIS_CRAP:
        }
 }
 
+/**
+ * \brief Replacement for sleep() that uses select() in order to avoid SIGALRM
+ * \param seconds how many seconds should we sleep?
+ */
+void sleeeeeeeeeep(int seconds)
+{
+       struct timeval tv;
+
+       tv.tv_sec = seconds;
+       tv.tv_usec = 0;
+       select(0, NULL, NULL, NULL, &tv);
+}
+
 
 /*@}*/