]> code.citadel.org Git - citadel.git/commitdiff
Removed spurious calls to CtdlClearSystemContext()
authorArt Cancro <ajc@uncensored.citadel.org>
Mon, 4 Apr 2011 18:39:12 +0000 (14:39 -0400)
committerArt Cancro <ajc@uncensored.citadel.org>
Mon, 4 Apr 2011 18:39:12 +0000 (14:39 -0400)
citadel/modules/expire/serv_expire.c
citadel/modules/extnotify/extnotify_main.c

index bdc8fc2b7b39acb00f33dcc23a166470bfbe4afb..6cd2b668dd3baaa26701f28c7322f790b61134fc 100644 (file)
@@ -247,13 +247,12 @@ void DoPurgeMessages(FILE *purgelist) {
 void PurgeMessages(void) {
        FILE *purgelist;
 
-       syslog(LOG_DEBUG, "PurgeMessages() called\n");
+       syslog(LOG_DEBUG, "PurgeMessages() called");
        messages_purged = 0;
 
        purgelist = tmpfile();
        if (purgelist == NULL) {
-               syslog(LOG_CRIT, "Can't create purgelist temp file: %s\n",
-                       strerror(errno));
+               syslog(LOG_CRIT, "Can't create purgelist temp file: %s", strerror(errno));
                return;
        }
 
@@ -320,7 +319,7 @@ void DoPurgeRooms(struct ctdlroom *qrbuf, void *data) {
                age = time(NULL) - (qrbuf->QRmtime);
                purge_secs = (time_t)config.c_roompurge * (time_t)86400;
                if (purge_secs <= (time_t)0) return;
-               syslog(LOG_DEBUG, "<%s> is <%ld> seconds old\n", qrbuf->QRname, (long)age);
+               syslog(LOG_DEBUG, "<%s> is <%ld> seconds old", qrbuf->QRname, (long)age);
                if (age > purge_secs) do_purge = 1;
        } /* !QR_MAILBOX */
 
@@ -342,7 +341,7 @@ int PurgeRooms(void) {
        struct ValidUser *vuptr;
        char *transcript = NULL;
 
-       syslog(LOG_DEBUG, "PurgeRooms() called\n");
+       syslog(LOG_DEBUG, "PurgeRooms() called");
 
 
        /* Load up a table full of valid user numbers so we can delete
@@ -379,7 +378,7 @@ int PurgeRooms(void) {
        if (num_rooms_purged > 0) CtdlAideMessage(transcript, "Room Autopurger Message");
        free(transcript);
 
-       syslog(LOG_DEBUG, "Purged %d rooms.\n", num_rooms_purged);
+       syslog(LOG_DEBUG, "Purged %d rooms.", num_rooms_purged);
        return(num_rooms_purged);
 }
 
@@ -527,7 +526,7 @@ int PurgeUsers(void) {
        int num_users_purged = 0;
        char *transcript = NULL;
 
-       syslog(LOG_DEBUG, "PurgeUsers() called\n");
+       syslog(LOG_DEBUG, "PurgeUsers() called");
        users_not_purged = 0;
 
        switch(config.c_auth_mode) {
@@ -538,7 +537,7 @@ int PurgeUsers(void) {
                        ForEachUser(do_uid_user_purge, NULL);
                        break;
                default:
-                       syslog(LOG_DEBUG, "User purge for auth mode %d is not implemented.\n",
+                       syslog(LOG_DEBUG, "User purge for auth mode %d is not implemented.",
                                config.c_auth_mode);
                        break;
        }
@@ -589,7 +588,7 @@ int PurgeUsers(void) {
                users_zero_msg = NULL;
        }
                
-       syslog(LOG_DEBUG, "Purged %d users.\n", num_users_purged);
+       syslog(LOG_DEBUG, "Purged %d users.", num_users_purged);
        return(num_users_purged);
 }
 
@@ -704,7 +703,7 @@ int PurgeUseTable(void) {
        struct UPurgeList *uptr; 
 
        /* Phase 1: traverse through the table, discovering old records... */
-       syslog(LOG_DEBUG, "Purge use table: phase 1\n");
+       syslog(LOG_DEBUG, "Purge use table: phase 1");
        cdb_rewind(CDB_USETABLE);
        while(cdbut = cdb_next_item(CDB_USETABLE), cdbut != NULL) {
 
@@ -731,7 +730,7 @@ int PurgeUseTable(void) {
        }
 
        /* Phase 2: delete the records */
-       syslog(LOG_DEBUG, "Purge use table: phase 2\n");
+       syslog(LOG_DEBUG, "Purge use table: phase 2");
        while (ul != NULL) {
                cdb_delete(CDB_USETABLE, ul->up_key, strlen(ul->up_key));
                uptr = ul->next;
@@ -739,7 +738,7 @@ int PurgeUseTable(void) {
                ul = uptr;
        }
 
-       syslog(LOG_DEBUG, "Purge use table: finished (purged %d records)\n", purged);
+       syslog(LOG_DEBUG, "Purge use table: finished (purged %d records)", purged);
        return(purged);
 }
 
@@ -758,7 +757,7 @@ int PurgeEuidIndexTable(void) {
        struct CtdlMessage *msg = NULL;
 
        /* Phase 1: traverse through the table, discovering old records... */
-       syslog(LOG_DEBUG, "Purge EUID index: phase 1\n");
+       syslog(LOG_DEBUG, "Purge EUID index: phase 1");
        cdb_rewind(CDB_EUIDINDEX);
        while(cdbei = cdb_next_item(CDB_EUIDINDEX), cdbei != NULL) {
 
@@ -785,7 +784,7 @@ int PurgeEuidIndexTable(void) {
        }
 
        /* Phase 2: delete the records */
-       syslog(LOG_DEBUG, "Purge euid index: phase 2\n");
+       syslog(LOG_DEBUG, "Purge euid index: phase 2");
        while (el != NULL) {
                cdb_delete(CDB_EUIDINDEX, el->ep_key, el->ep_keylen);
                free(el->ep_key);
@@ -794,7 +793,7 @@ int PurgeEuidIndexTable(void) {
                el = eptr;
        }
 
-       syslog(LOG_DEBUG, "Purge euid index: finished (purged %d records)\n", purged);
+       syslog(LOG_DEBUG, "Purge euid index: finished (purged %d records)", purged);
        return(purged);
 }
 
@@ -836,7 +835,7 @@ int PurgeStaleOpenIDassociations(void) {
        HashPos = GetNewHashPos(keys, 0);
        while (GetNextHashPos(keys, HashPos, &len, &Key, &Value)!=0)
        {
-               syslog(LOG_DEBUG, "Deleting associated OpenID <%s>\n",  (char*)Value);
+               syslog(LOG_DEBUG, "Deleting associated OpenID <%s>",  (char*)Value);
                cdb_delete(CDB_OPENID, Value, strlen(Value));
                /* note: don't free(Value) -- deleting the hash list will handle this for us */
                ++num_deleted;
@@ -870,67 +869,65 @@ void purge_databases(void)
                        return;
        }
 
-       syslog(LOG_INFO, "Auto-purger: starting.\n");
+       syslog(LOG_INFO, "Auto-purger: starting.");
 
        if (!server_shutting_down)
        {
                retval = PurgeUsers();
-               syslog(LOG_NOTICE, "Purged %d users.\n", retval);
+               syslog(LOG_NOTICE, "Purged %d users.", retval);
        }
                
        if (!server_shutting_down)
        {
                PurgeMessages();
-               syslog(LOG_NOTICE, "Expired %d messages.\n", messages_purged);
+               syslog(LOG_NOTICE, "Expired %d messages.", messages_purged);
        }
 
        if (!server_shutting_down)
        {
                        retval = PurgeRooms();
-                       syslog(LOG_NOTICE, "Expired %d rooms.\n", retval);
+                       syslog(LOG_NOTICE, "Expired %d rooms.", retval);
        }
 
        if (!server_shutting_down)
        {
                        retval = PurgeVisits();
-                       syslog(LOG_NOTICE, "Purged %d visits.\n", retval);
+                       syslog(LOG_NOTICE, "Purged %d visits.", retval);
        }
 
        if (!server_shutting_down)
        {
                retval = PurgeUseTable();
-                       syslog(LOG_NOTICE, "Purged %d entries from the use table.\n", retval);
+                       syslog(LOG_NOTICE, "Purged %d entries from the use table.", retval);
        }
 
        if (!server_shutting_down)
        {
                retval = PurgeEuidIndexTable();
-               syslog(LOG_NOTICE, "Purged %d entries from the EUID index.\n", retval);
+               syslog(LOG_NOTICE, "Purged %d entries from the EUID index.", retval);
        }
 
        if (!server_shutting_down)
        {
                retval = PurgeStaleOpenIDassociations();
-               syslog(LOG_NOTICE, "Purged %d stale OpenID associations.\n", retval);
+               syslog(LOG_NOTICE, "Purged %d stale OpenID associations.", retval);
        }
 
        if (!server_shutting_down)
        {
                        retval = TDAP_ProcessAdjRefCountQueue();
-               syslog(LOG_NOTICE, "Processed %d message reference count adjustments.\n", retval);
+               syslog(LOG_NOTICE, "Processed %d message reference count adjustments.", retval);
        }
 
        if (!server_shutting_down)
        {
-               syslog(LOG_INFO, "Auto-purger: finished.\n");
+               syslog(LOG_INFO, "Auto-purger: finished.");
                last_purge = now;       /* So we don't do it again soon */
                force_purge_now = 0;
        }
        else {
-               syslog(LOG_INFO, "Auto-purger: STOPPED.\n");
+               syslog(LOG_INFO, "Auto-purger: STOPPED.");
        }
-
-       CtdlClearSystemContext();
 }
 
 
index 4707abf991b60d022c6909edfeaadf4f3d92b660..ce477dcd6cd71627631963e417e9ab6655737154 100644 (file)
@@ -8,23 +8,24 @@
  * Based on bits of serv_funambol
  * Contact: <matt@mcbridematt.dhs.org> / <matt@comalies>
  *
- * Copyright (c) 2008-2009
+ * Copyright (c) 2008-2011
  *
- *  This program is free 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 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.
+ * 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.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
+
 #include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
 #include "domain.h"
 #include "clientsocket.h"
 #include "extnotify.h"
-
 #include "ctdl_module.h"
 
 
-
 void ExtNotify_PutErrorMessage(NotifyContext *Ctx, StrBuf *ErrMsg)
 {
        int nNext;
@@ -84,8 +83,6 @@ void ExtNotify_PutErrorMessage(NotifyContext *Ctx, StrBuf *ErrMsg)
 }
 
 
-
-
 StrBuf* GetNHBuf(int i, int allocit, StrBuf **NotifyHostList)
 {
        if ((NotifyHostList[i] == NULL) && (allocit != 0))
@@ -123,9 +120,7 @@ StrBuf** GetNotifyHosts(void)
                pchs = ChrPtr(Host);
                pche = strchr(pchs, ':');
                if (pche == NULL) {
-                       syslog(LOG_ERR, 
-                                     __FILE__": filename not found in %s.\n", 
-                                     pchs);
+                       syslog(LOG_ERR, __FILE__": filename not found in %s.", pchs);
                        continue;
                }
                File = GetNHBuf(notify * 2 + 1, 1, NotifyHostList);
@@ -156,8 +151,10 @@ void create_extnotify_queue(void) {
                CtdlPutRoomLock(&qrbuf);
        }
 }
-/*!
- * \brief Run through the pager room queue
+
+
+/*
+ * Run through the pager room queue
  */
 void do_extnotify_queue(void) 
 {
@@ -178,13 +175,12 @@ void do_extnotify_queue(void)
        /*
         * Go ahead and run the queue
         */
-       syslog(LOG_DEBUG, "serv_extnotify: processing notify queue\n");
+       syslog(LOG_DEBUG, "serv_extnotify: processing notify queue");
     
        memset(&Ctx, 0, sizeof(NotifyContext));
        Ctx.NotifyHostList = GetNotifyHosts();
        if (CtdlGetRoom(&CC->room, FNBL_QUEUE_ROOM) != 0) {
-               syslog(LOG_ERR, "Cannot find room <%s>\n", FNBL_QUEUE_ROOM);
-               CtdlClearSystemContext();
+               syslog(LOG_ERR, "Cannot find room <%s>", FNBL_QUEUE_ROOM);
                return;
        }
        CtdlForEachMessage(MSGS_ALL, 0L, NULL,
@@ -213,10 +209,11 @@ void do_extnotify_queue(void)
                DeleteHash(&Ctx.NotifyErrors);
        }
 
-       syslog(LOG_DEBUG, "serv_extnotify: queue run completed\n");
+       syslog(LOG_DEBUG, "serv_extnotify: queue run completed");
        doing_queue = 0;
 }
 
+
 /*
  * Process messages in the external notification queue
  */
@@ -335,8 +332,9 @@ nuke:
        CtdlDeleteMessages(FNBL_QUEUE_ROOM, todelete, 1, "");
 }
 
-/*! \brief Checks to see what notification option the user has set
- *
+
+/*
+ * Checks to see what notification option the user has set
  */
 void extNotify_getPrefs(long configMsgNum, char *configMsg) 
 {
@@ -344,7 +342,7 @@ void extNotify_getPrefs(long configMsgNum, char *configMsg)
        // Do a simple string search to see if 'funambol' is selected as the
        // type. This string would be at the very top of the message contents.
        if (configMsgNum == -1) {
-               syslog(LOG_ERR, "extNotify_isAllowedByPrefs was passed a non-existant config message id\n");
+               syslog(LOG_ERR, "extNotify_isAllowedByPrefs was passed a non-existant config message id");
                return;
        }
        prefMsg = CtdlFetchMessage(configMsgNum, 1);
@@ -352,8 +350,9 @@ void extNotify_getPrefs(long configMsgNum, char *configMsg)
        CtdlFreeMessage(prefMsg);
 }
 
-/*! \brief Get configuration message for pager/funambol system from the
- *                     users "My Citadel Config" room
+
+/*
+ * Get configuration message for pager/funambol system from the user's "My Citadel Config" room
  */
 long extNotify_getConfigMessage(char *username) {
        struct ctdlroom qrbuf; // scratch for room
@@ -383,7 +382,7 @@ long extNotify_getConfigMessage(char *username) {
                num_msgs = cdbfr->len / sizeof(long);
                cdb_free(cdbfr);
        } else {
-               syslog(LOG_DEBUG, "extNotify_getConfigMessage: No config messages found\n");
+               syslog(LOG_DEBUG, "extNotify_getConfigMessage: No config messages found");
                return -1;      /* No messages at all?  No further action. */
        }
        for (a = 0; a < num_msgs; ++a) {
@@ -401,6 +400,7 @@ long extNotify_getConfigMessage(char *username) {
     
 }
 
+
 CTDL_MODULE_INIT(extnotify)
 {
        if (!threading)