Some fixes to limiting actors.

This commit is contained in:
default 2023-08-07 06:35:31 +02:00
parent 4d9dfa9bf2
commit bf79c8c370

View file

@ -1558,37 +1558,38 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
} }
else else
if (strcmp(type, "Announce") == 0) { /** **/ if (strcmp(type, "Announce") == 0) { /** **/
xs *a_msg = NULL;
xs *wrk = NULL;
if (xs_type(object) == XSTYPE_DICT)
object = xs_dict_get(object, "id");
timeline_request(snac, &object, &wrk, 0);
if (is_limited(snac, actor)) if (is_limited(snac, actor))
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))) { xs *a_msg = NULL;
const char *who = xs_dict_get(a_msg, "attributedTo"); xs *wrk = NULL;
if (who && !is_muted(snac, who)) { if (xs_type(object) == XSTYPE_DICT)
/* bring the actor */ object = xs_dict_get(object, "id");
xs *who_o = NULL;
if (valid_status(actor_request(snac, who, &who_o))) { timeline_request(snac, &object, &wrk, 0);
timeline_admire(snac, object, actor, 0);
snac_log(snac, xs_fmt("new 'Announce' %s %s", actor, object)); if (valid_status(object_get(object, &a_msg))) {
do_notify = 1; const char *who = xs_dict_get(a_msg, "attributedTo");
if (who && !is_muted(snac, who)) {
/* bring the actor */
xs *who_o = NULL;
if (valid_status(actor_request(snac, who, &who_o))) {
timeline_admire(snac, object, actor, 0);
snac_log(snac, xs_fmt("new 'Announce' %s %s", actor, object));
do_notify = 1;
}
else
snac_log(snac, xs_fmt("dropped 'Announce' on actor request error %s", who));
} }
else else
snac_log(snac, xs_fmt("dropped 'Announce' on actor request error %s", who)); snac_log(snac, xs_fmt("ignored 'Announce' about muted actor %s", who));
} }
else else
snac_log(snac, xs_fmt("ignored 'Announce' about muted actor %s", who)); snac_debug(snac, 1, xs_fmt("error requesting 'Announce' object %s", object));
} }
else
snac_debug(snac, 1, xs_fmt("error requesting 'Announce' object %s", object));
} }
else else
if (strcmp(type, "Update") == 0) { /** **/ if (strcmp(type, "Update") == 0) { /** **/