$Id$
+Tue Jan 24 13:56:03 EST 2006 ajc
+* Fixes to wiki view to handle "short" links.
+
Tue Jan 24 11:07:04 EST 2006 ajc
* client_getln() now fails if the client attempts to transmit non printable
characters. This is for fast bailout if someone tries to do HTTPS to a
* Also convert weird character sets to UTF-8 if necessary.
* \param charset the input charset
*/
-void output_html(char *charset) {
+void output_html(char *charset, int treat_as_wiki) {
char buf[SIZ];
char *msg;
char *ptr;
ptr = &ptr[16];
++alevel;
}
- /** Make links open in a separate window */
+ /** Make external links open in a separate window */
else if (!strncasecmp(ptr, "<a href=", 8)) {
- content_length += 64;
- converted_msg = realloc(converted_msg, content_length);
- sprintf(&converted_msg[output_length], new_window);
- output_length += strlen(new_window);
- ptr = &ptr[8];
++alevel;
+ if ( ((strchr(ptr, ':') < strchr(ptr, '/')))
+ && ((strchr(ptr, '/') < strchr(ptr, '>')))
+ ) {
+ /* open external links to new window */
+ content_length += 64;
+ converted_msg = realloc(converted_msg, content_length);
+ sprintf(&converted_msg[output_length], new_window);
+ output_length += strlen(new_window);
+ ptr = &ptr[8];
+ }
+ else if ( (treat_as_wiki) && (strncasecmp(ptr, "<a href=\"wiki?", 14)) ) {
+ lprintf(9, "converting wiki link\n");
+ content_length += 64;
+ converted_msg = realloc(converted_msg, content_length);
+ sprintf(&converted_msg[output_length], "<a href=\"wiki?page=");
+ output_length += 19;
+ ptr = &ptr[9];
+ }
+ else {
+ sprintf(&converted_msg[output_length], "<a href=");
+ output_length += 8;
+ ptr = &ptr[8];
+ }
}
/**
* Turn anything that looks like a URL into a real link, as long
else /** HTML is fun, but we've got to strip it first */
if (!strcasecmp(mime_content_type, "text/html")) {
- output_html(mime_charset);
+ output_html(mime_charset, (WC->wc_view == VIEW_WIKI ? 1 : 0));
}
/** Unknown weirdness */
/** HTML is fun, but we've got to strip it first */
else if (!strcasecmp(content_type, "text/html")) {
wprintf(" <description><![CDATA[");
- output_html(charset);
+ output_html(charset, 0);
wprintf("]]></description>\n");
}
void serv_read(char *buf, int bytes);
int haschar(char *, char);
void readloop(char *oper);
+void read_message(long msgnum, int printable_view, char *section);
void embed_message(char *msgnum_as_string);
void print_message(char *msgnum_as_string);
void display_headers(char *msgnum_as_string);
void offer_start_page(void);
void convenience_page(char *titlebarcolor, char *titlebarmsg, char *messagetext);
void change_start_page(void);
-void output_html(char *);
+void output_html(char *, int);
void display_floorconfig(char *);
void delete_floor(void);
void create_floor(void);