From e0c6fb786c3b72b8a789041db2909fa7d1d880de Mon Sep 17 00:00:00 2001 From: default Date: Tue, 13 Jun 2023 20:36:43 +0200 Subject: New function webfinger_request_signed(). --- main.c | 49 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 15 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index e2de58e..97f47de 100644 --- a/main.c +++ b/main.c @@ -16,20 +16,21 @@ int usage(void) printf("\n"); printf("Commands:\n"); printf("\n"); - printf("init [{basedir}] Initializes the data storage\n"); - printf("upgrade {basedir} Upgrade to a new version\n"); - printf("adduser {basedir} [{uid}] Adds a new user\n"); - printf("httpd {basedir} Starts the HTTPD daemon\n"); - printf("purge {basedir} Purges old data\n"); - printf("webfinger {basedir} {user} Queries about a @user@host or actor\n"); - printf("queue {basedir} {uid} Processes a user queue\n"); - printf("follow {basedir} {uid} {actor} Follows an actor\n"); - printf("unfollow {basedir} {uid} {actor} Unfollows an actor\n"); - printf("request {basedir} {uid} {url} Requests an object\n"); - 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"); + printf("init [{basedir}] Initializes the data storage\n"); + printf("upgrade {basedir} Upgrade to a new version\n"); + printf("adduser {basedir} [{uid}] Adds a new user\n"); + printf("httpd {basedir} Starts the HTTPD daemon\n"); + printf("purge {basedir} Purges old data\n"); + printf("webfinger {basedir} {actor} Queries about an actor (@user@host or actor url)\n"); + printf("queue {basedir} {uid} Processes a user queue\n"); + printf("follow {basedir} {uid} {actor} Follows an actor\n"); + printf("unfollow {basedir} {uid} {actor} Unfollows an actor\n"); + printf("request {basedir} {uid} {url} Requests an object\n"); + 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"); + printf("webfinger_s {basedir} {uid} {actor} Queries about an actor (@user@host or actor url)\n"); /* printf("question {basedir} {uid} 'opts' Generates a poll (;-separated opts)\n");*/ return 1; @@ -179,6 +180,22 @@ int main(int argc, char *argv[]) if ((url = GET_ARGV()) == NULL) return usage(); + if (strcmp(cmd, "webfinger_s") == 0) { /** **/ + xs *actor = NULL; + xs *uid = NULL; + int status; + + status = webfinger_request_signed(&snac, url, &actor, &uid); + + printf("status: %d\n", status); + if (actor != NULL) + printf("actor: %s\n", actor); + if (uid != NULL) + printf("uid: %s\n", uid); + + return 0; + } + if (strcmp(cmd, "announce") == 0) { /** **/ xs *msg = msg_admiration(&snac, url, "Announce"); @@ -352,5 +369,7 @@ int main(int argc, char *argv[]) return 0; } - return 0; + fprintf(stderr, "ERROR: bad command '%s'\n", cmd); + + return 1; } -- cgit v1.2.3