snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit a73636f671045daec1feee6ba521434b3549c595
parent adcdb28b6f9ca3e21681f3503538df86ae949d1d
Author: default <nobody@localhost>
Date:   Wed, 24 May 2023 09:43:11 +0200

Questions (polls) are now stored (but not yet shown).

Diffstat:
Mactivitypub.c | 36+++++++++++++++++++++++++-----------
1 file changed, 25 insertions(+), 11 deletions(-)

diff --git a/activitypub.c b/activitypub.c @@ -1135,23 +1135,29 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req) } else if (strcmp(type, "Create") == 0) { + if (is_muted(snac, actor)) + snac_log(snac, xs_fmt("ignored 'Create' + '%s' from muted actor %s", utype, actor)); + if (strcmp(utype, "Note") == 0) { - if (is_muted(snac, actor)) - snac_log(snac, xs_fmt("ignored 'Note' from muted actor %s", actor)); - else { - char *id = xs_dict_get(object, "id"); - char *in_reply_to = xs_dict_get(object, "inReplyTo"); - xs *wrk = NULL; + char *id = xs_dict_get(object, "id"); + char *in_reply_to = xs_dict_get(object, "inReplyTo"); + xs *wrk = NULL; - timeline_request(snac, &in_reply_to, &wrk); + timeline_request(snac, &in_reply_to, &wrk); - if (timeline_add(snac, id, object)) { - snac_log(snac, xs_fmt("new 'Note' %s %s", actor, id)); - do_notify = 1; - } + if (timeline_add(snac, id, object)) { + snac_log(snac, xs_fmt("new 'Note' %s %s", actor, id)); + do_notify = 1; } } else + if (strcmp(utype, "Question") == 0) { + char *id = xs_dict_get(object, "id"); + + if (timeline_add(snac, id, object)) + snac_log(snac, xs_fmt("new 'Question' %s %s", actor, id)); + } + else snac_debug(snac, 1, xs_fmt("ignored 'Create' for object type '%s'", utype)); } else @@ -1223,6 +1229,14 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req) snac_log(snac, xs_fmt("updated post %s", id)); } else + if (strcmp(utype, "Question") == 0) { + char *id = xs_dict_get(object, "id"); + + object_add_ow(id, object); + + snac_log(snac, xs_fmt("updated poll %s", id)); + } + else snac_log(snac, xs_fmt("ignored 'Update' for object type '%s'", utype)); } else