]> code.citadel.org Git - citadel.git/blobdiff - webcit/messages.c
* Fixes to wiki view to handle "short" links.
[citadel.git] / webcit / messages.c
index 98837f1779841b4d5ea8492d65e6c9eb854b823f..84689122c86bc7ff9a4d55d3f5c818b5be32e089 100644 (file)
@@ -130,8 +130,7 @@ void utf8ify_rfc822_string(char *buf) {
  * target window in order to keep the BBS session in its own window.
  * \param buf the message buffer
  */
-void url(buf)
-char buf[];
+void url(char *buf)
 {
 
        int pos;
@@ -943,7 +942,7 @@ void read_message(long msgnum, int printable_view, char *section) {
 
        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 */
@@ -2528,12 +2527,13 @@ void post_message(void)
                        _("Automatically cancelled because you have already "
                        "saved this message."));
        } else {
-               sprintf(buf, "ENT0 1|%s|%d|4|%s|||%s|%s",
+               sprintf(buf, "ENT0 1|%s|%d|4|%s|||%s|%s|%s",
                        bstr("recp"),
                        is_anonymous,
                        bstr("subject"),
                        bstr("cc"),
-                       bstr("bcc")
+                       bstr("bcc"),
+                       bstr("wikipage")
                );
                serv_puts(buf);
                serv_getln(buf, sizeof buf);
@@ -2576,6 +2576,7 @@ void display_enter(void)
        int recipient_bad = 0;
        int i;
        int is_anonymous = 0;
+       long existing_page = (-1L);
 
        if (strlen(bstr("force_room")) > 0) {
                gotoroom(bstr("force_room"));
@@ -2639,7 +2640,8 @@ void display_enter(void)
 
        /** Now check our actual recipients if there are any */
        if (recipient_required) {
-               sprintf(buf, "ENT0 0|%s|%d|0||||%s|%s", bstr("recp"), is_anonymous, bstr("cc"), bstr("bcc"));
+               sprintf(buf, "ENT0 0|%s|%d|0||||%s|%s|%s", bstr("recp"), is_anonymous,
+                       bstr("cc"), bstr("bcc"), bstr("wikipage"));
                serv_puts(buf);
                serv_getln(buf, sizeof buf);
 
@@ -2677,6 +2679,9 @@ void display_enter(void)
                "name=\"enterform\""
                ">\n");
        wprintf("<input type=\"hidden\" name=\"postseq\" value=\"%ld\">\n", now);
+       if (WC->wc_view == VIEW_WIKI) {
+               wprintf("<input type=\"hidden\" name=\"wikipage\" value=\"%s\">\n", bstr("wikipage"));
+       }
 
        wprintf("<img src=\"static/newmess3_24x.gif\" align=middle alt=\" \">");
        wprintf("%s\n", buf);   /** header bar */
@@ -2774,6 +2779,16 @@ void display_enter(void)
                wprintf("</blockquote>\n\n");
        }
 
+       /** If we're editing a wiki page, insert the existing page here... */
+       else if (WC->wc_view == VIEW_WIKI) {
+               safestrncpy(buf, bstr("wikipage"), sizeof buf);
+               str_wiki_index(buf);
+               existing_page = locate_message_by_uid(buf);
+               if (existing_page >= 0L) {
+                       pullquote_message(existing_page, 1);
+               }
+       }
+
        /** Insert our signature if appropriate... */
        if ( (WC->is_mailbox) && (strcmp(bstr("sig_inserted"), "yes")) ) {
                get_preference("use_sig", buf, sizeof buf);