$Log$
+ Revision 613.11 2003/12/24 05:02:49 ajc
+ * Allow a separate default message expire policy for mailbox rooms. The
+ floor default setting is now ignored for mailboxes. Updated client and
+ documentation to match.
+
Revision 613.10 2003/12/23 03:53:49 ajc
* Expanded the size of all string fields in "struct CtdlIPCMessage" to
the standard SIZ length, in order to accomodate "weird" messages
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
-
/*
* Text description of this software
*/
-#define CITADEL "Citadel/UX 6.13"
+#define CITADEL "Citadel/UX 6.14"
/*
* REV_LEVEL is the current version number (multiplied by 100 to avoid having
* usually more strict because you're not really supposed to dump/load and
* upgrade at the same time.
*/
-#define REV_LEVEL 613 /* This version */
+#define REV_LEVEL 614 /* This version */
#define REV_MIN 591 /* Oldest compatible database */
-#define EXPORT_REV_MIN 612 /* Oldest compatible export files */
+#define EXPORT_REV_MIN 614 /* Oldest compatible export files */
#define SERVER_TYPE 0 /* zero for stock Citadel/UX; other developers please
obtain SERVER_TYPE codes for your implementations */
char c_baseroom[ROOMNAMELEN]; /* Name of baseroom (Lobby) */
char c_aideroom[ROOMNAMELEN]; /* Name of aideroom (Aide) */
int c_purge_hour; /* Hour during which db purges run */
+ struct ExpirePolicy c_mbxep; /* Expire policy for mailbox rooms */
};
/*
/* GPEX */
-/* which is 0 = room, 1 = floor, 2 = site */
+/* which is 0 = room, 1 = floor, 2 = site, 3 = default for mailboxes */
/* caller must free the struct ExpirePolicy */
int CtdlIPCGetMessageExpirationPolicy(CtdlIPC *ipc, int which,
struct ExpirePolicy **policy, char *cret)
{
- static char *proto[] = {"room", "floor", "site"};
+ static char *proto[] = {"room", "floor", "site", "mailboxes" };
char aaa[11];
register int ret;
if (!policy) return -2;
if (!*policy) *policy = (struct ExpirePolicy *)calloc(1, sizeof(struct ExpirePolicy));
if (!*policy) return -1;
- if (which < 0 || which > 2) return -2;
+ if (which < 0 || which > 3) return -2;
sprintf(aaa, "GPEX %s", proto[which]);
ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
/* SPEX */
-/* which is 0 = room, 1 = floor, 2 = site */
+/* which is 0 = room, 1 = floor, 2 = site, 3 = default for mailboxes */
/* policy is 0 = inherit, 1 = no purge, 2 = by count, 3 = by age (days) */
int CtdlIPCSetMessageExpirationPolicy(CtdlIPC *ipc, int which,
struct ExpirePolicy *policy, char *cret)
{
char aaa[38];
- char *whichvals[] = { "room", "floor", "site" };
+ char *whichvals[] = { "room", "floor", "site", "mailboxes" };
if (!cret) return -2;
- if (which < 0 || which > 2) return -2;
+ if (which < 0 || which > 3) return -2;
if (!policy) return -2;
if (policy->expire_mode < 0 || policy->expire_mode > 3) return -2;
if (policy->expire_mode >= 2 && policy->expire_value < 1) return -2;
will never be altered.</p>
<p>The final set of options configures system-wide defaults for the
auto-purger:</p>
-<pre>Default user purge time (days) [120]: <br>Default room purge time (days) [30]: <br>System default message expire policy (? for list) [2]: <br>Keep how many messages online? [150]:<br></pre>
+<pre>Default user purge time (days) [120]: <br>
+Default room purge time (days) [30]: <br>
+System default message expire policy (? for list) [2]: <br>
+Keep how many messages online? [150]:<br>
+Mailbox default message expire policy (? for list) [1]: <br>
+</pre>
<p>Any user who does not log in for the period specified in 'Default
user purge time' will be deleted the next time a purge is run. This
setting may be modified on a per-user basis.</p>
<li>Do not purge at all </li>
</ul>
<p>Again, this setting may be overridden on a per-floor basis, and the
-floor setting may be overridden on a per-room basis.</p>
+floor setting may be overridden on a per-room basis. You'll also notice
+that you can set a <i>different</i> default for mailbox rooms if you want
+to. This can allow you, for example, to set a policy under which old
+messages scroll out of public rooms, but private mail stays online indefinitely
+until deleted by the mailbox owners.</p>
<pre>Save this configuration? No<br></pre>
<p>When you're done, enter 'Yes' to confirm the changes, or 'No' to
discard the changes.</p>
return;
}
- /* Otherwise, if the floor has its own policy, return it */
- fl = cgetfloor(qrbuf->QRfloor);
- if (fl->f_ep.expire_mode != 0) {
- memcpy(epbuf, &fl->f_ep, sizeof(struct ExpirePolicy));
- return;
+ /* (non-mailbox rooms)
+ * If the floor has its own policy, return it
+ */
+ if ( (qrbuf->QRflags & QR_MAILBOX) == 0) {
+ fl = cgetfloor(qrbuf->QRfloor);
+ if (fl->f_ep.expire_mode != 0) {
+ memcpy(epbuf, &fl->f_ep, sizeof(struct ExpirePolicy));
+ return;
+ }
+ }
+
+ /* (Mailbox rooms)
+ * If there is a default policy for mailbox rooms, return it
+ */
+ if (qrbuf->QRflags & QR_MAILBOX) {
+ if (&config.c_mbxep.expire_mode != 0) {
+ memcpy(epbuf, &config.c_mbxep,
+ sizeof(struct ExpirePolicy));
+ return;
+ }
}
/* Otherwise, fall back on the system default */
fl = cgetfloor(CC->room.QRfloor);
memcpy(&exp, &fl->f_ep, sizeof(struct ExpirePolicy));
}
+ else if (!strcasecmp(which, "mailboxes")) {
+ memcpy(&exp, &config.c_mbxep, sizeof(struct ExpirePolicy));
+ }
else if (!strcasecmp(which, "site")) {
memcpy(&exp, &config.c_ep, sizeof(struct ExpirePolicy));
}
return;
}
+ else if (!strcasecmp(which, "mailboxes")) {
+ memcpy(&config.c_mbxep, &exp, sizeof(struct ExpirePolicy));
+ put_config();
+ cprintf("%d Default expire policy for mailboxes set.\n",
+ CIT_OK);
+ return;
+ }
+
else if (!strcasecmp(which, "site")) {
if (exp.expire_mode == EXPIRE_NEXTLEVEL) {
cprintf("%d Invalid policy (no higher level)\n",
char buf[SIZ];
char sc[32][SIZ];
char *resp = NULL;
- struct ExpirePolicy *expirepolicy = NULL;
+ struct ExpirePolicy *site_expirepolicy = NULL;
+ struct ExpirePolicy *mbx_expirepolicy = NULL;
int a;
int logpages = 0;
int r; /* IPC response code */
/* Fetch the expire policy (this will silently fail on old servers,
* resulting in "default" policy)
*/
- r = CtdlIPCGetMessageExpirationPolicy(ipc, 2, &expirepolicy, buf);
+ r = CtdlIPCGetMessageExpirationPolicy(ipc, 2, &site_expirepolicy, buf);
+ r = CtdlIPCGetMessageExpirationPolicy(ipc, 3, &mbx_expirepolicy, buf);
/* Identification parameters */
/* Angels and demons dancing in my head... */
do {
- snprintf(buf, sizeof buf, "%d", expirepolicy->expire_mode);
+ snprintf(buf, sizeof buf, "%d", site_expirepolicy->expire_mode);
strprompt("System default message expire policy (? for list)",
buf, 1);
if (buf[0] == '?') {
"3. Expire by message age\n");
}
} while ((buf[0] < '1') || (buf[0] > '3'));
- expirepolicy->expire_mode = buf[0] - '0';
+ site_expirepolicy->expire_mode = buf[0] - '0';
/* ...lunatics and monsters underneath my bed */
- if (expirepolicy->expire_mode == 2) {
- snprintf(buf, sizeof buf, "%d", expirepolicy->expire_value);
+ if (site_expirepolicy->expire_mode == 2) {
+ snprintf(buf, sizeof buf, "%d", site_expirepolicy->expire_value);
strprompt("Keep how many messages online?", buf, 10);
- expirepolicy->expire_value = atol(buf);
+ site_expirepolicy->expire_value = atol(buf);
}
- if (expirepolicy->expire_mode == 3) {
- snprintf(buf, sizeof buf, "%d", expirepolicy->expire_value);
+ if (site_expirepolicy->expire_mode == 3) {
+ snprintf(buf, sizeof buf, "%d", site_expirepolicy->expire_value);
strprompt("Keep messages for how many days?", buf, 10);
- expirepolicy->expire_value = atol(buf);
+ site_expirepolicy->expire_value = atol(buf);
+ }
+
+ /* Media messiahs preying on my fears... */
+ do {
+ snprintf(buf, sizeof buf, "%d", mbx_expirepolicy->expire_mode);
+ strprompt("Mailbox default message expire policy (? for list)",
+ buf, 1);
+ if (buf[0] == '?') {
+ scr_printf("\n"
+ "0. Go with the system default\n"
+ "1. Never automatically expire messages\n"
+ "2. Expire by message count\n"
+ "3. Expire by message age\n");
+ }
+ } while ((buf[0] < '0') || (buf[0] > '3'));
+ mbx_expirepolicy->expire_mode = buf[0] - '0';
+
+ /* ...Pop culture prophets playing in my ears */
+ if (mbx_expirepolicy->expire_mode == 2) {
+ snprintf(buf, sizeof buf, "%d", mbx_expirepolicy->expire_value);
+ strprompt("Keep how many messages online?", buf, 10);
+ mbx_expirepolicy->expire_value = atol(buf);
+ }
+ if (mbx_expirepolicy->expire_mode == 3) {
+ snprintf(buf, sizeof buf, "%d", mbx_expirepolicy->expire_value);
+ strprompt("Keep messages for how many days?", buf, 10);
+ mbx_expirepolicy->expire_value = atol(buf);
}
strprompt("How often to run network jobs (in seconds)", &sc[28][0], 5);
err_printf("%s\n", buf);
}
free(resp);
- r = CtdlIPCSetMessageExpirationPolicy(ipc, 2, expirepolicy, buf);
+
+ r = CtdlIPCSetMessageExpirationPolicy(ipc, 2, site_expirepolicy, buf);
if (r / 100 != 2) {
err_printf("%s\n", buf);
}
+
+ r = CtdlIPCSetMessageExpirationPolicy(ipc, 3, mbx_expirepolicy, buf);
+ if (r / 100 != 2) {
+ err_printf("%s\n", buf);
+ }
+
}
}
cprintf("%d\n", config.c_pop3_port);
cprintf("%d\n", config.c_smtp_port);
cprintf("%d\n", config.c_purge_hour);
+ cprintf("%d\n", config.c_mbxep.expire_mode);
+ cprintf("%d\n", config.c_mbxep.expire_value);
/* Export the control file */
get_control();
client_gets(buf); config.c_pop3_port = atoi(buf);
client_gets(buf); config.c_smtp_port = atoi(buf);
client_gets(buf); config.c_purge_hour = atoi(buf);
+ client_gets(buf); config.c_mbxep.expire_mode = atoi(buf);
+ client_gets(buf); config.c_mbxep.expire_value = atoi(buf);
put_config();
lprintf(7, "Imported config file\n");
}
3 - Purge by message age. (Requires a value: number of days)
The format of this command is: GPEX <which>
- The value of <which> must be one of: "room" "floor" "site"
+ The value of <which> must be one of: "room" "floor" "site" "mailboxes"
If successful, GPEX returns OK followed by <policy>|<value>.
the list of available policies.
The format of this command is: SPEX <which>|<policy>|<value>
- The value of <which> must be one of: "room" "floor" "site"
+ The value of <which> must be one of: "room" "floor" "site" "mailboxes"
If successful, GPEX returns OK; otherwise, an ERROR code is returned.