]> code.citadel.org Git - citadel.git/blobdiff - webcit/serv_func.c
* *** HUGE CHANGES *** *** WARNING: NOT FULLY FUNCTIONAL ***
[citadel.git] / webcit / serv_func.c
index 5d9bf1107093e079927fbc52fa7d0ad519fda920..055deb540b0695437ae2aa608421affd719122a3 100644 (file)
@@ -72,6 +72,7 @@ void get_serv_info(char *browser_host, char *user_agent)
                switch (a) {
                case 0:
                        serv_info.serv_pid = atoi(buf);
+                       WC->ctdl_pid = serv_info.serv_pid;
                        break;
                case 1:
                        strcpy(serv_info.serv_nodename, buf);
@@ -131,27 +132,28 @@ void fmout(FILE *fp, char *align)
                if (!strcmp(buf, "000")) {
                        if (bq == 1)
                                wprintf("</I>");
-                       wprintf("</DIV><BR>\n");
+                       wprintf("</DIV><br />\n");
                        return;
                }
                if ((intext == 1) && (isspace(buf[0]))) {
-                       wprintf("<BR>");
+                       wprintf("<br />");
                }
                intext = 1;
 
                /* Quoted text should be displayed in italics and in a
-                * different colour.  This code understands both Citadel/UX
-                * style " >" quotes and FordBoard-style " :-)" quotes.
+                * different colour.  This code understands Citadel-style
+                * " >" quotes and will convert to <BLOCKQUOTE> tags.
                 */
-               if ((bq == 0) &&
-                   ((!strncmp(buf, " >", 2)) || (!strncmp(buf, " :-)", 4)))) {
-                       wprintf("<SPAN CLASS=\"pull_quote\">");
+               if ((bq == 0) && (!strncmp(buf, " >", 2))) {
+                       wprintf("<BLOCKQUOTE>");
                        bq = 1;
-               } else if ((bq == 1) &&
-                 (strncmp(buf, " >", 2)) && (strncmp(buf, " :-)", 4))) {
-                       wprintf("</SPAN>");
+               } else if ((bq == 1) && (strncmp(buf, " >", 2))) {
+                       wprintf("</BLOCKQUOTE>");
                        bq = 0;
                }
+               if ((bq == 1) && (!strncmp(buf, " >", 2))) {
+                       strcpy(buf, &buf[2]);
+               }
                /* Activate embedded URL's */
                url(buf);
 
@@ -171,12 +173,9 @@ void fmout(FILE *fp, char *align)
 void text_to_server(char *ptr, int convert_to_html)
 {
        char buf[SIZ];
+       char conv[4];
        int ch, a, pos;
 
-       if (convert_to_html) {
-               serv_puts("<HTML><BODY>");
-       }
-
        pos = 0;
        strcpy(buf, "");
 
@@ -189,11 +188,14 @@ void text_to_server(char *ptr, int convert_to_html)
                        serv_puts(buf);
                        strcpy(buf, "");
                        if (convert_to_html) {
-                               strcat(buf, "<BR>");
+                               strcat(buf, "<br />");
                        }
                        else {
                                if (ptr[pos] != 0) strcat(buf, " ");
                        }
+               } else if ((convert_to_html)&&(strchr("#&;`'|*?-~<>^()[]{}$\\", ch) != NULL)) {
+                       sprintf(conv, "%c", ch);
+                       stresc(&buf[strlen(buf)], conv, 0, 0);
                } else {
                        a = strlen(buf);
                        buf[a + 1] = 0;
@@ -211,10 +213,6 @@ void text_to_server(char *ptr, int convert_to_html)
        }
        serv_puts(buf);
 
-       if (convert_to_html) {
-               serv_puts("</BODY></HTML>\n");
-       }
-
 }