]> code.citadel.org Git - citadel.git/blobdiff - webcit/webcit.c
* Removed the "convert_to_html" option from text_to_server() because we no
[citadel.git] / webcit / webcit.c
index 641b356157f0acc2e4d1e45d185f9fbdce317724..1d9610c41c6aeb6f0c73dbeab96e2a3b5a383b45 100644 (file)
@@ -5,7 +5,7 @@
  * \defgroup MainServer This is the main transaction loop of the web service.  It maintains a
  * persistent session to the Citadel server, handling HTTP WebCit requests as
  * they arrive and presenting a user interface.
- * \ingroup BackendWebServer
+ * \ingroup WebcitHttpServer
  */
 /*@{*/
 #include "webcit.h"
@@ -57,8 +57,8 @@ void unescape_input(char *buf)
 }
 
 /**
- * \brief add urls???
- * \param url what???
+ * \brief Extract variables from the URL.
+ * \param url URL supplied by the HTTP parser
  */
 void addurls(char *url)
 {
@@ -141,8 +141,8 @@ void dump_vars(void)
 }
 
 /**
- * \brief what???
- * \param key what???
+ * \brief Return the value of a variable supplied to the current web page (from the url or a form)
+ * \param key The name of the variable we want
  */
 char *bstr(char *key)
 {
@@ -196,8 +196,8 @@ void wDumpContent(int print_standard_html_footer)
 
 /**
  * \brief Copy a string, escaping characters which have meaning in HTML.  
- * \param target target buffer to copy to
- * \param strbuf source buffer ???
+ * \param target target buffer
+ * \param strbuf source buffer
  * \param nbsp If nonzero, spaces are converted to non-breaking spaces.
  * \param nolinebreaks if set, linebreaks are removed from the string.
  */
@@ -263,8 +263,8 @@ void escputs(char *strbuf)
 /** 
  * \brief Escape a string for feeding out as a URL.
  * Returns a pointer to a buffer that must be freed by the caller!
- * \param outbuf the outputbuffer
- * \param strbuf the input buffer???
+ * \param outbuf the output buffer
+ * \param strbuf the input buffer
  */
 void urlesc(char *outbuf, char *strbuf)
 {
@@ -363,8 +363,8 @@ void msgesc(char *target, char *strbuf)
 }
 
 /**
- * \brief print message to the client ???
- * \param strbuf message to print???
+ * \brief print a string to the client after cleaning it with msgesc()
+ * \param strbuf string to be printed
  */
 void msgescputs(char *strbuf) {
        char *outbuf;
@@ -394,11 +394,11 @@ void output_headers(      int do_httpheaders,     /**< 1 = output HTTP headers
                        int suppress_check,     /**< 1 = suppress check for instant messages          */
                        int cache               /**< 1 = allow browser to cache this page             */
 ) {
-       char cookie[SIZ];
-       char httpnow[SIZ];
+       char cookie[1024];
+       char httpnow[128];
 
        wprintf("HTTP/1.1 200 OK\n");
-       httpdate(httpnow, time(NULL));
+       http_datestring(httpnow, sizeof httpnow, time(NULL));
 
        if (do_httpheaders) {
                wprintf("Content-type: text/html; charset=utf-8\r\n"
@@ -457,8 +457,8 @@ void output_headers(        int do_httpheaders,     /**< 1 = output HTTP headers
                if ( (WC->logged_in) && (!unset_cookies) ) {
                        wprintf("<div id=\"iconbar\">");
                        do_selected_iconbar();
-                       /** check for instant messages (these display in a new window) 
-                       page_popup();  */
+                       /** check for instant messages (these display in a new window) */
+                       page_popup();
                        wprintf("</div>");
                }
 
@@ -648,7 +648,7 @@ void output_image()
  * \brief Generic function to output an arbitrary MIME part from an arbitrary
  * message number on the server.
  * \param msgnum number of the item on the citadel server
- * \param partnum the partnumber???
+ * \param partnum the MIME part to be output
  */
 void mimepart(char *msgnum, char *partnum)
 {
@@ -683,7 +683,7 @@ void mimepart(char *msgnum, char *partnum)
 /**
  * \brief Read any MIME part of a message, from the server, into memory.
  * \param msgnum number of the message on the citadel server
- * \param partnum the part number???
+ * \param partnum the MIME part to be loaded
  */
 char *load_mimepart(long msgnum, char *partnum)
 {
@@ -795,7 +795,7 @@ void change_start_page(void) {
 
 
 /**
- * \brief display the successfull edit or s.th. lisket hat ??? 
+ * \brief convenience function to indicate success
  * \param successmessage the mesage itself
  */
 void display_success(char *successmessage)
@@ -823,17 +823,20 @@ void authorization_required(const char *message)
 }
 
 /**
- * \brief handle file uploads 
- * \param name the url the upload is done to
- * \param filename the name of the file being uploaded
- * \param partnum item number on the citadel server ???
- * \param disp what???
- * \param content the file contents???
- * \param cbtype what???
- * \param cbcharset the character set of cb??
- * \param length the size of the file ???
- * \param encoding charset encoding of the file??
- * \param userdata what???
+ * \brief This function is called by the MIME parser to handle data uploaded by
+ *        the browser.  Form data, uploaded files, and the data from HTTP PUT
+ *        operations (such as those found in GroupDAV) all arrive this way.
+ *
+ * \param name Name of the item being uploaded
+ * \param filename Filename of the item being uploaded
+ * \param partnum MIME part identifier (not needed)
+ * \param disp MIME content disposition (not needed)
+ * \param content The actual data
+ * \param cbtype MIME content-type
+ * \param cbcharset Character set
+ * \param length Content length
+ * \param encoding MIME encoding type (not needed)
+ * \param userdata Not used here
  */
 void upload_handler(char *name, char *filename, char *partnum, char *disp,
                        void *content, char *cbtype, char *cbcharset,
@@ -897,7 +900,7 @@ void end_ajax_response(void) {
 }
 
 /**
- * \brief parse server command to execute on the citadel
+ * \brief Wraps a Citadel server command in an AJAX transaction.
  */
 void ajax_servcmd(void)
 {
@@ -922,7 +925,7 @@ void ajax_servcmd(void)
                wprintf("000");
        }
        if (buf[0] == '4') {
-               text_to_server(bstr("g_input"), 0);
+               text_to_server(bstr("g_input"));
                serv_puts("000");
        }
        if (buf[0] == '6') {
@@ -1621,6 +1624,8 @@ void session_loop(struct httprequest *req)
                dump_vars();
                wprintf("</PRE><hr />\n");
                wDumpContent(1);
+       } else if (!strcasecmp(action, "updatenote")) {
+               updatenote();
        }
 
        /** When all else fais, display the main menu. */