X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fhtml2html.c;h=023ab7c4af8184dfc9193003d28079a8d3964f38;hb=6da0b648b6daa418da90834dd9252a0bfbb2e5c4;hp=903e9696152cb7b5b8a235770246337948111381;hpb=42335286211e4f63fc0e60e9120858fded430f56;p=citadel.git
diff --git a/webcit/html2html.c b/webcit/html2html.c
index 903e96961..023ab7c4a 100644
--- a/webcit/html2html.c
+++ b/webcit/html2html.c
@@ -37,11 +37,18 @@ void output_html(void) {
char *ptr;
char *msgstart;
char *msgend;
+ char *converted_msg;
int buffer_length = 1;
int line_length = 0;
int content_length = 0;
+ int output_length = 0;
+ char new_window[SIZ];
+ int brak = 0;
+ int i;
+ int linklen;
msg = strdup("");
+ sprintf(new_window, "http_sock, msgstart, strlen(msgstart));
+ converted_msg = malloc(content_length);
+ strcpy(converted_msg, "");
+ ptr = msgstart;
+ while (ptr < msgend) {
+ /* Make links open in a separate window */
+ if (!strncasecmp(ptr, "')
+ ||(ptr[i]==']')
+ ) linklen = i;
+ if (linklen > 0) break;
+ }
+ if (linklen > 0) {
+ content_length += (32 + linklen);
+ converted_msg = realloc(converted_msg, content_length);
+ sprintf(&converted_msg[output_length], new_window);
+ output_length += strlen(new_window);
+ converted_msg[output_length] = '\"';
+ converted_msg[++output_length] = 0;
+ for (i=0; i");
+ output_length += 2;
+ for (i=0; i");
+ output_length += 4;
+ }
+ }
+ else {
+ if (*ptr == '<') ++brak;
+ if (*ptr == '>') --brak;
+ converted_msg[output_length] = *ptr++;
+ converted_msg[++output_length] = 0;
+ }
+ }
+
+ /* Output our big pile of markup */
+ write(WC->http_sock, converted_msg, output_length);
/* A little trailing vertical whitespace... */
wprintf("
\n");
/* Now give back the memory */
+ free(converted_msg);
free(msg);
-
}