projects
/
citadel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of ssh://git.citadel.org/appl/gitroot/citadel
[citadel.git]
/
citadel
/
modules
/
expire
/
serv_expire.c
diff --git
a/citadel/modules/expire/serv_expire.c
b/citadel/modules/expire/serv_expire.c
index 583b86dd504019e844aa0ccbe9c5a906b246b976..76bd626fbada1a23cb473f0a03b799da95d2ff45 100644
(file)
--- a/
citadel/modules/expire/serv_expire.c
+++ b/
citadel/modules/expire/serv_expire.c
@@
-3,7
+3,7
@@
*
* You might also see this module affectionately referred to as the DAP (the Dreaded Auto-Purger).
*
*
* You might also see this module affectionately referred to as the DAP (the Dreaded Auto-Purger).
*
- * Copyright (c) 1988-201
1
by citadel.org (Art Cancro, Wilifried Goesgens, and others)
+ * Copyright (c) 1988-201
5
by citadel.org (Art Cancro, Wilifried Goesgens, and others)
*
* 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
*
* 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
@@
-15,11
+15,6
@@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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
- *
- *
* A brief technical discussion:
*
* Several of the purge operations found in this module operate in two
* A brief technical discussion:
*
* Several of the purge operations found in this module operate in two
@@
-197,7
+192,7
@@
void GatherPurgeMessages(struct ctdlroom *qrbuf, void *data) {
for (a=0; a<num_msgs; ++a) {
delnum = msglist[a];
for (a=0; a<num_msgs; ++a) {
delnum = msglist[a];
- msg = CtdlFetchMessage(delnum, 0); /* dont need body */
+ msg = CtdlFetchMessage(delnum, 0
, 1
); /* dont need body */
if (msg != NULL) {
xtime = atol(msg->cm_fields[eTimestamp]);
CM_Free(msg);
if (msg != NULL) {
xtime = atol(msg->cm_fields[eTimestamp]);
CM_Free(msg);
@@
-312,11
+307,11
@@
void DoPurgeRooms(struct ctdlroom *qrbuf, void *data) {
if (qrbuf->QRmtime <= (time_t)0) return;
/* If no room purge time is set, be safe and don't purge */
if (qrbuf->QRmtime <= (time_t)0) return;
/* If no room purge time is set, be safe and don't purge */
- if (
config.c_roompurge
< 0) return;
+ if (
CtdlGetConfigLong("c_roompurge")
< 0) return;
/* Otherwise, check the date of last modification */
age = time(NULL) - (qrbuf->QRmtime);
/* Otherwise, check the date of last modification */
age = time(NULL) - (qrbuf->QRmtime);
- purge_secs =
(time_t)config.c_roompurge * (time_t)
86400;
+ purge_secs =
CtdlGetConfigLong("c_roompurge") *
86400;
if (purge_secs <= (time_t)0) return;
syslog(LOG_DEBUG, "<%s> is <%ld> seconds old", qrbuf->QRname, (long)age);
if (age > purge_secs) do_purge = 1;
if (purge_secs <= (time_t)0) return;
syslog(LOG_DEBUG, "<%s> is <%ld> seconds old", qrbuf->QRname, (long)age);
if (age > purge_secs) do_purge = 1;
@@
-417,10
+412,10
@@
void do_user_purge(struct ctdluser *us, void *data) {
/* Set purge time; if the user overrides the system default, use it */
if (us->USuserpurge > 0) {
/* Set purge time; if the user overrides the system default, use it */
if (us->USuserpurge > 0) {
- purge_time = ((time_t)us->USuserpurge) * 86400
L
;
+ purge_time = ((time_t)us->USuserpurge) * 86400;
}
else {
}
else {
- purge_time =
((time_t)config.c_userpurge) * 86400L
;
+ purge_time =
CtdlGetConfigLong("c_userpurge") * 86400
;
}
/* The default rule is to not purge. */
}
/* The default rule is to not purge. */
@@
-429,7
+424,7
@@
void do_user_purge(struct ctdluser *us, void *data) {
/* If the user hasn't called in two months and expiring of accounts is turned on, his/her account
* has expired, so purge the record.
*/
/* If the user hasn't called in two months and expiring of accounts is turned on, his/her account
* has expired, so purge the record.
*/
- if (
config.c_userpurge
> 0)
+ if (
CtdlGetConfigLong("c_userpurge")
> 0)
{
now = time(NULL);
if ((now - us->lastcall) > purge_time) purge = 1;
{
now = time(NULL);
if ((now - us->lastcall) > purge_time) purge = 1;
@@
-528,7
+523,7
@@
int PurgeUsers(void) {
syslog(LOG_DEBUG, "PurgeUsers() called");
users_not_purged = 0;
syslog(LOG_DEBUG, "PurgeUsers() called");
users_not_purged = 0;
- switch(
config.c_auth_mode
) {
+ switch(
CtdlGetConfigInt("c_auth_mode")
) {
case AUTHMODE_NATIVE:
ForEachUser(do_user_purge, NULL);
break;
case AUTHMODE_NATIVE:
ForEachUser(do_user_purge, NULL);
break;
@@
-536,8
+531,7
@@
int PurgeUsers(void) {
ForEachUser(do_uid_user_purge, NULL);
break;
default:
ForEachUser(do_uid_user_purge, NULL);
break;
default:
- syslog(LOG_DEBUG, "User purge for auth mode %d is not implemented.",
- config.c_auth_mode);
+ syslog(LOG_DEBUG, "User purge for auth mode %d is not implemented.", CtdlGetConfigInt("c_auth_mode"));
break;
}
break;
}
@@
-771,7
+765,7
@@
int PurgeEuidIndexTable(void) {
memcpy(&msgnum, cdbei->ptr, sizeof(long));
memcpy(&msgnum, cdbei->ptr, sizeof(long));
- msg = CtdlFetchMessage(msgnum, 0);
+ msg = CtdlFetchMessage(msgnum, 0
, 1
);
if (msg != NULL) {
CM_Free(msg); /* it still exists, so do nothing */
}
if (msg != NULL) {
CM_Free(msg); /* it still exists, so do nothing */
}
@@
-870,10
+864,8
@@
void purge_databases(void)
*/
now = time(NULL);
localtime_r(&now, &tm);
*/
now = time(NULL);
localtime_r(&now, &tm);
- if (
- ((tm.tm_hour != config.c_purge_hour) || ((now - last_purge) < 43200))
- && (force_purge_now == 0)
- ) {
+ if (((tm.tm_hour != CtdlGetConfigInt("c_purge_hour")) || ((now - last_purge) < 43200)) && (force_purge_now == 0))
+ {
return;
}
return;
}