summaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-02-05 19:09:22 +0100
committerdefault <nobody@localhost>2023-02-05 19:09:22 +0100
commit70c73d03363e890c4d7f85287fa7624160b1c352 (patch)
tree1af3c8c37688152875f857c6ae664d8104ad2768 /data.c
parent143c73500bb2a528f2a124e0a5ca34259a44bf05 (diff)
New user option 'purge_days'.
Diffstat (limited to 'data.c')
-rw-r--r--data.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/data.c b/data.c
index 0d85efd..fd5d02c 100644
--- a/data.c
+++ b/data.c
@@ -1575,11 +1575,24 @@ void purge_server(void)
void purge_user(snac *snac)
/* do the purge for this user */
{
- int priv_days, pub_days;
+ int priv_days, pub_days, user_days = 0;
+ char *v;
priv_days = xs_number_get(xs_dict_get(srv_config, "timeline_purge_days"));
pub_days = xs_number_get(xs_dict_get(srv_config, "local_purge_days"));
+ if ((v = xs_dict_get(snac->config, "purge_days")) != NULL)
+ user_days = xs_number_get(v);
+
+ if (user_days) {
+ /* override admin settings only if they are lesser */
+ if (priv_days == 0 || user_days < priv_days)
+ priv_days = user_days;
+
+ if (pub_days == 0 || user_days < pub_days)
+ pub_days = user_days;
+ }
+
_purge_subdir(snac, "hidden", priv_days);
_purge_subdir(snac, "private", priv_days);