If you can't handle me at my worst, you don't deserve me at my best.
authorArt Cancro <ajc@citadel.org>
Sat, 11 Jun 2022 23:27:53 +0000 (19:27 -0400)
committerArt Cancro <ajc@citadel.org>
Sat, 11 Jun 2022 23:27:53 +0000 (19:27 -0400)
42 files changed:
citadel/configure
citadel/server/citadel_dirs.h
citadel/server/modules/autocompletion/serv_autocompletion.c
citadel/server/modules/bio/serv_bio.c
citadel/server/modules/blog/serv_blog.c
citadel/server/modules/calendar/serv_calendar.c
citadel/server/modules/checkpoint/serv_checkpoint.c
citadel/server/modules/clamav/serv_virus.c
citadel/server/modules/ctdlproto/serv_file.c
citadel/server/modules/ctdlproto/serv_messages.c
citadel/server/modules/ctdlproto/serv_rooms.c
citadel/server/modules/ctdlproto/serv_session.c
citadel/server/modules/ctdlproto/serv_syscmds.c
citadel/server/modules/ctdlproto/serv_user.c
citadel/server/modules/expire/serv_expire.c
citadel/server/modules/fulltext/serv_fulltext.c
citadel/server/modules/image/serv_image.c
citadel/server/modules/imap/serv_imap.c
citadel/server/modules/inboxrules/serv_inboxrules.c
citadel/server/modules/inetcfg/serv_inetcfg.c
citadel/server/modules/instmsg/serv_instmsg.c
citadel/server/modules/listdeliver/serv_listdeliver.c
citadel/server/modules/listsub/serv_listsub.c
citadel/server/modules/migrate/serv_migrate.c
citadel/server/modules/newuser/serv_newuser.c
citadel/server/modules/nntp/serv_nntp.c
citadel/server/modules/notes/serv_notes.c
citadel/server/modules/openid/serv_openid_rp.c
citadel/server/modules/pop3/serv_pop3.c
citadel/server/modules/pop3client/serv_pop3client.c
citadel/server/modules/roomchat/serv_roomchat.c
citadel/server/modules/rssclient/serv_rssclient.c
citadel/server/modules/rwho/serv_rwho.c
citadel/server/modules/smtp/serv_smtp.c
citadel/server/modules/smtp/serv_smtpclient.c
citadel/server/modules/spam/serv_spam.c
citadel/server/modules/test/serv_test.c
citadel/server/modules/upgrade/serv_upgrade.c
citadel/server/modules/vcard/serv_vcard.c
citadel/server/modules/wiki/serv_wiki.c
citadel/server/modules/xmpp/serv_xmpp.c
citadel/server/modules_init.h

index 7d1b524fc75b1b7fb52382838d5835a37f039c85..a6c2def3e7df3a4ce72e4301827e35814828a82e 100755 (executable)
@@ -16,7 +16,9 @@ echo
 echo Running the configure script to create config.mk
 echo
 
+########################################################################
 # Parse the command line arguments
+########################################################################
 for x in $*
 do
        a=$1
@@ -41,7 +43,10 @@ do
        shift
 done
 
-# Set any missing values (FIXME remove the ultra-fatal -W options when finished converting from autotools)
+
+########################################################################
+# Set any missing values
+########################################################################
 
 # Accept PREFIX as a substitute for CTDLDIR, but only if CTDLDIR is not already set
 [ "$CTDLDIR" = "" ] && [ "$PREFIX" != "" ] && CTDLDIR=$PREFIX
@@ -50,9 +55,10 @@ done
 [ "$CTDLDIR" = "" ] && CTDLDIR=/usr/local/citadel
 
 # Permit override of CFLAGS and LDFLAGS using environment variables
-[ "$CFLAGS" = "" ]     && CFLAGS='-ggdb -Werror -Wfatal-errors -Wno-discarded-qualifiers'
+[ "$CFLAGS" = "" ]     && CFLAGS='-ggdb -Wno-discarded-qualifiers'
 [ "$LDFLAGS" = "" ]    && LDFLAGS=''
 
+
 ########################################################################
 # Test for OpenSSL
 ########################################################################
@@ -107,13 +113,17 @@ cc $tempcc -o $tempfile && {
 }
 
 
+########################################################################
 # FIXME do a real build id here
+########################################################################
 CFLAGS=${CFLAGS}' -DBUILD_ID=\"unknown\"'
 
-# Output the config.mk
 
