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;
}
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 */
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
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);
}
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) {
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;
}
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);
}
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) {
}
/* 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;
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);
}
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) {
}
/* 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);
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);
}
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;
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();
}
* 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;
}
-
-
StrBuf* GetNHBuf(int i, int allocit, StrBuf **NotifyHostList)
{
if ((NotifyHostList[i] == NULL) && (allocit != 0))
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);
CtdlPutRoomLock(&qrbuf);
}
}
-/*!
- * \brief Run through the pager room queue
+
+
+/*
+ * Run through the pager room queue
*/
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,
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
*/
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)
{
// 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);
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
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) {
}
+
CTDL_MODULE_INIT(extnotify)
{
if (!threading)