mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-25 14:35:04 +00:00
Check for muted actors in Announce messages.
This commit is contained in:
parent
03b0e105b5
commit
3b8a43013d
1 changed files with 18 additions and 2 deletions
|
@ -563,6 +563,7 @@ void process_message(snac *snac, char *msg, char *req)
|
|||
/* actor and type exist, were checked previously */
|
||||
char *actor = xs_dict_get(msg, "actor");
|
||||
char *type = xs_dict_get(msg, "type");
|
||||
xs *actor_o = NULL;
|
||||
|
||||
char *object, *utype;
|
||||
|
||||
|
@ -572,6 +573,9 @@ void process_message(snac *snac, char *msg, char *req)
|
|||
else
|
||||
utype = "(null)";
|
||||
|
||||
/* bring the actor */
|
||||
actor_request(snac, actor, &actor_o);
|
||||
|
||||
/* check the signature */
|
||||
/* ... */
|
||||
|
||||
|
@ -632,14 +636,26 @@ void process_message(snac *snac, char *msg, char *req)
|
|||
}
|
||||
else
|
||||
if (strcmp(type, "Announce") == 0) {
|
||||
xs *a_msg = NULL;
|
||||
|
||||
if (xs_type(object) == XSTYPE_DICT)
|
||||
object = xs_dict_get(object, "id");
|
||||
|
||||
timeline_request(snac, object, actor);
|
||||
|
||||
if ((a_msg = timeline_find(snac, object)) != NULL) {
|
||||
char *who = xs_dict_get(a_msg, "attributedTo");
|
||||
|
||||
if (who && !is_muted(snac, who)) {
|
||||
timeline_admire(snac, object, actor, 0);
|
||||
snac_log(snac, xs_fmt("new 'Announce' %s %s", actor, object));
|
||||
}
|
||||
else
|
||||
snac_log(snac, xs_fmt("ignored 'Announce' about muted actor %s", who));
|
||||
}
|
||||
else
|
||||
snac_log(snac, xs_fmt("error requesting 'Announce' object %s", object));
|
||||
}
|
||||
/*
|
||||
else
|
||||
if (strcmp(type, "Update") == 0) {
|
||||
|
|
Loading…
Reference in a new issue