more log silencing.
[citadel.git] / citadel / modules / smtp / serv_smtpqueue.c
index 9a618e092ee88731c465c2e2683a397293a2a0f7..59dcd64a403205ea16a3a31153148f663e69e347 100644 (file)
  * The VRFY and EXPN commands have been removed from this implementation
  * because nobody uses these commands anymore, except for spammers.
  *
- * Copyright (c) 1998-2012 by the citadel.org team
+ * Copyright (c) 1998-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.
+ * 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 "sysdep.h"
@@ -492,7 +486,8 @@ StrBuf *smtp_load_msg(OneQueItem *MyQItem, int n, char **Author, char **Address)
                      0, 1, NULL,
                      (ESC_DOT|SUPPRESS_ENV_TO),
                      Author,
-                     Address);
+                     Address,
+                       NULL);
 
        SendMsg = CCC->redirect_buffer;
        CCC->redirect_buffer = NULL;
@@ -605,7 +600,7 @@ void smtpq_do_bounce(OneQueItem *MyQItem, StrBuf *OMsgTxt, ParsedURL *Relay)
        boundary = NewStrBufPlain(HKEY("=_Citadel_Multipart_"));
        StrBufAppendPrintf(boundary,
                           "%s_%04x%04x",
-                          config.c_fqdn,
+                          CtdlGetConfigStr("c_fqdn"),
                           getpid(),
                           ++seq);
 
@@ -702,7 +697,7 @@ void smtpq_do_bounce(OneQueItem *MyQItem, StrBuf *OMsgTxt, ParsedURL *Relay)
 
        CM_SetField(bmsg, eOriginalRoom, HKEY(MAILROOM));
        CM_SetField(bmsg, eAuthor, HKEY("Citadel"));
-       CM_SetField(bmsg, eNodeName, CFG_KEY(c_nodename));
+       CM_SetField(bmsg, eNodeName, CtdlGetConfigStr("c_nodename"), strlen(CtdlGetConfigStr("c_nodename")));
        CM_SetField(bmsg, eMsgSubject, HKEY("Delivery Status Notification (Failure)"));
        CM_SetAsFieldSB(bmsg, eMesageText, &BounceMB);
 
@@ -724,7 +719,7 @@ void smtpq_do_bounce(OneQueItem *MyQItem, StrBuf *OMsgTxt, ParsedURL *Relay)
 
        /* If not, post it in the Aide> room */
        if (successful_bounce == 0) {
-               CtdlSubmitMsg(bmsg, NULL, config.c_aideroom, QP_EADDR);
+               CtdlSubmitMsg(bmsg, NULL, CtdlGetConfigStr("c_aideroom"), QP_EADDR);
        }
 
        /* Free up the memory we used */
@@ -841,7 +836,7 @@ void smtp_do_procmsg(long msgnum, void *userdata) {
        SMTPC_syslog(LOG_DEBUG, "smtp_do_procmsg(%ld)\n", msgnum);
        ///strcpy(envelope_from, "");
 
-       msg = CtdlFetchMessage(msgnum, 1);
+       msg = CtdlFetchMessage(msgnum, 1, 1);
        if (msg == NULL) {
                SMTPC_syslog(LOG_ERR, "tried %ld but no such message!\n",
                       msgnum);
@@ -997,12 +992,12 @@ void smtp_do_procmsg(long msgnum, void *userdata) {
                                nActivated++;
 
                                if (i > 1) n = MsgCount++;
-                               syslog(LOG_INFO,
-                                      "SMTPC: giving up on <%ld> <%s> %d / %d \n",
-                                      MyQItem->MessageID,
-                                      ChrPtr(ThisItem->Recipient),
-                                      i,
-                                      m);
+                               SMTPC_syslog(LOG_INFO,
+                                            "SMTPC: giving up on <%ld> <%s> %d / %d \n",
+                                            MyQItem->MessageID,
+                                            ChrPtr(ThisItem->Recipient),
+                                            i,
+                                            m);
                                (*((int*) userdata)) ++;
                                smtp_try_one_queue_entry(MyQItem,
                                                         ThisItem,
@@ -1039,12 +1034,12 @@ void smtp_do_procmsg(long msgnum, void *userdata) {
                                        usleep(delay_msec);
 
                                if (i > 1) n = MsgCount++;
-                               syslog(LOG_DEBUG,
-                                      "SMTPC: Trying <%ld> <%s> %d / %d \n",
-                                      MyQItem->MessageID,
-                                      ChrPtr(ThisItem->Recipient),
-                                      i,
-                                      m);
+                               SMTPC_syslog(LOG_DEBUG,
+                                            "SMTPC: Trying <%ld> <%s> %d / %d \n",
+                                            MyQItem->MessageID,
+                                            ChrPtr(ThisItem->Recipient),
+                                            i,
+                                            m);
                                (*((int*) userdata)) ++;
                                smtp_try_one_queue_entry(MyQItem,
                                                         ThisItem,
@@ -1118,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);
@@ -1132,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);
+       }
 
 }