commit cf2cfca

default  ·  2023-06-11 18:10:23 +0000 UTC
parent 1dd88aa
Also reject Like messages in is_msg_for_me().
1 files changed,  +5, -1
+5, -1
 1@@ -383,12 +383,16 @@ int is_msg_for_me(snac *snac, const xs_dict *c_msg)
 2 {
 3     const char *type = xs_dict_get(c_msg, "type");
 4 
 5-    if (strcmp(type, "Announce") == 0) {
 6+    if (strcmp(type, "Like") == 0 || strcmp(type, "Announce") == 0) {
 7         const char *object = xs_dict_get(c_msg, "object");
 8 
 9         if (xs_type(object) == XSTYPE_DICT)
10             object = xs_dict_get(object, "id");
11 
12+        /* bad object id? reject */
13+        if (xs_type(object) != XSTYPE_STRING)
14+            return 0;
15+
16         /* if it's about one of our posts, accept it */
17         if (xs_startswith(object, snac->actor))
18             return 2;