More C99-style comments.
authorArt Cancro <ajc@citadel.org>
Wed, 3 Jan 2024 17:01:44 +0000 (12:01 -0500)
committerArt Cancro <ajc@citadel.org>
Wed, 3 Jan 2024 17:01:44 +0000 (12:01 -0500)
citadel/server/control.h
citadel/server/internet_addressing.c
citadel/server/journaling.c
citadel/server/serv_extensions.h
citadel/server/sysconfig.h
citadel/server/sysdep_decls.h

index 649d3fd85c1937ce79a5658d88be25d2d2c96c59..3fa869fc87201f9315d1004d2af8613731e45456 100644 (file)
@@ -1,14 +1,7 @@
-/*
- * Copyright (c) 1987-2015 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 distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
+// Copyright (c) 1987-2023 by the citadel.org team
+//
+// This program is open source software.  Use, duplication, or disclosure
+// are subject to the terms of the GNU General Public License version 3.
 
 void get_control (void);
 void put_control (void);
index 05a0e900a236a04de7523ae8d2b128603d3f08bb..b08123143c647ea2c95448422cb4dc075288241f 100644 (file)
@@ -1,7 +1,7 @@
 // This file contains functions which handle the mapping of Internet addresses
 // to users on the Citadel system.
 //
-// Copyright (c) 1987-2023 by the citadel.org team
+// Copyright (c) 1987-2024 by the citadel.org team
 //
 // This program is open source software.  Use, duplication, or disclosure
 // is subject to the terms of the GNU General Public License, version 3.
@@ -36,7 +36,6 @@
 #include "ctdl_module.h"
 
 
-
 char *inetcfg = NULL;
 
 // Return nonzero if the supplied name is an alias for this host.
@@ -834,7 +833,7 @@ int convert_field(struct CtdlMessage *msg, const char *beg, const char *end) {
                if (*pos == ':') colonpos = pos;
        }
 
-       if (colonpos == NULL) return(0);        /* no colon? not a valid header line */
+       if (colonpos == NULL) return(0);        // no colon? not a valid header line
 
        len = end - beg;
        key = malloc(len + 2);
