Renderers cleanup part 1
authorArt Cancro <ajc@citadel.org>
Thu, 5 Apr 2018 15:13:23 +0000 (11:13 -0400)
committerArt Cancro <ajc@citadel.org>
Thu, 5 Apr 2018 15:13:23 +0000 (11:13 -0400)
webcit/messages.c
webcit/msg_renderers.c
webcit/roomops.c
webcit/roomviews.c
webcit/serv_func.c
webcit/static.c
webcit/sysdep.c
webcit/useredit.c
webcit/webcit.c

index a8b4c60259a063ccf313212b65d18115cae536db..db7638b51a254bf399b463e6def3ee8809a7685b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Functions which deal with the fetching and displaying of messages.
  *
 /*
  * Functions which deal with the fetching and displaying of messages.
  *
- * Copyright (c) 1996-2012 by the citadel.org team
+ * Copyright (c) 1996-2018 by the citadel.org team
  *
  * 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 open source software.  You can redistribute it and/or
  * modify it under the terms of the GNU General Public License, version 3.
@@ -932,22 +932,12 @@ void post_mime_to_server(void) {
                serv_printf("\n--%s", alt_boundary);
        }
 
                serv_printf("\n--%s", alt_boundary);
        }
 
-       if (havebstr("markdown"))
-       {
-               serv_puts("Content-type: text/x-markdown; charset=utf-8");
-               serv_puts("Content-Transfer-Encoding: quoted-printable");
-               serv_puts("");
-               text_to_server_qp(sbstr("msgtext"));    /* Transmit message in quoted-printable encoding */
-       }
-       else
-       {
-               serv_puts("Content-type: text/html; charset=utf-8");
-               serv_puts("Content-Transfer-Encoding: quoted-printable");
-               serv_puts("");
-               serv_puts("<html><body>\r\n");
-               text_to_server_qp(sbstr("msgtext"));    /* Transmit message in quoted-printable encoding */
-               serv_puts("</body></html>\r\n");
-       }
+       serv_puts("Content-type: text/html; charset=utf-8");
+       serv_puts("Content-Transfer-Encoding: quoted-printable");
+       serv_puts("");
+       serv_puts("<html><body>\r\n");
+       text_to_server_qp(sbstr("msgtext"));    /* Transmit message in quoted-printable encoding */
+       serv_puts("</body></html>\r\n");
 
        if (include_text_alt) {
                serv_printf("--%s--", alt_boundary);
 
        if (include_text_alt) {
                serv_printf("--%s--", alt_boundary);
@@ -1364,10 +1354,6 @@ void display_enter(void)
        int i = 0;
        long replying_to;
 
        int i = 0;
        long replying_to;
 
-       int prefer_md;
-
-       get_pref_yesno("markdown", &prefer_md, 0);
-
        if (havebstr("force_room")) {
                gotoroom(sbstr("force_room"));
        }
        if (havebstr("force_room")) {
                gotoroom(sbstr("force_room"));
        }
@@ -1720,10 +1706,7 @@ void display_enter(void)
 
        begin_burst();
        output_headers(1, 0, 0, 0, 1, 0);
 
        begin_burst();
        output_headers(1, 0, 0, 0, 1, 0);
-       if ((WCC->CurRoom.defview == VIEW_WIKIMD) || prefer_md)
-               DoTemplate(HKEY("edit_markdown_epic"), NULL, &NoCtx);
-       else
-               DoTemplate(HKEY("edit_message"), NULL, &NoCtx);
+       DoTemplate(HKEY("edit_message"), NULL, &NoCtx);
        end_burst();
 
        return;
        end_burst();
 
        return;
@@ -2116,8 +2099,6 @@ InitModule_MSG
                           PRF_STRING, 
                           NULL);
        RegisterPreference("mailbox",_("Mailbox view mode"), PRF_STRING, NULL);
                           PRF_STRING, 
                           NULL);
        RegisterPreference("mailbox",_("Mailbox view mode"), PRF_STRING, NULL);
-       RegisterPreference("markdown",_("Prefer markdown editing"), PRF_YESNO, NULL);
-
 
        WebcitAddUrlHandler(HKEY("readnew"), "", 0, h_readnew, ANONYMOUS|NEED_URL);
        WebcitAddUrlHandler(HKEY("readold"), "", 0, h_readold, ANONYMOUS|NEED_URL);
 
        WebcitAddUrlHandler(HKEY("readnew"), "", 0, h_readnew, ANONYMOUS|NEED_URL);
        WebcitAddUrlHandler(HKEY("readold"), "", 0, h_readold, ANONYMOUS|NEED_URL);
