diff options
| author | 2023-05-05 09:54:41 +0200 | |
|---|---|---|
| committer | 2023-05-05 09:54:41 +0200 | |
| commit | d3a36218a6ebfc951ff38c410ac1c29ec15c3c7f (patch) | |
| tree | 029f4a81193e739d8254db83699349a4983a9983 /main.c | |
| parent | Updated documentation. (diff) | |
| download | penes-snac2-d3a36218a6ebfc951ff38c410ac1c29ec15c3c7f.tar.gz penes-snac2-d3a36218a6ebfc951ff38c410ac1c29ec15c3c7f.tar.xz penes-snac2-d3a36218a6ebfc951ff38c410ac1c29ec15c3c7f.zip | |
Implemented 'Ping' and 'Pong' activities.
According to https://humungus.tedunangst.com/r/honk/v/tip/f/docs/ping.txt
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 14 |
1 files changed, 14 insertions, 0 deletions
| @@ -30,6 +30,7 @@ int usage(void) | |||
| 30 | printf("actor {basedir} {uid} {url} Requests an actor\n"); | 30 | printf("actor {basedir} {uid} {url} Requests an actor\n"); |
| 31 | printf("note {basedir} {uid} {'text'} Sends a note to followers\n"); | 31 | printf("note {basedir} {uid} {'text'} Sends a note to followers\n"); |
| 32 | printf("resetpwd {basedir} {uid} Resets the password of a user\n"); | 32 | printf("resetpwd {basedir} {uid} Resets the password of a user\n"); |
| 33 | printf("ping {basedir} {uid} {actor} Pings an actor\n"); | ||
| 33 | 34 | ||
| 34 | return 1; | 35 | return 1; |
| 35 | } | 36 | } |
| @@ -228,6 +229,19 @@ int main(int argc, char *argv[]) | |||
| 228 | return 0; | 229 | return 0; |
| 229 | } | 230 | } |
| 230 | 231 | ||
| 232 | if (strcmp(cmd, "ping") == 0) { | ||
| 233 | xs *msg = msg_ping(&snac, url); | ||
| 234 | |||
| 235 | enqueue_output_by_actor(&snac, msg, url, 0); | ||
| 236 | |||
| 237 | if (dbglevel) { | ||
| 238 | xs *j = xs_json_dumps_pp(msg, 4); | ||
| 239 | printf("%s\n", msg); | ||
| 240 | } | ||
| 241 | |||
| 242 | return 0; | ||
| 243 | } | ||
| 244 | |||
| 231 | if (strcmp(cmd, "request") == 0) { | 245 | if (strcmp(cmd, "request") == 0) { |
| 232 | int status; | 246 | int status; |
| 233 | xs *data = NULL; | 247 | xs *data = NULL; |