diff options
| author | default <nobody@localhost> | 2024-09-06 09:54:27 +0200 |
|---|---|---|
| committer | default <nobody@localhost> | 2024-09-06 09:54:27 +0200 |
| commit | 7286216f14a8baffff31cdbfa1507c93376e3119 (patch) | |
| tree | 66e1613b57fea3af2f4f890ff898fca00bfae486 /data.c | |
| parent | 97c4af001b800c6195076ad50eb969e20f484262 (diff) | |
Some new draft functions.
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -1658,6 +1658,36 @@ xs_list *pinned_list(snac *user) } +/** drafts **/ + +int is_draft(snac *user, const char *id) +/* returns true if this note is a draft */ +{ + return object_user_cache_in(user, id, "draft"); +} + + +void draft_del(snac *user, const char *id) +/* delete a message from the draft cache */ +{ + object_user_cache_del(user, id, "draft"); +} + + +void draft_add(snac *user, const char *id, const xs_dict *msg) +/* store the message as a draft */ +{ + /* delete from the index, in case it was already there */ + draft_del(user, id); + + /* overwrite object */ + object_add_ow(id, msg); + + /* [re]add to the index */ + object_user_cache_add(user, id, "draft"); +} + + /** hiding **/ xs_str *_hidden_fn(snac *snac, const char *id) |