index 9b1c7eec90e0258325134f9d4773486f25f038d9..c925c58ee971160ac8d6a2ebbacf08703083be46 100644 (file)
@@ -1209,40 +1209,6 @@ void render_MAIL_html(StrBuf *Target, WCTemplputParams *TP, StrBuf *FoundCharset
        Mime->Data = Buf;
 }
 
        Mime->Data = Buf;
 }
 
-#ifdef HAVE_MARKDOWN
-/*
-char * MarkdownHandleURL(const char* SourceURL, const int len, void* something)
-{
-
-}
-*/
-void render_MAIL_markdown(StrBuf *Target, WCTemplputParams *TP, StrBuf *FoundCharset)
-{
-#include <mkdio.h>
-       wc_mime_attachment *Mime = (wc_mime_attachment *) CTX(CTX_MIME_ATACH);
-       MMIOT *doc;
-       char *md_as_html = NULL;
-       const char *format;
-
-       if (StrLength(Mime->Data) == 0)
-               return;
-
-       format = bstr("format");
-
-       if ((format == NULL) || 
-           strcmp(format, "plain"))
-       {
-               doc = mkd_string(ChrPtr(Mime->Data), StrLength(Mime->Data), 0);
-               mkd_basename(doc, "/wiki?page=");
-               mkd_compile(doc, 0);
-               if (mkd_document(doc, &md_as_html) != EOF) {
-                       FreeStrBuf(&Mime->Data);
-                       Mime->Data = NewStrBufPlain(md_as_html, -1);
-               }
-               mkd_cleanup(doc);
-       }
-}
-#endif
 
 void render_MAIL_UNKNOWN(StrBuf *Target, WCTemplputParams *TP, StrBuf *FoundCharset)
 {
 
 void render_MAIL_UNKNOWN(StrBuf *Target, WCTemplputParams *TP, StrBuf *FoundCharset)
 {
@@ -1586,9 +1552,6 @@ InitModule_MSGRENDERERS
        RegisterMimeRenderer(HKEY("text/plain"), render_MAIL_text_plain, 1, 3);
        RegisterMimeRenderer(HKEY("text"), render_MAIL_text_plain, 1, 1);
        RegisterMimeRenderer(HKEY("text/html"), render_MAIL_html, 1, 100);
        RegisterMimeRenderer(HKEY("text/plain"), render_MAIL_text_plain, 1, 3);
        RegisterMimeRenderer(HKEY("text"), render_MAIL_text_plain, 1, 1);
        RegisterMimeRenderer(HKEY("text/html"), render_MAIL_html, 1, 100);
-#ifdef HAVE_MARKDOWN
-       RegisterMimeRenderer(HKEY("text/x-markdown"), render_MAIL_markdown, 1, 30);
-#endif
        RegisterMimeRenderer(HKEY(""), render_MAIL_UNKNOWN, 0, 0);
 
        /* these headers are citserver replies to MSG4 and friends. one evaluator for each */
        RegisterMimeRenderer(HKEY(""), render_MAIL_UNKNOWN, 0, 0);
 
        /* these headers are citserver replies to MSG4 and friends. one evaluator for each */
index ea58fc0e3aa2a2ae1c669746f42c60998421a0be..2dc7865b8763b5ae4201dd0ce9824554956a7f35 100644 (file)
@@ -113,13 +113,11 @@ void dotskip(void) {
 }
 
 void dotgoto(void) {
 }
 
 void dotgoto(void) {
-       wcsession *WCC = WC;
        if (!havebstr("room")) {
                readloop(readnew, eUseDefault);
                return;
        }
        if (!havebstr("room")) {
                readloop(readnew, eUseDefault);
                return;
        }
-       if ((WCC->CurRoom.view != VIEW_MAILBOX)  &&
-           (WCC->CurRoom.view != WCC->CurRoom.view)) {
+       if (WC->CurRoom.view != VIEW_MAILBOX) {
                /* dotgoto acts like dotskip when we're in a mailbox view */
                slrp_highest();
        }
                /* dotgoto acts like dotskip when we're in a mailbox view */
                slrp_highest();
        }
index 40fa9e02a32383c3035965412f733970f5df089b..18563000db4ebc8062d6d7c76d42627c2d4319d2 100644 (file)
@@ -23,8 +23,7 @@ int allowed_default_views[VIEW_MAX] = {
        0, /* VIEW_JOURNAL      Journal */
        0, /* VIEW_DRAFTS       Drafts */
        1, /* VIEW_BLOG         Blog */
        0, /* VIEW_JOURNAL      Journal */
        0, /* VIEW_DRAFTS       Drafts */
        1, /* VIEW_BLOG         Blog */
-       0, /* VIEW_QUEUE        Mail Queue */
-       1  /* VIEW_WIKIMD       MarkDown Wiki */
+       0  /* VIEW_QUEUE        Mail Queue */
 };
 
 /*
 };
 
 /*
@@ -43,7 +42,6 @@ ROOM_VIEWS exchangeable_views[VIEW_MAX][VIEW_MAX] = {
        { 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 }, /* journal */
        { 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0 }, /* drafts */
        { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 }, /* blog */
        { 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 }, /* journal */
        { 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0 }, /* drafts */
        { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 }, /* blog */
-       { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }  /* Markdown wiki */
 };
 
 /*
 };
 
 /*
@@ -61,7 +59,6 @@ void initialize_viewdefs(void) {
        viewdefs[VIEW_JOURNAL]          = _("Journal");
        viewdefs[VIEW_DRAFTS]           = _("Drafts");
        viewdefs[VIEW_BLOG]             = _("Blog");
        viewdefs[VIEW_JOURNAL]          = _("Journal");
        viewdefs[VIEW_DRAFTS]           = _("Drafts");
        viewdefs[VIEW_BLOG]             = _("Blog");
-       viewdefs[VIEW_WIKIMD]           = _("Markdown Wiki");
 }
 
 
 }
 
 
@@ -88,9 +85,6 @@ void tmplput_ROOM_COLLECTIONTYPE(StrBuf *Target, WCTemplputParams *TP)
        case VIEW_WIKI:
                StrBufAppendBufPlain(Target, HKEY("wiki"), 0);
                break;
        case VIEW_WIKI:
                StrBufAppendBufPlain(Target, HKEY("wiki"), 0);
                break;
-       case VIEW_WIKIMD:
-               StrBufAppendBufPlain(Target, HKEY("x-markdown"), 0);
-               break;
        }
 }
 
        }
 }
 
index bff64e9e3373993fd08827960bee66aceba72017..66afe5e12e87dd818c95a461d4371fa6f9ec6fc8 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Functions which handle communication with the Citadel server.
+ *
+ * Copyright (c) 1996-2018 by the citadel.org team
+ *
+ * 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.
+ */
 
 #include "webcit.h"
 #include "webserver.h"
 
 #include "webcit.h"
 #include "webserver.h"
index 2a2fc2847bc7bc837f69a05f072cc33eac730c8d..34a656ee2b6058ed3203c4fc5d70cf9ad816dd98 100644 (file)
@@ -163,13 +163,20 @@ int LoadStaticDir(const char *DirName, HashList *DirList, const char *RelDir)
         int d_namelen;
        int istoplevel;
                
         int d_namelen;
        int istoplevel;
                
+       if (IsEmptyStr(DirName))
+       {
+               return 0;
+       }
+
        filedir = opendir (DirName);
        filedir = opendir (DirName);
-       if (filedir == NULL) {
+       if (filedir == NULL)
+       {
                return 0;
        }
 
        d = (struct dirent *)malloc(offsetof(struct dirent, d_name) + PATH_MAX + 1);
                return 0;
        }
 
        d = (struct dirent *)malloc(offsetof(struct dirent, d_name) + PATH_MAX + 1);
-       if (d == NULL) {
+       if (d == NULL)
+       {
                closedir(filedir);
                return 0;
        }
                closedir(filedir);
                return 0;
        }
@@ -409,6 +416,5 @@ InitModule_STATIC
        WebcitAddUrlHandler(HKEY("static.local"), "", 0, output_static_1, ANONYMOUS|COOKIEUNNEEDED|ISSTATIC|LOGCHATTY);
        WebcitAddUrlHandler(HKEY("tinymce"), "", 0, output_static_2, ANONYMOUS|COOKIEUNNEEDED|ISSTATIC|LOGCHATTY);
        WebcitAddUrlHandler(HKEY("tiny_mce"), "", 0, output_static_2, ANONYMOUS|COOKIEUNNEEDED|ISSTATIC|LOGCHATTY);
        WebcitAddUrlHandler(HKEY("static.local"), "", 0, output_static_1, ANONYMOUS|COOKIEUNNEEDED|ISSTATIC|LOGCHATTY);
        WebcitAddUrlHandler(HKEY("tinymce"), "", 0, output_static_2, ANONYMOUS|COOKIEUNNEEDED|ISSTATIC|LOGCHATTY);
        WebcitAddUrlHandler(HKEY("tiny_mce"), "", 0, output_static_2, ANONYMOUS|COOKIEUNNEEDED|ISSTATIC|LOGCHATTY);
-       WebcitAddUrlHandler(HKEY("markdown"), "", 0, output_static_3, ANONYMOUS|COOKIEUNNEEDED|ISSTATIC|LOGCHATTY);
        WebcitAddUrlHandler(HKEY("epiceditor"), "", 0, output_static_3, ANONYMOUS|COOKIEUNNEEDED|ISSTATIC|LOGCHATTY);
 }
        WebcitAddUrlHandler(HKEY("epiceditor"), "", 0, output_static_3, ANONYMOUS|COOKIEUNNEEDED|ISSTATIC|LOGCHATTY);
 }
