commit 79df266

default  ·  2024-05-05 06:23:12 +0000 UTC
parent be9cf2f
Added some more logging.
1 files changed,  +10, -0
+10, -0
 1@@ -1988,8 +1988,15 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
 2         if (xs_match(utype, "Note|Article")) { /** **/
 3             char *id          = xs_dict_get(object, "id");
 4             char *in_reply_to = xs_dict_get(object, "inReplyTo");
 5+            char *atto        = get_atto(object);
 6             xs *wrk           = NULL;
 7 
 8+            if (xs_is_null(id))
 9+                snac_log(snac, xs_fmt("malformed message: no 'id' field"));
10+            else
11+            if (xs_is_null(atto))
12+                snac_log(snac, xs_fmt("malformed message: no 'attributedTo' field"));
13+            else
14             if (!xs_is_null(in_reply_to) && is_hidden(snac, in_reply_to)) {
15                 snac_debug(snac, 0, xs_fmt("dropped reply %s to hidden post %s", id, in_reply_to));
16             }
17@@ -1999,6 +2006,9 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
18                     return 1;
19                 }
20 
21+                if (strcmp(actor, atto) != 0)
22+                    snac_log(snac, xs_fmt("SUSPICIOUS: actor != atto (%s != %s)", actor, atto));
23+
24                 timeline_request(snac, &in_reply_to, &wrk, 0);
25 
26                 if (timeline_add(snac, id, object)) {