diff options
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) | |||
| 1658 | } | 1658 | } |
| 1659 | 1659 | ||
| 1660 | 1660 | ||
| 1661 | /** drafts **/ | ||
| 1662 | |||
| 1663 | int is_draft(snac *user, const char *id) | ||
| 1664 | /* returns true if this note is a draft */ | ||
| 1665 | { | ||
| 1666 | return object_user_cache_in(user, id, "draft"); | ||
| 1667 | } | ||
| 1668 | |||
| 1669 | |||
| 1670 | void draft_del(snac *user, const char *id) | ||
| 1671 | /* delete a message from the draft cache */ | ||
| 1672 | { | ||
| 1673 | object_user_cache_del(user, id, "draft"); | ||
| 1674 | } | ||
| 1675 | |||
| 1676 | |||
| 1677 | void draft_add(snac *user, const char *id, const xs_dict *msg) | ||
| 1678 | /* store the message as a draft */ | ||
| 1679 | { | ||
| 1680 | /* delete from the index, in case it was already there */ | ||
| 1681 | draft_del(user, id); | ||
| 1682 | |||
| 1683 | /* overwrite object */ | ||
| 1684 | object_add_ow(id, msg); | ||
| 1685 | |||
| 1686 | /* [re]add to the index */ | ||
| 1687 | object_user_cache_add(user, id, "draft"); | ||
| 1688 | } | ||
| 1689 | |||
| 1690 | |||
| 1661 | /** hiding **/ | 1691 | /** hiding **/ |
| 1662 | 1692 | ||
| 1663 | xs_str *_hidden_fn(snac *snac, const char *id) | 1693 | xs_str *_hidden_fn(snac *snac, const char *id) |