瀏覽代碼

Don't store objects other than 'Note' in timeline_request().

default 3 年之前
父節點
當前提交
34a2b47e85
共有 1 個文件被更改,包括 14 次插入10 次删除
  1. 14 10
      activitypub.c

+ 14 - 10
activitypub.c

@@ -91,20 +91,24 @@ int timeline_request(snac *snac, char *id, char *referrer)
             status = activitypub_request(snac, id, &object);
             status = activitypub_request(snac, id, &object);
 
 
             if (valid_status(status)) {
             if (valid_status(status)) {
-                char *actor = xs_dict_get(object, "attributedTo");
+                char *type = xs_dict_get(object, "type");
 
 
-                /* request (and drop) the actor for this entry */
-                if (!xs_is_null(actor))
-                    actor_request(snac, actor, NULL);
+                if (!xs_is_null(type) && strcmp(type, "Note") == 0) {
+                    char *actor = xs_dict_get(object, "attributedTo");
 
 
-                /* does it have an ancestor? */
-                char *in_reply_to = xs_dict_get(object, "inReplyTo");
+                    /* request (and drop) the actor for this entry */
+                    if (!xs_is_null(actor))
+                        actor_request(snac, actor, NULL);
+
+                    /* does it have an ancestor? */
+                    char *in_reply_to = xs_dict_get(object, "inReplyTo");
 
 
-                /* recurse! */
-                timeline_request(snac, in_reply_to, referrer);
+                    /* recurse! */
+                    timeline_request(snac, in_reply_to, referrer);
 
 
-                /* finally store */
-                timeline_add(snac, id, object, in_reply_to, referrer);
+                    /* finally store */
+                    timeline_add(snac, id, object, in_reply_to, referrer);
+                }
             }
             }
         }
         }
     }
     }