diff options
| author | 2022-10-13 15:44:38 +0200 | |
|---|---|---|
| committer | 2022-10-13 15:44:38 +0200 | |
| commit | 45f0988fb390f20356e6cc03d7303367122fc465 (patch) | |
| tree | 544cae303136f7d3bc65da485fac1d12914220b0 | |
| parent | Added beers to emoticon shortcodes because yes. (diff) | |
| download | snac2-45f0988fb390f20356e6cc03d7303367122fc465.tar.gz snac2-45f0988fb390f20356e6cc03d7303367122fc465.tar.xz snac2-45f0988fb390f20356e6cc03d7303367122fc465.zip | |
New command-line command 'unfollow'.
| -rw-r--r-- | main.c | 19 |
1 files changed, 19 insertions, 0 deletions
| @@ -22,6 +22,7 @@ int usage(void) | |||
| 22 | printf("webfinger {basedir} {user} Queries about a @user@host or actor\n"); | 22 | printf("webfinger {basedir} {user} Queries about a @user@host or actor\n"); |
| 23 | printf("queue {basedir} {uid} Processes a user queue\n"); | 23 | printf("queue {basedir} {uid} Processes a user queue\n"); |
| 24 | printf("follow {basedir} {uid} {actor} Follows an actor\n"); | 24 | printf("follow {basedir} {uid} {actor} Follows an actor\n"); |
| 25 | printf("unfollow {basedir} {uid} {actor} Unfollows an actor\n"); | ||
| 25 | 26 | ||
| 26 | // printf("check {basedir} [{uid}] Checks the database\n"); | 27 | // printf("check {basedir} [{uid}] Checks the database\n"); |
| 27 | 28 | ||
| @@ -177,6 +178,24 @@ int main(int argc, char *argv[]) | |||
| 177 | return 0; | 178 | return 0; |
| 178 | } | 179 | } |
| 179 | 180 | ||
| 181 | if (strcmp(cmd, "unfollow") == 0) { | ||
| 182 | xs *object = NULL; | ||
| 183 | |||
| 184 | if (valid_status(following_get(&snac, url, &object))) { | ||
| 185 | xs *msg = msg_undo(&snac, xs_dict_get(object, "object")); | ||
| 186 | |||
| 187 | following_del(&snac, url); | ||
| 188 | |||
| 189 | enqueue_output(&snac, msg, url, 0); | ||
| 190 | |||
| 191 | snac_log(&snac, xs_fmt("unfollowed actor %s", url)); | ||
| 192 | } | ||
| 193 | else | ||
| 194 | snac_log(&snac, xs_fmt("actor is not being followed %s", url)); | ||
| 195 | |||
| 196 | return 0; | ||
| 197 | } | ||
| 198 | |||
| 180 | if (strcmp(cmd, "request") == 0) { | 199 | if (strcmp(cmd, "request") == 0) { |
| 181 | int status; | 200 | int status; |
| 182 | xs *data = NULL; | 201 | xs *data = NULL; |