"), 0);
+ }
ptr = msg;
msgend = strchr(msg, 0);
while (ptr < msgend) {
@@ -301,7 +372,7 @@ void output_html(const char *supplied_charset, int treat_as_wiki, int msgnum, St
if (!strncasecmp(ptr, "')))
- ) {
+ && ((strchr(ptr, '/') < strchr(ptr, '>')))
+ ) {
/* open external links to new window */
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 {
@@ -329,27 +407,39 @@ void output_html(const char *supplied_charset, int treat_as_wiki, int msgnum, St
}
/** Fixup ');
- char* src=strstr(ptr, " src=\"cid:");
char *cid_start, *cid_end;
- ++brak;
+ char* tag_end=strchr(ptr,'>');
+ char* src;
+ /* FIXME - handle this situation (maybe someone opened an ')
- ||(ptr[i]=='[')
- ||(ptr[i]==']')
- ||(ptr[i]=='"')
- ||(ptr[i]=='\'')
+ strlenptr = strlen(ptr);
+ for (i=0; i<=strlenptr; ++i) {
+ if ((ptr[i]==0)
+ ||(isspace(ptr[i]))
+ ||(ptr[i]==10)
+ ||(ptr[i]==13)
+ ||(ptr[i]=='(')
+ ||(ptr[i]==')')
+ ||(ptr[i]=='<')
+ ||(ptr[i]=='>')
+ ||(ptr[i]=='[')
+ ||(ptr[i]==']')
+ ||(ptr[i]=='"')
+ ||(ptr[i]=='\'')
) linklen = i;
- /* did s.b. send us an entity? */
- if (ptr[i] == '&') {
- if ((ptr[i+2] ==';') ||
- (ptr[i+3] ==';') ||
- (ptr[i+5] ==';') ||
- (ptr[i+6] ==';') ||
- (ptr[i+7] ==';'))
- linklen = i;
- }
- if (linklen > 0) break;
+ /* did s.b. send us an entity? */
+ if (ptr[i] == '&') {
+ if ((ptr[i+2] ==';') ||
+ (ptr[i+3] ==';') ||
+ (ptr[i+5] ==';') ||
+ (ptr[i+6] ==';') ||
+ (ptr[i+7] ==';'))
+ linklen = i;
}
- if (linklen > 0) {
- char *ltreviewptr;
- char *nbspreviewptr;
- char linkedchar;
- int len = linklen;
+ if (linklen > 0) break;
+ }
+ if (linklen > 0) {
+ char *ltreviewptr;
+ char *nbspreviewptr;
+ char linkedchar;
+ int len;
- len = linklen;
- linkedchar = ptr[len];
- ptr[len] = '\0';
- /* spot for some subject strings tinymce tends to give us. */
- ltreviewptr = strchr(ptr, '<');
- if (ltreviewptr != NULL) {
- *ltreviewptr = '\0';
- linklen = ltreviewptr - ptr;
- }
+ len = linklen;
+ linkedchar = ptr[len];
+ ptr[len] = '\0';
+ /* spot for some subject strings tinymce tends to give us. */
+ ltreviewptr = strchr(ptr, '<');
+ if (ltreviewptr != NULL) {
+ *ltreviewptr = '\0';
+ linklen = ltreviewptr - ptr;
+ }
- nbspreviewptr = strstr(ptr, " ");
- if (nbspreviewptr != NULL) {
- ///*nbspreviewptr = '\0';
- linklen = nbspreviewptr - ptr;
- }
- if (ltreviewptr != 0)
- *ltreviewptr = '<';
-
- ptr[len] = linkedchar;
-
- content_length += (32 + linklen);
- StrBufAppendPrintf(converted_msg, "%s\"", new_window);
- StrBufAppendBufPlain(converted_msg, ptr, linklen, 0);
- StrBufAppendPrintf(converted_msg, "\">");
- StrBufAppendBufPlain(converted_msg, ptr, linklen, 0);
- ptr += linklen;
- StrBufAppendPrintf(converted_msg, "");
+ nbspreviewptr = strstr(ptr, " ");
+ if (nbspreviewptr != NULL) {
+ /* nbspreviewptr = '\0'; */
+ linklen = nbspreviewptr - ptr;
}
+ if (ltreviewptr != 0)
+ *ltreviewptr = '<';
+
+ ptr[len] = linkedchar;
+
+ content_length += (32 + linklen);
+ StrBufAppendPrintf(converted_msg, "%s\"", new_window);
+ StrBufAppendBufPlain(converted_msg, ptr, linklen, 0);
+ StrBufAppendPrintf(converted_msg, "\">");
+ StrBufAppendBufPlain(converted_msg, ptr, linklen, 0);
+ ptr += linklen;
+ StrBufAppendPrintf(converted_msg, "");
+ }
}
else {
StrBufAppendBufPlain(converted_msg, ptr, 1, 0);
ptr++;
}
- /**
- * We need to know when we're inside a tag,
- * so we don't turn things that look like URL's into
- * links, when they're already links - or image sources.
- */
- if (*(ptr-1) == '<') {
- ++brak;
- }
- if (*(ptr-1) == '>') {
- --brak;
- if ((scriptlevel == 0) && (script_start_pos >= 0)) {
- StrBufCutRight(converted_msg, StrLength(converted_msg) - script_start_pos);
- script_start_pos = (-1);
+
+ if ((ptr >= msg) && (ptr <= msgend)) {
+ /*
+ * We need to know when we're inside a tag,
+ * so we don't turn things that look like URL's into
+ * links, when they're already links - or image sources.
+ */
+ if ((ptr > msg) && (*(ptr-1) == '<')) {
+ ++brak;
}
+ if ((ptr > msg) && (*(ptr-1) == '>')) {
+ --brak;
+ if ((scriptlevel == 0) && (script_start_pos >= 0)) {
+ StrBufCutRight(converted_msg, StrLength(converted_msg) - script_start_pos);
+ script_start_pos = (-1);
+ }
+ }
+ if (!strncasecmp(ptr, "", 3)) --alevel;
}
- if (!strncasecmp(ptr, "", 3)) --alevel;
+ }
+
+ if (BodyArea != NULL) {
+ StrBufAppendBufPlain(converted_msg, HKEY(" |