jcs
/subtext
/amendments
/426
db: Add mail_prune_days field, default to 180 days
jcs made amendment 426 about 1 year ago
--- db.c Tue Mar 14 17:55:00 2023
+++ db.c Wed Mar 15 15:29:46 2023
@@ -69,8 +69,7 @@ struct struct_field config_fields[] = {
300, 115200 },
{ "Modem Bits/Parity/Stop", CONFIG_TYPE_STRING,
offsetof(struct config, modem_parity),
- member_size(struct config, modem_parity),
- member_size(struct config, modem_parity) },
+ 1, member_size(struct config, modem_parity) },
{ "Modem Init String", CONFIG_TYPE_STRING,
offsetof(struct config, modem_init),
1, member_size(struct config, modem_init) },
@@ -89,9 +88,12 @@ struct struct_field config_fields[] = {
offsetof(struct config, blanker_runtime_seconds),
1, USHRT_MAX },
- { "Session Log History Days", CONFIG_TYPE_SHORT,
- offsetof(struct config, session_log_days),
- 1, USHRT_MAX },
+ { "Prune Session Logs After N Days", CONFIG_TYPE_SHORT,
+ offsetof(struct config, session_log_prune_days),
+ 0, USHRT_MAX },
+ { "Prune Mail After N Days", CONFIG_TYPE_SHORT,
+ offsetof(struct config, mail_prune_days),
+ 0, USHRT_MAX },
{ "FTN Network Name", CONFIG_TYPE_STRING,
offsetof(struct config, ftn_network),
@@ -351,9 +353,10 @@ db_migrate(struct db *tdb, short is_new, Str255 fullpa
tdb->config.max_login_seconds = 90;
tdb->config.blanker_idle_seconds = (60 * 60);
tdb->config.blanker_runtime_seconds = 30;
- tdb->config.session_log_days = 21;
+ tdb->config.session_log_prune_days = 21;
tdb->config.binkp_port = 24554;
tdb->config.binkp_interval_seconds = (60 * 60 * 3);
+ tdb->config.mail_prune_days = 180;
db_config_save(tdb);
/* create a default sysop user */
@@ -560,13 +563,13 @@ db_migrate(struct db *tdb, short is_new, Str255 fullpa
break;
}
case 10: {
- /* 10->11, added session_log_days */
+ /* 10->11, added session_log_prune_days */
struct config new_config = { 0 };
bile_read(tdb->bile, DB_CONFIG_RTYPE, 1, (char *)&new_config,
sizeof(new_config));
- new_config.session_log_days = 21;
+ new_config.session_log_prune_days = 21;
bile_write(tdb->bile, DB_CONFIG_RTYPE, 1, &new_config,
sizeof(new_config));
@@ -685,6 +688,19 @@ db_migrate(struct db *tdb, short is_new, Str255 fullpa
sizeof(new_config));
new_config.timezone_utcoff = 0;
+
+ bile_write(tdb->bile, DB_CONFIG_RTYPE, 1, &new_config,
+ sizeof(new_config));
+ break;
+ }
+ case 16: {
+ /* 16->17, mail_prune_days */
+ struct config new_config = { 0 };
+
+ bile_read(tdb->bile, DB_CONFIG_RTYPE, 1, (char *)&new_config,
+ sizeof(new_config));
+
+ new_config.mail_prune_days = 180;
bile_write(tdb->bile, DB_CONFIG_RTYPE, 1, &new_config,
sizeof(new_config));
--- db.h Tue Mar 14 13:13:20 2023
+++ db.h Wed Mar 15 15:30:12 2023
@@ -19,7 +19,7 @@
#include <time.h>
-#define DB_CUR_VERS 16
+#define DB_CUR_VERS 17
#define SUBTEXT_CREATOR 'SUBT'
#define DB_TYPE 'STDB'
@@ -88,7 +88,7 @@ struct config {
unsigned long trusted_proxy_ip;
unsigned long modem_speed;
unsigned short trusted_proxy_udp_port;
- short session_log_days;
+ short session_log_prune_days;
char modem_parity[4];
char ftn_node_addr[32];
char ftn_hub_addr[32];
@@ -100,6 +100,7 @@ struct config {
short binkp_delete_done;
short timezone_utcoff;
char ftn_network[16];
+ short mail_prune_days;
};
extern struct struct_field config_fields[];