index 4b8f4c6a681213f05ecfbe7bebb4c9a2e8d63363..1278b56259ea984b8bf3a6c4b5437bfe1544208f 100644 (file)
@@ -71,7 +71,6 @@ char file_crpt_file_cer[PATH_MAX]="";
 char file_etc_mimelist[PATH_MAX]="";
 
 const char editor_absolut_dir[PATH_MAX]=EDITORDIR;     /* nailed to what configure gives us. */
 char file_etc_mimelist[PATH_MAX]="";
 
 const char editor_absolut_dir[PATH_MAX]=EDITORDIR;     /* nailed to what configure gives us. */
-const char markdown_editor_absolutedir[]=MARKDOWNEDITORDIR;
 
 char etc_dir[PATH_MAX];
 char static_dir[PATH_MAX];             /* calculated on startup */
 
 char etc_dir[PATH_MAX];
 char static_dir[PATH_MAX];             /* calculated on startup */
@@ -81,8 +80,7 @@ char  *static_dirs[]={                                /* needs same sort order as the web mapping */
        (char*)static_dir,                      /* our templates on disk */
        (char*)static_local_dir,                /* user provided templates disk */
        (char*)editor_absolut_dir,              /* the editor on disk */
        (char*)static_dir,                      /* our templates on disk */
        (char*)static_local_dir,                /* user provided templates disk */
        (char*)editor_absolut_dir,              /* the editor on disk */
-       (char*)static_icon_dir,                  /* our icons... */
-       (char*)markdown_editor_absolutedir
+       (char*)static_icon_dir                  /* our icons... */
 };
 
 int ExitPipe[2];
 };
 
 int ExitPipe[2];
