summaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authorGravatar default2023-08-07 06:38:19 +0200
committerGravatar default2023-08-07 06:38:19 +0200
commita3f1387daaaa15253a242876aa0e9e4639e8e23d (patch)
tree11d2dda4c56446b878790117f6e9b75185301ba8 /data.c
parentSome fixes to limiting actors. (diff)
downloadsnac2-a3f1387daaaa15253a242876aa0e9e4639e8e23d.tar.gz
snac2-a3f1387daaaa15253a242876aa0e9e4639e8e23d.tar.xz
snac2-a3f1387daaaa15253a242876aa0e9e4639e8e23d.zip
Only create the limited/ folder in calling limit().
Diffstat (limited to 'data.c')
-rw-r--r--data.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/data.c b/data.c
index 61438b7..e1e5484 100644
--- a/data.c
+++ b/data.c
@@ -1506,11 +1506,9 @@ int limited(snac *user, const char *id, int cmd)
1506/* announce messages from a followed (0: check, 1: limit; 2: unlimit) */ 1506/* announce messages from a followed (0: check, 1: limit; 2: unlimit) */
1507{ 1507{
1508 int ret = 0; 1508 int ret = 0;
1509 xs *fn = xs_fmt("%s/limited/", user->basedir); 1509 xs *dir = xs_fmt("%s/limited", user->basedir);
1510 mkdirx(fn);
1511
1512 xs *md5 = xs_md5_hex(id, strlen(id)); 1510 xs *md5 = xs_md5_hex(id, strlen(id));
1513 fn = xs_str_cat(fn, md5); 1511 xs *fn = xs_fmt("%s/%s", dir, md5);
1514 1512
1515 switch (cmd) { 1513 switch (cmd) {
1516 case 0: /** check **/ 1514 case 0: /** check **/
@@ -1518,6 +1516,8 @@ int limited(snac *user, const char *id, int cmd)
1518 break; 1516 break;
1519 1517
1520 case 1: /** limit **/ 1518 case 1: /** limit **/
1519 mkdirx(dir);
1520
1521 if (mtime(fn) > 0.0) 1521 if (mtime(fn) > 0.0)
1522 ret = -1; 1522 ret = -1;
1523 else { 1523 else {