[srvx-commits] CVS: services/src chanserv.c,1.232.2.4,1.232.2.5
Brought to you by:
entrope
|
From: Zoot <zo...@us...> - 2002-07-27 04:32:53
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv15828/src
Modified Files:
Tag: rel-1_1-branch
chanserv.c
Log Message:
Backport the fix for "disappearing suspended channels" from 1.2.x.
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.232.2.4
retrieving revision 1.232.2.5
diff -C2 -r1.232.2.4 -r1.232.2.5
*** chanserv.c 25 Jul 2002 01:00:12 -0000 1.232.2.4
--- chanserv.c 27 Jul 2002 04:32:50 -0000 1.232.2.5
***************
*** 7004,7008 ****
struct chanNode *cNode = NULL;
struct chanData *cData = NULL;
! dict_t users, bans, notes;
dict_iterator_t it;
--- 7004,7008 ----
struct chanNode *cNode = NULL;
struct chanData *cData = NULL;
! dict_t channel, users, bans, notes;
dict_iterator_t it;
***************
*** 7011,7017 ****
unsigned long num_flags;
unsigned int max;
! time_t registered, visited;
!
! users = database_get_data(hir->d.object, KEY_USERS, RECDB_OBJECT);
if(!users)
--- 7011,7017 ----
unsigned long num_flags;
unsigned int max;
! time_t registered, visited, expires = 0;
! channel = hir->d.object;
! users = database_get_data(channel, KEY_USERS, RECDB_OBJECT);
if(!users)
***************
*** 7021,7040 ****
}
! bans = database_get_data(hir->d.object, KEY_BANS, RECDB_OBJECT);
! notes = database_get_data(hir->d.object, KEY_NOTES, RECDB_OBJECT);
! flags = database_get_data(hir->d.object, KEY_FLAGS, RECDB_QSTRING);
! topic = database_get_data(hir->d.object, KEY_TOPIC, RECDB_QSTRING);
! topic_mask = database_get_data(hir->d.object, KEY_TOPIC_MASK, RECDB_QSTRING);
! registrar = database_get_data(hir->d.object, KEY_REGISTRAR, RECDB_QSTRING);
! greeting = database_get_data(hir->d.object, KEY_GREETING, RECDB_QSTRING);
! modes = database_get_data(hir->d.object, KEY_MODES, RECDB_QSTRING);
! data = database_get_data(hir->d.object, KEY_REGISTERED, RECDB_QSTRING);
registered = data ? (signed)strtoul(data, NULL, 0) : now;
! data = database_get_data(hir->d.object, KEY_VISITED, RECDB_QSTRING);
visited = data ? (signed)strtoul(data, NULL, 0) : now;
! data = database_get_data(hir->d.object, KEY_MAX, RECDB_QSTRING);
max = data ? strtoul(data, NULL, 0) : 0;
--- 7021,7040 ----
}
! bans = database_get_data(channel, KEY_BANS, RECDB_OBJECT);
! notes = database_get_data(channel, KEY_NOTES, RECDB_OBJECT);
! flags = database_get_data(channel, KEY_FLAGS, RECDB_QSTRING);
! topic = database_get_data(channel, KEY_TOPIC, RECDB_QSTRING);
! topic_mask = database_get_data(channel, KEY_TOPIC_MASK, RECDB_QSTRING);
! registrar = database_get_data(channel, KEY_REGISTRAR, RECDB_QSTRING);
! greeting = database_get_data(channel, KEY_GREETING, RECDB_QSTRING);
! modes = database_get_data(channel, KEY_MODES, RECDB_QSTRING);
! data = database_get_data(channel, KEY_REGISTERED, RECDB_QSTRING);
registered = data ? (signed)strtoul(data, NULL, 0) : now;
! data = database_get_data(channel, KEY_VISITED, RECDB_QSTRING);
visited = data ? (signed)strtoul(data, NULL, 0) : now;
! data = database_get_data(channel, KEY_MAX, RECDB_QSTRING);
max = data ? strtoul(data, NULL, 0) : 0;
***************
*** 7049,7052 ****
--- 7049,7066 ----
options = CHANNEL_DEFAULT_OPTIONS;
}
+
+ if(num_flags & CHANNEL_SUSPENDED)
+ {
+ char *exp_text;
+ exp_text = database_get_data(channel, KEY_SUSPEND_EXPIRES, RECDB_QSTRING);
+ if(exp_text)
+ {
+ expires = strtoul(exp_text, NULL, 0);
+ if(expires <= now)
+ {
+ num_flags &= ~CHANNEL_SUSPENDED;
+ }
+ }
+ }
if(!(num_flags & CHANNEL_SUSPENDED))
***************
*** 7067,7082 ****
{
struct suspended *suspended;
! char *reason, *exp_text;
! time_t expires = 0;
- if((exp_text = database_get_data(hir->d.object, KEY_SUSPEND_EXPIRES, RECDB_QSTRING)))
- {
- expires = strtoul(exp_text, NULL, 0);
- if(expires < now)
- {
- cData->flags &= ~CHANNEL_SUSPENDED;
- goto suspended_done;
- }
- }
suspended = malloc(sizeof(struct suspended));
if((suspended->expires = expires))
--- 7081,7086 ----
{
struct suspended *suspended;
! char *reason;
suspended = malloc(sizeof(struct suspended));
if((suspended->expires = expires))
***************
*** 7085,7091 ****
}
suspended->name = strdup(key);
! suspender = database_get_data(hir->d.object, KEY_SUSPENDER, RECDB_QSTRING);
suspended->suspender = strdup(suspender);
! reason = database_get_data(hir->d.object, KEY_SUSPEND_REASON, RECDB_QSTRING);
suspended->reason = reason ? strdup(reason) : NULL;
--- 7089,7095 ----
}
suspended->name = strdup(key);
! suspender = database_get_data(channel, KEY_SUSPENDER, RECDB_QSTRING);
suspended->suspender = strdup(suspender);
! reason = database_get_data(channel, KEY_SUSPEND_REASON, RECDB_QSTRING);
suspended->reason = reason ? strdup(reason) : NULL;
***************
*** 7094,7098 ****
dict_insert(sChannels, suspended->name, suspended);
- suspended_done: ;
}
--- 7098,7101 ----
|