commit 8823325

default  ·  2023-12-10 09:36:14 +0000 UTC
parent 90179f8
The 'actor' command from the command-line allows non-signed queries.
1 files changed,  +17, -1
M main.c
M main.c
+17, -1
 1@@ -27,7 +27,7 @@ int usage(void)
 2     printf("follow {basedir} {uid} {actor}      Follows an actor\n");
 3     printf("unfollow {basedir} {uid} {actor}    Unfollows an actor\n");
 4     printf("request {basedir} {uid} {url}       Requests an object\n");
 5-    printf("actor {basedir} {uid} {url}         Requests an actor\n");
 6+    printf("actor {basedir} [{uid}] {url}       Requests an actor\n");
 7     printf("note {basedir} {uid} {'text'}       Sends a note to followers\n");
 8     printf("resetpwd {basedir} {uid}            Resets the password of a user\n");
 9     printf("ping {basedir} {uid} {actor}        Pings an actor\n");
10@@ -179,6 +179,22 @@ int main(int argc, char *argv[])
11         return 0;
12     }
13 
14+    if (argi == argc && strcmp(cmd, "actor") == 0) { /** **/
15+        /* query an actor without user (non-signed) */
16+        xs *actor = NULL;
17+        int status;
18+
19+        status = actor_request(NULL, user, &actor);
20+
21+        printf("status: %d\n", status);
22+        if (valid_status(status)) {
23+            xs_json_dump(actor, 4, stdout);
24+            printf("\n");
25+        }
26+
27+        return 0;
28+    }
29+
30     if (!user_open(&snac, user)) {
31         printf("invalid user '%s'\n", user);
32         return 1;