diff options
author | default <nobody@localhost> | 2022-09-20 12:50:37 +0200 |
---|---|---|
committer | default <nobody@localhost> | 2022-09-20 12:50:37 +0200 |
commit | 922b04b4d79c01d13a0de71edf934f019f5a9771 (patch) | |
tree | 3d9af6fd42033e5dabfd6cd0187c1130ab6ecb6d /data.c | |
parent | e923a4f5ec586d9dcec90e585b8d50cfbeafb8a1 (diff) |
New function dequeue().
Diffstat (limited to 'data.c')
-rw-r--r-- | data.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -587,3 +587,23 @@ d_char *queue(snac *snac) return list; } + + +d_char *dequeue(snac *snac, char *fn) +/* dequeues a message */ +{ + FILE *f; + d_char *obj = NULL; + + if ((f = fopen(fn, "r")) != NULL) { + /* delete right now */ + unlink(fn); + + xs *j = xs_readall(f); + obj = xs_json_loads(j); + + fclose(f); + } + + return obj; +} |