From: Art Cancro Date: Wed, 24 Nov 2021 04:44:04 +0000 (-0500) Subject: Moved the remaining else blocks X-Git-Tag: v941~17 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=3063427564f6fd6d8844ac1cb5e7092320f76173;p=citadel.git Moved the remaining else blocks --- diff --git a/webcit-ng/admin_functions.c b/webcit-ng/admin_functions.c index 551c06d13..9ac3d1a18 100644 --- a/webcit-ng/admin_functions.c +++ b/webcit-ng/admin_functions.c @@ -1,7 +1,7 @@ // // Admin functions // -// Copyright (c) 1996-2018 by the citadel.org team +// Copyright (c) 1996-2021 by the citadel.org team // // This program is open source software. It runs great on the // Linux operating system (and probably elsewhere). You can use, diff --git a/webcit-ng/api.txt b/webcit-ng/api.txt index 8daab3466..635feb3ea 100644 --- a/webcit-ng/api.txt +++ b/webcit-ng/api.txt @@ -8,7 +8,7 @@ PROPFIND /ctdl/r/ROOMNAME/ Show a bunch of crap GET /ctdl/r/ROOMNAME/ Returns information about the room (name, view, etc.) in JSON format GET /ctdl/r/ROOMNAME/msgs.all JSON array of message list in room GET /ctdl/r/ROOMNAME/msgs.new JSON array of message list in room (new messages) -GET /ctdl/r/ROOMNAME/MSGNUM Retrieve the content of an individual message (message headers are HTTP headers) +GET /ctdl/r/ROOMNAME/MSGNUM Retrieve the content of an individual message (FIXME: make msg headers HTTP headers) PUT /ctdl/r/ROOMNAME/xxx DAV operation to insert a new message into a room (The returned ETag will be the new message number) GET /ctdl/r/ROOMNAME/MSGNUM/json Retrieve an individual message in a room, encapsulated in JSON diff --git a/webcit-ng/caldav_reports.c b/webcit-ng/caldav_reports.c index b5ae8744a..e7c9687e0 100644 --- a/webcit-ng/caldav_reports.c +++ b/webcit-ng/caldav_reports.c @@ -2,7 +2,7 @@ // This file contains functions which handle all of the CalDAV "REPORT" queries // specified in RFC4791 section 7. // -// Copyright (c) 2018 by the citadel.org team +// Copyright (c) 2021 by the citadel.org team // // This program is open source software. It runs great on the // Linux operating system (and probably elsewhere). You can use, @@ -76,7 +76,8 @@ void caldav_xml_end(void *data, const char *el) { if ((!strcasecmp(el, "DAV::href")) || (!strcasecmp(el, "DAV:href"))) { if (crp->Hrefs == NULL) { // append crp->Chardata to crp->Hrefs crp->Hrefs = NewStrBuf(); - } else { + } + else { StrBufAppendBufPlain(crp->Hrefs, HKEY("|"), 0); } StrBufAppendBuf(crp->Hrefs, crp->Chardata, 0); @@ -121,7 +122,8 @@ StrBuf *fetch_ical(struct ctdlsession * c, long msgnum) { while (ctdl_readline(c, buf, sizeof(buf)), strcmp(buf, "000")) { if (Buf != NULL) { // already in body StrBufAppendPrintf(Buf, "%s\n", buf); - } else if (IsEmptyStr(buf)) { // beginning of body + } + else if (IsEmptyStr(buf)) { // beginning of body Buf = NewStrBuf(); } } @@ -159,7 +161,8 @@ void caldav_response(struct http_transaction *h, struct ctdlsession *c, StrBuf * euid = strrchr(ChrPtr(ThisHref), '/'); if (euid != NULL) { ++euid; - } else { + } + else { euid = (char *) ChrPtr(ThisHref); } @@ -195,7 +198,8 @@ void caldav_response(struct http_transaction *h, struct ctdlsession *c, StrBuf * StrBufAppendPrintf(ReportOut, ""); FreeStrBuf(&Caldata); Caldata = NULL; - } else { + } + else { // syslog(LOG_DEBUG, "caldav_response(%s) 404 not found", ChrPtr(ThisHref)); StrBufAppendPrintf(ReportOut, ""); StrBufAppendPrintf(ReportOut, "HTTP/1.1 404 not found"); diff --git a/webcit-ng/ctdl_commands.c b/webcit-ng/ctdl_commands.c index d50885be9..90c10e17c 100644 --- a/webcit-ng/ctdl_commands.c +++ b/webcit-ng/ctdl_commands.c @@ -1,5 +1,5 @@ // -// Copyright (c) 1996-2018 by the citadel.org team +// Copyright (c) 1996-2021 by the citadel.org team // // This program is open source software. It runs great on the // Linux operating system (and probably elsewhere). You can use, @@ -94,7 +94,8 @@ void serv_info(struct http_transaction *h, struct ctdlsession *c) { void ctdl_c(struct http_transaction *h, struct ctdlsession *c) { if (!strcasecmp(h->uri, "/ctdl/c/info")) { serv_info(h, c); - } else { + } + else { do_404(h); } } diff --git a/webcit-ng/ctdlclient.c b/webcit-ng/ctdlclient.c index eb74598e4..a5a25f9e5 100644 --- a/webcit-ng/ctdlclient.c +++ b/webcit-ng/ctdlclient.c @@ -1,7 +1,7 @@ // // Functions that handle communication with a Citadel Server // -// Copyright (c) 1987-2018 by the citadel.org team +// Copyright (c) 1987-2021 by the citadel.org team // // This program is open source software. It runs great on the // Linux operating system (and probably elsewhere). You can use, @@ -158,7 +158,8 @@ int tcp_connectsock(char *host, char *service) { if (rc == 1) { // dotted quad hints.ai_family = AF_INET; hints.ai_flags |= AI_NUMERICHOST; - } else { + } + else { rc = inet_pton(AF_INET6, host, &serveraddr); if (rc == 1) { // IPv6 address hints.ai_family = AF_INET6; @@ -210,7 +211,8 @@ int tcp_connectsock(char *host, char *service) { } return (s); - } else { + } + else { syslog(LOG_WARNING, "connect() failed: %s", strerror(errno)); close(s); } @@ -341,7 +343,8 @@ struct ctdlsession *connect_to_citadel(struct http_transaction *h) { if (my_session->sock < 3) { is_new_session = 1; - } else { // make sure our Citadel session is still good + } + else { // make sure our Citadel session is still good int test_conn; test_conn = ctdl_write(my_session, HKEY("NOOP\n")); if (test_conn < 5) { @@ -349,7 +352,8 @@ struct ctdlsession *connect_to_citadel(struct http_transaction *h) { close(my_session->sock); my_session->sock = 0; is_new_session = 1; - } else { + } + else { test_conn = ctdl_readline(my_session, buf, sizeof(buf)); if (test_conn < 1) { syslog(LOG_DEBUG, "Citadel session is broken , must reconnect"); diff --git a/webcit-ng/ctdlfunctions.c b/webcit-ng/ctdlfunctions.c index 0365ad498..d937110b7 100644 --- a/webcit-ng/ctdlfunctions.c +++ b/webcit-ng/ctdlfunctions.c @@ -1,7 +1,7 @@ // // These utility functions loosely make up a Citadel protocol client library. // -// Copyright (c) 2016-2018 by the citadel.org team +// Copyright (c) 2016-2021 by the citadel.org team // // This program is open source software. It runs great on the // Linux operating system (and probably elsewhere). You can use, @@ -35,7 +35,8 @@ void ctdl_delete_msgs(struct ctdlsession *c, long *msgnums, int num_msgs) { ctdl_printf(c, "%s", buf); ctdl_readline(c, buf, sizeof(buf)); syslog(LOG_DEBUG, "%s", buf); - } else { + } + else { strcat(buf, ","); } } while (++i < num_msgs); diff --git a/webcit-ng/forum_view.c b/webcit-ng/forum_view.c index 4321a89fc..97f8a1b28 100644 --- a/webcit-ng/forum_view.c +++ b/webcit-ng/forum_view.c @@ -1,7 +1,7 @@ // // Forum view (threaded/flat) // -// Copyright (c) 1996-2020 by the citadel.org team +// Copyright (c) 1996-2021 by the citadel.org team // // This program is open source software. It runs great on the // Linux operating system (and probably elsewhere). You can use, @@ -104,7 +104,8 @@ void json_render_one_message(struct http_transaction *h, struct ctdlsession *c, } } raw_msg = ctdl_readtextmsg(c); - } else { + } + else { raw_msg = NULL; } diff --git a/webcit-ng/html2html.c b/webcit-ng/html2html.c index 0d0264a43..8704525be 100644 --- a/webcit-ng/html2html.c +++ b/webcit-ng/html2html.c @@ -2,7 +2,7 @@ // Output an HTML message, modifying it slightly to make sure it plays nice // with the rest of our web framework. // -// Copyright (c) 2005-2020 by the citadel.org team +// Copyright (c) 2005-2021 by the citadel.org team // // This program is open source software. It runs great on the // Linux operating system (and probably elsewhere). You can use, @@ -221,8 +221,10 @@ StrBuf *html2html(const char *supplied_charset, int treat_as_wiki, char *roomnam if (ptr - cid_end > 0) StrBufAppendBufPlain(BodyArea, cid_end + 1, ptr - cid_end, 0); - } else + } + else { StrBufAppendBufPlain(BodyArea, pBody, ptr - pBody, 0); + } } *ptr = '>'; } @@ -274,7 +276,8 @@ StrBuf *html2html(const char *supplied_charset, int treat_as_wiki, char *roomnam msg = osav; iconv_close(ic); } - } else { + } + else { if (ic != (iconv_t) (-1)) { StrBuf *Buf = NewStrBufPlain(NULL, StrLength(Source) + 8096);; StrBufConvert(Source, Buf, &ic); @@ -336,7 +339,8 @@ StrBuf *html2html(const char *supplied_charset, int treat_as_wiki, char *roomnam // open external links to new window StrBufAppendPrintf(converted_msg, new_window); ptr = &ptr[8]; - } else if ((treat_as_wiki) + } + else if ((treat_as_wiki) && (strncasecmp(ptr, "response_body, (char *) ChrPtr(Body), StrLength(Body)); } FreeStrBuf(&Body); - } else if (encoding == 'b') { + } + else if (encoding == 'b') { h->response_body = malloc(StrLength(Body)); if (h->response_body != NULL) { h->response_body_length = CtdlDecodeBase64(h->response_body, ChrPtr(Body), StrLength(Body)); } FreeStrBuf(&Body); - } else { + } + else { h->response_body_length = StrLength(Body); h->response_body = SmashStrBuf(&Body); } @@ -212,7 +218,8 @@ void dav_put_message(struct http_transaction *h, struct ctdlsession *c, char *eu if (old_msgnum <= 0) { h->response_code = 201; // We created this item for the first time. h->response_string = strdup("created"); - } else { + } + else { h->response_code = 204; // We modified an existing item. h->response_string = strdup("no content"); diff --git a/webcit-ng/room_functions.c b/webcit-ng/room_functions.c index 179884d9f..6e081bd29 100644 --- a/webcit-ng/room_functions.c +++ b/webcit-ng/room_functions.c @@ -523,7 +523,8 @@ void ctdl_r(struct http_transaction *h, struct ctdlsession *c) { // 13 (int)is_trash Boolean flag: 1 if this is the user's Trash folder, 0 otherwise. // 14 (int)CC->room.QRflags2 More flags associated with this room // 15 (long)CC->room.QRmtime Timestamp of the last write activity in this room - } else { + } + else { do_404(h); return; } diff --git a/webcit-ng/ssl.c b/webcit-ng/ssl.c index 8d33fe45f..f1744c2bb 100644 --- a/webcit-ng/ssl.c +++ b/webcit-ng/ssl.c @@ -2,7 +2,7 @@ // Functions in this module handle SSL encryption when WebCit is running // as an HTTPS server. // -// Copyright (c) 1996-2018 by the citadel.org team +// Copyright (c) 1996-2021 by the citadel.org team // // This program is open source software. It runs great on the // Linux operating system (and probably elsewhere). You can use, diff --git a/webcit-ng/static.c b/webcit-ng/static.c index 8b7483424..80f506431 100644 --- a/webcit-ng/static.c +++ b/webcit-ng/static.c @@ -1,7 +1,7 @@ // // Output static content // -// Copyright (c) 1996-2018 by the citadel.org team +// Copyright (c) 1996-2021 by the citadel.org team // // This program is open source software. It runs great on the // Linux operating system (and probably elsewhere). You can use, diff --git a/webcit-ng/static/js/view_forum.js b/webcit-ng/static/js/view_forum.js index edf0a971b..fb9121b58 100644 --- a/webcit-ng/static/js/view_forum.js +++ b/webcit-ng/static/js/view_forum.js @@ -264,8 +264,15 @@ function cancel_post(div_name) { // Save the posted message to the server -function save_message(div_name, reply_to_msgnum) { +function Xsave_message(div_name, reply_to_msgnum) { + msg_text = "" + document.getElementById("ctdl-editor-body").innerHTML + "\n"; + m = btoa(msg_text); + alert(m); +} + +// Save the posted message to the server +function save_message(div_name, reply_to_msgnum) { msg_text = "" + document.getElementById("ctdl-editor-body").innerHTML + "\n"; url = "/ctdl/r/" + escapeHTMLURI(current_room) + "/dummy_name_for_new_message"; diff --git a/webcit-ng/tcp_sockets.c b/webcit-ng/tcp_sockets.c index 1e005a546..4fbc427b6 100644 --- a/webcit-ng/tcp_sockets.c +++ b/webcit-ng/tcp_sockets.c @@ -1,7 +1,7 @@ // // TCP sockets layer // -// Copyright (c) 1987-2018 by the citadel.org team +// Copyright (c) 1987-2021 by the citadel.org team // // This program is open source software. It runs great on the // Linux operating system (and probably elsewhere). You can use, diff --git a/webcit-ng/user_functions.c b/webcit-ng/user_functions.c index 5f668049f..fbecef57c 100644 --- a/webcit-ng/user_functions.c +++ b/webcit-ng/user_functions.c @@ -1,7 +1,7 @@ // // User functions // -// Copyright (c) 1996-2018 by the citadel.org team +// Copyright (c) 1996-2021 by the citadel.org team // // This program is open source software. It runs great on the // Linux operating system (and probably elsewhere). You can use, @@ -115,7 +115,8 @@ void ctdl_u(struct http_transaction *h, struct ctdlsession *c) { if (num_tokens(h->uri, '/') == 5) { if (IsEmptyStr(buf)) { the_user_itself(h, c, requested_username); // /ctdl/u/username/ ( same as /ctdl/u/username ) - } else { + } + else { object_in_user(h, c, requested_username); // /ctdl/u/username/object } return; diff --git a/webcit-ng/util.c b/webcit-ng/util.c index 17dca336c..66591944d 100644 --- a/webcit-ng/util.c +++ b/webcit-ng/util.c @@ -1,7 +1,7 @@ // // Utility functions // -// Copyright (c) 1996-2018 by the citadel.org team +// Copyright (c) 1996-2021 by the citadel.org team // // This program is open source software. It runs great on the // Linux operating system (and probably elsewhere). You can use, diff --git a/webcit-ng/webserver.c b/webcit-ng/webserver.c index 2cf80a0ca..b28a3fab2 100644 --- a/webcit-ng/webserver.c +++ b/webcit-ng/webserver.c @@ -5,7 +5,7 @@ // connections, and dispatching active connections onto a pool of worker // threads. // -// Copyright (c) 1996-2018 by the citadel.org team +// Copyright (c) 1996-2021 by the citadel.org team // // This program is open source software. It runs great on the // Linux operating system (and probably elsewhere). You can use,