diff options
| author | 2023-02-05 19:09:22 +0100 | |
|---|---|---|
| committer | 2023-02-05 19:09:22 +0100 | |
| commit | 70c73d03363e890c4d7f85287fa7624160b1c352 (patch) | |
| tree | 1af3c8c37688152875f857c6ae664d8104ad2768 /data.c | |
| parent | Reworked purge_user() to be clearer. (diff) | |
| download | snac2-70c73d03363e890c4d7f85287fa7624160b1c352.tar.gz snac2-70c73d03363e890c4d7f85287fa7624160b1c352.tar.xz snac2-70c73d03363e890c4d7f85287fa7624160b1c352.zip | |
New user option 'purge_days'.
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 15 |
1 files changed, 14 insertions, 1 deletions
| @@ -1575,11 +1575,24 @@ void purge_server(void) | |||
| 1575 | void purge_user(snac *snac) | 1575 | void purge_user(snac *snac) |
| 1576 | /* do the purge for this user */ | 1576 | /* do the purge for this user */ |
| 1577 | { | 1577 | { |
| 1578 | int priv_days, pub_days; | 1578 | int priv_days, pub_days, user_days = 0; |
| 1579 | char *v; | ||
| 1579 | 1580 | ||
| 1580 | priv_days = xs_number_get(xs_dict_get(srv_config, "timeline_purge_days")); | 1581 | priv_days = xs_number_get(xs_dict_get(srv_config, "timeline_purge_days")); |
| 1581 | pub_days = xs_number_get(xs_dict_get(srv_config, "local_purge_days")); | 1582 | pub_days = xs_number_get(xs_dict_get(srv_config, "local_purge_days")); |
| 1582 | 1583 | ||
| 1584 | if ((v = xs_dict_get(snac->config, "purge_days")) != NULL) | ||
| 1585 | user_days = xs_number_get(v); | ||
| 1586 | |||
| 1587 | if (user_days) { | ||
| 1588 | /* override admin settings only if they are lesser */ | ||
| 1589 | if (priv_days == 0 || user_days < priv_days) | ||
| 1590 | priv_days = user_days; | ||
| 1591 | |||
| 1592 | if (pub_days == 0 || user_days < pub_days) | ||
| 1593 | pub_days = user_days; | ||
| 1594 | } | ||
| 1595 | |||
| 1583 | _purge_subdir(snac, "hidden", priv_days); | 1596 | _purge_subdir(snac, "hidden", priv_days); |
| 1584 | _purge_subdir(snac, "private", priv_days); | 1597 | _purge_subdir(snac, "private", priv_days); |
| 1585 | 1598 | ||