Explorar o código

New function enqueue_webmention().

The q_msg is queued, but nothing is done yet.
grunfink hai 1 ano
pai
achega
605b60c06e
Modificáronse 4 ficheiros con 18 adicións e 1 borrados
  1. 13 0
      data.c
  2. 3 1
      html.c
  3. 1 0
      main.c
  4. 1 0
      snac.h

+ 13 - 0
data.c

@@ -3473,6 +3473,19 @@ void enqueue_actor_refresh(snac *user, const char *actor, int forward_secs)
 }
 
 
+void enqueue_webmention(const xs_dict *msg)
+/* enqueues a webmention for the post */
+{
+    xs *qmsg   = _new_qmsg("webmention", msg, 0);
+    const char *ntid = xs_dict_get(qmsg, "ntid");
+    xs *fn     = xs_fmt("%s/queue/%s.json", srv_basedir, ntid);
+
+    qmsg = _enqueue_put(fn, qmsg);
+
+    srv_debug(1, xs_fmt("enqueue_webmention"));
+}
+
+
 int was_question_voted(snac *user, const char *id)
 /* returns true if the user voted in this poll */
 {

+ 3 - 1
html.c

@@ -4488,8 +4488,10 @@ int html_post_handler(const xs_dict *req, const char *q_path,
                     snac_log(&snac, xs_fmt("cannot get object '%s' for editing", edit_id));
             }
 
-            if (c_msg != NULL)
+            if (c_msg != NULL) {
                 enqueue_message(&snac, c_msg);
+                enqueue_webmention(msg);
+            }
 
             history_del(&snac, "timeline.html_");
         }

+ 1 - 0
main.c

@@ -830,6 +830,7 @@ int main(int argc, char *argv[])
         }
 
         enqueue_message(&snac, c_msg);
+        enqueue_webmention(msg);
 
         timeline_add(&snac, xs_dict_get(msg, "id"), msg);
 

+ 1 - 0
snac.h

@@ -289,6 +289,7 @@ void enqueue_close_question(snac *user, const char *id, int end_secs);
 void enqueue_object_request(snac *user, const char *id, int forward_secs);
 void enqueue_verify_links(snac *user);
 void enqueue_actor_refresh(snac *user, const char *actor, int forward_secs);
+void enqueue_webmention(const xs_dict *msg);
 int was_question_voted(snac *user, const char *id);
 
 xs_list *user_queue(snac *snac);