diff options
| author | 2024-10-27 08:53:10 +0100 | |
|---|---|---|
| committer | 2024-10-27 08:53:10 +0100 | |
| commit | be98082eee0e0d523560912cd7b5103028ea4826 (patch) | |
| tree | 2e5574f71f5cdaca03bad88bbfaef9e88600afcc | |
| parent | Merge pull request 'Wrap user mention in post around span to ensure frontends... (diff) | |
| download | snac2-be98082eee0e0d523560912cd7b5103028ea4826.tar.gz snac2-be98082eee0e0d523560912cd7b5103028ea4826.tar.xz snac2-be98082eee0e0d523560912cd7b5103028ea4826.zip | |
New command line action 'insert'.
| -rw-r--r-- | main.c | 18 |
1 files changed, 18 insertions, 0 deletions
| @@ -30,6 +30,7 @@ int usage(void) | |||
| 30 | printf("follow {basedir} {uid} {actor} Follows an actor\n"); | 30 | printf("follow {basedir} {uid} {actor} Follows an actor\n"); |
| 31 | printf("unfollow {basedir} {uid} {actor} Unfollows an actor\n"); | 31 | printf("unfollow {basedir} {uid} {actor} Unfollows an actor\n"); |
| 32 | printf("request {basedir} {uid} {url} Requests an object\n"); | 32 | printf("request {basedir} {uid} {url} Requests an object\n"); |
| 33 | printf("insert {basedir} {uid} {url} Requests an object and inserts it into the timeline\n"); | ||
| 33 | printf("actor {basedir} [{uid}] {url} Requests an actor\n"); | 34 | printf("actor {basedir} [{uid}] {url} Requests an actor\n"); |
| 34 | printf("note {basedir} {uid} {text} [files...] Sends a note with optional attachments\n"); | 35 | printf("note {basedir} {uid} {text} [files...] Sends a note with optional attachments\n"); |
| 35 | printf("boost|announce {basedir} {uid} {url} Boosts (announces) a post\n"); | 36 | printf("boost|announce {basedir} {uid} {url} Boosts (announces) a post\n"); |
| @@ -546,6 +547,23 @@ int main(int argc, char *argv[]) | |||
| 546 | return 0; | 547 | return 0; |
| 547 | } | 548 | } |
| 548 | 549 | ||
| 550 | if (strcmp(cmd, "insert") == 0) { /** **/ | ||
| 551 | int status; | ||
| 552 | xs *data = NULL; | ||
| 553 | |||
| 554 | status = activitypub_request(&snac, url, &data); | ||
| 555 | |||
| 556 | printf("status: %d\n", status); | ||
| 557 | |||
| 558 | if (data != NULL) { | ||
| 559 | xs_json_dump(data, 4, stdout); | ||
| 560 | enqueue_actor_refresh(&snac, xs_dict_get(data, "attributedTo"), 0); | ||
| 561 | timeline_add(&snac, url, data); | ||
| 562 | } | ||
| 563 | |||
| 564 | return 0; | ||
| 565 | } | ||
| 566 | |||
| 549 | if (strcmp(cmd, "request2") == 0) { /** **/ | 567 | if (strcmp(cmd, "request2") == 0) { /** **/ |
| 550 | enqueue_object_request(&snac, url, 2); | 568 | enqueue_object_request(&snac, url, 2); |
| 551 | 569 | ||