Explorar o código

Reject my own messages in is_msg_for_me().

default %!s(int64=2) %!d(string=hai) anos
pai
achega
b598cb5176
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  1. 6 0
      activitypub.c

+ 6 - 0
activitypub.c

@@ -625,6 +625,12 @@ int is_msg_for_me(snac *snac, const xs_dict *c_msg)
     const char *type  = xs_dict_get(c_msg, "type");
     const char *type  = xs_dict_get(c_msg, "type");
     const char *actor = xs_dict_get(c_msg, "actor");
     const char *actor = xs_dict_get(c_msg, "actor");
 
 
+    if (strcmp(actor, snac->actor) == 0) {
+        /* message by myself? (most probably via the shared-inbox) reject */
+        snac_debug(snac, 1, xs_fmt("ignoring message by myself"));
+        return 0;
+    }
+
     if (xs_match(type, "Like|Announce")) {
     if (xs_match(type, "Like|Announce")) {
         const char *object = xs_dict_get(c_msg, "object");
         const char *object = xs_dict_get(c_msg, "object");