aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2024-10-27 08:53:10 +0100
committerdefault <nobody@localhost>2024-10-27 08:53:10 +0100
commitbe98082eee0e0d523560912cd7b5103028ea4826 (patch)
tree2e5574f71f5cdaca03bad88bbfaef9e88600afcc /main.c
parent0d6659af739ac45c7bb8e9bc6e916425076e9c71 (diff)
New command line action 'insert'.
Diffstat (limited to 'main.c')
-rw-r--r--main.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/main.c b/main.c
index 587aae1..c6fff5f 100644
--- a/main.c
+++ b/main.c
@@ -30,6 +30,7 @@ int usage(void)
printf("follow {basedir} {uid} {actor} Follows an actor\n");
printf("unfollow {basedir} {uid} {actor} Unfollows an actor\n");
printf("request {basedir} {uid} {url} Requests an object\n");
+ printf("insert {basedir} {uid} {url} Requests an object and inserts it into the timeline\n");
printf("actor {basedir} [{uid}] {url} Requests an actor\n");
printf("note {basedir} {uid} {text} [files...] Sends a note with optional attachments\n");
printf("boost|announce {basedir} {uid} {url} Boosts (announces) a post\n");
@@ -546,6 +547,23 @@ int main(int argc, char *argv[])
return 0;
}
+ if (strcmp(cmd, "insert") == 0) { /** **/
+ int status;
+ xs *data = NULL;
+
+ status = activitypub_request(&snac, url, &data);
+
+ printf("status: %d\n", status);
+
+ if (data != NULL) {
+ xs_json_dump(data, 4, stdout);
+ enqueue_actor_refresh(&snac, xs_dict_get(data, "attributedTo"), 0);
+ timeline_add(&snac, url, data);
+ }
+
+ return 0;
+ }
+
if (strcmp(cmd, "request2") == 0) { /** **/
enqueue_object_request(&snac, url, 2);