commit be98082
default
·
2024-10-27 07:53:10 +0000 UTC
parent 0d6659a
New command line action 'insert'.
1 files changed,
+18,
-0
M
main.c
M
main.c
+18,
-0
1@@ -30,6 +30,7 @@ int usage(void)
2 printf("follow {basedir} {uid} {actor} Follows an actor\n");
3 printf("unfollow {basedir} {uid} {actor} Unfollows an actor\n");
4 printf("request {basedir} {uid} {url} Requests an object\n");
5+ printf("insert {basedir} {uid} {url} Requests an object and inserts it into the timeline\n");
6 printf("actor {basedir} [{uid}] {url} Requests an actor\n");
7 printf("note {basedir} {uid} {text} [files...] Sends a note with optional attachments\n");
8 printf("boost|announce {basedir} {uid} {url} Boosts (announces) a post\n");
9@@ -546,6 +547,23 @@ int main(int argc, char *argv[])
10 return 0;
11 }
12
13+ if (strcmp(cmd, "insert") == 0) { /** **/
14+ int status;
15+ xs *data = NULL;
16+
17+ status = activitypub_request(&snac, url, &data);
18+
19+ printf("status: %d\n", status);
20+
21+ if (data != NULL) {
22+ xs_json_dump(data, 4, stdout);
23+ enqueue_actor_refresh(&snac, xs_dict_get(data, "attributedTo"), 0);
24+ timeline_add(&snac, url, data);
25+ }
26+
27+ return 0;
28+ }
29+
30 if (strcmp(cmd, "request2") == 0) { /** **/
31 enqueue_object_request(&snac, url, 2);
32