commit 1359cceb2003ad96a57a1e8ecac99ed00da80bb9
parent 43485ce71b4eb227d934c5726bc234195e0cbafa
Author: Jacki <jacki@thejackimonster.de>
Date: Sat, 10 Feb 2024 23:40:38 +0100
Automatic persistent blocking without manual intervention
Signed-off-by: Jacki <jacki@thejackimonster.de>
Diffstat:
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/gnunet_chat_contact.c b/src/gnunet_chat_contact.c
@@ -71,10 +71,16 @@ contact_update_join (struct GNUNET_CHAT_Contact *contact,
(contact) &&
(contact->joined) &&
(context) &&
- (context->room) &&
(hash)
);
+ if (!(context->room))
+ return;
+
+ const enum GNUNET_GenericReturnValue blocked = contact_is_blocked(
+ contact, context
+ );
+
const struct GNUNET_HashCode *key = GNUNET_MESSENGER_room_get_key(
context->room
);
@@ -94,12 +100,22 @@ contact_update_join (struct GNUNET_CHAT_Contact *contact,
GNUNET_free(current);
return;
}
+
+ GNUNET_memcpy(current, hash,
+ sizeof(struct GNUNET_HashCode));
+ return;
}
else if (0 == (flags & GNUNET_MESSENGER_FLAG_RECENT))
return;
+ if (GNUNET_YES == blocked)
+ contact_unblock(contact, context);
+
GNUNET_memcpy(current, hash,
sizeof(struct GNUNET_HashCode));
+
+ if (GNUNET_YES == blocked)
+ contact_block(contact, context);
}
void