mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-28 23:53:36 +00:00
New command-line command 'unfollow'.
This commit is contained in:
parent
3a1123bfa4
commit
45f0988fb3
1 changed files with 19 additions and 0 deletions
19
main.c
19
main.c
|
@ -22,6 +22,7 @@ int usage(void)
|
|||
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("check {basedir} [{uid}] Checks the database\n");
|
||||
|
||||
|
@ -177,6 +178,24 @@ int main(int argc, char *argv[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (strcmp(cmd, "unfollow") == 0) {
|
||||
xs *object = NULL;
|
||||
|
||||
if (valid_status(following_get(&snac, url, &object))) {
|
||||
xs *msg = msg_undo(&snac, xs_dict_get(object, "object"));
|
||||
|
||||
following_del(&snac, url);
|
||||
|
||||
enqueue_output(&snac, msg, url, 0);
|
||||
|
||||
snac_log(&snac, xs_fmt("unfollowed actor %s", url));
|
||||
}
|
||||
else
|
||||
snac_log(&snac, xs_fmt("actor is not being followed %s", url));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strcmp(cmd, "request") == 0) {
|
||||
int status;
|
||||
xs *data = NULL;
|
||||
|
|
Loading…
Reference in a new issue