diff options
| author | 2023-06-28 20:52:09 +0200 | |
|---|---|---|
| committer | 2023-06-28 20:52:09 +0200 | |
| commit | af180685bdb430e90e3c4057c87595520ee385b4 (patch) | |
| tree | 65db25c5b4d5f273224a61109e18554ede0997d2 /main.c | |
| parent | Also purge pinned.idx. (diff) | |
| download | penes-snac2-af180685bdb430e90e3c4057c87595520ee385b4.tar.gz penes-snac2-af180685bdb430e90e3c4057c87595520ee385b4.tar.xz penes-snac2-af180685bdb430e90e3c4057c87595520ee385b4.zip | |
Added some error control to pinning.
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 22 |
1 files changed, 22 insertions, 0 deletions
| @@ -31,6 +31,8 @@ int usage(void) | |||
| 31 | printf("resetpwd {basedir} {uid} Resets the password of a user\n"); | 31 | printf("resetpwd {basedir} {uid} Resets the password of a user\n"); |
| 32 | printf("ping {basedir} {uid} {actor} Pings an actor\n"); | 32 | printf("ping {basedir} {uid} {actor} Pings an actor\n"); |
| 33 | printf("webfinger_s {basedir} {uid} {actor} Queries about an actor (@user@host or actor url)\n"); | 33 | printf("webfinger_s {basedir} {uid} {actor} Queries about an actor (@user@host or actor url)\n"); |
| 34 | printf("pin {basedir} {uid} {msg_url} Pins a message\n"); | ||
| 35 | printf("unpin {basedir} {uid} {msg_url} Unpins a message\n"); | ||
| 34 | /* printf("question {basedir} {uid} 'opts' Generates a poll (;-separated opts)\n");*/ | 36 | /* printf("question {basedir} {uid} 'opts' Generates a poll (;-separated opts)\n");*/ |
| 35 | 37 | ||
| 36 | return 1; | 38 | return 1; |
| @@ -269,6 +271,26 @@ int main(int argc, char *argv[]) | |||
| 269 | return 0; | 271 | return 0; |
| 270 | } | 272 | } |
| 271 | 273 | ||
| 274 | if (strcmp(cmd, "pin") == 0) { /** **/ | ||
| 275 | int ret = pin(&snac, url); | ||
| 276 | if (ret < 0) { | ||
| 277 | fprintf(stderr, "error pinning %s %d\n", url, ret); | ||
| 278 | return 1; | ||
| 279 | } | ||
| 280 | |||
| 281 | return 0; | ||
| 282 | } | ||
| 283 | |||
| 284 | if (strcmp(cmd, "unpin") == 0) { /** **/ | ||
| 285 | int ret = unpin(&snac, url); | ||
| 286 | if (ret < 0) { | ||
| 287 | fprintf(stderr, "error unpinning %s %d\n", url, ret); | ||
| 288 | return 1; | ||
| 289 | } | ||
| 290 | |||
| 291 | return 0; | ||
| 292 | } | ||
| 293 | |||
| 272 | if (strcmp(cmd, "question") == 0) { /** **/ | 294 | if (strcmp(cmd, "question") == 0) { /** **/ |
| 273 | int end_secs = 5 * 60; | 295 | int end_secs = 5 * 60; |
| 274 | xs *opts = xs_split(url, ";"); | 296 | xs *opts = xs_split(url, ";"); |