Silence logging in non-debug usecases. The raspii users gonna love this.
authorWilfried Goesgens <willi@arangodb.com>
Sat, 23 Jan 2016 14:30:39 +0000 (15:30 +0100)
committerWilfried Goesgens <willi@arangodb.com>
Sat, 23 Jan 2016 14:30:39 +0000 (15:30 +0100)
15 files changed:
citadel/citserver.c
citadel/database.c
citadel/modules/ctdlproto/serv_ctdlproto.c [new file with mode: 0644]
citadel/modules/ctdlproto/serv_file.c
citadel/modules/ctdlproto/serv_rooms.c
citadel/modules/extnotify/extnotify_main.c
citadel/modules/network/serv_netspool.c
citadel/modules/network/serv_network.c
citadel/modules/networkclient/serv_networkclient.c
citadel/modules/smtp/serv_smtpqueue.c
citadel/modules/xmpp/xmpp_queue.c
citadel/msgbase.c
citadel/room_ops.c
citadel/serv_extensions.c
citadel/serv_extensions.h

index 9832b781276932dbab8d01c4bee2e1ae96c4effc..9f41f35f56bc9d55ee2e9827cae596631bc99f63 100644 (file)
@@ -373,69 +373,6 @@ void citproto_begin_admin_session() {
 }
 
 
-
-
-/*
- * This loop recognizes all server commands.
- */
-void do_command_loop(void) {
-       char cmdbuf[SIZ];
-       
-       time(&CC->lastcmd);
-       memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
-       if (client_getln(cmdbuf, sizeof cmdbuf) < 1) {
-               syslog(LOG_ERR, "Citadel client disconnected: ending session.\n");
-               CC->kill_me = KILLME_CLIENT_DISCONNECTED;
-               return;
-       }
-
-       /* Log the server command, but don't show passwords... */
-       if ( (strncasecmp(cmdbuf, "PASS", 4)) && (strncasecmp(cmdbuf, "SETP", 4)) ) {
-               syslog(LOG_INFO, "[%d][%s(%ld)] %s",
-                       CC->cs_pid, CC->curr_user, CC->user.usernum, cmdbuf
-               );
-       }
-       else {
-               syslog(LOG_INFO, "[%d][%s(%ld)] <password command hidden from log>",
-                       CC->cs_pid, CC->curr_user, CC->user.usernum
-               );
-       }
-
-       buffer_output();
-
-       /*
-        * Let other clients see the last command we executed, and
-        * update the idle time, but not NOOP, QNOP, PEXP, GEXP, RWHO, or TIME.
-        */
-       if ( (strncasecmp(cmdbuf, "NOOP", 4))
-          && (strncasecmp(cmdbuf, "QNOP", 4))
-          && (strncasecmp(cmdbuf, "PEXP", 4))
-          && (strncasecmp(cmdbuf, "GEXP", 4))
-          && (strncasecmp(cmdbuf, "RWHO", 4))
-          && (strncasecmp(cmdbuf, "TIME", 4)) ) {
-               strcpy(CC->lastcmdname, "    ");
-               safestrncpy(CC->lastcmdname, cmdbuf, sizeof(CC->lastcmdname));
-               time(&CC->lastidle);
-       }
-       
-       if ((strncasecmp(cmdbuf, "ENT0", 4))
-          && (strncasecmp(cmdbuf, "MESG", 4))
-          && (strncasecmp(cmdbuf, "MSGS", 4)))
-       {
-          CC->cs_flags &= ~CS_POSTING;
-       }
-                  
-       if (!DLoader_Exec_Cmd(cmdbuf)) {
-               cprintf("%d Unrecognized or unsupported command.\n", ERROR + CMD_NOT_SUPPORTED);
-       }       
-
-       unbuffer_output();
-
-       /* Run any after-each-command routines registered by modules */
-       PerformSessionHooks(EVT_CMD);
-}
-
-
 /*
  * This loop performs all asynchronous functions.
  */
