snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit a3f1387daaaa15253a242876aa0e9e4639e8e23d
parent bf79c8c3707d020643387567cbcbb24461359f77
Author: default <nobody@localhost>
Date:   Mon,  7 Aug 2023 06:38:19 +0200

Only create the limited/ folder in calling limit().

Diffstat:
Mdata.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/data.c b/data.c @@ -1506,11 +1506,9 @@ int limited(snac *user, const char *id, int cmd) /* announce messages from a followed (0: check, 1: limit; 2: unlimit) */ { int ret = 0; - xs *fn = xs_fmt("%s/limited/", user->basedir); - mkdirx(fn); - + xs *dir = xs_fmt("%s/limited", user->basedir); xs *md5 = xs_md5_hex(id, strlen(id)); - fn = xs_str_cat(fn, md5); + xs *fn = xs_fmt("%s/%s", dir, md5); switch (cmd) { case 0: /** check **/ @@ -1518,6 +1516,8 @@ int limited(snac *user, const char *id, int cmd) break; case 1: /** limit **/ + mkdirx(dir); + if (mtime(fn) > 0.0) ret = -1; else {