index af6a022760fe7e9400ac3580b535244961d47698..a6b4d4b44df152eb836e8acc4d06ee6a04e4cb2a 100644 (file)
@@ -289,7 +289,7 @@ HashList *iterate_load_userlist(StrBuf *Target, WCTemplputParams *TP)
        StrBuf_ServGetln(Buf);
        if (GetServerStatus(Buf, NULL) == 1) {
                Hash = NewHash(1, Flathash);
        StrBuf_ServGetln(Buf);
        if (GetServerStatus(Buf, NULL) == 1) {
                Hash = NewHash(1, Flathash);
-
+               Done = 0;
                while (!Done) {
                        len = StrBuf_ServGetln(Buf);
                        if ((len <0) || 
                while (!Done) {
                        len = StrBuf_ServGetln(Buf);
                        if ((len <0) || 
@@ -308,14 +308,15 @@ HashList *iterate_load_userlist(StrBuf *Target, WCTemplputParams *TP)
 
                serv_puts("LBIO 1");
                StrBuf_ServGetln(Buf);
 
                serv_puts("LBIO 1");
                StrBuf_ServGetln(Buf);
-               if (GetServerStatus(Buf, NULL) == 1)
+               if (GetServerStatus(Buf, NULL) == 1) {
                        Done = 0;
                        while (!Done) {
                        Done = 0;
                        while (!Done) {
-                       len = StrBuf_ServGetln(Buf);
-                       if ((len <0) || ((len == 3) && !strcmp(ChrPtr(Buf), "000")))
-                       {
-                               Done = 1;
-                               break;
+                               len = StrBuf_ServGetln(Buf);
+                               if ((len <0) || ((len == 3) && !strcmp(ChrPtr(Buf), "000")))
+                               {
+                                       Done = 1;
+                                       break;
+                               }
                        }
                        UID = atoi(ChrPtr(Buf));
                        if (GetHash(Hash, IKEY(UID), &vData) && vData != 0)
                        }
                        UID = atoi(ChrPtr(Buf));
                        if (GetHash(Hash, IKEY(UID), &vData) && vData != 0)
index 4c78cb6b250a407a8b8ec1aa37ece04c0e688bcf..4108ecb38c3971355b6f5ad650ed7cbd02c9b133 100644 (file)
@@ -3,7 +3,7 @@
  * persistent session to the Citadel server, handling HTTP WebCit requests as
  * they arrive and presenting a user interface.
  *
  * persistent session to the Citadel server, handling HTTP WebCit requests as
  * they arrive and presenting a user interface.
  *
- * Copyright (c) 1996-2013 by the citadel.org team
+ * Copyright (c) 1996-2018 by the citadel.org team
  *
  * 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 open source software.  You can redistribute it and/or
  * modify it under the terms of the GNU General Public License, version 3.