diff options
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 22 |
1 files changed, 22 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,27 @@ int main(int argc, char *argv[]) | |||
| 228 | return 0; | 229 | return 0; |
| 229 | } | 230 | } |
| 230 | 231 | ||
| 232 | if (strcmp(cmd, "ping") == 0) { | ||
| 233 | xs *actor_o = NULL; | ||
| 234 | |||
| 235 | if (valid_status(actor_request(&snac, url, &actor_o))) { | ||
| 236 | xs *msg = msg_ping(&snac, url); | ||
| 237 | |||
| 238 | enqueue_output_by_actor(&snac, msg, url, 0); | ||
| 239 | |||
| 240 | if (dbglevel) { | ||
| 241 | xs *j = xs_json_dumps_pp(msg, 4); | ||
| 242 | printf("%s\n", j); | ||
| 243 | } | ||
| 244 | } | ||
| 245 | else { | ||
| 246 | srv_log(xs_fmt("Error getting actor %s", url)); | ||
| 247 | return 1; | ||
| 248 | } | ||
| 249 | |||
| 250 | return 0; | ||
| 251 | } | ||
| 252 | |||
| 231 | if (strcmp(cmd, "request") == 0) { | 253 | if (strcmp(cmd, "request") == 0) { |
| 232 | int status; | 254 | int status; |
| 233 | xs *data = NULL; | 255 | xs *data = NULL; |