summaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authorGravatar default2023-02-12 09:26:44 +0100
committerGravatar default2023-02-12 09:26:44 +0100
commitd817264e524296639eeae3e183608cb7967f76b0 (patch)
tree80e217eaddfea419189df0708de020dcdbf27f14 /data.c
parentNew file ~user/user_o.json, for the admin to override user settings. (diff)
downloadsnac2-d817264e524296639eeae3e183608cb7967f76b0.tar.gz
snac2-d817264e524296639eeae3e183608cb7967f76b0.tar.xz
snac2-d817264e524296639eeae3e183608cb7967f76b0.zip
Added a user config override for 'purge_days'.
Diffstat (limited to 'data.c')
-rw-r--r--data.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/data.c b/data.c
index c56b6a0..00bd5fa 100644
--- a/data.c
+++ b/data.c
@@ -184,20 +184,20 @@ int user_open(snac *snac, const char *uid)
184 fclose(f); 184 fclose(f);
185 185
186 if ((snac->config_o = xs_json_loads(j)) == NULL) 186 if ((snac->config_o = xs_json_loads(j)) == NULL)
187 srv_log(xs_fmt("cannot parse '%s'", cfg_file_o)); 187 srv_log(xs_fmt("error parsing '%s'", cfg_file_o));
188 } 188 }
189 189
190 if (snac->config_o == NULL) 190 if (snac->config_o == NULL)
191 snac->config_o = xs_dict_new(); 191 snac->config_o = xs_dict_new();
192 } 192 }
193 else 193 else
194 srv_log(xs_fmt("cannot parse '%s'", key_file)); 194 srv_log(xs_fmt("error parsing '%s'", key_file));
195 } 195 }
196 else 196 else
197 srv_log(xs_fmt("error opening '%s' %d", key_file, errno)); 197 srv_log(xs_fmt("error opening '%s' %d", key_file, errno));
198 } 198 }
199 else 199 else
200 srv_log(xs_fmt("cannot parse '%s'", cfg_file)); 200 srv_log(xs_fmt("error parsing '%s'", cfg_file));
201 } 201 }
202 else 202 else
203 srv_debug(2, xs_fmt("error opening '%s' %d", cfg_file, errno)); 203 srv_debug(2, xs_fmt("error opening '%s' %d", cfg_file, errno));
@@ -1648,7 +1648,8 @@ void purge_user(snac *snac)
1648 priv_days = xs_number_get(xs_dict_get(srv_config, "timeline_purge_days")); 1648 priv_days = xs_number_get(xs_dict_get(srv_config, "timeline_purge_days"));
1649 pub_days = xs_number_get(xs_dict_get(srv_config, "local_purge_days")); 1649 pub_days = xs_number_get(xs_dict_get(srv_config, "local_purge_days"));
1650 1650
1651 if ((v = xs_dict_get(snac->config, "purge_days")) != NULL) 1651 if ((v = xs_dict_get(snac->config_o, "purge_days")) != NULL ||
1652 (v = xs_dict_get(snac->config, "purge_days")) != NULL)
1652 user_days = xs_number_get(v); 1653 user_days = xs_number_get(v);
1653 1654
1654 if (user_days) { 1655 if (user_days) {