From 63a2fd9da036686e883b4774ed7522624c9d4675 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Sat, 23 Jan 2016 17:42:48 +0100 Subject: [PATCH] more log silencing. --- citadel/internet_addressing.c | 14 +++++++----- citadel/modules/smtp/serv_smtpqueue.c | 24 ++++++++++----------- citadel/modules/smtp/smtp_util.c | 22 +++++++++++-------- citadel/modules/xmpp/xmpp_presence.c | 8 +++---- citadel/modules/xmpp/xmpp_query_namespace.c | 2 +- citadel/msgbase.c | 9 ++++---- citadel/room_ops.c | 13 +++++------ 7 files changed, 51 insertions(+), 41 deletions(-) diff --git a/citadel/internet_addressing.c b/citadel/internet_addressing.c index 99b22d786..d7473e852 100644 --- a/citadel/internet_addressing.c +++ b/citadel/internet_addressing.c @@ -1176,6 +1176,7 @@ void process_rfc822_addr(const char *rfc822, char *user, char *node, char *name) * message text. */ int convert_field(struct CtdlMessage *msg, const char *beg, const char *end) { + struct CitContext *CCC = CC; char *key, *value, *valueend; long len; const char *pos; @@ -1225,7 +1226,7 @@ int convert_field(struct CtdlMessage *msg, const char *beg, const char *end) { else if (!strcasecmp(key, "From")) { process_rfc822_addr(value, user, node, name); - syslog(LOG_DEBUG, "Converted to <%s@%s> (%s)\n", user, node, name); + MSG_syslog(LOG_DEBUG, "Converted to <%s@%s> (%s)\n", user, node, name); snprintf(addr, sizeof(addr), "%s@%s", user, node); if (CM_IsEmpty(msg, eAuthor) && !IsEmptyStr(name)) CM_SetField(msg, eAuthor, name, strlen(name)); @@ -1530,6 +1531,7 @@ char *rfc822_fetch_field(const char *rfc822, const char *fieldname) { void directory_key(char *key, char *addr) { int i; int keylen = 0; + struct CitContext *CCC = CC; for (i=0; !IsEmptyStr(&addr[i]); ++i) { if (!isspace(addr[i])) { @@ -1538,7 +1540,7 @@ void directory_key(char *key, char *addr) { } key[keylen++] = 0; - syslog(LOG_DEBUG, "Directory key is <%s>\n", key); + MSG_syslog(LOG_DEBUG, "Directory key is <%s>\n", key); } @@ -1580,10 +1582,11 @@ void CtdlDirectoryInit(void) { */ int CtdlDirectoryAddUser(char *internet_addr, char *citadel_addr) { char key[SIZ]; + struct CitContext *CCC = CC; if (IsDirectory(internet_addr, 0) == 0) return 0; - syslog(LOG_DEBUG, "Create directory entry: %s --> %s\n", internet_addr, citadel_addr); + MSG_syslog(LOG_DEBUG, "Create directory entry: %s --> %s\n", internet_addr, citadel_addr); directory_key(key, internet_addr); cdb_store(CDB_DIRECTORY, key, strlen(key), citadel_addr, strlen(citadel_addr)+1 ); return 1; @@ -1598,8 +1601,9 @@ int CtdlDirectoryAddUser(char *internet_addr, char *citadel_addr) { */ int CtdlDirectoryDelUser(char *internet_addr, char *citadel_addr) { char key[SIZ]; - - syslog(LOG_DEBUG, "Delete directory entry: %s --> %s\n", internet_addr, citadel_addr); + struct CitContext *CCC = CC; + + MSG_syslog(LOG_DEBUG, "Delete directory entry: %s --> %s\n", internet_addr, citadel_addr); directory_key(key, internet_addr); return cdb_delete(CDB_DIRECTORY, key, strlen(key) ) == 0; } diff --git a/citadel/modules/smtp/serv_smtpqueue.c b/citadel/modules/smtp/serv_smtpqueue.c index a7754616e..59dcd64a4 100644 --- a/citadel/modules/smtp/serv_smtpqueue.c +++ b/citadel/modules/smtp/serv_smtpqueue.c @@ -992,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, @@ -1034,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, diff --git a/citadel/modules/smtp/smtp_util.c b/citadel/modules/smtp/smtp_util.c index 1cca96e3a..7484cd5f4 100644 --- a/citadel/modules/smtp/smtp_util.c +++ b/citadel/modules/smtp/smtp_util.c @@ -81,6 +81,8 @@ #include "ctdl_module.h" #include "smtp_util.h" +#include "smtpqueue.h" +#include "smtp_clienthandlers.h" const char *smtp_get_Recipients(void) { @@ -119,7 +121,7 @@ void smtp_do_bounce(char *instr, StrBuf *OMsgTxt) StrBuf *BounceMB; long omsgid = (-1); - syslog(LOG_DEBUG, "smtp_do_bounce() called\n"); + SMTPCM_syslog(LOG_DEBUG, "smtp_do_bounce() called"); strcpy(bounceto, ""); boundary = NewStrBufPlain(HKEY("=_Citadel_Multipart_")); @@ -204,8 +206,8 @@ void smtp_do_bounce(char *instr, StrBuf *OMsgTxt) dsnlen = extract_token(dsn, buf, 3, '|', sizeof dsn); bounce_this = 0; - syslog(LOG_DEBUG, "key=<%s> addr=<%s> status=%d dsn=<%s>\n", - key, addr, status, dsn); + SMTPC_syslog(LOG_DEBUG, "key=<%s> addr=<%s> status=%d dsn=<%s>", + key, addr, status, dsn); if (!strcasecmp(key, "bounceto")) { strcpy(bounceto, addr); @@ -277,14 +279,16 @@ void smtp_do_bounce(char *instr, StrBuf *OMsgTxt) CM_SetAsFieldSB(bmsg, eMesageText, &BounceMB); /* Deliver the bounce if there's anything worth mentioning */ - syslog(LOG_DEBUG, "num_bounces = %d\n", num_bounces); + SMTPC_syslog(LOG_DEBUG, "num_bounces = %d\n", num_bounces); if (num_bounces > 0) { /* First try the user who sent the message */ - if (IsEmptyStr(bounceto)) - syslog(LOG_ERR, "No bounce address specified\n"); - else - syslog(LOG_DEBUG, "bounce to user <%s>\n", bounceto); + if (IsEmptyStr(bounceto)) { + SMTPCM_syslog(LOG_ERR, "No bounce address specified"); + } + else { + SMTPC_syslog(LOG_DEBUG, "bounce to user <%s>", bounceto); + } /* Can we deliver the bounce to the original sender? */ valid = validate_recipients(bounceto, smtp_get_Recipients (), @@ -308,5 +312,5 @@ void smtp_do_bounce(char *instr, StrBuf *OMsgTxt) } FreeStrBuf(&boundary); CM_Free(bmsg); - syslog(LOG_DEBUG, "Done processing bounces\n"); + SMTPCM_syslog(LOG_DEBUG, "Done processing bounces\n"); } diff --git a/citadel/modules/xmpp/xmpp_presence.c b/citadel/modules/xmpp/xmpp_presence.c index a3be435f7..4c4fa9335 100644 --- a/citadel/modules/xmpp/xmpp_presence.c +++ b/citadel/modules/xmpp/xmpp_presence.c @@ -195,11 +195,11 @@ void xmpp_presence_notify(char *presence_jid, int event_type) { } } - syslog(LOG_DEBUG, "%d sessions for <%s> are now visible to session %d\n", visible_sessions, presence_jid, CC->cs_pid); + XMPP_syslog(LOG_DEBUG, "%d sessions for <%s> are now visible to session %d\n", visible_sessions, presence_jid, CC->cs_pid); if ( (event_type == XMPP_EVT_LOGIN) && (visible_sessions == 1) ) { - syslog(LOG_DEBUG, "Telling session %d that <%s> logged in\n", CC->cs_pid, presence_jid); + XMPP_syslog(LOG_DEBUG, "Telling session %d that <%s> logged in\n", CC->cs_pid, presence_jid); /* Do an unsolicited roster update that adds a new contact. */ assert(which_cptr_is_relevant >= 0); @@ -213,7 +213,7 @@ void xmpp_presence_notify(char *presence_jid, int event_type) { } if (visible_sessions == 0) { - syslog(LOG_DEBUG, "Telling session %d that <%s> logged out\n", + XMPP_syslog(LOG_DEBUG, "Telling session %d that <%s> logged out\n", CC->cs_pid, presence_jid); xmpp_destroy_buddy(presence_jid, 0); /* non aggressive presence update */ } @@ -270,7 +270,7 @@ void xmpp_fetch_mortuary_backend(long msgnum, void *userdata) { HashList *xmpp_fetch_mortuary(void) { HashList *mortuary = NewHash(1, NULL); if (!mortuary) { - syslog(LOG_ALERT, "NewHash() failed!\n"); + XMPPM_syslog(LOG_ALERT, "NewHash() failed!\n"); return(NULL); } diff --git a/citadel/modules/xmpp/xmpp_query_namespace.c b/citadel/modules/xmpp/xmpp_query_namespace.c index 848fcc735..a517f2a50 100644 --- a/citadel/modules/xmpp/xmpp_query_namespace.c +++ b/citadel/modules/xmpp/xmpp_query_namespace.c @@ -78,7 +78,7 @@ void xmpp_iq_roster_query(void) struct CitContext *cptr; int nContexts, i; - syslog(LOG_DEBUG, "Roster push!"); + XMPPM_syslog(LOG_DEBUG, "Roster push!"); cprintf(""); cptr = CtdlGetContextArray(&nContexts); if (cptr) { diff --git a/citadel/msgbase.c b/citadel/msgbase.c index 42e83b68f..2709a62fa 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -3128,6 +3128,7 @@ void flood_protect_quickie_message(const char *from, long ioid, time_t NOW) { + struct CitContext *CCC = CC; int i; u_char rawdigest[MD5_DIGEST_LEN]; struct MD5Context md5context; @@ -3165,14 +3166,14 @@ void flood_protect_quickie_message(const char *from, { FreeStrBuf(&guid); /* yes, we did. flood protection kicks in. */ - syslog(LOG_DEBUG, - "not sending message again - %ld < %ld \n", seenstamp, tsday); + MSG_syslog(LOG_DEBUG, + "not sending message again - %ld < %ld \n", seenstamp, tsday); return; } else { - syslog(LOG_DEBUG, - "sending message. %ld >= %ld", seenstamp, tsday); + MSG_syslog(LOG_DEBUG, + "sending message. %ld >= %ld", seenstamp, tsday); FreeStrBuf(&guid); /* no, this message isn't sent recently; go ahead. */ quickie_message(from, diff --git a/citadel/room_ops.c b/citadel/room_ops.c index 8d0a0d212..a018662d9 100644 --- a/citadel/room_ops.c +++ b/citadel/room_ops.c @@ -978,6 +978,7 @@ void convert_room_name_macros(char *towhere, size_t maxlen) { * in *at least* the old name! */ int CtdlRenameRoom(char *old_name, char *new_name, int new_floor) { + struct CitContext *CCC = CC; int old_floor = 0; struct ctdlroom qrbuf; struct ctdlroom qrtmp; @@ -987,7 +988,7 @@ int CtdlRenameRoom(char *old_name, char *new_name, int new_floor) { long owner = 0L; char actual_old_name[ROOMNAMELEN]; - syslog(LOG_DEBUG, "CtdlRenameRoom(%s, %s, %d)", old_name, new_name, new_floor); + MSG_syslog(LOG_DEBUG, "CtdlRenameRoom(%s, %s, %d)", old_name, new_name, new_floor); if (new_floor >= 0) { fl = CtdlGetCachedFloor(new_floor); @@ -1007,9 +1008,9 @@ int CtdlRenameRoom(char *old_name, char *new_name, int new_floor) { ret = crr_room_not_found; } - else if ( (CC->user.axlevel < AxAideU) && (!CC->internal_pgm) - && (CC->user.usernum != qrbuf.QRroomaide) - && ( (((qrbuf.QRflags & QR_MAILBOX) == 0) || (atol(qrbuf.QRname) != CC->user.usernum))) ) { + else if ( (CCC->user.axlevel < AxAideU) && (!CCC->internal_pgm) + && (CCC->user.usernum != qrbuf.QRroomaide) + && ( (((qrbuf.QRflags & QR_MAILBOX) == 0) || (atol(qrbuf.QRname) != CCC->user.usernum))) ) { ret = crr_access_denied; } @@ -1076,11 +1077,11 @@ int CtdlRenameRoom(char *old_name, char *new_name, int new_floor) { lgetfloor(&flbuf, old_floor); --flbuf.f_ref_count; lputfloor(&flbuf, old_floor); - syslog(LOG_DEBUG, "Reference count for floor %d is now %d", old_floor, flbuf.f_ref_count); + MSG_syslog(LOG_DEBUG, "Reference count for floor %d is now %d", old_floor, flbuf.f_ref_count); lgetfloor(&flbuf, new_floor); ++flbuf.f_ref_count; lputfloor(&flbuf, new_floor); - syslog(LOG_DEBUG, "Reference count for floor %d is now %d", new_floor, flbuf.f_ref_count); + MSG_syslog(LOG_DEBUG, "Reference count for floor %d is now %d", new_floor, flbuf.f_ref_count); } /* ...and everybody say "YATTA!" */ -- 2.30.2