From aaffd92765c6a7fa51e97e44693a648a6328e4f5 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Thu, 30 Mar 2017 16:42:33 -0400 Subject: [PATCH] Updated XMPP server to new logging standard --- citadel/modules/xmpp/serv_xmpp.c | 25 +++++++++------------ citadel/modules/xmpp/serv_xmpp.h | 14 +----------- citadel/modules/xmpp/xmpp_presence.c | 13 +++++------ citadel/modules/xmpp/xmpp_query_namespace.c | 9 ++++---- citadel/modules/xmpp/xmpp_queue.c | 23 +++++++------------ citadel/modules/xmpp/xmpp_sasl_service.c | 19 +++++----------- 6 files changed, 36 insertions(+), 67 deletions(-) diff --git a/citadel/modules/xmpp/serv_xmpp.c b/citadel/modules/xmpp/serv_xmpp.c index 36b1d33ce..2ee2493cc 100644 --- a/citadel/modules/xmpp/serv_xmpp.c +++ b/citadel/modules/xmpp/serv_xmpp.c @@ -1,6 +1,6 @@ /* * XMPP (Jabber) service for the Citadel system - * Copyright (c) 2007-2015 by Art Cancro and citadel.org + * Copyright (c) 2007-2017 by Art Cancro and citadel.org * * 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 @@ -76,7 +76,7 @@ static void xmpp_entity_declaration(void *userData, const XML_Char *entityName, const XML_Char *systemId, const XML_Char *publicId, const XML_Char *notationName ) { - XMPPM_syslog(LOG_WARNING, "Illegal entity declaration encountered; stopping parser."); + syslog(LOG_WARNING, "xmpp: illegal entity declaration encountered; stopping parser."); XML_StopParser(XMPP->xp, XML_FALSE); } #endif @@ -240,9 +240,9 @@ void xmpp_xml_start(void *data, const char *supplied_el, const char **attr) { } /* - XMPP_syslog(LOG_DEBUG, "XMPP ELEMENT START: <%s>\n", el); + syslog(LOG_DEBUG, "xmpp: ELEMENT START: <%s>", el); for (i=0; attr[i] != NULL; i+=2) { - XMPP_syslog(LOG_DEBUG, " Attribute '%s' = '%s'\n", attr[i], attr[i+1]); + syslog(LOG_DEBUG, "xmpp: Attribute '%s' = '%s'", attr[i], attr[i+1]); } uncomment for more verbosity */ @@ -312,9 +312,9 @@ void xmpp_xml_end(void *data, const char *supplied_el) { } /* - XMPP_syslog(LOG_DEBUG, "XMPP ELEMENT END : <%s>\n", el); + syslog(LOG_DEBUG, "xmpp: ELEMENT END : <%s>", el); if (XMPP->chardata_len > 0) { - XMPP_syslog(LOG_DEBUG, " chardata: %s\n", XMPP->chardata); + syslog(LOG_DEBUG, "xmpp: chardata: %s", XMPP->chardata); } uncomment for more verbosity */ @@ -375,10 +375,7 @@ void xmpp_xml_end(void *data, const char *supplied_el) { * Unknown query ... return the XML equivalent of a blank stare */ else { - XMPP_syslog(LOG_DEBUG, - "Unknown query <%s> - returning \n", - el - ); + syslog(LOG_DEBUG, "xmpp: Unknown query <%s> - returning ", el); cprintf("", xmlesc(xmlbuf, XMPP->iq_id, sizeof xmlbuf)); cprintf("" "" @@ -510,7 +507,7 @@ void xmpp_xml_end(void *data, const char *supplied_el) { } else if (!strcasecmp(el, "stream")) { - XMPPM_syslog(LOG_DEBUG, "XMPP client shut down their stream\n"); + syslog(LOG_DEBUG, "xmpp: client shut down their stream"); xmpp_massacre_roster(); cprintf("\n"); CC->kill_me = KILLME_CLIENT_LOGGED_OUT; @@ -525,7 +522,7 @@ void xmpp_xml_end(void *data, const char *supplied_el) { } else { - XMPP_syslog(LOG_DEBUG, "Ignoring unknown tag <%s>\n", el); + syslog(LOG_DEBUG, "xmpp: ignoring unknown tag <%s>", el); } XMPP->chardata_len = 0; @@ -590,7 +587,7 @@ void xmpp_greeting(void) { XMPP->xp = XML_ParserCreateNS("UTF-8", ':'); if (XMPP->xp == NULL) { - XMPPM_syslog(LOG_ALERT, "Cannot create XML parser!\n"); + syslog(LOG_ERR, "xmpp: cannot create XML parser"); CC->kill_me = KILLME_XML_PARSER; return; } @@ -627,7 +624,7 @@ void xmpp_command_loop(void) { XML_Parse(XMPP->xp, ChrPtr(stream_input), rc, 0); } else { - XMPPM_syslog(LOG_ERR, "client disconnected: ending session.\n"); + syslog(LOG_ERR, "xmpp: client disconnected: ending session."); CC->kill_me = KILLME_CLIENT_DISCONNECTED; } FreeStrBuf(&stream_input); diff --git a/citadel/modules/xmpp/serv_xmpp.h b/citadel/modules/xmpp/serv_xmpp.h index 27f341054..222c8f79f 100644 --- a/citadel/modules/xmpp/serv_xmpp.h +++ b/citadel/modules/xmpp/serv_xmpp.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2009 by the citadel.org team + * Copyright (c) 2007-2017 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. @@ -77,15 +77,3 @@ void xmpp_massacre_roster(void); void xmpp_delete_old_buddies_who_no_longer_exist_from_the_client_roster(void); int xmpp_is_visible(struct CitContext *from, struct CitContext *to_whom); char *xmlesc(char *buf, char *str, int bufsiz); - -extern int XMPPSrvDebugEnable; - -#define DBGLOG(LEVEL) if ((LEVEL != LOG_DEBUG) || (XMPPSrvDebugEnable != 0)) - -#define XMPP_syslog(LEVEL, FORMAT, ...) \ - DBGLOG(LEVEL) syslog(LEVEL, \ - "XMPP: " FORMAT, __VA_ARGS__) - -#define XMPPM_syslog(LEVEL, FORMAT) \ - DBGLOG(LEVEL) syslog(LEVEL, \ - "XMPP: " FORMAT); diff --git a/citadel/modules/xmpp/xmpp_presence.c b/citadel/modules/xmpp/xmpp_presence.c index 4c4fa9335..2d4980784 100644 --- a/citadel/modules/xmpp/xmpp_presence.c +++ b/citadel/modules/xmpp/xmpp_presence.c @@ -1,7 +1,7 @@ /* * Handle XMPP presence exchanges * - * Copyright (c) 2007-2015 by Art Cancro and citadel.org + * Copyright (c) 2007-2017 by Art Cancro and citadel.org * * 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 @@ -67,7 +67,7 @@ void xmpp_indicate_presence(char *presence_jid) { char xmlbuf[256]; - XMPP_syslog(LOG_DEBUG, "XMPP: indicating presence of <%s> to <%s>", presence_jid, XMPP->client_jid); + syslog(LOG_DEBUG, "xmpp: indicating presence of <%s> to <%s>", presence_jid, XMPP->client_jid); cprintf("", xmlesc(xmlbuf, XMPP->client_jid, sizeof xmlbuf)); } @@ -195,11 +195,11 @@ void xmpp_presence_notify(char *presence_jid, int event_type) { } } - XMPP_syslog(LOG_DEBUG, "%d sessions for <%s> are now visible to session %d\n", visible_sessions, presence_jid, CC->cs_pid); + syslog(LOG_DEBUG, "xmpp: %d sessions for <%s> are now visible to session %d", visible_sessions, presence_jid, CC->cs_pid); if ( (event_type == XMPP_EVT_LOGIN) && (visible_sessions == 1) ) { - XMPP_syslog(LOG_DEBUG, "Telling session %d that <%s> logged in\n", CC->cs_pid, presence_jid); + syslog(LOG_DEBUG, "xmpp: telling session %d that <%s> logged in", CC->cs_pid, presence_jid); /* Do an unsolicited roster update that adds a new contact. */ assert(which_cptr_is_relevant >= 0); @@ -213,8 +213,7 @@ void xmpp_presence_notify(char *presence_jid, int event_type) { } if (visible_sessions == 0) { - XMPP_syslog(LOG_DEBUG, "Telling session %d that <%s> logged out\n", - CC->cs_pid, presence_jid); + syslog(LOG_DEBUG, "xmpp: telling session %d that <%s> logged out", CC->cs_pid, presence_jid); xmpp_destroy_buddy(presence_jid, 0); /* non aggressive presence update */ } @@ -270,7 +269,7 @@ void xmpp_fetch_mortuary_backend(long msgnum, void *userdata) { HashList *xmpp_fetch_mortuary(void) { HashList *mortuary = NewHash(1, NULL); if (!mortuary) { - XMPPM_syslog(LOG_ALERT, "NewHash() failed!\n"); + syslog(LOG_ALERT, "xmpp: NewHash() failed!"); return(NULL); } diff --git a/citadel/modules/xmpp/xmpp_query_namespace.c b/citadel/modules/xmpp/xmpp_query_namespace.c index a517f2a50..8016a6357 100644 --- a/citadel/modules/xmpp/xmpp_query_namespace.c +++ b/citadel/modules/xmpp/xmpp_query_namespace.c @@ -78,13 +78,13 @@ void xmpp_iq_roster_query(void) struct CitContext *cptr; int nContexts, i; - XMPPM_syslog(LOG_DEBUG, "Roster push!"); + syslog(LOG_DEBUG, "xmpp: roster push!"); cprintf(""); cptr = CtdlGetContextArray(&nContexts); if (cptr) { for (i=0; i\n", query_xmlns); + syslog(LOG_DEBUG, "xmpp: unknown query namespace '%s' - returning ", query_xmlns); cprintf("" "" "" diff --git a/citadel/modules/xmpp/xmpp_queue.c b/citadel/modules/xmpp/xmpp_queue.c index 4b031bca5..8cdf1a4d8 100644 --- a/citadel/modules/xmpp/xmpp_queue.c +++ b/citadel/modules/xmpp/xmpp_queue.c @@ -1,22 +1,15 @@ /* * XMPP event queue * - * Copyright (c) 2007-2009 by Art Cancro + * Copyright (c) 2007-2017 by Art Cancro * - * 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" @@ -66,7 +59,7 @@ void xmpp_queue_event(int event_type, char *email_addr) { int purged_something = 0; struct CitContext *cptr; - MARK_syslog(LOG_DEBUG, "xmpp_queue_event(%d, %s)\n", event_type, email_addr); + syslog(LOG_DEBUG, "xmpp: xmpp_queue_event(%d, %s)", event_type, email_addr); /* Purge events more than a minute old */ begin_critical_section(S_XMPP_QUEUE); diff --git a/citadel/modules/xmpp/xmpp_sasl_service.c b/citadel/modules/xmpp/xmpp_sasl_service.c index 393174dce..ce2c8890b 100644 --- a/citadel/modules/xmpp/xmpp_sasl_service.c +++ b/citadel/modules/xmpp/xmpp_sasl_service.c @@ -5,20 +5,13 @@ * * Copyright (c) 2007-2009 by Art Cancro * - * 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" -- 2.30.2