summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorpoesty <poesty@noreply.codeberg.org>2023-05-07 07:27:24 +0000
committerpoesty <poesty@noreply.codeberg.org>2023-05-07 07:27:24 +0000
commite65760a349112abce39404ca50f6bc2f1301bed9 (patch)
treec2484af8006961d95dcf39cf16c3749100a713c9 /main.c
parent7d3a909598c1fc9def2069aeeccda58e305c738a (diff)
parent6a1cc55676eaf18ecadb42b86474aaef73cf9805 (diff)
Merge pull request 'master' (#1) from grunfink/snac2:master into master
Reviewed-on: https://codeberg.org/poesty/snac2/pulls/1
Diffstat (limited to 'main.c')
-rw-r--r--main.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/main.c b/main.c
index 6a0bb74..3f34673 100644
--- a/main.c
+++ b/main.c
@@ -30,6 +30,7 @@ int usage(void)
printf("actor {basedir} {uid} {url} Requests an actor\n");
printf("note {basedir} {uid} {'text'} Sends a note to followers\n");
printf("resetpwd {basedir} {uid} Resets the password of a user\n");
+ printf("ping {basedir} {uid} {actor} Pings an actor\n");
return 1;
}
@@ -228,6 +229,27 @@ int main(int argc, char *argv[])
return 0;
}
+ if (strcmp(cmd, "ping") == 0) {
+ xs *actor_o = NULL;
+
+ if (valid_status(actor_request(&snac, url, &actor_o))) {
+ xs *msg = msg_ping(&snac, url);
+
+ enqueue_output_by_actor(&snac, msg, url, 0);
+
+ if (dbglevel) {
+ xs *j = xs_json_dumps_pp(msg, 4);
+ printf("%s\n", j);
+ }
+ }
+ else {
+ srv_log(xs_fmt("Error getting actor %s", url));
+ return 1;
+ }
+
+ return 0;
+ }
+
if (strcmp(cmd, "request") == 0) {
int status;
xs *data = NULL;