]> code.citadel.org Git - citadel.git/commitdiff
* HTML now works.
authorArt Cancro <ajc@citadel.org>
Sun, 29 Aug 1999 20:07:53 +0000 (20:07 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 29 Aug 1999 20:07:53 +0000 (20:07 +0000)
citadel/citserver.c
citadel/html.c

index 0bfb13af6608ab3913d2bf49bc71a8884a806495..d0d5619fd27aa6c62afd58571590bd3b138bad1b 100644 (file)
@@ -433,6 +433,7 @@ void cmd_iden(char *argbuf)
        strncpy(CC->cs_clientname,desc,31);
        CC->cs_clientname[31] = 0;
 
+       lprintf(9, "Looking up hostname\n");
        if ((strlen(from_host)>0) && 
           (is_public_client(CC->cs_host))) {
                if (inet_aton(from_host, &addr))
@@ -442,6 +443,8 @@ void cmd_iden(char *argbuf)
                        CC->cs_host[24] = 0;
                        }
                }
+
+       lprintf(9, "Setting wtmpsupp\n");
        set_wtmpsupp_to_current_room();
 
        syslog(LOG_NOTICE,"client %d/%d/%01d.%02d (%s)\n",
index 8ba2a21693cc124183c8a3e84715b199b1b6d46c..7127c89ac18408adc9786be16c63f8bef3d0f33d 100644 (file)
@@ -39,6 +39,8 @@ char *html_to_ascii(char *inputmsg, int screenwidth) {
        char tag[1024];
        int done_reading = 0;
        char *inptr;
+       char *outptr;
+       size_t outlen;
        int i, j, ch, did_out, rb;
        int nest = 0;           /* Bracket nesting level */
 
@@ -46,6 +48,11 @@ char *html_to_ascii(char *inputmsg, int screenwidth) {
        strcpy(inbuf, "");
        strcpy(outbuf, "");
 
+       outptr = mallok(strlen(inptr) + 256);
+       if (outptr == NULL) return NULL;
+       strcpy(outptr, "");
+       outlen = 0;
+
        do {
                /* Fill the input buffer */
                if ( (done_reading == 0) && (strlen(inbuf) < 128) ) {
@@ -192,6 +199,19 @@ char *html_to_ascii(char *inputmsg, int screenwidth) {
                                strcpy(&outbuf[i+3], &outbuf[i+6]);
                        }
 
+                       else if (!strncasecmp(&outbuf[i], "&reg;", 5)) {
+                               outbuf[i] = '(';
+                               outbuf[i+1] = 'r';
+                               outbuf[i+2] = ')';
+                               strcpy(&outbuf[i+3], &outbuf[i+5]);
+                       }
+
+               }
+
+               /* Make sure the output buffer is big enough */
+               if ((strlen(outptr) + strlen(outbuf) + 128) > outlen) {
+                       outlen += 128;
+                       outptr = realloc(outptr, outlen);
                }
 
                /* Output any lines terminated with hard line breaks */
@@ -200,7 +220,9 @@ char *html_to_ascii(char *inputmsg, int screenwidth) {
                        if (strlen(outbuf)>0)
                            for (i = 0; i<strlen(outbuf); ++i) {
                                if ( (i<(screenwidth-2)) && (outbuf[i]=='\n')) {
-                                       fwrite(outbuf, i+1, 1, stdout);
+
+                                       strncat(outptr, outbuf, i+1);
+
                                        strcpy(outbuf, &outbuf[i+1]);
                                        i = 0;
                                        did_out = 1;
@@ -215,23 +237,26 @@ char *html_to_ascii(char *inputmsg, int screenwidth) {
                                if (outbuf[i]==32) rb = i;
                        }
                        if (rb>=0) {
-                               fwrite(outbuf, rb, 1, stdout);
-                               fwrite("\n", 1, 1, stdout);
+
+                               strncat(outptr, outbuf, rb);
+                               strcat(outptr, "\n");
+
                                strcpy(outbuf, &outbuf[rb+1]);
                        } else {
-                               fwrite(outbuf, screenwidth-2, 1, stdout);
-                               fwrite("\n", 1, 1, stdout);
+
+                               strncat(outptr, outbuf, screenwidth-2);
+                               strcat(outptr, "\n");
+
                                strcpy(outbuf, &outbuf[screenwidth-2]);
                        }
                }
 
        } while (done_reading == 0);
-       fwrite(outbuf, strlen(outbuf), 1, stdout);
-       fwrite("\n", 1, 1, stdout);
 
-       inptr = mallok(100);
-       strcpy(inptr, "This is eekish.\n");
-       return inptr;
+       strcat(outptr, outbuf);
+       strcat(outptr, "\n");
+
+       return outptr;
 
 }