commit 605b60c

grunfink  ·  2025-05-03 17:16:21 +0000 UTC
parent 7f38c74
New function enqueue_webmention().

The q_msg is queued, but nothing is done yet.
4 files changed,  +18, -1
M data.c
M html.c
M main.c
M snac.h
M data.c
+13, -0
 1@@ -3473,6 +3473,19 @@ void enqueue_actor_refresh(snac *user, const char *actor, int forward_secs)
 2 }
 3 
 4 
 5+void enqueue_webmention(const xs_dict *msg)
 6+/* enqueues a webmention for the post */
 7+{
 8+    xs *qmsg   = _new_qmsg("webmention", msg, 0);
 9+    const char *ntid = xs_dict_get(qmsg, "ntid");
10+    xs *fn     = xs_fmt("%s/queue/%s.json", srv_basedir, ntid);
11+
12+    qmsg = _enqueue_put(fn, qmsg);
13+
14+    srv_debug(1, xs_fmt("enqueue_webmention"));
15+}
16+
17+
18 int was_question_voted(snac *user, const char *id)
19 /* returns true if the user voted in this poll */
20 {
M html.c
+3, -1
 1@@ -4488,8 +4488,10 @@ int html_post_handler(const xs_dict *req, const char *q_path,
 2                     snac_log(&snac, xs_fmt("cannot get object '%s' for editing", edit_id));
 3             }
 4 
 5-            if (c_msg != NULL)
 6+            if (c_msg != NULL) {
 7                 enqueue_message(&snac, c_msg);
 8+                enqueue_webmention(msg);
 9+            }
10 
11             history_del(&snac, "timeline.html_");
12         }
M main.c
+1, -0
1@@ -830,6 +830,7 @@ int main(int argc, char *argv[])
2         }
3 
4         enqueue_message(&snac, c_msg);
5+        enqueue_webmention(msg);
6 
7         timeline_add(&snac, xs_dict_get(msg, "id"), msg);
8 
M snac.h
+1, -0
1@@ -289,6 +289,7 @@ void enqueue_close_question(snac *user, const char *id, int end_secs);
2 void enqueue_object_request(snac *user, const char *id, int forward_secs);
3 void enqueue_verify_links(snac *user);
4 void enqueue_actor_refresh(snac *user, const char *actor, int forward_secs);
5+void enqueue_webmention(const xs_dict *msg);
6 int was_question_voted(snac *user, const char *id);
7 
8 xs_list *user_queue(snac *snac);