diff options
Diffstat (limited to 'mastoapi.c')
| -rw-r--r-- | mastoapi.c | 22 |
1 files changed, 16 insertions, 6 deletions
| @@ -2726,14 +2726,24 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path, | |||
| 2726 | msg = xs_dict_set(msg, "summary", summary); | 2726 | msg = xs_dict_set(msg, "summary", summary); |
| 2727 | } | 2727 | } |
| 2728 | 2728 | ||
| 2729 | /* store */ | 2729 | /* scheduled? */ |
| 2730 | timeline_add(&snac, xs_dict_get(msg, "id"), msg); | 2730 | const char *scheduled_at = xs_dict_get(args, "scheduled_at"); |
| 2731 | 2731 | ||
| 2732 | /* 'Create' message */ | 2732 | if (xs_is_string(scheduled_at) && *scheduled_at) { |
| 2733 | xs *c_msg = msg_create(&snac, msg); | 2733 | msg = xs_dict_set(msg, "published", scheduled_at); |
| 2734 | enqueue_message(&snac, c_msg); | ||
| 2735 | 2734 | ||
| 2736 | timeline_touch(&snac); | 2735 | schedule_add(&snac, xs_dict_get(msg, "id"), msg); |
| 2736 | } | ||
| 2737 | else { | ||
| 2738 | /* store */ | ||
| 2739 | timeline_add(&snac, xs_dict_get(msg, "id"), msg); | ||
| 2740 | |||
| 2741 | /* 'Create' message */ | ||
| 2742 | xs *c_msg = msg_create(&snac, msg); | ||
| 2743 | enqueue_message(&snac, c_msg); | ||
| 2744 | |||
| 2745 | timeline_touch(&snac); | ||
| 2746 | } | ||
| 2737 | 2747 | ||
| 2738 | /* convert to a mastodon status as a response code */ | 2748 | /* convert to a mastodon status as a response code */ |
| 2739 | xs *st = mastoapi_status(&snac, msg); | 2749 | xs *st = mastoapi_status(&snac, msg); |