index b35b012651b55127ba8271a810c82b76fb7aa9e9..e7e57a6437e38c712443bea4ab76b4e4626a4166 100644 (file)
@@ -215,7 +215,7 @@ void cdb_checkpoint(void)
 {
        int ret;
 
-       syslog(LOG_DEBUG, "-- db checkpoint --");
+       MARKM_syslog(LOG_DEBUG, "-- db checkpoint --");
        ret = dbenv->txn_checkpoint(dbenv, MAX_CHECKPOINT_KBYTES, MAX_CHECKPOINT_MINUTES, 0);
 
        if (ret != 0) {
diff --git a/citadel/modules/ctdlproto/serv_ctdlproto.c b/citadel/modules/ctdlproto/serv_ctdlproto.c
new file mode 100644 (file)
index 0000000..811fcb6
--- /dev/null
@@ -0,0 +1,81 @@
+/* 
+ * Citadel protocoll main dispatcher
+ *
+ * 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.
+ */
+
+#include <stdio.h>
+#include <libcitadel.h>
+
+#include "citserver.h"
+#include "ctdl_module.h"
+#include "config.h"
+/*
+ * This loop recognizes all server commands.
+ */
+void do_command_loop(void) {
+       struct CitContext *CCC = CC;
+       char cmdbuf[SIZ];
+       
+       time(&CCC->lastcmd);
+       memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
+       if (client_getln(cmdbuf, sizeof cmdbuf) < 1) {
+               CTDLM_syslog(LOG_INFO, "Citadel client disconnected: ending session.");
+               CCC->kill_me = KILLME_CLIENT_DISCONNECTED;
+               return;
+       }
+
+       /* Log the server command, but don't show passwords... */
+       if ( (strncasecmp(cmdbuf, "PASS", 4)) && (strncasecmp(cmdbuf, "SETP", 4)) ) {
+               CTDL_syslog(LOG_DEBUG, "[%s(%ld)] %s",
+                       CCC->curr_user, CCC->user.usernum, cmdbuf
+               );
+       }
+       else {
+               CTDL_syslog(LOG_DEBUG, "[%s(%ld)] <password command hidden from log>",
+                           CCC->curr_user, CCC->user.usernum
+               );
+       }
+
+       buffer_output();
+
+       /*
+        * Let other clients see the last command we executed, and
+        * update the idle time, but not NOOP, QNOP, PEXP, GEXP, RWHO, or TIME.
+        */
+       if ( (strncasecmp(cmdbuf, "NOOP", 4))
+          && (strncasecmp(cmdbuf, "QNOP", 4))
+          && (strncasecmp(cmdbuf, "PEXP", 4))
+          && (strncasecmp(cmdbuf, "GEXP", 4))
+          && (strncasecmp(cmdbuf, "RWHO", 4))
+          && (strncasecmp(cmdbuf, "TIME", 4)) ) {
+               strcpy(CCC->lastcmdname, "    ");
+               safestrncpy(CCC->lastcmdname, cmdbuf, sizeof(CCC->lastcmdname));
+               time(&CCC->lastidle);
+       }
+       
+       if ((strncasecmp(cmdbuf, "ENT0", 4))
+          && (strncasecmp(cmdbuf, "MESG", 4))
+          && (strncasecmp(cmdbuf, "MSGS", 4)))
+       {
+          CCC->cs_flags &= ~CS_POSTING;
+       }
+                  
+       if (!DLoader_Exec_Cmd(cmdbuf)) {
+               cprintf("%d Unrecognized or unsupported command.\n", ERROR + CMD_NOT_SUPPORTED);
+       }       
+
+       unbuffer_output();
+
+       /* Run any after-each-command routines registered by modules */
+       PerformSessionHooks(EVT_CMD);
+}
+
index 8a3bd5c823e84c89afd0d14ec6c204dab0e915ce..7f75b4e2647562b1d5dd6741fcf45708893a706f 100644 (file)
@@ -500,39 +500,40 @@ void abort_upl(CitContext *who)
  */
 void cmd_ucls(char *cmd)
 {
+       struct CitContext *CCC = CC;
        FILE *fp;
        char upload_notice[512];
        static int seq = 0;
 
-       if (CC->upload_fp == NULL) {
+       if (CCC->upload_fp == NULL) {
                cprintf("%d You don't have an upload file open.\n", ERROR + RESOURCE_NOT_OPEN);
                return;
        }
 
        fclose(CC->upload_fp);
-       CC->upload_fp = NULL;
+       CCC->upload_fp = NULL;
 
-       if ((!strcasecmp(cmd, "1")) && (CC->upload_type != UPL_FILE)) {
+       if ((!strcasecmp(cmd, "1")) && (CCC->upload_type != UPL_FILE)) {
                cprintf("%d Upload completed.\n", CIT_OK);
 
-               if (CC->upload_type == UPL_NET) {
+               if (CCC->upload_type == UPL_NET) {
                        char final_filename[PATH_MAX];
                        snprintf(final_filename, sizeof final_filename,
                                "%s/%s.%04lx.%04x",
                                ctdl_netin_dir,
-                               CC->net_node,
+                               CCC->net_node,
                                (long)getpid(),
                                ++seq
                        );
 
-                       if (link(CC->upl_path, final_filename) == 0) {
-                               syslog(LOG_INFO, "UCLS: updoaded %s\n",
+                       if (link(CCC->upl_path, final_filename) == 0) {
+                               CTDL_syslog(LOG_INFO, "UCLS: updoaded %s",
                                       final_filename);
-                               unlink(CC->upl_path);
+                               unlink(CCC->upl_path);
                        }
                        else {
-                               syslog(LOG_ALERT, "Cannot link %s to %s: %s\n",
-                                       CC->upl_path, final_filename, strerror(errno)
+                               CTDL_syslog(LOG_INFO, "Cannot link %s to %s: %s",
+                                           CCC->upl_path, final_filename, strerror(errno)
                                );
                        }
                        
@@ -540,36 +541,36 @@ void cmd_ucls(char *cmd)
                        /* FIXME ... here we need to trigger a network run */
                }
 
-               CC->upload_type = UPL_FILE;
+               CCC->upload_type = UPL_FILE;
                return;
        }
 
        if (!strcasecmp(cmd, "1")) {
-               cprintf("%d File '%s' saved.\n", CIT_OK, CC->upl_path);
-               fp = fopen(CC->upl_filedir, "a");
+               cprintf("%d File '%s' saved.\n", CIT_OK, CCC->upl_path);
+               fp = fopen(CCC->upl_filedir, "a");
                if (fp == NULL) {
-                       fp = fopen(CC->upl_filedir, "w");
+                       fp = fopen(CCC->upl_filedir, "w");
                }
                if (fp != NULL) {
-                       fprintf(fp, "%s %s %s\n", CC->upl_file,
-                               CC->upl_mimetype,
-                               CC->upl_comment);
+                       fprintf(fp, "%s %s %s\n", CCC->upl_file,
+                               CCC->upl_mimetype,
+                               CCC->upl_comment);
                        fclose(fp);
                }
 
-               if ((CC->room.QRflags2 & QR2_NOUPLMSG) == 0) {
+               if ((CCC->room.QRflags2 & QR2_NOUPLMSG) == 0) {
                        /* put together an upload notice */
                        snprintf(upload_notice, sizeof upload_notice,
                                 "NEW UPLOAD: '%s'\n %s\n%s\n",
-                                CC->upl_file, 
-                                CC->upl_comment, 
-                                CC->upl_mimetype);
-                       quickie_message(CC->curr_user, NULL, NULL, CC->room.QRname,
+                                CCC->upl_file, 
+                                CCC->upl_comment, 
+                                CCC->upl_mimetype);
+                       quickie_message(CCC->curr_user, NULL, NULL, CCC->room.QRname,
                                        upload_notice, 0, NULL);
                }
        } else {
-               abort_upl(CC);
-               cprintf("%d File '%s' aborted.\n", CIT_OK, CC->upl_path);
+               abort_upl(CCC);
+               cprintf("%d File '%s' aborted.\n", CIT_OK, CCC->upl_path);
        }
 }
 
@@ -605,11 +606,12 @@ void cmd_read(char *cmdbuf)
 
        rc = fseek(CC->download_fp, start_pos, 0);
        if (rc < 0) {
+               struct CitContext *CCC = CC;
                cprintf("%d your file is smaller then %ld.\n", ERROR + ILLEGAL_VALUE, start_pos);
-               syslog(LOG_ALERT, "your file %s is smaller then %ld. [%s]\n", 
-                      CC->upl_path, 
-                      start_pos,
-                      strerror(errno));
+               CTDL_syslog(LOG_ERR, "your file %s is smaller then %ld. [%s]\n", 
+                           CC->upl_path, 
+                           start_pos,
+                           strerror(errno));
 
                return;
        }
@@ -630,6 +632,7 @@ void cmd_read(char *cmdbuf)
  */
 void cmd_writ(char *cmdbuf)
 {
+       struct CitContext *CCC = CC;
        int bytes;
        char *buf;
        int rv;
@@ -638,7 +641,7 @@ void cmd_writ(char *cmdbuf)
 
        bytes = extract_int(cmdbuf, 0);
 
-       if (CC->upload_fp == NULL) {
+       if (CCC->upload_fp == NULL) {
                cprintf("%d You don't have an upload file open.\n", ERROR + RESOURCE_NOT_OPEN);
                return;
        }
@@ -654,10 +657,10 @@ void cmd_writ(char *cmdbuf)
        cprintf("%d %d\n", SEND_BINARY, bytes);
        buf = malloc(bytes + 1);
        client_read(buf, bytes);
-       rv = fwrite(buf, bytes, 1, CC->upload_fp);
+       rv = fwrite(buf, bytes, 1, CCC->upload_fp);
        if (rv == -1) {
-               syslog(LOG_EMERG, "Couldn't write: %s\n",
-                      strerror(errno));
+               CTDL_syslog(LOG_EMERG, "Couldn't write: %s\n",
+                           strerror(errno));
        }
        free(buf);
 }
@@ -670,16 +673,17 @@ void cmd_writ(char *cmdbuf)
  */
 void cmd_ndop(char *cmdbuf)
 {
+       struct CitContext *CCC = CC;
        char pathname[256];
        struct stat statbuf;
 
-       if (IsEmptyStr(CC->net_node)) {
+       if (IsEmptyStr(CCC->net_node)) {
                cprintf("%d Not authenticated as a network node.\n",
                        ERROR + NOT_LOGGED_IN);
                return;
        }
 
-       if (CC->download_fp != NULL) {
+       if (CCC->download_fp != NULL) {
                cprintf("%d You already have a download file open.\n",
                        ERROR + RESOURCE_BUSY);
                return;
@@ -688,18 +692,18 @@ void cmd_ndop(char *cmdbuf)
        snprintf(pathname, sizeof pathname, 
                         "%s/%s",
                         ctdl_netout_dir,
-                        CC->net_node);
+                        CCC->net_node);
 
        /* first open the file in append mode in order to create a
         * zero-length file if it doesn't already exist 
         */
-       CC->download_fp = fopen(pathname, "a");
-       if (CC->download_fp != NULL)
-               fclose(CC->download_fp);
+       CCC->download_fp = fopen(pathname, "a");
+       if (CCC->download_fp != NULL)
+               fclose(CCC->download_fp);
 
        /* now open it */
-       CC->download_fp = fopen(pathname, "r");
-       if (CC->download_fp == NULL) {
+       CCC->download_fp = fopen(pathname, "r");
+       if (CCC->download_fp == NULL) {
                cprintf("%d cannot open %s: %s\n",
                        ERROR + INTERNAL_ERROR, pathname, strerror(errno));
                return;
@@ -709,10 +713,10 @@ void cmd_ndop(char *cmdbuf)
        /* set this flag so other routines know that the download file
         * currently open is a network spool file 
         */
-       CC->dl_is_net = 1;
+       CCC->dl_is_net = 1;
 
        stat(pathname, &statbuf);
-       CC->download_fp_total = statbuf.st_size;
+       CCC->download_fp_total = statbuf.st_size;
        cprintf("%d %ld\n", CIT_OK, (long)statbuf.st_size);
 }
 
index 51456ac03528ecae834bb62506128a2ce3d61fe7..9df142cd04b96579a7c74468fbca82dccc2824d7 100644 (file)
@@ -266,6 +266,7 @@ void cmd_lzrm(char *argbuf)
  */
 void cmd_goto(char *gargs)
 {
+       struct CitContext *CCC = CC;
        struct ctdlroom QRscratch;
        int c;
        int ok = 0;
@@ -281,7 +282,7 @@ void cmd_goto(char *gargs)
        extract_token(password, gargs, 1, '|', sizeof password);
        transiently = extract_int(gargs, 2);
 
-       CtdlGetUser(&CC->user, CC->curr_user);
+       CtdlGetUser(&CCC->user, CCC->curr_user);
 
        /*
         * Handle some of the macro named rooms
@@ -294,7 +295,7 @@ void cmd_goto(char *gargs)
        /* Then try a mailbox name match */
        if (c != 0) {
                CtdlMailboxName(augmented_roomname, sizeof augmented_roomname,
-                           &CC->user, towhere);
+                           &CCC->user, towhere);
                c = CtdlGetRoom(&QRscratch, augmented_roomname);
                if (c == 0)
                        safestrncpy(towhere, augmented_roomname, sizeof towhere);
@@ -304,15 +305,15 @@ void cmd_goto(char *gargs)
        if (c == 0) {
 
                /* Let internal programs go directly to any room. */
-               if (CC->internal_pgm) {
-                       memcpy(&CC->room, &QRscratch,
+               if (CCC->internal_pgm) {
+                       memcpy(&CCC->room, &QRscratch,
                                sizeof(struct ctdlroom));
                        CtdlUserGoto(NULL, 1, transiently, NULL, NULL, NULL, NULL);
                        return;
                }
 
                /* See if there is an existing user/room relationship */
-               CtdlRoomAccess(&QRscratch, &CC->user, &ra, NULL);
+               CtdlRoomAccess(&QRscratch, &CCC->user, &ra, NULL);
 
                /* normal clients have to pass through security */
                if (ra & UA_GOTOALLOWED) {
@@ -322,14 +323,14 @@ void cmd_goto(char *gargs)
                if (ok == 1) {
                        if ((QRscratch.QRflags & QR_MAILBOX) &&
                            ((ra & UA_GOTOALLOWED))) {
-                               memcpy(&CC->room, &QRscratch,
+                               memcpy(&CCC->room, &QRscratch,
                                        sizeof(struct ctdlroom));
                                CtdlUserGoto(NULL, 1, transiently, NULL, NULL, NULL, NULL);
                                return;
                        } else if ((QRscratch.QRflags & QR_PASSWORDED) &&
                            ((ra & UA_KNOWN) == 0) &&
                            (strcasecmp(QRscratch.QRpasswd, password)) &&
-                           (CC->user.axlevel < AxAideU)
+                           (CCC->user.axlevel < AxAideU)
                            ) {
                                cprintf("%d wrong or missing passwd\n",
                                        ERROR + PASSWORD_REQUIRED);
@@ -338,11 +339,11 @@ void cmd_goto(char *gargs)
                                   ((QRscratch.QRflags & QR_PASSWORDED) == 0) &&
                                   ((QRscratch.QRflags & QR_GUESSNAME) == 0) &&
                                   ((ra & UA_KNOWN) == 0) &&
-                                  (CC->user.axlevel < AxAideU)
+                                  (CCC->user.axlevel < AxAideU)
                                   ) {
-                               syslog(LOG_DEBUG, "Failed to acquire private room\n");
+                               CTDLM_syslog(LOG_DEBUG, "Failed to acquire private room");
                        } else {
-                               memcpy(&CC->room, &QRscratch,
+                               memcpy(&CCC->room, &QRscratch,
                                        sizeof(struct ctdlroom));
                                CtdlUserGoto(NULL, 1, transiently, NULL, NULL, NULL, NULL);
                                return;
@@ -897,6 +898,7 @@ void cmd_cre8(char *args)
 
 void cmd_einf(char *ok)
 {                              /* enter info file for current room */
+       struct CitContext *CCC = CC;
        FILE *fp;
        char infofilename[SIZ];
        char buf[SIZ];
@@ -909,10 +911,10 @@ void cmd_einf(char *ok)
                cprintf("%d Ok.\n", CIT_OK);
                return;
        }
-       assoc_file_name(infofilename, sizeof infofilename, &CC->room, ctdl_info_dir);
-       syslog(LOG_DEBUG, "opening\n");
+       assoc_file_name(infofilename, sizeof infofilename, &CCC->room, ctdl_info_dir);
+       CTDL_syslog(LOG_DEBUG, "opening %s", infofilename);
        fp = fopen(infofilename, "w");
-       syslog(LOG_DEBUG, "checking\n");
+       CTDLM_syslog(LOG_DEBUG, "checking");
        if (fp == NULL) {
                cprintf("%d Cannot open %s: %s\n",
                  ERROR + INTERNAL_ERROR, infofilename, strerror(errno));
@@ -928,9 +930,9 @@ void cmd_einf(char *ok)
        fclose(fp);
 
        /* now update the room index so people will see our new info */
-       CtdlGetRoomLock(&CC->room, CC->room.QRname);            /* lock so no one steps on us */
-       CC->room.QRinfo = CC->room.QRhighest + 1L;
-       CtdlPutRoomLock(&CC->room);
+       CtdlGetRoomLock(&CCC->room, CCC->room.QRname);          /* lock so no one steps on us */
+       CCC->room.QRinfo = CCC->room.QRhighest + 1L;
+       CtdlPutRoomLock(&CCC->room);
 }
 
 
index 38b6ef1fa19cd1e65ac25dc16f9be541255d5aff..097c9fef8f35a47f5879d0c33eadc191d34455f8 100644 (file)
@@ -120,7 +120,7 @@ int GetNotifyHosts(NotifyContext *Ctx)
                if (pche == NULL) {
                        syslog(LOG_ERR,
                               "extnotify: filename of notification "
-                              "template not found in %s.\n",
+                              "template not found in %s.",
                               pchs);
                        continue;
                }
@@ -174,9 +174,9 @@ eNotifyType extNotify_getConfigMessage(char *username,
                num_msgs = cdbfr->len / sizeof(long);
                cdb_free(cdbfr);
        } else {
-               syslog(LOG_DEBUG,
-                      "extNotify_getConfigMessage: "
-                      "No config messages found\n");
+               MARKM_syslog(LOG_DEBUG,
+                            "extNotify_getConfigMessage: "
+                            "No config messages found");
                return eNone;   /* No messages at all?  No further action. */
        }
        for (a = 0; a < num_msgs; ++a) {
@@ -392,8 +392,8 @@ void do_extnotify_queue(void)
        if (IsEmptyStr(CtdlGetConfigStr("c_pager_program")) &&
            IsEmptyStr(CtdlGetConfigStr("c_funambol_host")))
        {
-               syslog(LOG_ERR,
-                      "No external notifiers configured on system/user\n");
+               MARKM_syslog(LOG_DEBUG,
+                            "No external notifiers configured on system/user");
                return;
        }
 
@@ -409,13 +409,13 @@ void do_extnotify_queue(void)
        /*
         * Go ahead and run the queue
         */
-       syslog(LOG_DEBUG, "serv_extnotify: processing notify queue\n");
+       MARKM_syslog(LOG_DEBUG, "serv_extnotify: processing notify queue");
 
        memset(&Ctx, 0, sizeof(NotifyContext));
        if ((GetNotifyHosts(&Ctx) > 0) &&
            (CtdlGetRoom(&CC->room, FNBL_QUEUE_ROOM) != 0))
        {
-               syslog(LOG_ERR, "Cannot find room <%s>\n", FNBL_QUEUE_ROOM);
+               syslog(LOG_ERR, "Cannot find room <%s>", FNBL_QUEUE_ROOM);
                if (Ctx.nNotifyHosts > 0)
                {
                        for (i = 0; i < Ctx.nNotifyHosts * 2; i++)
@@ -426,7 +426,7 @@ void do_extnotify_queue(void)
        }
        CtdlForEachMessage(MSGS_ALL, 0L, NULL,
                           SPOOLMIME, NULL, process_notify, &Ctx);
-       syslog(LOG_DEBUG, "serv_extnotify: queue run completed\n");
+       MARKM_syslog(LOG_DEBUG, "serv_extnotify: queue run completed");
        doing_queue = 0;
        if (Ctx.nNotifyHosts > 0)
        {
index 697ca62c095a844477a4c71402aa8c1ac3f9305e..3ebac02fe1da072764f7e1b4da1835c01f9d9ceb 100644 (file)
@@ -293,7 +293,7 @@ void InspectQueuedRoom(SpoolControl **pSC,
        if ( (!HaveSpoolConfig(sc->RNCfg)) || (sc->room.QRhighest <= sc->RNCfg->lastsent) ) 
        {
                // There is nothing to send from this room.
-               syslog(LOG_DEBUG, "Nothing to do for <%s>", room_to_spool->name);
+               MARK_syslog(LOG_DEBUG, "Nothing to do for <%s>", room_to_spool->name);
                FreeRoomNetworkStruct(&sc->RNCfg);
                sc->RNCfg = NULL;
                free(sc);
@@ -845,11 +845,11 @@ void network_do_spoolin(HashList *working_ignetcfg, HashList *the_netmap, int *n
         */
        if (stat(ctdl_netin_dir, &statbuf)) return;
        if (statbuf.st_mtime == last_spoolin_mtime) {
-               syslog(LOG_DEBUG, "network: nothing in inbound queue");
+               MARKM_syslog(LOG_DEBUG, "network: nothing in inbound queue");
                return;
        }
        last_spoolin_mtime = statbuf.st_mtime;
-       syslog(LOG_DEBUG, "network: processing inbound queue");
+       MARKM_syslog(LOG_DEBUG, "network: processing inbound queue");
 
        /*
         * Ok, there's something interesting in there, so scan it.
index d36660e4b03cbda332f703a3820567949c431812..ab9dbd66605381c563ee9bec21c32788d681a479 100644 (file)
@@ -319,8 +319,8 @@ void network_do_queue(void)
        if ( (time(NULL) - last_run) < CtdlGetConfigLong("c_net_freq") )
        {
                full_processing = 0;
-               syslog(LOG_DEBUG, "Network full processing in %ld seconds.",
-                      CtdlGetConfigLong("c_net_freq") - (time(NULL)- last_run)
+               MARK_syslog(LOG_DEBUG, "Network full processing in %ld seconds.",
+                           CtdlGetConfigLong("c_net_freq") - (time(NULL)- last_run)
                );
        }
 
index 0fe749d337a8a2aef81e3f653a32eb3ad24dda39..4140916b5bfe9bb931a1d5732833cdb4c122a22b 100644 (file)
@@ -1044,7 +1044,7 @@ void network_poll_other_citadel_nodes(int full_poll, HashList *ignetcfg)
        int poll = 0;
        
        if (GetCount(ignetcfg) ==0) {
-               syslog(LOG_DEBUG, "network: no neighbor nodes are configured - not polling.\n");
+               MARKM_syslog(LOG_DEBUG, "network: no neighbor nodes are configured - not polling.\n");
                return;
        }
        become_session(&networker_client_CC);
index d12e06aa58e2bd064939bdca6854393d9593cba5..a7754616ed720fc46e27b7fcec44515172c6046f 100644 (file)
@@ -1113,7 +1113,7 @@ void smtp_do_queue(void) {
        int num_activated = 0;
 
        pthread_setspecific(MyConKey, (void *)&smtp_queue_CC);
-       SMTPCM_syslog(LOG_INFO, "processing outbound queue");
+       SMTPCM_syslog(LOG_DEBUG, "processing outbound queue");
 
        if (CtdlGetRoom(&CC->room, SMTP_SPOOLOUT_ROOM) != 0) {
                SMTPC_syslog(LOG_ERR, "Cannot find room <%s>", SMTP_SPOOLOUT_ROOM);
@@ -1127,9 +1127,11 @@ void smtp_do_queue(void) {
                                                   smtp_do_procmsg,
                                                   &num_activated);
        }
-       SMTPC_syslog(LOG_INFO,
-                    "queue run completed; %d messages processed %d activated",
-                    num_processed, num_activated);
+       if (num_activated > 0) {
+               SMTPC_syslog(LOG_INFO,
+                            "queue run completed; %d messages processed %d activated",
+                            num_processed, num_activated);
+       }
 
 }
 
index 530ea5a76942131f5b69dba7adfa563377380478..4b031bca536806cf877ba2921e1a964186b9b6b4 100644 (file)
@@ -66,7 +66,7 @@ void xmpp_queue_event(int event_type, char *email_addr) {
        int purged_something = 0;
        struct CitContext *cptr;
 
-       syslog(LOG_DEBUG, "xmpp_queue_event(%d, %s)\n", event_type, email_addr);
+       MARK_syslog(LOG_DEBUG, "xmpp_queue_event(%d, %s)\n", event_type, email_addr);
 
        /* Purge events more than a minute old */
        begin_critical_section(S_XMPP_QUEUE);
index 93c673faa3c1a245962136cd48c36ebdcdb5757d..42e83b68fc7884d67196b3b7dae7fdc4805360b4 100644 (file)
@@ -2848,7 +2848,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
                strcpy(actual_rm, force_room);
        }
 
-       MSG_syslog(LOG_INFO, "Final selection: %s (%s)\n", actual_rm, room);
+       MSG_syslog(LOG_DEBUG, "Final selection: %s (%s)\n", actual_rm, room);
        if (strcasecmp(actual_rm, CCC->room.QRname)) {
                /* CtdlGetRoom(&CCC->room, actual_rm); */
                CtdlUserGoto(actual_rm, 0, 1, NULL, NULL, NULL, NULL);
index 7d772c7daa8f30c84104d4ead96eaf8cab6d2526..8d0a0d212ae01cbf86134e1409c76f79b818c53d 100644 (file)
@@ -905,7 +905,7 @@ void CtdlUserGoto(char *where, int display_result, int transiently,
        if (retnew != NULL) *retnew = new_messages;
        if (retoldest != NULL) *retoldest = oldest_message;
        if (retnewest != NULL) *retnewest = newest_message;
-       MSG_syslog(LOG_INFO, "<%s> %d new of %d total messages, oldest=%ld, newest=%ld",
+       MSG_syslog(LOG_DEBUG, "<%s> %d new of %d total messages, oldest=%ld, newest=%ld",
                   CCC->room.QRname, new_messages, total_messages, oldest_message, newest_message
        );
 
@@ -1225,10 +1225,10 @@ unsigned CtdlCreateRoom(char *new_room_name,
        struct floor flbuf;
        visit vbuf;
 
-       syslog(LOG_DEBUG, "CtdlCreateRoom(name=%s, type=%d, view=%d)", new_room_name, new_room_type, new_room_view);
+       MARK_syslog(LOG_DEBUG, "CtdlCreateRoom(name=%s, type=%d, view=%d)", new_room_name, new_room_type, new_room_view);
 
        if (CtdlGetRoom(&qrbuf, new_room_name) == 0) {
-               syslog(LOG_DEBUG, "Cannot create room <%s> - already exists", new_room_name);
+               MARK_syslog(LOG_DEBUG, "Cannot create room <%s> - already exists", new_room_name);
                return(0);
        }
 
index 9984e23cf23c2308610be2c7205f5e6448b4b240..f4a963cf7bf9ad2c124449ad8e7b9103dbaffafe 100644 (file)
@@ -25,7 +25,9 @@
 
 
 int DebugModules = 0;
+int EnableMarkers = 0;
+int EnableCtlProto = 0;
+
 /*
  * Structure defentitions for hook tables
  */
@@ -1480,10 +1482,21 @@ void DebugModulesEnable(const int n)
 {
        DebugModules = n;
 }
+void MarkersEnable(const int n)
+{
+       EnableMarkers = n;
+}
+void DebugCitadelProtoEnable(const int n)
+{
+       EnableCtlProto = n;
+}
+
 CTDL_MODULE_INIT(modules)
 {
        if (!threading) {
                CtdlRegisterDebugFlagHook(HKEY("modules"), DebugModulesEnable, &DebugModules);
+               CtdlRegisterDebugFlagHook(HKEY("periodicmarkers"), MarkersEnable, &EnableMarkers);
+               CtdlRegisterDebugFlagHook(HKEY("citadelprotocol"), DebugCitadelProtoEnable, &EnableCtlProto);
        }
        return "modules";
 }
index 93c80ab3e110158482e0b5ea4c9ae0a37a8f2b7c..95f9640335fbc69291385968ee1c75cde731d8a9 100644 (file)
@@ -29,6 +29,29 @@ extern int DebugModules;
                              "%s Modules: " FORMAT, IOSTR);
 
 
+extern int EnableMarkers;
+#define MARKLOG(LEVEL) if ((LEVEL != LOG_DEBUG) || (EnableMarkers != 0))
+
+#define MARK_syslog(LEVEL, FORMAT, ...)                                        \
+       MARKLOG(LEVEL) syslog(LEVEL,                                    \
+                             "%s: " FORMAT, IOSTR, __VA_ARGS__)
+
+#define MARKM_syslog(LEVEL, FORMAT)                            \
+       MARKLOG(LEVEL) syslog(LEVEL,                            \
+                              "%s: " FORMAT, IOSTR);
+
+
+extern int EnableCtlProto;
+#define CTDLLOG(LEVEL) if ((LEVEL != LOG_DEBUG) || (EnableCtlProto != 0))
+
+#define CTDL_syslog(LEVEL, FORMAT, ...)                                        \
+       CTDLLOG(LEVEL) syslog(LEVEL,                                    \
+                             "%s CC[%d]: " FORMAT, IOSTR, CCCID, __VA_ARGS__)
+
+#define CTDLM_syslog(LEVEL, FORMAT)                            \
+       CTDLLOG(LEVEL) syslog(LEVEL,                            \
+                             "%s CC[%d]: " FORMAT, IOSTR, CCCID);
+
 
 
 /*