diff options
| author | 2024-11-24 08:37:19 +0100 | |
|---|---|---|
| committer | 2024-11-24 08:37:19 +0100 | |
| commit | 129049edf4752495f768b247253cb7ffc848b0cc (patch) | |
| tree | 176241029e4a541d5b1be40f4c6e27155126c518 /data.c | |
| parent | New function pending_get() and pending_list(). (diff) | |
| download | snac2-129049edf4752495f768b247253cb7ffc848b0cc.tar.gz snac2-129049edf4752495f768b247253cb7ffc848b0cc.tar.xz snac2-129049edf4752495f768b247253cb7ffc848b0cc.zip | |
New function pending_check() and pending_del().
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 20 |
1 files changed, 20 insertions, 0 deletions
| @@ -1224,6 +1224,16 @@ int pending_add(snac *user, const char *actor, const xs_dict *msg) | |||
| 1224 | } | 1224 | } |
| 1225 | 1225 | ||
| 1226 | 1226 | ||
| 1227 | int pending_check(snac *user, const char *actor) | ||
| 1228 | /* checks if there is a pending follow confirmation for the actor */ | ||
| 1229 | { | ||
| 1230 | xs *md5 = xs_md5_hex(actor, strlen(actor)); | ||
| 1231 | xs *fn = xs_fmt("%s/pending/%s.json", user->basedir, md5); | ||
| 1232 | |||
| 1233 | return mtime(fn) != 0; | ||
| 1234 | } | ||
| 1235 | |||
| 1236 | |||
| 1227 | xs_dict *pending_get(snac *user, const char *actor) | 1237 | xs_dict *pending_get(snac *user, const char *actor) |
| 1228 | /* returns the pending follow confirmation for the actor */ | 1238 | /* returns the pending follow confirmation for the actor */ |
| 1229 | { | 1239 | { |
| @@ -1241,6 +1251,16 @@ xs_dict *pending_get(snac *user, const char *actor) | |||
| 1241 | } | 1251 | } |
| 1242 | 1252 | ||
| 1243 | 1253 | ||
| 1254 | void pending_del(snac *user, const char *actor) | ||
| 1255 | /* deletes a pending follow confirmation for the actor */ | ||
| 1256 | { | ||
| 1257 | xs *md5 = xs_md5_hex(actor, strlen(actor)); | ||
| 1258 | xs *fn = xs_fmt("%s/pending/%s.json", user->basedir, md5); | ||
| 1259 | |||
| 1260 | unlink(fn); | ||
| 1261 | } | ||
| 1262 | |||
| 1263 | |||
| 1244 | xs_list *pending_list(snac *user) | 1264 | xs_list *pending_list(snac *user) |
| 1245 | /* returns a list of pending follow confirmations */ | 1265 | /* returns a list of pending follow confirmations */ |
| 1246 | { | 1266 | { |