@@ -1029,9 +1028,8 @@ struct CtdlMessage *convert_internet_message_buf(StrBuf **rfc822) {
 
        while (!alldone) {
 
-               /* Locate beginning and end of field, keeping in mind that
-                * some fields might be multiline
-                */
+               // Locate beginning and end of field, keeping in mind that
+               // some fields might be multiline
                end = beg = pos;
 
                while ((end < totalend) && (end == beg) && (done == 0) ) {
@@ -1040,7 +1038,7 @@ struct CtdlMessage *convert_internet_message_buf(StrBuf **rfc822) {
                                end = pos;
                        }
 
-                       /* done with headers? */
+                       // done with headers?
                        if ((*pos=='\n') && ( (*(pos+1)=='\n') || (*(pos+1)=='\r')) ) {
                                alldone = 1;
                        }
@@ -1054,16 +1052,16 @@ struct CtdlMessage *convert_internet_message_buf(StrBuf **rfc822) {
 
                }
 
-               /* At this point we have a field.  Are we interested in it? */
+               // At this point we have a field.  Are we interested in it?
                converted = convert_field(msg, beg, end);
 
-               /* Strip the field out of the RFC822 header if we used it */
+               // Strip the field out of the RFC822 header if we used it
                if (!converted) {
                        StrBufAppendBufPlain(OtherHeaders, beg, end - beg, 0);
                        StrBufAppendBufPlain(OtherHeaders, HKEY("\n"), 0);
                }
 
-               /* If we've hit the end of the message, bail out */
+               // If we've hit the end of the message, bail out
                if (pos >= totalend)
                        alldone = 1;
        }
@@ -1073,16 +1071,15 @@ struct CtdlMessage *convert_internet_message_buf(StrBuf **rfc822) {
        FreeStrBuf(rfc822);
        CM_SetAsFieldSB(msg, eMesageText, &OtherHeaders);
 
-       /* Follow-up sanity checks... */
+       // Follow-up sanity checks...
 
-       /* If there's no timestamp on this message, set it to now. */
+       // If there's no timestamp on this message, set it to now.
        if (CM_IsEmpty(msg, eTimestamp)) {
                CM_SetFieldLONG(msg, eTimestamp, time(NULL));
        }
 
-       /* If a W (references, or rather, Wefewences) field is present, we
-        * have to convert it from RFC822 format to Citadel format.
-        */
+       // If a W (references, or rather, Wefewences) field is present, we
+       // have to convert it from RFC822 format to Citadel format.
        if (!CM_IsEmpty(msg, eWeferences)) {
                /// todo: API!
                convert_references_to_wefewences(msg->cm_fields[eWeferences]);
@@ -1092,13 +1089,11 @@ struct CtdlMessage *convert_internet_message_buf(StrBuf **rfc822) {
 }
 
 
-/*
- * Look for a particular header field in an RFC822 message text.  If the
- * requested field is found, it is unfolded (if necessary) and returned to
- * the caller.  The field name is stripped out, leaving only its contents.
- * The caller is responsible for freeing the returned buffer.  If the requested
- * field is not present, or anything else goes wrong, it returns NULL.
- */
+// Look for a particular header field in an RFC822 message text.  If the
+// requested field is found, it is unfolded (if necessary) and returned to
+// the caller.  The field name is stripped out, leaving only its contents.
+// The caller is responsible for freeing the returned buffer.  If the requested
+// field is not present, or anything else goes wrong, it returns NULL.
 char *rfc822_fetch_field(const char *rfc822, const char *fieldname) {
        char *fieldbuf = NULL;
        const char *end_of_headers;
@@ -1107,13 +1102,13 @@ char *rfc822_fetch_field(const char *rfc822, const char *fieldname) {
        char *cont;
        char fieldhdr[SIZ];
 
-       /* Should never happen, but sometimes we get stupid */
+       // Should never happen, but sometimes we get stupid
        if (rfc822 == NULL) return(NULL);
        if (fieldname == NULL) return(NULL);
 
        snprintf(fieldhdr, sizeof fieldhdr, "%s:", fieldname);
 
-       /* Locate the end of the headers, so we don't run past that point */
+       // Locate the end of the headers, so we don't run past that point
        end_of_headers = cbmstrcasestr(rfc822, "\n\r\n");
        if (end_of_headers == NULL) {
                end_of_headers = cbmstrcasestr(rfc822, "\n\n");
@@ -1143,14 +1138,12 @@ char *rfc822_fetch_field(const char *rfc822, const char *fieldname) {
 }
 
 
-/*****************************************************************************
- *                      DIRECTORY MANAGEMENT FUNCTIONS                       *
- *****************************************************************************/
+//     *****************************************************************************
+//                          DIRECTORY MANAGEMENT FUNCTIONS                       
+//     *****************************************************************************
 
-/*
- * Generate the index key for an Internet e-mail address to be looked up
- * in the database.
- */
+// Generate the index key for an Internet e-mail address to be looked up
+// in the database.
 void directory_key(char *key, char *addr) {
        int i;
        int keylen = 0;
@@ -1161,14 +1154,11 @@ void directory_key(char *key, char *addr) {
                }
        }
        key[keylen++] = 0;
-
        syslog(LOG_DEBUG, "internet_addressing: directory key is <%s>", key);
 }
 
 
-/*
- * Return nonzero if the supplied address is in one of "our" domains
- */
+// Return nonzero if the supplied address is in one of "our" domains
 int IsDirectory(char *addr, int allow_masq_domains) {
        char domain[256];
        int h;
@@ -1190,9 +1180,7 @@ int IsDirectory(char *addr, int allow_masq_domains) {
 }
 
 
-/*
- * Add an Internet e-mail address to the directory for a user
- */
+// Add an Internet e-mail address to the directory for a user
 int CtdlDirectoryAddUser(char *internet_addr, char *citadel_addr) {
        char key[SIZ];
 
@@ -1206,12 +1194,10 @@ int CtdlDirectoryAddUser(char *internet_addr, char *citadel_addr) {
 }
 
 
-/*
- * Delete an Internet e-mail address from the directory.
- *
- * (NOTE: we don't actually use or need the citadel_addr variable; it's merely
- * here because the callback API expects to be able to send it.)
- */
+// Delete an Internet e-mail address from the directory.
+//
+// (NOTE: we don't actually use or need the citadel_addr variable; it's merely
+// here because the callback API expects to be able to send it.)
 int CtdlDirectoryDelUser(char *internet_addr, char *citadel_addr) {
        char key[SIZ];
        
@@ -1221,24 +1207,22 @@ int CtdlDirectoryDelUser(char *internet_addr, char *citadel_addr) {
 }
 
 
-/*
- * Look up an Internet e-mail address in the directory.
- * On success: returns 0, and Citadel address stored in 'target'
- * On failure: returns nonzero
- */
+// Look up an Internet e-mail address in the directory.
+// On success: returns 0, and Citadel address stored in 'target'
+// On failure: returns nonzero
 int CtdlDirectoryLookup(char *target, char *internet_addr, size_t targbuflen) {
        struct cdbdata cdbrec;
        char key[SIZ];
 
-       /* Dump it in there unchanged, just for kicks */
+       // Dump it in there unchanged, just for kicks
        if (target != NULL) {
                safestrncpy(target, internet_addr, targbuflen);
        }
 
-       /* Only do lookups for addresses with hostnames in them */
+       // Only do lookups for addresses with hostnames in them
        if (num_tokens(internet_addr, '@') != 2) return(-1);
 
-       /* Only do lookups for domains in the directory */
+       // Only do lookups for domains in the directory
        if (IsDirectory(internet_addr, 0) == 0) return(-1);
 
        directory_key(key, internet_addr);
@@ -1254,10 +1238,8 @@ int CtdlDirectoryLookup(char *target, char *internet_addr, size_t targbuflen) {
 }
 
 
-/*
- * Harvest any email addresses that someone might want to have in their
- * "collected addresses" book.
- */
+// Harvest any email addresses that someone might want to have in their
+// "collected addresses" book.
 char *harvest_collected_addresses(struct CtdlMessage *msg) {
        char *coll = NULL;
        char addr[256];
@@ -1291,7 +1273,7 @@ char *harvest_collected_addresses(struct CtdlMessage *msg) {
 
        if (coll == NULL) return(NULL);
 
-       /* Scan both the R (To) and Y (CC) fields */
+       // Scan both the R (To) and Y (CC) fields
        for (i = 0; i < 2; ++i) {
                if (i == 0) field = eRecipient;
                if (i == 1) field = eCarbonCopY;
@@ -1325,9 +1307,7 @@ char *harvest_collected_addresses(struct CtdlMessage *msg) {
 }
 
 
-/*
- * Helper function for CtdlRebuildDirectoryIndex()
- */
+// Helper function for CtdlRebuildDirectoryIndex()
 void CtdlRebuildDirectoryIndex_backend(char *username, void *data) {
 
        int j = 0;
@@ -1347,9 +1327,7 @@ void CtdlRebuildDirectoryIndex_backend(char *username, void *data) {
 }
 
 
-/*
- * Initialize the directory database (erasing anything already there)
- */
+// Initialize the directory database (erasing anything already there)
 void CtdlRebuildDirectoryIndex(void) {
        syslog(LOG_INFO, "internet_addressing: rebuilding email address directory index");
        cdb_trunc(CDB_DIRECTORY);
@@ -1387,9 +1365,7 @@ void CtdlSetEmailAddressesForUser(char *requested_user, char *new_emailaddrs) {
 }
 
 
-/*
- * Auto-generate an Internet email address for a user account
- */
+// Auto-generate an Internet email address for a user account
 void AutoGenerateEmailAddressForUser(struct ctdluser *user) {
        char synthetic_email_addr[1024];
        int i, j;
index 77cd53e1472972ac1e2a4a81861dd713a749b389..8a97fd4798bdf52743b2c6a77159c253b0048df9 100644 (file)
@@ -1,6 +1,6 @@
 // Message journaling functions.
 //
-// Copyright (c) 1987-2023 by the citadel.org team
+// Copyright (c) 1987-2024 by the citadel.org team
 //
 // This program is open source software.  Use, duplication, or disclosure
 // is subject to the terms of the GNU General Public License, version 3.
 
 struct jnlq *jnlq = NULL;      // journal queue
 
-/*
- * Hand off a copy of a message to be journalized.
- */
-void JournalBackgroundSubmit(struct CtdlMessage *msg,
-                       StrBuf *saved_rfc822_version,
-                       struct recptypes *recps) {
-
+// Hand off a copy of a message to be journalized.
+void JournalBackgroundSubmit(struct CtdlMessage *msg, StrBuf *saved_rfc822_version, struct recptypes *recps) {
        struct jnlq *jptr = NULL;
 
-       /* Avoid double journaling! */
+       // Avoid double journaling!
        if (!CM_IsEmpty(msg, eJournal)) {
                FreeStrBuf(&saved_rfc822_version);
                return;
@@ -45,7 +40,7 @@ void JournalBackgroundSubmit(struct CtdlMessage *msg,
        if (!CM_IsEmpty(msg, emessageId)) jptr->msgn = strdup(msg->cm_fields[emessageId]);
        jptr->rfc822 = SmashStrBuf(&saved_rfc822_version);
 
-       /* Add to the queue */
+       // Add to the queue
        begin_critical_section(S_JOURNAL_QUEUE);
        jptr->next = jnlq;
        jnlq = jptr;
@@ -53,10 +48,8 @@ void JournalBackgroundSubmit(struct CtdlMessage *msg,
 }
 
 
-/*
- * Convert a local user name to an internet email address for the journal
- * FIXME - grab the user's Internet email address from the user record, not from vCard !!!!
- */
+// Convert a local user name to an internet email address for the journal
+// FIXME - grab the user's Internet email address from the user record, not from vCard !!!!
 void local_to_inetemail(char *inetemail, char *localuser, size_t inetemail_len) {
        struct ctdluser us;
        struct vCard *v;
@@ -76,9 +69,7 @@ void local_to_inetemail(char *inetemail, char *localuser, size_t inetemail_len)
 }
 
 
-/*
- * Called by JournalRunQueue() to send an individual message.
- */
+// Called by JournalRunQueue() to send an individual message.
 void JournalRunQueueMsg(struct jnlq *jmsg) {
 
        struct CtdlMessage *journal_msg = NULL;
@@ -101,11 +92,8 @@ void JournalRunQueueMsg(struct jnlq *jmsg) {
                   || (journal_recps->num_internet > 0)
                   || (journal_recps->num_room > 0)
                ) {
-
-                       /*
-                        * Construct journal message.
-                        * Note that we are transferring ownership of some of the memory here.
-                        */
+                       // Construct journal message.
+                       // Note that we are transferring ownership of some of the memory here.
                        journal_msg = malloc(sizeof(struct CtdlMessage));
                        memset(journal_msg, 0, sizeof(struct CtdlMessage));
                        journal_msg->cm_magic = CTDLMESSAGE_MAGIC;
@@ -137,10 +125,8 @@ void JournalRunQueueMsg(struct jnlq *jmsg) {
 
                        message_text = NewStrBufPlain(NULL, rfc822len + sizeof(struct recptypes) + 1024);
 
-                       /*
-                        * Here is where we begin to compose the journalized message.
-                        * (The "ExJournalReport" header is consumed by some email retention services which assume the journaling agent is Exchange.)
-                        */
+                       // Here is where we begin to compose the journalized message.
+                       // (The "ExJournalReport" header is consumed by some email retention services which assume the journaling agent is Exchange.)
                        StrBufAppendBufPlain(
                                message_text, 
                                HKEY("Content-type: multipart/mixed; boundary=\""),
@@ -215,7 +201,7 @@ void JournalRunQueueMsg(struct jnlq *jmsg) {
                        jmsg->rfc822 = NULL;
                        jmsg->msgn = NULL;
                        
-                       /* Submit journal message */
+                       // Submit journal message
                        CtdlSubmitMsg(journal_msg, journal_recps, "");
                        CM_Free(journal_msg);
                }
@@ -223,14 +209,12 @@ void JournalRunQueueMsg(struct jnlq *jmsg) {
                free_recipients(journal_recps);
        }
 
-       /* We are responsible for freeing this memory. */
+       // We are responsible for freeing this memory.
        free(jmsg);
 }
 
 
-/*
- * Run the queue.
- */
+// Run the queue.
 void JournalRunQueue(void) {
        struct jnlq *jptr = NULL;
 
index c8308cf6260690a8569146d7db5960a98b50d3ab..3ad56c8a0c2f08a3c10ef2c49c4562f6c7a41838 100644 (file)
@@ -4,10 +4,8 @@
 
 #include "server.h"
 
-/*
- * ServiceFunctionHook extensions are used for hooks which implement various
- * protocols (either on TCP or on unix domain sockets) directly in the Citadel server.
- */
+// ServiceFunctionHook extensions are used for hooks which implement various
+// protocols (either on TCP or on unix domain sockets) directly in the Citadel server.
 typedef struct ServiceFunctionHook ServiceFunctionHook;
 struct ServiceFunctionHook {
        ServiceFunctionHook *next;
@@ -17,32 +15,19 @@ struct ServiceFunctionHook {
        void (*h_command_function) (void) ;
        void (*h_async_function) (void) ;
        int msock;
-       const char* ServiceName; /* this is just for debugging and logging purposes. */
+       const char *ServiceName;                // this is just for debugging and logging purposes.
 };
 extern ServiceFunctionHook *ServiceHookTable;
-
 void initialize_server_extensions(void);
 int DLoader_Exec_Cmd(char *cmdbuf);
 char *Dynamic_Module_Init(void);
-
 void PerformSessionHooks(int EventType);
-
 void PerformUserHooks(struct ctdluser *usbuf, int EventType);
-
 int PerformXmsgHooks(char *, char *, char *, char *);
-
 int PerformMessageHooks(struct CtdlMessage *, struct recptypes *recps, int EventType);
-
 int PerformRoomHooks(struct ctdlroom *);
-
 void PerformDeleteHooks(char *, long);
-
-
-
-
-
 int PerformFixedOutputHooks(char *, char *, int);
-
 void netcfg_keyname(char *keybuf, long roomnum);
 
-#endif /* SERV_EXTENSIONS_H */
+#endif
index 99947bc0cd37f58751faa99637f19c225ac9640e..a6d4fe967dbdce1d46192fc1110d724cb834a800 100644 (file)
@@ -1,62 +1,43 @@
 // Tuning of various parameters of the system.
 // Normally you don't want to mess with any of this.
 //
-// Copyright (c) 1987-2021 by the citadel.org team
+// Copyright (c) 1987-2024 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 distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
+// This program is open source software.  Use, duplication, or disclosure
+// are subject to the terms of the GNU General Public License version 3.
 
-/*
- * NLI is the string that shows up in a <W>ho's online listing for sessions
- * that are active, but for which no user has yet authenticated.
- */
+// NLI is the string that shows up in a <W>ho's online listing for sessions
+// that are active, but for which no user has yet authenticated.
 #define NLI    "(not logged in)"
 
-/*
- * Maximum number of floors on the system.
- * WARNING!  *Never* change this value once your system is up; THINGS WILL DIE!
- * Also, do not set it higher than 127.
- */
+// Maximum number of floors on the system.
+// WARNING!  *Never* change this value once your system is up; THINGS WILL DIE!
+// Also, do not set it higher than 127.
 #define MAXFLOORS      16
 
-/*
- * Standard buffer size for string datatypes.  DO NOT CHANGE!  Not only does
- * there exist a minimum buffer size for certain protocols (such as IMAP), but
- * fixed-length buffers are now stored in some of the data structures on disk,
- * so if you change the buffer size you'll fux0r your database.
- */
+// Standard buffer size for string datatypes.  DO NOT CHANGE!  Not only does
+// there exist a minimum buffer size for certain protocols (such as IMAP), but
+// fixed-length buffers are now stored in some of the data structures on disk,
+// so if you change the buffer size you'll fux0r your database.
 #define SIZ            4096
 
-/*
- * If the body of a message is beyond this size, it will be stored in
- * a separate table.
- */
+// If the body of a message is beyond this size, it will be stored in
+// a separate table.
 #define BIGMSG         1024
 
-/*
- * SMTP delivery timeouts (measured in seconds)
- * If outbound SMTP deliveries cannot be completed due to transient errors
- * within SMTP_DELIVER_WARN seconds, the sender will receive a warning message
- * indicating that the message has not yet been delivered but Citadel will
- * keep trying.  After SMTP_DELIVER_FAIL seconds, Citadel will advise the
- * sender that the deliveries have failed.
- */
+// SMTP delivery timeouts (measured in seconds)
+// If outbound SMTP deliveries cannot be completed due to transient errors
+// within SMTP_DELIVER_WARN seconds, the sender will receive a warning message
+// indicating that the message has not yet been delivered but Citadel will
+// keep trying.  After SMTP_DELIVER_FAIL seconds, Citadel will advise the
+// sender that the deliveries have failed.
 #define SMTP_DELIVER_WARN      14400           // warn after four hours
 #define SMTP_DELIVER_FAIL      432000          // fail after five days
 
-/*
- * Who bounced messages appear to be from
- */
+// Who bounced messages appear to be from
 #define BOUNCESOURCE           "Citadel Mail Delivery Subsystem"
 
-/*
- * The names of rooms which are automatically created by the system
- */
+// The names of rooms which are automatically created by the system
 #define BASEROOM               "Lobby"
 #define MAILROOM               "Mail"
 #define SENTITEMS              "Sent Items"
 #define SMTP_SPOOLOUT_ROOM     "__CitadelSMTPspoolout__"
 #define ADDRESS_BOOK_ROOM      "Global Address Book"
 
-/*
- * How long (in seconds) to retain message entries in the use table
- */
-#define USETABLE_RETAIN                864000L         /* 10 days */
+// How long (in seconds) to retain message entries in the use table
+#define USETABLE_RETAIN                864000L         // 10 days
 
-/*
- * The size of per-thread stacks.  If set too low, citserver will randomly crash.
- */
+// The size of per-thread stacks.  If set too low, citserver will randomly crash.
 #define THREADSTACKSIZE                0x100000
 
-/*
- * How many messages may the full text indexer scan before flushing its
- * tables to disk?
- */
+// How many messages may the full text indexer scan before flushing its
+// tables to disk?
 #define FT_MAX_CACHE           25
index 304f453bc85895042ea4e117af3af260160a2c9d..a88eeb5b6b0b23b73439e812cf41e74084292660 100644 (file)
@@ -62,4 +62,4 @@ extern int rescan[];
 
 extern int SyslogFacility(char *name);
 
-#endif /* SYSDEP_DECLS_H */
+#endif