X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fhtml2html.c;h=965dc55d69bc57ea9458068f8d19602897b261aa;hb=fb6f6fa4ec4e3277e30d84326d48e6850822d318;hp=aff7eec7b8849c6bc67c9f7a803afeeff37320c4;hpb=593d0c23d2422a6a1fc9ceb7de9bda66335e0836;p=citadel.git diff --git a/webcit/html2html.c b/webcit/html2html.c index aff7eec7b..965dc55d6 100644 --- a/webcit/html2html.c +++ b/webcit/html2html.c @@ -2,21 +2,15 @@ * Output an HTML message, modifying it slightly to make sure it plays nice * with the rest of our web framework. * - * Copyright (c) 2005-2010 by the citadel.org team + * Copyright (c) 2005-2012 by the citadel.org team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. + * This program is open source software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License, version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "webcit.h" @@ -137,7 +131,7 @@ void output_html(const char *supplied_charset, int treat_as_wiki, int msgnum, St StrBufAppendPrintf(Target, _("realloc() error! couldn't get %d bytes: %s"), buffer_length + 1, strerror(errno)); - StrBufAppendPrintf(Target, "

\n"); + StrBufAppendPrintf(Target, "

\n"); while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) { /** flush */ } @@ -302,10 +296,10 @@ void output_html(const char *supplied_charset, int treat_as_wiki, int msgnum, St && (strcasecmp(charset, "UTF-8")) && (strcasecmp(charset, "")) ) { - lprintf(9, "Converting %s to UTF-8\n", charset); + syslog(9, "Converting %s to UTF-8\n", charset); ctdl_iconv_open("UTF-8", charset, &ic); if (ic == (iconv_t)(-1) ) { - lprintf(5, "%s:%d iconv_open() failed: %s\n", + syslog(5, "%s:%d iconv_open() failed: %s\n", __FILE__, __LINE__, strerror(errno)); } } @@ -345,7 +339,7 @@ void output_html(const char *supplied_charset, int treat_as_wiki, int msgnum, St */ if (converted_msg == NULL) { - StrBufAppendPrintf(Target, "Error %d: %s
%s:%d", errno, strerror(errno), __FILE__, __LINE__); + StrBufAppendPrintf(Target, "Error %d: %s
%s:%d", errno, strerror(errno), __FILE__, __LINE__); goto BAIL; } @@ -394,9 +388,16 @@ void output_html(const char *supplied_charset, int treat_as_wiki, int msgnum, St StrBufAppendPrintf(converted_msg, new_window); ptr = &ptr[8]; } - else if ( (treat_as_wiki) && (strncasecmp(ptr, "CurRoom.name, NULL); + StrBufAppendPrintf(converted_msg, "?page="); ptr = &ptr[9]; } else { @@ -413,9 +414,9 @@ void output_html(const char *supplied_charset, int treat_as_wiki, int msgnum, St * and then ended the message) */ if (!tag_end) { - lprintf(9, "tag_end is null and ptr is:\n"); - lprintf(9, "%s\n", ptr); - lprintf(9, "Theoretical bytes remaining: %d\n", msgend - ptr); + syslog(9, "tag_end is null and ptr is:\n"); + syslog(9, "%s\n", ptr); + syslog(9, "Theoretical bytes remaining: %d\n", (int)(msgend - ptr)); } src=strstr(ptr, "src=\"cid:"); @@ -555,7 +556,7 @@ void output_html(const char *supplied_charset, int treat_as_wiki, int msgnum, St StrBufAppendBuf(Target, converted_msg, 0); BAIL: /** A little trailing vertical whitespace... */ - StrBufAppendPrintf(Target, "

\n"); + StrBufAppendPrintf(Target, "

\n"); /** Now give back the memory */ FreeStrBuf(&converted_msg); @@ -640,7 +641,7 @@ void url(char *buf, size_t bufsize) start = NULL; len = strlen(buf); if (len > bufsize) { - lprintf(1, "URL: content longer than buffer!"); + syslog(1, "URL: content longer than buffer!"); return; } end = buf + len; @@ -676,7 +677,7 @@ void url(char *buf, size_t bufsize) UrlLen = end - start; if (UrlLen > sizeof(urlbuf)){ - lprintf(1, "URL: content longer than buffer!"); + syslog(1, "URL: content longer than buffer!"); return; } memcpy(urlbuf, start, UrlLen); @@ -689,7 +690,7 @@ void url(char *buf, size_t bufsize) "%ca href=%c%s%c TARGET=%c%s%c%c%s%c/A%c", LB, QU, urlbuf, QU, QU, TARGET, QU, RB, urlbuf, LB, RB); if (outpos >= sizeof(outbuf) - Offset) { - lprintf(1, "URL: content longer than buffer!"); + syslog(1, "URL: content longer than buffer!"); return; } @@ -697,7 +698,7 @@ void url(char *buf, size_t bufsize) if (TrailerLen > 0) memcpy(outbuf + Offset + outpos, end, TrailerLen); if (Offset + outpos + TrailerLen > bufsize) { - lprintf(1, "URL: content longer than buffer!"); + syslog(1, "URL: content longer than buffer!"); return; } memcpy (buf, outbuf, Offset + outpos + TrailerLen);