From: Art Cancro Date: Wed, 9 Nov 2022 21:20:01 +0000 (-0500) Subject: war on old style X-Git-Tag: v959~6 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=28c9012d1e3ab1d460fdda87d4b0a16423dda99a war on old style --- diff --git a/libcitadel/lib/stringbuf.c b/libcitadel/lib/stringbuf.c index 8023ab7c7..e4824cf36 100644 --- a/libcitadel/lib/stringbuf.c +++ b/libcitadel/lib/stringbuf.c @@ -517,7 +517,7 @@ int StrBufPlain(StrBuf *Buf, const char* ptr, int nChars) { } -/** +/* * use strbuf as wrapper for a string constant for easy handling * StringConstant a string to wrap * SizeOfStrConstant should be sizeof(StringConstant)-1 @@ -540,7 +540,7 @@ StrBuf* _NewConstStrBuf(const char* StringConstant, size_t SizeOfStrConstant) } -/** +/* * flush the content of a Buf; keep its struct * buf Buffer to flush */ @@ -555,7 +555,7 @@ int FlushStrBuf(StrBuf *buf) return 0; } -/** +/* * wipe the content of a Buf thoroughly (overwrite it -> expensive); keep its struct * buf Buffer to wipe */ @@ -575,7 +575,7 @@ int FLUSHStrBuf(StrBuf *buf) #ifdef SIZE_DEBUG int hFreeDbglog = -1; #endif -/** +/* * Release a Buffer * Its a double pointer, so it can NULL your pointer * so fancy SIG11 appear instead of random results @@ -639,7 +639,7 @@ void HFreeStrBuf (void *VFreeMe) { * Simple string transformations * *******************************************************************************/ -/** +/* * Wrapper around atol */ long StrTol(const StrBuf *Buf) @@ -652,7 +652,7 @@ long StrTol(const StrBuf *Buf) return 0; } -/** +/* * Wrapper around atoi */ int StrToi(const StrBuf *Buf) @@ -665,7 +665,7 @@ int StrToi(const StrBuf *Buf) return 0; } -/** +/* * Checks to see if the string is a pure number * Buf The buffer to inspect * @returns 1 if its a pure number, 0, if not. diff --git a/libcitadel/lib/tools.c b/libcitadel/lib/tools.c index 53151fb95..131cc2f7a 100644 --- a/libcitadel/lib/tools.c +++ b/libcitadel/lib/tools.c @@ -282,8 +282,7 @@ size_t striplt(char *buf) { * ch the char to search * returns the number of times ch appears in st */ -int haschar(const char *st, int ch) -{ +int haschar(const char *st, int ch) { const char *ptr; int b; b = 0; @@ -302,8 +301,7 @@ int haschar(const char *st, int ch) * Determine whether the specified message number is contained within the * specified sequence set. */ -int is_msg_in_sequence_set(const char *mset, long msgnum) -{ +int is_msg_in_sequence_set(const char *mset, long msgnum) { int num_sets; int s; char setstr[128], lostr[128], histr[128]; @@ -342,8 +340,7 @@ int is_msg_in_sequence_set(const char *mset, long msgnum) * maxlen Size of string buffer * returns pointer to the source memory right after we stopped reading. */ -char *memreadline(char *start, char *buf, int maxlen) -{ +char *memreadline(char *start, char *buf, int maxlen) { char ch; char *ptr; int len = 0; /* tally our own length to avoid strlen() delays */ @@ -371,8 +368,7 @@ char *memreadline(char *start, char *buf, int maxlen) * retlen the length of the returned string * returns a pointer to the source memory right after we stopped reading. */ -char *memreadlinelen(char *start, char *buf, int maxlen, int *retlen) -{ +char *memreadlinelen(char *start, char *buf, int maxlen, int *retlen) { char ch; char *ptr; int len = 0; /* tally our own length to avoid strlen() delays */ @@ -668,6 +664,7 @@ inline static char *_bmstrcasestr_len(char *text, size_t textlen, const char *pa return (NULL); } + /* * bmstrcasestr() -- case-insensitive substring search * @@ -693,8 +690,6 @@ char *bmstrcasestr_len(char *text, size_t textlen, const char *pattern, size_t p } - - /* * bmstrcasestr() -- case-insensitive substring search * @@ -753,6 +748,7 @@ inline static const char *_cbmstrcasestr_len(const char *text, size_t textlen, c return (NULL); } + /* * bmstrcasestr() -- case-insensitive substring search * @@ -773,10 +769,12 @@ const char *cbmstrcasestr(const char *text, const char *pattern) { return _cbmstrcasestr_len(text, textlen, pattern, patlen); } + const char *cbmstrcasestr_len(const char *text, size_t textlen, const char *pattern, size_t patlen) { return _cbmstrcasestr_len(text, textlen, pattern, patlen); } + /* * Local replacement for controversial C library function that generates * names for temporary files. Included to shut up compiler warnings. @@ -796,7 +794,6 @@ void CtdlMakeTempFileName(char *name, int len) { } - /* * Determine whether the specified message number is contained within the specified set. * Returns nonzero if the specified message number is in the specified message set string. @@ -804,12 +801,10 @@ void CtdlMakeTempFileName(char *name, int len) { int is_msg_in_mset(const char *mset, long msgnum) { int num_sets; int s; - char setstr[SIZ], lostr[SIZ], histr[SIZ]; /* was 1024 */ + char setstr[SIZ], lostr[SIZ], histr[SIZ]; long lo, hi; - /* - * Now set it for all specified messages. - */ + // Now set it for all specified messages. num_sets = num_tokens(mset, ','); for (s=0; s delta) && (isspace(buf[delta]))){ @@ -877,8 +868,7 @@ void stripltlen(char *buf, int *len) /* * Convert all whitespace characters in a supplied string to underscores */ -void convert_spaces_to_underscores(char *str) -{ +void convert_spaces_to_underscores(char *str) { int len; int i; @@ -896,8 +886,7 @@ void convert_spaces_to_underscores(char *str) /* * check whether the provided string needs to be qp encoded or not */ -int CheckEncode(const char *pch, long len, const char *pche) -{ +int CheckEncode(const char *pch, long len, const char *pche) { if (pche == NULL) pche = pch + len; while (pch < pche) { diff --git a/libcitadel/lib/urlhandling.c b/libcitadel/lib/urlhandling.c index 7d53f9bdb..db879dcaf 100644 --- a/libcitadel/lib/urlhandling.c +++ b/libcitadel/lib/urlhandling.c @@ -13,17 +13,9 @@ #include "libcitadel.h" #include -/** - * @defgroup URLHandling ParsedURL object to handle connection data - */ - -/** - * @ingroup URLHandling - * @brief frees a linked list of ParsedURL - * @param Url (list) of ParsedURL to be freet; Pointer is NULL'ed for the caller. - */ -void FreeURL(ParsedURL** Url) -{ +// frees a linked list of ParsedURL +// Url (list) of ParsedURL to be freet; Pointer is NULL'ed for the caller. +void FreeURL(ParsedURL** Url) { if (*Url != NULL) { FreeStrBuf(&(*Url)->URL); FreeStrBuf(&(*Url)->UrlWithoutCred); @@ -37,30 +29,23 @@ void FreeURL(ParsedURL** Url) } } -/** - * @ingroup URLHandling - * @brief parses the string provided with UrlStr into *Url - * @param Url on success this contains the parsed object; needs to be free'd by caller. - * @param UrlStr String we should parse into parts - * @param DefaultPort Which is the default port here? - */ -int ParseURL(ParsedURL **Url, StrBuf *UrlStr, unsigned short DefaultPort) -{ +// parses the string provided with UrlStr into *Url +// Url on success this contains the parsed object; needs to be free'd by caller. +// UrlStr String we should parse into parts +// DefaultPort Which is the default port here? +int ParseURL(ParsedURL **Url, StrBuf *UrlStr, unsigned short DefaultPort) { const char *pch, *pPort, *pCredEnd, *pUserEnd; ParsedURL *url = (ParsedURL *)malloc(sizeof(ParsedURL)); memset(url, 0, sizeof(ParsedURL)); url->af = AF_INET; url->Port = DefaultPort; - /* - * http://username:passvoid@[ipv6]:port/url - */ - url->URL = NewStrBufDup(UrlStr); + url->URL = NewStrBufDup(UrlStr); // http://username:password@[ipv6]:port/url url->Host = pch = ChrPtr(url->URL); url->LocalPart = strchr(pch, '/'); if (url->LocalPart != NULL) { if ((*(url->LocalPart + 1) == '/') && - (*(url->LocalPart - 1) == ':')) { /* TODO: find default port for this protocol... */ + (*(url->LocalPart - 1) == ':')) { url->Host = url->LocalPart + 2; url->LocalPart = strchr(url->Host, '/'); if (url->LocalPart != NULL) @@ -77,8 +62,7 @@ int ParseURL(ParsedURL **Url, StrBuf *UrlStr, unsigned short DefaultPort) pCredEnd = strrchr(ChrPtr(url->URL), '@'); if (pCredEnd >= url->LocalPart) pCredEnd = NULL; - if (pCredEnd != NULL) - { + if (pCredEnd != NULL) { url->User = url->Host; url->Host = pCredEnd + 1; pUserEnd = strchr(url->User, ':'); @@ -120,20 +104,16 @@ int ParseURL(ParsedURL **Url, StrBuf *UrlStr, unsigned short DefaultPort) } if (pPort != NULL) url->Port = atol(pPort); - if (url->IPv6) - { + if (url->IPv6) { url->IsIP = inet_pton(AF_INET6, url->Host, &url->Addr.sin6_addr); - if (url->IsIP) - { + if (url->IsIP) { url->Addr.sin6_port = htons(url->Port); url->Addr.sin6_port = AF_INET6; } } - else - { + else { url->IsIP = inet_pton(AF_INET, url->Host, &((struct sockaddr_in *)&(url->Addr))->sin_addr); - if (url->IsIP) - { + if (url->IsIP) { ((struct sockaddr_in *)&(url->Addr))->sin_port = htons(url->Port); ((struct sockaddr_in *)&(url->Addr))->sin_family = AF_INET; } @@ -157,8 +137,7 @@ int ParseURL(ParsedURL **Url, StrBuf *UrlStr, unsigned short DefaultPort) return 1; } -void CurlPrepareURL(ParsedURL *Url) -{ +void CurlPrepareURL(ParsedURL *Url) { if (!strcmp(ChrPtr(Url->URL), "http")) Url->UrlWithoutCred = NewStrBufPlain(ChrPtr(Url->URL), -1); else @@ -170,12 +149,10 @@ void CurlPrepareURL(ParsedURL *Url) StrBufAppendPrintf(Url->UrlWithoutCred, "%u", Url->Port); StrBufAppendBufPlain(Url->UrlWithoutCred, HKEY("/"), 0); - if (Url->LocalPart) - { + if (Url->LocalPart) { StrBufAppendBufPlain(Url->UrlWithoutCred, Url->LocalPart, -1, 0); } - if (Url->User != NULL) - { + if (Url->User != NULL) { Url->CurlCreds = NewStrBufPlain(Url->User, -1); StrBufAppendBufPlain(Url->CurlCreds, HKEY(":"), 0); if (Url->Pass != NULL) diff --git a/webcit-ng/server/util.c b/webcit-ng/server/util.c index 72bf66038..e14dcd2e4 100644 --- a/webcit-ng/server/util.c +++ b/webcit-ng/server/util.c @@ -1,10 +1,6 @@ -// // Utility functions -// // Copyright (c) 1996-2022 by the citadel.org team -// -// This program is open source software. Use, duplication, or -// disclosure are subject to the GNU General Public License v3. +// This program is open source software. Use, duplication, or disclosure are subject to the GNU General Public License v3. #include "webcit.h" diff --git a/webcit-ng/static/js/view_mail.js b/webcit-ng/static/js/view_mail.js index d524c7988..fac046dec 100644 --- a/webcit-ng/static/js/view_mail.js +++ b/webcit-ng/static/js/view_mail.js @@ -343,7 +343,7 @@ function mail_compose(is_quoted, references, quoted_msgnum, m_to, m_cc, m_subjec // The button bar is a Grid element, and is also a Flexbox container. + "
" - + " " + _("Send message") + "" + + " " + _("Send message") + "" + "" + _("Save to Drafts") + "" + "" + _("Attachments:") + " 0" + "" + "" + _("Contacts") + "" @@ -367,7 +367,7 @@ function make_cc_bcc_visible() { } -// Helper function for mail_save_messages() to extract form values. +// Helper function for mail_send_messages() to extract form values. // (We have to replace "|" with "!" because "|" is a field separator in the Citadel protocol) function msm_field(element_name, separator) { return (document.getElementById(element_name).innerHTML).replaceAll("|",separator); @@ -375,7 +375,7 @@ function msm_field(element_name, separator) { // Save the posted message to the server -function mail_save_message() { +function mail_send_message() { document.body.style.cursor = "wait"; url = "/ctdl/r/" + escapeHTMLURI(current_room) @@ -386,6 +386,7 @@ function mail_save_message() { + "&mailcc=" + msm_field("ctdl-compose-cc-field", ",") // Cc: (if present) + "&mailbcc=" + msm_field("ctdl-compose-bcc-field", ",") // Bcc: (if present) ; + console.log(url); boundary = randomString(); body_text = "--" + boundary + "\r\n" diff --git a/webcit/utils.c b/webcit/utils.c index 4a8228146..e08dcb7d5 100644 --- a/webcit/utils.c +++ b/webcit/utils.c @@ -1,6 +1,4 @@ -/* - * de/encoding stuff. hopefully mostly to be depricated in favour of subst.c + strbuf - */ +// de/encoding stuff. hopefully mostly to be depricated in favour of subst.c + strbuf #define SHOW_ME_VAPPEND_PRINTF #include @@ -8,11 +6,8 @@ #include "webcit.h" -/* - * remove escaped strings from i.e. the url string (like %20 for blanks) - */ -long unescape_input(char *buf) -{ +// remove escaped strings from i.e. the url string (like %20 for blanks) +long unescape_input(char *buf) { unsigned int a, b; char hex[3]; long buflen; @@ -30,7 +25,7 @@ long unescape_input(char *buf) if (buf[a] == '+') buf[a] = ' '; if (buf[a] == '%') { - /* don't let % chars through, rather truncate the input. */ + // don't let % chars through, rather truncate the input. if (a + 2 > buflen) { buf[a] = '\0'; buflen = a; @@ -54,22 +49,19 @@ long unescape_input(char *buf) return a; } -/* - * Copy a string, escaping characters which have meaning in HTML. - * - * target target buffer - * strbuf source buffer - * nbsp If nonzero, spaces are converted to non-breaking spaces. - * nolinebreaks if set, linebreaks are removed from the string. - */ -long stresc(char *target, long tSize, char *strbuf, int nbsp, int nolinebreaks) -{ +// Copy a string, escaping characters which have meaning in HTML. +// +// target target buffer +// strbuf source buffer +// nbsp If nonzero, spaces are converted to non-breaking spaces. +// nolinebreaks if set, linebreaks are removed from the string. +long stresc(char *target, long tSize, char *strbuf, int nbsp, int nolinebreaks) { char *aptr, *bptr, *eptr; *target = '\0'; aptr = strbuf; bptr = target; - eptr = target + tSize - 6; /* our biggest unit to put in... */ + eptr = target + tSize - 6; // our biggest unit to put in... while ((bptr < eptr) && !IsEmptyStr(aptr) ){ @@ -127,37 +119,25 @@ long stresc(char *target, long tSize, char *strbuf, int nbsp, int nolinebreaks) return (bptr - target); } -/* - * static wrapper for ecsputs1 - */ -void escputs(const char *strbuf) -{ +// static wrapper for escputs1 +void escputs(const char *strbuf) { StrEscAppend(WC->WBuf, NULL, strbuf, 0, 0); } -/* - * urlescape buffer and print it to the client - */ -void urlescputs(const char *strbuf) -{ +// urlescape buffer and print it to the client +void urlescputs(const char *strbuf) { StrBufUrlescAppend(WC->WBuf, NULL, strbuf); } -/** - * urlescape buffer and print it as header - */ -void hurlescputs(const char *strbuf) -{ +// urlescape buffer and print it as header +void hurlescputs(const char *strbuf) { StrBufUrlescAppend(WC->HBuf, NULL, strbuf); } -/* - * Output a string to the client as a CDATA block - */ -void cdataout(char *rawdata) -{ +// Output a string to the client as a CDATA block +void cdataout(char *rawdata) { char *ptr = rawdata; wc_printf(""); -} - +} \ No newline at end of file