+########################################################################
+# Output the config.mk
+########################################################################
 (
-       echo # config.mk is generated by configure
+       echo '# config.mk is generated by configure'
        echo "CTDLDIR := ${CTDLDIR}"
        echo "CFLAGS := ${CFLAGS}"
        echo "LDFLAGS := ${LDFLAGS}"
index ad422bf05b963a08c6704ed06545f25c9b735d14..f4c2b6c6fb198476080b2b5930c8a9084335ba14 100644 (file)
@@ -1,9 +1,15 @@
+// Copyright (c) 1987-2021 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.
+// The program is distributed without any warranty, expressed or implied.
+
 #ifndef __CITADEL_DIRS_H
 #define __CITADEL_DIRS_H
 
 #include <limits.h>
 
-/* Fixed directory names (some of these are obsolete and used only for migration) */
+// Fixed directory names (some of these are obsolete and used only for migration)
 #define ctdl_home_directory    "."
 #define ctdl_db_dir            "data"
 #define ctdl_file_dir          "files"
@@ -21,7 +27,7 @@
 #define ctdl_bin_dir           "."
 #define ctdl_utilbin_dir       "."
 
-/* Fixed file names (some of these are obsolete and used only for migration) */
+// Fixed file names (some of these are obsolete and used only for migration)
 #define file_citadel_config            "citadel.config"
 #define file_lmtp_socket               "lmtp.socket"
 #define file_lmtp_unfiltered_socket    "lmtp-unfiltered.socket"
 #define file_guesstimezone             "guesstimezone.sh"
 
 
-/* externs */
+// externs
 extern int create_run_directories(long UID, long GUID);
 extern size_t assoc_file_name(char *buf, size_t n, struct ctdlroom *qrbuf, const char *prefix);
 extern FILE *create_digest_file(struct ctdlroom *room, int forceCreate);
 extern void remove_digest_file(struct ctdlroom *room);
 
-#endif /* __CITADEL_DIRS_H */
+#endif // __CITADEL_DIRS_H
index 732bd714534d2bd8896a9f80daa7eda38dac6e51..7ce241d03e1a76bbff149cd37145b9c3657cb80a 100644 (file)
@@ -216,6 +216,7 @@ void cmd_auto(char *argbuf) {
 }
 
 
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_autocompletion(void) {
        if (!threading) {
                CtdlRegisterProtoHook(cmd_auto, "AUTO", "Do recipient autocompletion");
index b973bb5a9d8a02a3382d9285070756f264fd6880..cf3823210911fd2af59c242478815ca0b53f1cdb 100644 (file)
@@ -215,7 +215,7 @@ void import_old_bio_files(void)
 }
 
 
-
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_bio(void) {
        if (!threading) {
                import_old_bio_files();
index e4cfca5fc1751f39d435422fcf792182af61d0f9..4751e35c08ea33f579ca14d0c9a62c47a75f2aaa 100644 (file)
@@ -69,7 +69,7 @@ int blog_upload_beforesave(struct CtdlMessage *msg, struct recptypes *recp) {
 }
 
 
-// Module initialization
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_blog(void) {
        if (!threading) {
                CtdlRegisterMessageHook(blog_upload_beforesave, EVT_BEFORESAVE);
index 6820458983beef9de00b0e3e6f400a6cceb41b81..61f3d73cab948b671616c69fcdbdcbb66ebdb4f9 100644 (file)
@@ -2531,9 +2531,7 @@ void ical_fixed_output(char *ptr, int len) {
 }
 
 
-/*
- * Register this module with the Citadel server.
- */
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_calendar(void) {
        if (!threading) {
 
index 090bfd6afd906d346422f8ef8373e6714d3462d8..96cc8e132337777bb20e4a39f10defed3d02c76f 100644 (file)
@@ -32,6 +32,7 @@
 #include "../../ctdl_module.h"
 #include "../../context.h"
 
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_checkpoint(void) {
        if (threading) {
                CtdlRegisterSessionHook(cdb_checkpoint, EVT_TIMER, PRIO_CLEANUP + 10);
index 2913006cb6b5cea67d3f44caab41daa18bf91e5c..0ec85682bf8e4fe7bcbd604906181b90a7eeac87 100644 (file)
@@ -168,6 +168,7 @@ bail:       close(sock);
 }
 
 
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_virus(void) {
        if (!threading) {
                CtdlRegisterMessageHook(clamd, EVT_SMTPSCAN);
index d266578109e97ac56216e0b7371127946c170ce5..177a957d6f699b7f4f746c3f2e756f05ba2b1ee6 100644 (file)
@@ -659,10 +659,8 @@ void cmd_emsg(char *mname)
        fclose(mfp);
 }
 
-/*****************************************************************************/
-/*                      MODULE INITIALIZATION STUFF                          */
-/*****************************************************************************/
 
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_file_ops(void) {
        if (!threading) {
                CtdlRegisterSessionHook(files_logout_hook, EVT_LOGOUT, PRIO_LOGOUT + 8);
@@ -679,6 +677,6 @@ char *ctdl_module_init_file_ops(void) {
                CtdlRegisterProtoHook(cmd_mesg, "MESG", "fetch system banners");
                CtdlRegisterProtoHook(cmd_emsg, "EMSG", "submit system banners");
        }
-        /* return our Subversion id for the Log */
+        // return a module name for the log
        return "file_ops";
 }
index 4036c9e0a3331ee782caa9d3ea72ba4236c7f4c2..c5124aacddfa0157688deac5da1c9c8d834a9ada 100644 (file)
@@ -815,9 +815,7 @@ void cmd_move(char *args) {
 }
 
 
-/*****************************************************************************/
-/*                      MODULE INITIALIZATION STUFF                          */
-/*****************************************************************************/
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_ctdl_message(void) {
        if (!threading) {
                CtdlRegisterProtoHook(cmd_msgs, "MSGS", "Output a list of messages in the current room");
@@ -832,6 +830,6 @@ char *ctdl_module_init_ctdl_message(void) {
                CtdlRegisterProtoHook(cmd_move, "MOVE", "Move or copy a message to another room");
        }
 
-        /* return our Subversion id for the Log */
+       // return a module name for the log
        return "ctdl_message";
 }
index 16c69b7e081aa119cb2a023ca83182cfbd4216a7..840f08c93b6bfcba486fcf12a0f96e761d3d147a 100644 (file)
@@ -1016,10 +1016,7 @@ void cmd_stat(char *gargs) {
 }
 
 
-/*****************************************************************************/
-/*                      MODULE INITIALIZATION STUFF                          */
-/*****************************************************************************/
-
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_rooms(void) {
        if (!threading) {
                CtdlRegisterProtoHook(cmd_lrms, "LRMS", "List rooms");
index cb41b535d717156f3793290f27319f4dde542617..cc36bd4a091a6f79b4ac658d7f0bc859d702d578 100644 (file)
@@ -208,10 +208,7 @@ void cmd_time(char *argbuf)
 }
 
 
-/*****************************************************************************/
-/*                      MODULE INITIALIZATION STUFF                          */
-/*****************************************************************************/
-
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_serv_session(void) {
        if (!threading) {
                CtdlRegisterProtoHook(cmd_noop, "NOOP", "no operation");
index a397149a4ee7e4fe3ce0d7ed0f122053aae4ac2c..c788f1e00fbd1f211c342c404783af5042f0a0b8 100644 (file)
@@ -71,10 +71,7 @@ void cmd_scdn(char *argbuf) {
 }
 
 
-// ****************************************************************************
-// *                     MODULE INITIALIZATION STUFF                          *
-// ****************************************************************************
-
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_syscmd(void) {
        if (!threading) {
                CtdlRegisterProtoHook(cmd_down, "DOWN", "perform a server shutdown");
index d88731745474b271871fdee9471903f5bb81bd1e..9e438625c0bf46684e26ab457dc9b57950940570 100644 (file)
@@ -774,11 +774,7 @@ void cmd_lout(char *argbuf) {
 }
 
 
-/*****************************************************************************/
-/*                      MODULE INITIALIZATION STUFF                          */
-/*****************************************************************************/
-
-
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_serv_user(void) {
        if (!threading) {
                CtdlRegisterProtoHook(cmd_user, "USER", "Submit username for login");
index f204751cba08667030195e91829ed703cabc0bc7..ca51edd096b574555028596c80144a84278ea954 100644 (file)
@@ -823,6 +823,7 @@ void cmd_tdap(char *argbuf) {
 }
 
 
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_expire(void) {
        if (!threading) {
                CtdlRegisterProtoHook(cmd_tdap, "TDAP", "Manually initiate auto-purger");
index 5ecba6077d9147266c7e1642b4e11682a351dda1..f5a63029c210d949fa9f724b0a139ea85bd21f94 100644 (file)
@@ -460,8 +460,7 @@ void ft_delete_remove(char *room, long msgnum)
 }
 
 
-/*****************************************************************************/
-
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_fulltext(void) {
        if (!threading) {
                initialize_ft_cache();
index e6b520f8240daf106e0677e45bd3dfa97016c357..dfdec40fa3afcd7791ef60a8a73233d8b7568afc 100644 (file)
@@ -339,7 +339,7 @@ void import_old_userpic_files(void) {
 }
 
 
-
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_image(void) {
        if (!threading) {
                import_old_userpic_files();
index 048e470c231071d6f966882ec430b13f7ca5edb0..d9cbab2822474620346b2c97563b4bd72108d0fe 100644 (file)
@@ -1,23 +1,21 @@
-/*
- * IMAP server for the Citadel system
- *
- * Copyright (C) 2000-2022 by Art Cancro and others.
- * This code is released under the terms of the GNU General Public License.
- *
- * WARNING: the IMAP protocol is badly designed.  No implementation of it
- * is perfect.  Indeed, with so much gratuitous complexity, *all* IMAP
- * implementations have bugs.
- *
- * This program is open source software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * 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.
- */
+// IMAP server for the Citadel system
+//
+// Copyright (C) 2000-2022 by Art Cancro and others.
+// This code is released under the terms of the GNU General Public License.
+//
+// WARNING: the IMAP protocol is badly designed.  No implementation of it
+// is perfect.  Indeed, with so much gratuitous complexity, *all* IMAP
+// implementations have bugs.
+//
+// This program is open source software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// 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.
 
 #include "../../sysdep.h"
 #include <stdlib.h>
@@ -163,8 +161,7 @@ void imap_free_msgids(void)
 /*
  * If there is a transmitted message in memory, free it
  */
-void imap_free_transmitted_message(void)
-{
+void imap_free_transmitted_message(void) {
        FreeStrBuf(&IMAP->TransmittedMessage);
 }
 
@@ -179,8 +176,7 @@ void imap_free_transmitted_message(void)
  * room, or some other value if we're only interested in an incremental
  * update.
  */
-void imap_set_seen_flags(int first_msg)
-{
+void imap_set_seen_flags(int first_msg) {
        citimap *Imap = IMAP;
        visit vbuf;
        int i;
@@ -263,8 +259,7 @@ void imap_set_seen_flags(int first_msg)
  * allocate space in the list for REALLOC_INCREMENT messages at a time.  This
  * allows the mapping to proceed much faster.
  */
-void imap_add_single_msgid(long msgnum, void *userdata)
-{
+void imap_add_single_msgid(long msgnum, void *userdata) {
        citimap *Imap = IMAP;
 
        ++Imap->num_msgs;
@@ -282,8 +277,7 @@ void imap_add_single_msgid(long msgnum, void *userdata)
 /*
  * Set up a message ID map for the current room (folder)
  */
-void imap_load_msgids(void)
-{
+void imap_load_msgids(void) {
        struct CitContext *CCC = CC;
        struct cdbdata *cdbfr;
        citimap *Imap = CCCIMAP;
@@ -318,8 +312,7 @@ void imap_load_msgids(void)
 /*
  * Re-scan the selected room (folder) and see if it's been changed at all
  */
-void imap_rescan_msgids(void)
-{
+void imap_rescan_msgids(void) {
        struct CitContext *CCC = CC;
        citimap *Imap = CCCIMAP;
        int original_num_msgs = 0;
@@ -380,41 +373,28 @@ void imap_rescan_msgids(void)
                        if (message_still_exists == 0) {
                                IAPrintf("* %d EXPUNGE\r\n", i + 1);
 
-                               /* Here's some nice stupid nonsense.  When a
-                                * message is expunged, we have to slide all
-                                * the existing messages up in the message
-                                * array.
-                                */
+                               // When a message is expunged, we have to slide all the existing messages up in the message array.
                                --Imap->num_msgs;
-                               memmove(&Imap->msgids[i],
-                                       &Imap->msgids[i + 1],
-                                       (sizeof(long) *
-                                        (Imap->num_msgs - i)));
-                               memmove(&Imap->flags[i],
-                                       &Imap->flags[i + 1],
-                                       (sizeof(unsigned int) *
-                                        (Imap->num_msgs - i)));
+                               memmove(&Imap->msgids[i], &Imap->msgids[i + 1], (sizeof(long) * (Imap->num_msgs - i)));
+                               memmove(&Imap->flags[i], &Imap->flags[i + 1], (sizeof(unsigned int) * (Imap->num_msgs - i)));
                                --i;
                        }
 
                }
        }
 
-       /*
-        * Remember how many messages were here before we re-scanned.
-        */
+       // Remember how many messages were here before we re-scanned.
        original_num_msgs = Imap->num_msgs;
        if (Imap->num_msgs > 0) {
                original_highest = Imap->msgids[Imap->num_msgs - 1];
-       } else {
+       }
+       else {
                original_highest = 0L;
        }
 
-       /*
-        * Now peruse the room for *new* messages only.
-        * This logic is probably the cause of Bug # 368
-        * [ http://bugzilla.citadel.org/show_bug.cgi?id=368 ]
-        */
+       // Now peruse the room for *new* messages only.
+       // This logic is probably the cause of Bug # 368
+       // [ http://bugzilla.citadel.org/show_bug.cgi?id=368 ]
        if (num_msgs > 0) {
                for (j = 0; j < num_msgs; ++j) {
                        if (msglist[j] > original_highest) {
@@ -450,8 +430,7 @@ void imap_rescan_msgids(void)
  * This cleanup function blows away the temporary memory and files used by
  * the IMAP server.
  */
-void imap_cleanup_function(void)
-{
+void imap_cleanup_function(void) {
        struct CitContext *CCC = CC;
        citimap *Imap = CCCIMAP;
 
@@ -525,8 +504,7 @@ void imap_output_capability_string(void) {
 /*
  * implements the CAPABILITY command
  */
-void imap_capability(int num_parms, ConstStr *Params)
-{
+void imap_capability(int num_parms, ConstStr *Params) {
        IAPuts("* ");
        imap_output_capability_string();
        IAPuts("\r\n");
@@ -543,8 +521,7 @@ void imap_capability(int num_parms, ConstStr *Params)
  * making use of this extension.
  * 
  */
-void imap_id(int num_parms, ConstStr *Params)
-{
+void imap_id(int num_parms, ConstStr *Params) {
        IAPuts("* ID NIL\r\n");
        IReply("OK ID completed");
 }
@@ -553,8 +530,7 @@ void imap_id(int num_parms, ConstStr *Params)
 /*
  * Here's where our IMAP session begins its happy day.
  */
-void imap_greeting(void)
-{
+void imap_greeting(void) {
        citimap *Imap;
        CitContext *CCC = CC;
 
@@ -567,8 +543,7 @@ void imap_greeting(void)
        Imap->cached_rfc822_withbody = 0;
        Imap->Reply = NewStrBufPlain(NULL, SIZ * 10); /* 40k */
 
-       if (CCC->nologin)
-       {
+       if (CCC->nologin) {
                IAPuts("* BYE; Server busy, try later\r\n");
                CCC->kill_me = KILLME_NOLOGIN;
                IUnbuffer();
@@ -597,8 +572,7 @@ void imaps_greeting(void) {
 /*
  * implements the LOGIN command (ordinary username/password login)
  */
-void imap_login(int num_parms, ConstStr *Params)
-{
+void imap_login(int num_parms, ConstStr *Params) {
 
        switch (num_parms) {
        case 3:
@@ -641,8 +615,7 @@ void imap_login(int num_parms, ConstStr *Params)
 /*
  * Implements the AUTHENTICATE command
  */
-void imap_authenticate(int num_parms, ConstStr *Params)
-{
+void imap_authenticate(int num_parms, ConstStr *Params) {
        char UsrBuf[SIZ];
 
        if (num_parms != 3) {
@@ -686,8 +659,7 @@ void imap_authenticate(int num_parms, ConstStr *Params)
 }
 
 
-void imap_auth_plain(void)
-{
+void imap_auth_plain(void) {
        citimap *Imap = IMAP;
        const char *decoded_authstring;
        char ident[256] = "";
@@ -701,8 +673,7 @@ void imap_auth_plain(void)
        memset(pass, 0, sizeof(pass));
        decoded_len = StrBufDecodeBase64(Imap->Cmd.CmdBuf);
 
-       if (decoded_len > 0)
-       {
+       if (decoded_len > 0) {
                decoded_authstring = ChrPtr(Imap->Cmd.CmdBuf);
 
                len = safestrncpy(ident, decoded_authstring, sizeof ident);
@@ -710,16 +681,14 @@ void imap_auth_plain(void)
                decoded_len -= len - 1;
                decoded_authstring += len + 1;
 
-               if (decoded_len > 0)
-               {
+               if (decoded_len > 0) {
                        len = safestrncpy(user, decoded_authstring, sizeof user);
 
                        decoded_authstring += len + 1;
                        decoded_len -= len - 1;
                }
 
-               if (decoded_len > 0)
-               {
+               if (decoded_len > 0) {
                        plen = safestrncpy(pass, decoded_authstring, sizeof pass);
 
                        if (plen < 0)
@@ -745,12 +714,11 @@ void imap_auth_plain(void)
 }
 
 
-void imap_auth_login_user(long state)
-{
+void imap_auth_login_user(long state) {
        char PWBuf[SIZ];
        citimap *Imap = IMAP;
 
-       switch (state){
+       switch (state) {
        case imap_as_expecting_username:
                StrBufDecodeBase64(Imap->Cmd.CmdBuf);
                CtdlLoginExistingUser(ChrPtr(Imap->Cmd.CmdBuf));
@@ -773,8 +741,7 @@ void imap_auth_login_user(long state)
 }
 
 
-void imap_auth_login_pass(long state)
-{
+void imap_auth_login_pass(long state) {
        citimap *Imap = IMAP;
        const char *pass = NULL;
        long len = 0;
@@ -796,7 +763,8 @@ void imap_auth_login_pass(long state)
 
        if (CtdlTryPassword(pass, len) == pass_ok) {
                IAPrintf("%s OK authentication succeeded\r\n", Imap->authseq);
-       } else {
+       }
+       else {
                IAPrintf("%s NO authentication failed\r\n", Imap->authseq);
        }
        Imap->authstate = imap_as_normal;
@@ -807,8 +775,7 @@ void imap_auth_login_pass(long state)
 /*
  * implements the STARTTLS command (Citadel API version)
  */
-void imap_starttls(int num_parms, ConstStr *Params)
-{
+void imap_starttls(int num_parms, ConstStr *Params) {
        char ok_response[SIZ];
        char nosup_response[SIZ];
        char error_response[SIZ];
@@ -823,8 +790,7 @@ void imap_starttls(int num_parms, ConstStr *Params)
 /*
  * implements the SELECT command
  */
-void imap_select(int num_parms, ConstStr *Params)
-{
+void imap_select(int num_parms, ConstStr *Params) {
        citimap *Imap = IMAP;
        char towhere[ROOMNAMELEN];
        char augmented_roomname[ROOMNAMELEN];
@@ -885,7 +851,8 @@ void imap_select(int num_parms, ConstStr *Params)
 
        if (!strcasecmp(Params[1].Key, "EXAMINE")) {
                Imap->readonly = 1;
-       } else {
+       }
+       else {
                Imap->readonly = 0;
        }
 
@@ -919,8 +886,7 @@ void imap_select(int num_parms, ConstStr *Params)
 /*
  * Does the real work for expunge.
  */
-int imap_do_expunge(void)
-{
+int imap_do_expunge(void) {
        struct CitContext *CCC = CC;
        citimap *Imap = CCCIMAP;
        int i;
@@ -959,8 +925,7 @@ int imap_do_expunge(void)
 /*
  * implements the EXPUNGE command syntax
  */
-void imap_expunge(int num_parms, ConstStr *Params)
-{
+void imap_expunge(int num_parms, ConstStr *Params) {
        int num_expunged = 0;
 
        num_expunged = imap_do_expunge();
@@ -971,8 +936,7 @@ void imap_expunge(int num_parms, ConstStr *Params)
 /*
  * implements the CLOSE command
  */
-void imap_close(int num_parms, ConstStr *Params)
-{
+void imap_close(int num_parms, ConstStr *Params) {
 
        /* Yes, we always expunge on close. */
        if (IMAP->selected) {
@@ -989,8 +953,7 @@ void imap_close(int num_parms, ConstStr *Params)
 /*
  * Implements the NAMESPACE command.
  */
-void imap_namespace(int num_parms, ConstStr *Params)
-{
+void imap_namespace(int num_parms, ConstStr *Params) {
        long len;
        int i;
        struct floor *fl;
@@ -1002,7 +965,7 @@ void imap_namespace(int num_parms, ConstStr *Params)
        /* All personal folders are subordinate to INBOX. */
        IAPuts("((\"INBOX/\" \"/\")) ");
 
-       /* Other users' folders ... coming soon! FIXME */
+       /* Other users' folders ... eventually? FIXME */
        IAPuts("NIL ");
 
        /* Show all floors as shared namespaces.  Neato! */
@@ -1030,8 +993,7 @@ void imap_namespace(int num_parms, ConstStr *Params)
  * Implements the CREATE command
  *
  */
-void imap_create(int num_parms, ConstStr *Params)
-{
+void imap_create(int num_parms, ConstStr *Params) {
        int ret;
        char roomname[ROOMNAMELEN];
        int floornum;
@@ -1071,7 +1033,8 @@ void imap_create(int num_parms, ConstStr *Params)
        if (flags & IR_MAILBOX) {
                newroomtype = 4;                /* private mailbox */
                newroomview = VIEW_MAILBOX;
-       } else {
+       }
+       else {
                newroomtype = 0;                /* public folder */
                newroomview = VIEW_BBS;
        }
@@ -1081,11 +1044,11 @@ void imap_create(int num_parms, ConstStr *Params)
 
        ret = CtdlCreateRoom(roomname, newroomtype, "", floornum, 1, 0, newroomview);
        if (ret == 0) {
-               /*** DO NOT CHANGE THIS ERROR MESSAGE IN ANY WAY!  BYNARI CONNECTOR DEPENDS ON IT! ***/
                IReply("NO Mailbox already exists, or create failed");
-       } else {
+       }
+       else {
                IReply("OK CREATE completed");
-               /* post a message in Aide> describing the new room */
+               // post a message in Aide> describing the new room
                notification_message = malloc(1024);
                snprintf(notification_message, 1024,
                        "A new room called \"%s\" has been created by %s%s%s%s\n",
@@ -1106,8 +1069,7 @@ void imap_create(int num_parms, ConstStr *Params)
  * Locate a room by its IMAP folder name, and check access to it.
  * If zapped_ok is nonzero, we can also look for the room in the zapped list.
  */
-int imap_grabroom(char *returned_roomname, const char *foldername, int zapped_ok)
-{
+int imap_grabroom(char *returned_roomname, const char *foldername, int zapped_ok) {
        int ret;
        char augmented_roomname[ROOMNAMELEN];
        char roomname[ROOMNAMELEN];
@@ -1162,8 +1124,7 @@ int imap_grabroom(char *returned_roomname, const char *foldername, int zapped_ok
  * Implements the STATUS command (sort of)
  *
  */
-void imap_status(int num_parms, ConstStr *Params)
-{
+void imap_status(int num_parms, ConstStr *Params) {
        long len;
        int ret;
        char roomname[ROOMNAMELEN];
@@ -1220,8 +1181,7 @@ void imap_status(int num_parms, ConstStr *Params)
  * Implements the SUBSCRIBE command
  *
  */
-void imap_subscribe(int num_parms, ConstStr *Params)
-{
+void imap_subscribe(int num_parms, ConstStr *Params) {
        int ret;
        char roomname[ROOMNAMELEN];
        char savedroom[ROOMNAMELEN];
@@ -1262,8 +1222,7 @@ void imap_subscribe(int num_parms, ConstStr *Params)
  * Implements the UNSUBSCRIBE command
  *
  */
-void imap_unsubscribe(int num_parms, ConstStr *Params)
-{
+void imap_unsubscribe(int num_parms, ConstStr *Params) {
        int ret;
        char roomname[ROOMNAMELEN];
        char savedroom[ROOMNAMELEN];
@@ -1306,8 +1265,7 @@ void imap_unsubscribe(int num_parms, ConstStr *Params)
  * Implements the DELETE command
  *
  */
-void imap_delete(int num_parms, ConstStr *Params)
-{
+void imap_delete(int num_parms, ConstStr *Params) {
        int ret;
        char roomname[ROOMNAMELEN];
        char savedroom[ROOMNAMELEN];
@@ -1352,8 +1310,7 @@ void imap_delete(int num_parms, ConstStr *Params)
 /*
  * Back end function for imap_rename()
  */
-void imap_rename_backend(struct ctdlroom *qrbuf, void *data)
-{
+void imap_rename_backend(struct ctdlroom *qrbuf, void *data) {
        char foldername[SIZ];
        char newfoldername[SIZ];
        char newroomname[ROOMNAMELEN];
@@ -1382,8 +1339,7 @@ void imap_rename_backend(struct ctdlroom *qrbuf, void *data)
  * Implements the RENAME command
  *
  */
-void imap_rename(int num_parms, ConstStr *Params)
-{
+void imap_rename(int num_parms, ConstStr *Params) {
        char old_room[ROOMNAMELEN];
        char new_room[ROOMNAMELEN];
        int newr;
@@ -1476,8 +1432,7 @@ void imap_rename(int num_parms, ConstStr *Params)
 /* 
  * Main command loop for IMAP sessions.
  */
-void imap_command_loop(void)
-{
+void imap_command_loop(void) {
        struct CitContext *CCC = CC;
        struct timeval tv1, tv2;
        suseconds_t total_time = 0;
@@ -1518,10 +1473,7 @@ void imap_command_loop(void)
        pchs = ChrPtr(Imap->Cmd.CmdBuf);
        pche = pchs + StrLength(Imap->Cmd.CmdBuf);
 
-       while ((pche > pchs) &&
-              ((*pche == '\n') ||
-               (*pche == '\r')))
-       {
+       while ((pche > pchs) && ((*pche == '\n') || (*pche == '\r'))) {
                pche --;
                StrBufCutRight(Imap->Cmd.CmdBuf, 1);
        }
@@ -1560,30 +1512,11 @@ void imap_command_loop(void)
 
        /* Grab the tag, command, and parameters. */
        imap_parameterize(&Imap->Cmd);
-#if 0 
-/* debug output the parsed vector */
-       {
-               int i;
-               syslog(LOG_DEBUG, "----- %ld params", Imap->Cmd.num_parms);
-
-       for (i=0; i < Imap->Cmd.num_parms; i++) {
-               if (Imap->Cmd.Params[i].len != strlen(Imap->Cmd.Params[i].Key))
-                       syslog(LOG_DEBUG, "*********** %ld != %ld : %s",
-                                   Imap->Cmd.Params[i].len, 
-                                   strlen(Imap->Cmd.Params[i].Key),
-                                     Imap->Cmd.Params[i].Key);
-               else
-                       syslog(LOG_DEBUG, "%ld : %s",
-                                   Imap->Cmd.Params[i].len, 
-                                   Imap->Cmd.Params[i].Key);
-       }}
-#endif
 
        /* Now for the command set. */
        h = imap_lookup(Imap->Cmd.num_parms, Imap->Cmd.Params);
 
-       if (h == NULL)
-       {
+       if (h == NULL) {
                IReply("BAD command unrecognized");
                goto BAIL;
        }
@@ -1591,14 +1524,12 @@ void imap_command_loop(void)
        /* RFC3501 says that we cannot output untagged data during these commands */
        if ((h->Flags & I_FLAG_UNTAGGED) == 0) {
 
-               /* we can put any additional untagged stuff right here in the future */
+               // we can put any additional untagged stuff right here in the future
 
-               /*
-                * Before processing the command that was just entered... if we happen
-                * to have a folder selected, we'd like to rescan that folder for new
-                * messages, and for deletions/changes of existing messages.  This
-                * could probably be optimized better with some deep thought...
-                */
+               // Before processing the command that was just entered... if we happen
+               // to have a folder selected, we'd like to rescan that folder for new
+               // messages, and for deletions/changes of existing messages.  This
+               // could probably be optimized better with some deep thought...
                if (Imap->selected) {
                        imap_rescan_msgids();
                }
@@ -1632,13 +1563,13 @@ BAIL:
                );
 }
 
-void imap_noop (int num_parms, ConstStr *Params)
-{
+
+void imap_noop(int num_parms, ConstStr *Params) {
        IReply("OK No operation");
 }
 
-void imap_logout(int num_parms, ConstStr *Params)
-{
+
+void imap_logout(int num_parms, ConstStr *Params) {
        if (IMAP->selected) {
                imap_do_expunge();      /* yes, we auto-expunge at logout */
        }
@@ -1648,12 +1579,12 @@ void imap_logout(int num_parms, ConstStr *Params)
        return;
 }
 
+
 const char *CitadelServiceIMAP="IMAP";
 const char *CitadelServiceIMAPS="IMAPS";
 
-/*
- * This function is called to register the IMAP extension with Citadel.
- */
+
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_imap(void) {
        if (ImapCmds == NULL) {
                ImapCmds = NewHash(1, NULL);
@@ -1705,15 +1636,13 @@ char *ctdl_module_init_imap(void) {
        RegisterImapCMD("CLOSE", "", imap_close, I_FLAG_LOGGED_IN | I_FLAG_SELECT);
 
        if (!threading) {
-               CtdlRegisterServiceHook(CtdlGetConfigInt("c_imap_port"),
-                                       NULL, imap_greeting, imap_command_loop, NULL, CitadelServiceIMAP);
+               CtdlRegisterServiceHook(CtdlGetConfigInt("c_imap_port"), NULL, imap_greeting, imap_command_loop, NULL, CitadelServiceIMAP);
 #ifdef HAVE_OPENSSL
-               CtdlRegisterServiceHook(CtdlGetConfigInt("c_imaps_port"),
-                                       NULL, imaps_greeting, imap_command_loop, NULL, CitadelServiceIMAPS);
+               CtdlRegisterServiceHook(CtdlGetConfigInt("c_imaps_port"), NULL, imaps_greeting, imap_command_loop, NULL, CitadelServiceIMAPS);
 #endif
                CtdlRegisterSessionHook(imap_cleanup_function, EVT_STOP, PRIO_STOP + 30);
        }
        
-       /* return our module name for the log */
+       // return our module name for the log
        return "imap";
 }
index 17340a1c2cee8e3fea74d7828ef7e4f5a0408bf7..fb6bdd66e86b30d34005c878a1a58020f45c2fe7 100644 (file)
@@ -967,6 +967,7 @@ void cmd_pibr(char *argbuf) {
 }
 
 
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_sieve(void) {
        if (!threading) {
                CtdlRegisterProtoHook(cmd_gibr, "GIBR", "Get InBox Rules");
index ee763a920bc15cceb4260110fd071e55aa81a9ad..de095a2f8c5ea1483817b8e10964c7cca4fb5589 100644 (file)
@@ -122,11 +122,7 @@ void inetcfg_init(void) {
 }
 
 
-/*****************************************************************************/
-/*                      MODULE INITIALIZATION STUFF                          */
-/*****************************************************************************/
-
-
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_inetcfg(void) {
        if (!threading) {
                CtdlRegisterMessageHook(inetcfg_aftersave, EVT_AFTERSAVE);
index 1e2d0f04358295704b29f3570d46eb65b61be40c..978efef6dade7ff7a6cd37e1b6e984ac3f93dab0 100644 (file)
@@ -558,15 +558,17 @@ void flush_conversations_to_disk(time_t if_older_than) {
 }
 
 
-
 void instmsg_timer(void) {
        flush_conversations_to_disk(300);       /* Anything that hasn't peeped in more than 5 minutes */
 }
 
+
 void instmsg_shutdown(void) {
        flush_conversations_to_disk(0);         /* Get it ALL onto disk NOW. */
 }
 
+
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_instmsg(void) {
        if (!threading) {
                CtdlRegisterProtoHook(cmd_gexp, "GEXP", "Get instant messages");
index e3b1d23d7c625cb41436223ebfc6b5000eefbe0c..61df918cf69f405e8540d7aa3bb2e786787a4b92 100644 (file)
@@ -238,7 +238,7 @@ void listdeliver_sweep(void) {
 }
 
 
-// Module entry point
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_listdeliver(void) {
        if (!threading) {
                CtdlRegisterSessionHook(listdeliver_sweep, EVT_TIMER, PRIO_AGGR + 50);
index 80adb60f0917147c4cbb9337480795e96fc525ef..70f6174e35a79bd02f3c6529b6fa8eabe13ce3a6 100644 (file)
@@ -291,9 +291,7 @@ void cmd_lsub(char *cmdbuf) {
 }
 
 
-/*
- * Module entry point
- */
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_listsub(void) {
        if (!threading) {
                CtdlRegisterProtoHook(cmd_lsub, "LSUB", "List subscribe/unsubscribe");
index 698cf1cbc23d00867ef20d61629be093b40cd4db..994d908752ed323a4b5a660669d1d59123adbf12 100644 (file)
@@ -1114,10 +1114,7 @@ void cmd_migr(char *cmdbuf) {
 }
 
 
-// ******************************************************************************
-// *                              Module Hook                                   *
-// ******************************************************************************
-
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_migrate() {
        if (!threading) {
                CtdlRegisterProtoHook(cmd_migr, "MIGR", "Across-the-wire migration");
index 751ecb314df3d99c5f311cfbfb669160f2c96c1e..37563c08ad354eba375717665131b5b4e5585372 100644 (file)
@@ -81,6 +81,7 @@ void CopyNewUserGreetings(void) {
 }
 
 
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_newuser(void) {
        if (!threading) {
                CtdlRegisterSessionHook(CopyNewUserGreetings, EVT_LOGIN, PRIO_LOGIN + 1);
index 5db995d74bd3cf3f07aec1adf0eacccc227b376b..e2c7bd75daf3a6d8c7fdf12cccaa8c6f45a12244 100644 (file)
@@ -1142,6 +1142,8 @@ void nntp_cleanup_function(void) {
 const char *CitadelServiceNNTP="NNTP";
 const char *CitadelServiceNNTPS="NNTPS";
 
+
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_nntp(void) {
        if (!threading) {
                CtdlRegisterServiceHook(CtdlGetConfigInt("c_nntp_port"),
index 2f32faef604ac1e7ffbf45534af0735ca65e13e9..1351db3da369ac22502f948f31f60dc39b5bd486 100644 (file)
@@ -145,6 +145,7 @@ int serv_notes_beforesave(struct CtdlMessage *msg, struct recptypes *recp)
 }
 
 
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_notes(void) {
        if (!threading) {
                CtdlRegisterMessageHook(serv_notes_beforesave, EVT_BEFORESAVE);
index 7f34b601fff4e9da683a3f54f2a2843d7d8e188e..2942223dfdfaf9f3537bff19fd4d9f9bba3ccd9f 100644 (file)
@@ -1137,14 +1137,7 @@ void cmd_oidf(char *argbuf) {
 }
 
 
-
-/**************************************************************************/
-/*                                                                        */
-/* Functions in this section handle module initialization and shutdown    */
-/*                                                                        */
-/**************************************************************************/
-
-
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_openid_rp(void) {
        if (!threading) {
                /* Only enable the OpenID command set when native mode authentication is in use. */
index 7eca60dc94ec612a3a575aed92977369eaec2678..e6b018d5affbc39f8f782bbd8a828762f7d0b817 100644 (file)
@@ -573,6 +573,7 @@ const char *CitadelServicePop3="POP3";
 const char *CitadelServicePop3S="POP3S";
 
 
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_pop3(void) {
        if (!threading) {
                CtdlRegisterServiceHook(CtdlGetConfigInt("c_pop3_port"),
index d8fc9270ee0ed70293b1a41b7ee8d8ca8fc0e57d..05a5cffa602134bf19e96bc583ef9a6b3d90afc2 100644 (file)
@@ -250,11 +250,12 @@ void pop3client_scan(void) {
 }
 
 
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_pop3client(void) {
        if (!threading) {
                CtdlRegisterSessionHook(pop3client_scan, EVT_TIMER, PRIO_AGGR + 50);
        }
 
-       /* return our module id for the log */
+       /* return our module name for the log */
        return "pop3client";
 }
index 4f3a71eae0991310b658ae072d4ca0df9e0c3597..4adb1a492e5281497404e72235194eb8a727ed1e 100644 (file)
@@ -238,6 +238,7 @@ void cmd_rcht(char *argbuf)
 }
 
 
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_roomchat(void) {
        if (!threading) {
                CtdlRegisterProtoHook(cmd_rcht, "RCHT", "Participate in real time chat in a room");
index e23463a7745047f9ccfc68862f321671d2c13014..b1c42f2921bd17a0c4a4766fe0fc918fbe8df91e 100644 (file)
@@ -451,6 +451,7 @@ void rssclient_scan(void) {
 }
 
 
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_rssclient(void) {
        if (!threading) {
                syslog(LOG_INFO, "rssclient: using %s", curl_version());
index ef1b7dac4a1e789d4937720c7da193f1680fe6a2..557f6042d984dacf08f2fcd5e0f7ec0343476b2d 100644 (file)
@@ -177,6 +177,7 @@ void cmd_stel(char *cmdbuf)
 }
 
 
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_rwho(void) {
        if (!threading) {
                CtdlRegisterProtoHook(cmd_rwho, "RWHO", "Display who is online");
index 3a89d4e08154464aefa43fdbe60efcd2820e8c31..8707406bfab899b46195560b84cd685910cde182 100644 (file)
@@ -1018,6 +1018,7 @@ const char *CitadelServiceSMTP_LMTP="LMTP";
 const char *CitadelServiceSMTP_LMTP_UNF="LMTP-UnF";
 
 
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_smtp(void) {
        if (!threading) {
                CtdlRegisterServiceHook(CtdlGetConfigInt("c_smtp_port"),        /* SMTP MTA */
index 1ff3d6d3b4adcb8ac7eb949b961ca339a38d06db..b6bb3ad65927e73d0f820698df0f20f455fff041 100644 (file)
@@ -558,7 +558,7 @@ void smtp_do_queue(void) {
 }
 
 
-// Module entry point
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_smtpclient(void) {
        if (!threading) {
                CtdlRegisterMessageHook(smtp_aftersave, EVT_AFTERSAVE);
index 97d1e23b6e046c9c9a410a18c37d3f4bd95986ff..0a576a37baf9d1374c3c9234c83be22543e7fe33 100644 (file)
@@ -170,7 +170,7 @@ bail:       close(sock);
 }
 
 
-
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_spam(void) {
        if (!threading) {
                CtdlRegisterMessageHook(spam_assassin, EVT_SMTPSCAN);
index 7445ac0bce04ab9faf8ce8d245fadcb3324ed20a..91602997dd1d8d93f52859f3fce5865042becf21 100644 (file)
@@ -47,6 +47,7 @@ void LoginTest(void) {
        syslog(LOG_DEBUG, "--- Hello, %s ---\n", CC->curr_user);
 }
 
+// Initialization function, called from modules_init.c
 // To insert this module into the server activate the next block by changing the #if 0 to #if 1
 char *ctdl_module_init_test() {
 #if 0
index d8369963b60b1e810d6bde6c992130d8c5e9a87a..722ba5752865e8f99a2947f1aa2b0ced515a9cbd 100644 (file)
@@ -566,6 +566,7 @@ void post_startup_upgrades(void) {
 }
 
 
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_upgrade(void) {
        if (!threading) {
                post_startup_upgrades();
index 61d9ef7d8bb425e3b493519186177911f6568c2e..cd1bcde312211d94a180a55bbc824cc7d0fd12af 100644 (file)
@@ -1206,9 +1206,10 @@ void vcard_fixed_output(char *ptr, int len) {
        vcard_free(v);
 }
 
-
 const char *CitadelServiceDICT_TCP="DICT_TCP";
 
+
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_vcard(void) {
        struct ctdlroom qr;
 
index a4bc7c6994b3ba7e9dd6cf57b2b52803bfbfe299..427c8a2c45abb71fcb53ac354fd299872ebe2714 100644 (file)
@@ -712,9 +712,7 @@ void cmd_wiki(char *argbuf) {
 
 
 
-/*
- * Module initialization
- */
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_wiki() {
        if (!threading) {
                CtdlRegisterMessageHook(wiki_upload_beforesave, EVT_BEFORESAVE);
index c81720ca05dd9966705a89fa6dcd5499401c0cf3..1a0ec98c2e1f8c07af0a6834a474384825c55b88 100644 (file)
@@ -651,6 +651,9 @@ void xmpp_logout_hook(void) {
 
 
 const char *CitadelServiceXMPP="XMPP";
+
+
+// Initialization function, called from modules_init.c
 char *ctdl_module_init_xmpp() {
        if (!threading) {
                CtdlRegisterServiceHook(CtdlGetConfigInt("c_xmpp_c2s_port"),
index 0513dcde7ec8c5423135d3a40954a7256acc1b44..426253240fae3c709d77779bb5891f0fc578b627 100644 (file)
@@ -61,4 +61,4 @@ char *ctdl_module_init_vcard(void);
 char *ctdl_module_init_wiki(void);
 char *ctdl_module_init_xmpp(void);
 char *ctdl_module_init_netconfig(void);
-#endif /* MODULES_INIT_H */
+#endif // MODULES_INIT_H