+Fri Dec 11 18:50:00 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
+ * setup.c: default value for maxsessions is now 0 (no limit)
+ * room_ops.c: don't allow users to create a room called "Mail"
+ * serv_expire.c: fixed "number of messages purged" display
+
Tue Dec 8 07:58:16 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
* Beta 2
void terminate_idle_sessions(void) {
struct CitContext *ccptr;
time_t now;
-
- time(&now);
+
+START_OVER:
+ now = time(NULL);
for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
if ( (ccptr!=CC)
&& (config.c_sleeping > 0)
&& (now - (ccptr->lastcmd) > config.c_sleeping) ) {
- lprintf(3, "Session %d timed out\n", ccptr->cs_pid);
+ lprintf(3, "Session %d timed out. Terminating it...\n",
+ ccptr->cs_pid);
kill_session(ccptr->cs_pid);
- ccptr = ContextList;
+ lprintf(9, "...done terminating it.\n");
+ goto START_OVER;
}
}
}
*/
void do_housekeeping(void) {
+ lprintf(9, "--- begin housekeeping ---\n");
begin_critical_section(S_HOUSEKEEPING);
/*
* Terminate idle sessions.
*/
lprintf(7, "Calling terminate_idle_sessions()\n");
terminate_idle_sessions();
+ lprintf(9, "Done with terminate_idle_sessions()\n");
/*
* If the server is scheduled to shut down the next time all
master_cleanup();
}
end_critical_section(S_HOUSEKEEPING);
+ lprintf(9, "--- end housekeeping ---\n");
}
return;
}
+ if (!strcasecmp(new_room_name, MAILROOM)) {
+ cprintf("%d '%s' already exists.\n",
+ ERROR+ALREADY_EXISTS, new_room_name);
+ return;
+ }
+
if (num_parms(args)>=5) {
getfloor(&flbuf,extract_int(args,4));
if ((flbuf.f_flags & F_INUSE) == 0) {
/* Check to make sure the requested room name doesn't already exist */
if (getroom(&qrbuf, new_room_name)==0) {
cprintf("%d '%s' already exists.\n",
- ERROR,qrbuf.QRname);
+ ERROR+ALREADY_EXISTS, qrbuf.QRname);
return;
}
char msgid[64];
int a;
- messages_purged = 0;
time(&now);
GetExpirePolicy(&epbuf, qrbuf);
if ((xtime > 0L)
&& (now - xtime > (time_t)(epbuf.expire_value * 86400L))) {
+ lprintf(5, "Expiring message %ld\n", delnum);
cdb_delete(CDB_MSGMAIN, &delnum, sizeof(long));
SetMessageInList(a, 0L);
- lprintf(5, "Expiring message %ld\n", delnum);
+ ++messages_purged;
}
}
}
void PurgeMessages(void) {
lprintf(5, "PurgeMessages() called\n");
+ messages_purged = 0;
ForEachRoom(DoPurgeMessages);
}
void do_import(char *argbuf) {
char import_filename[PATH_MAX];
+
+ if (CC->internal_pgm == 0) {
+ cprintf("%d This command is for internal programs only.\n",
+ ERROR);
+ return;
+ }
extract(import_filename, argbuf, 0);
imfp = fopen(import_filename, "rb");
void do_export(char *argbuf) {
char export_filename[PATH_MAX];
+
+ if (CC->internal_pgm == 0) {
+ cprintf("%d This command is for internal programs only.\n",
+ ERROR);
+ return;
+ }
extract(export_filename, argbuf, 0);
exfp = fopen(export_filename, "wb");
}
/*
- * Make sure that at least one concurrent session is allowed!
+ * Negative values for maxsessions are not allowed.
*/
- if (config.c_maxsessions < 1) {
- config.c_maxsessions = 1;
+ if (config.c_maxsessions < 0) {
+ config.c_maxsessions = 0;
}
/* We need a system default message expiry policy, because this is