//
// 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,
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
// 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,
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);
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();
}
}
euid = strrchr(ChrPtr(ThisHref), '/');
if (euid != NULL) {
++euid;
- } else {
+ }
+ else {
euid = (char *) ChrPtr(ThisHref);
}
StrBufAppendPrintf(ReportOut, "</D:prop>");
FreeStrBuf(&Caldata);
Caldata = NULL;
- } else {
+ }
+ else {
// syslog(LOG_DEBUG, "caldav_response(%s) 404 not found", ChrPtr(ThisHref));
StrBufAppendPrintf(ReportOut, "<D:status>");
StrBufAppendPrintf(ReportOut, "HTTP/1.1 404 not found");
//
-// 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,
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);
}
}
//
// 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,
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;
}
return (s);
- } else {
+ }
+ else {
syslog(LOG_WARNING, "connect() failed: %s", strerror(errno));
close(s);
}
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) {
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");
//
// 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,
ctdl_printf(c, "%s", buf);
ctdl_readline(c, buf, sizeof(buf));
syslog(LOG_DEBUG, "%s", buf);
- } else {
+ }
+ else {
strcat(buf, ",");
}
} while (++i < num_msgs);
//
// 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,
}
}
raw_msg = ctdl_readtextmsg(c);
- } else {
+ }
+ else {
raw_msg = NULL;
}
// 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,
if (ptr - cid_end > 0)
StrBufAppendBufPlain(BodyArea, cid_end + 1, ptr - cid_end, 0);
- } else
+ }
+ else {
StrBufAppendBufPlain(BodyArea, pBody, ptr - pBody, 0);
+ }
}
*ptr = '>';
}
msg = osav;
iconv_close(ic);
}
- } else {
+ }
+ else {
if (ic != (iconv_t) (-1)) {
StrBuf *Buf = NewStrBufPlain(NULL, StrLength(Source) + 8096);;
StrBufConvert(Source, Buf, &ic);
// 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, "<a href=\"wiki?", 14))
&& (strncasecmp(ptr, "<a href=\"dotgoto?", 17))
&& (strncasecmp(ptr, "<a href=\"knrooms?", 17))
//StrBufUrlescAppend(converted_msg, "FIXME ROOM NAME", NULL); // FIXME make compatible with webcit-ng
StrBufAppendPrintf(converted_msg, "?page=");
ptr = &ptr[9];
- } else {
+ }
+ else {
StrBufAppendPrintf(converted_msg, "<a href=\"");
ptr = &ptr[9];
}
//
// This module handles HTTP transactions.
//
-// 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,
//
// Main entry point for the program.
//
-// 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,
//
// Message base 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,
if (IsEmptyStr(buf) && (in_body == 0)) {
in_body = 1;
Body = NewStrBuf();
- } else if (in_body == 0) {
+ }
+ else if (in_body == 0) {
char *k = buf;
char *v = strchr(buf, ':');
if (v) {
striplt(v); // we now have a key (k) and a value (v)
if ((!strcasecmp(k, "content-type")) // fields which can be passed from RFC822 to HTTP as-is
|| (!strcasecmp(k, "date"))
- ) {
+ ) {
add_response_header(h, strdup(k), strdup(v));
- } else if (!strcasecmp(k, "content-transfer-encoding")) {
+ }
+ else if (!strcasecmp(k, "content-transfer-encoding")) {
if (!strcasecmp(v, "base64")) {
encoding = 'b';
- } else if (!strcasecmp(v, "quoted-printable")) {
+ }
+ else if (!strcasecmp(v, "quoted-printable")) {
encoding = 'q';
}
}
}
- } else if ((in_body == 1) && (Body != NULL)) {
+ }
+ else if ((in_body == 1) && (Body != NULL)) {
StrBufAppendPrintf(Body, "%s\n", buf);
}
}
CtdlDecodeQuotedPrintable(h->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);
}
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");
// 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;
}
// 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,
//
// 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,
// 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 = "<html><body>" + document.getElementById("ctdl-editor-body").innerHTML + "</body></html>\n";
+ m = btoa(msg_text);
+ alert(m);
+}
+
+// Save the posted message to the server
+function save_message(div_name, reply_to_msgnum) {
msg_text = "<html><body>" + document.getElementById("ctdl-editor-body").innerHTML + "</body></html>\n";
url = "/ctdl/r/" + escapeHTMLURI(current_room) + "/dummy_name_for_new_message";
//
// 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,
//
// 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,
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;
//
// 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,
// 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,