From: Art Cancro Date: Thu, 5 Apr 2018 15:13:23 +0000 (-0400) Subject: Renderers cleanup part 1 X-Git-Tag: v939~392 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=c73091a2ae896b6be5aa94b911c1c89d76a85688 Renderers cleanup part 1 --- diff --git a/webcit/messages.c b/webcit/messages.c index a8b4c6025..db7638b51 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -1,7 +1,7 @@ /* * 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. @@ -932,22 +932,12 @@ void post_mime_to_server(void) { 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("\r\n"); - text_to_server_qp(sbstr("msgtext")); /* Transmit message in quoted-printable encoding */ - serv_puts("\r\n"); - } + serv_puts("Content-type: text/html; charset=utf-8"); + serv_puts("Content-Transfer-Encoding: quoted-printable"); + serv_puts(""); + serv_puts("\r\n"); + text_to_server_qp(sbstr("msgtext")); /* Transmit message in quoted-printable encoding */ + serv_puts("\r\n"); if (include_text_alt) { serv_printf("--%s--", alt_boundary); @@ -1364,10 +1354,6 @@ void display_enter(void) int i = 0; long replying_to; - int prefer_md; - - get_pref_yesno("markdown", &prefer_md, 0); - 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); - 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; @@ -2116,8 +2099,6 @@ InitModule_MSG 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); diff --git a/webcit/msg_renderers.c b/webcit/msg_renderers.c index 9b1c7eec9..c925c58ee 100644 --- a/webcit/msg_renderers.c +++ b/webcit/msg_renderers.c @@ -1209,40 +1209,6 @@ void render_MAIL_html(StrBuf *Target, WCTemplputParams *TP, StrBuf *FoundCharset 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 - 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) { @@ -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); -#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 */ diff --git a/webcit/roomops.c b/webcit/roomops.c index ea58fc0e3..2dc7865b8 100644 --- a/webcit/roomops.c +++ b/webcit/roomops.c @@ -113,13 +113,11 @@ void dotskip(void) { } void dotgoto(void) { - wcsession *WCC = WC; 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(); } diff --git a/webcit/roomviews.c b/webcit/roomviews.c index 40fa9e02a..18563000d 100644 --- a/webcit/roomviews.c +++ b/webcit/roomviews.c @@ -23,8 +23,7 @@ int allowed_default_views[VIEW_MAX] = { 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, 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_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_WIKIMD: - StrBufAppendBufPlain(Target, HKEY("x-markdown"), 0); - break; } } diff --git a/webcit/serv_func.c b/webcit/serv_func.c index bff64e9e3..66afe5e12 100644 --- a/webcit/serv_func.c +++ b/webcit/serv_func.c @@ -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" diff --git a/webcit/static.c b/webcit/static.c index 2a2fc2847..34a656ee2 100644 --- a/webcit/static.c +++ b/webcit/static.c @@ -163,13 +163,20 @@ int LoadStaticDir(const char *DirName, HashList *DirList, const char *RelDir) int d_namelen; int istoplevel; + if (IsEmptyStr(DirName)) + { + return 0; + } + filedir = opendir (DirName); - if (filedir == NULL) { + if (filedir == NULL) + { return 0; } d = (struct dirent *)malloc(offsetof(struct dirent, d_name) + PATH_MAX + 1); - if (d == NULL) { + if (d == NULL) + { 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("markdown"), "", 0, output_static_3, ANONYMOUS|COOKIEUNNEEDED|ISSTATIC|LOGCHATTY); WebcitAddUrlHandler(HKEY("epiceditor"), "", 0, output_static_3, ANONYMOUS|COOKIEUNNEEDED|ISSTATIC|LOGCHATTY); } diff --git a/webcit/sysdep.c b/webcit/sysdep.c index 4b8f4c6a6..1278b5625 100644 --- a/webcit/sysdep.c +++ b/webcit/sysdep.c @@ -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. */ -const char markdown_editor_absolutedir[]=MARKDOWNEDITORDIR; 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_icon_dir, /* our icons... */ - (char*)markdown_editor_absolutedir + (char*)static_icon_dir /* our icons... */ }; int ExitPipe[2]; diff --git a/webcit/useredit.c b/webcit/useredit.c index af6a02276..a6b4d4b44 100644 --- a/webcit/useredit.c +++ b/webcit/useredit.c @@ -289,7 +289,7 @@ HashList *iterate_load_userlist(StrBuf *Target, WCTemplputParams *TP) StrBuf_ServGetln(Buf); if (GetServerStatus(Buf, NULL) == 1) { Hash = NewHash(1, Flathash); - + Done = 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); - if (GetServerStatus(Buf, NULL) == 1) + if (GetServerStatus(Buf, NULL) == 1) { 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) diff --git a/webcit/webcit.c b/webcit/webcit.c index 4c78cb6b2..4108ecb38 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -3,7 +3,7 @@ * 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.