mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-22 13:25:04 +00:00
Added command-line interface for limit/unlimit users.
This commit is contained in:
parent
28adb6c850
commit
106791ff6b
2 changed files with 31 additions and 1 deletions
|
@ -1570,7 +1570,7 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
|
||||||
snac_log(snac, xs_fmt("dropped 'Announce' from limited actor %s", actor));
|
snac_log(snac, xs_fmt("dropped 'Announce' from limited actor %s", actor));
|
||||||
else
|
else
|
||||||
if (valid_status(object_get(object, &a_msg))) {
|
if (valid_status(object_get(object, &a_msg))) {
|
||||||
char *who = xs_dict_get(a_msg, "attributedTo");
|
const char *who = xs_dict_get(a_msg, "attributedTo");
|
||||||
|
|
||||||
if (who && !is_muted(snac, who)) {
|
if (who && !is_muted(snac, who)) {
|
||||||
/* bring the actor */
|
/* bring the actor */
|
||||||
|
|
30
main.c
30
main.c
|
@ -35,6 +35,8 @@ int usage(void)
|
||||||
printf("unpin {basedir} {uid} {msg_url} Unpins a message\n");
|
printf("unpin {basedir} {uid} {msg_url} Unpins a message\n");
|
||||||
printf("block {basedir} {instance_url} Blocks a full instance\n");
|
printf("block {basedir} {instance_url} Blocks a full instance\n");
|
||||||
printf("unblock {basedir} {instance_url} Unblocks a full instance\n");
|
printf("unblock {basedir} {instance_url} Unblocks a full instance\n");
|
||||||
|
printf("limit {basedir} {uid} {actor} Limits an actor (drops their announces)\n");
|
||||||
|
printf("unlimit {basedir} {uid} {actor} Unlimits an actor\n");
|
||||||
|
|
||||||
/* printf("question {basedir} {uid} 'opts' Generates a poll (;-separated opts)\n");*/
|
/* printf("question {basedir} {uid} 'opts' Generates a poll (;-separated opts)\n");*/
|
||||||
|
|
||||||
|
@ -272,6 +274,34 @@ int main(int argc, char *argv[])
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strcmp(cmd, "limit") == 0) { /** **/
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (!following_check(&snac, url))
|
||||||
|
snac_log(&snac, xs_fmt("actor %s is not being followed", url));
|
||||||
|
else
|
||||||
|
if ((ret = limit(&snac, url)) == 0)
|
||||||
|
snac_log(&snac, xs_fmt("actor %s is now limited", url));
|
||||||
|
else
|
||||||
|
snac_log(&snac, xs_fmt("error limiting actor %s (%d)", url, ret));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcmp(cmd, "unlimit") == 0) { /** **/
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (!following_check(&snac, url))
|
||||||
|
snac_log(&snac, xs_fmt("actor %s is not being followed", url));
|
||||||
|
else
|
||||||
|
if ((ret = unlimit(&snac, url)) == 0)
|
||||||
|
snac_log(&snac, xs_fmt("actor %s is no longer limited", url));
|
||||||
|
else
|
||||||
|
snac_log(&snac, xs_fmt("error unlimiting actor %s (%d)", url, ret));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (strcmp(cmd, "ping") == 0) { /** **/
|
if (strcmp(cmd, "ping") == 0) { /** **/
|
||||||
xs *actor_o = NULL;
|
xs *actor_o = NULL;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue