commit bd8aa616a2b2a90fdd90c5ab18f9e4006f51e07c
parent aac4ef670b7045eb793ab9166a5faa63521f8175
Author: Jacki <jacki@thejackimonster.de>
Date: Wed, 11 Jun 2025 01:20:18 +0200
Implement changes regarding messenger local feeds
Signed-off-by: Jacki <jacki@thejackimonster.de>
Diffstat:
4 files changed, 62 insertions(+), 15 deletions(-)
diff --git a/src/gnunet_chat_lib.c b/src/gnunet_chat_lib.c
@@ -1021,7 +1021,13 @@ GNUNET_CHAT_group_create (struct GNUNET_CHAT_Handle *handle,
return NULL;
union GNUNET_MESSENGER_RoomKey key;
- GNUNET_MESSENGER_create_room_key(&key, topic, topic? GNUNET_YES : GNUNET_NO, GNUNET_YES);
+ GNUNET_MESSENGER_create_room_key(
+ &key,
+ topic,
+ topic? GNUNET_YES : GNUNET_NO,
+ GNUNET_YES,
+ GNUNET_NO
+ );
if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains(handle->contexts, &(key.hash)))
return NULL;
@@ -1595,15 +1601,34 @@ GNUNET_CHAT_context_request (struct GNUNET_CHAT_Context *context)
goto cleanup_contact;
union GNUNET_MESSENGER_RoomKey key;
- GNUNET_MESSENGER_create_room_key(&key, NULL, GNUNET_NO, GNUNET_NO);
+ GNUNET_MESSENGER_create_room_key(
+ &key,
+ NULL,
+ GNUNET_NO,
+ GNUNET_NO,
+ GNUNET_YES == contact->owned? GNUNET_YES : GNUNET_NO
+ );
if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains(
handle->contexts, &(key.hash)))
goto cleanup_contact;
- struct GNUNET_MESSENGER_Room *room = GNUNET_MESSENGER_open_room(
- handle->messenger, &key
- );
+ struct GNUNET_MESSENGER_Room *room;
+ if (GNUNET_YES == contact->owned)
+ {
+ struct GNUNET_PeerIdentity door;
+ if (GNUNET_OK == GNUNET_CRYPTO_get_peer_identity(
+ handle->cfg, &door))
+ room = GNUNET_MESSENGER_enter_room(
+ handle->messenger, &door, &key
+ );
+ else
+ room = NULL;
+ }
+ else
+ room = GNUNET_MESSENGER_open_room(
+ handle->messenger, &key
+ );
if (!room)
goto cleanup_contact;
@@ -1615,14 +1640,18 @@ GNUNET_CHAT_context_request (struct GNUNET_CHAT_Context *context)
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
goto cleanup_room;
- struct GNUNET_MESSENGER_Message msg;
- memset(&msg, 0, sizeof(msg));
+ if (GNUNET_YES != contact->owned)
+ {
+ struct GNUNET_MESSENGER_Message msg;
+ memset(&msg, 0, sizeof(msg));
- msg.header.kind = GNUNET_MESSENGER_KIND_INVITE;
- GNUNET_CRYPTO_get_peer_identity(handle->cfg, &(msg.body.invite.door));
- GNUNET_memcpy(&(msg.body.invite.key), &key, sizeof(msg.body.invite.key));
+ msg.header.kind = GNUNET_MESSENGER_KIND_INVITE;
+ GNUNET_CRYPTO_get_peer_identity(handle->cfg, &(msg.body.invite.door));
+ GNUNET_memcpy(&(msg.body.invite.key), &key, sizeof(msg.body.invite.key));
+
+ GNUNET_MESSENGER_send_message(other->room, &msg, context->contact);
+ }
- GNUNET_MESSENGER_send_message(other->room, &msg, context->contact);
return GNUNET_OK;
cleanup_room:
@@ -1647,8 +1676,18 @@ GNUNET_CHAT_context_get_contact (struct GNUNET_CHAT_Context *context)
struct GNUNET_MESSENGER_Room *room = context->room;
struct GNUNET_CHAT_RoomFindContact find;
+ union GNUNET_MESSENGER_RoomKey key;
+
+ GNUNET_memcpy(&(key.hash), GNUNET_MESSENGER_room_get_key(room), sizeof(key.hash));
+
+ if (key.code.group_bit)
+ return NULL;
- find.ignore_key = GNUNET_MESSENGER_get_key(context->handle->messenger);
+ if (! key.code.feed_bit)
+ find.ignore_key = GNUNET_MESSENGER_get_key(context->handle->messenger);
+ else
+ find.ignore_key = NULL;
+
find.contact = NULL;
int member_count = GNUNET_MESSENGER_iterate_members(
diff --git a/src/gnunet_chat_lobby.c b/src/gnunet_chat_lobby.c
@@ -97,7 +97,13 @@ lobby_open (struct GNUNET_CHAT_Lobby *lobby,
}
union GNUNET_MESSENGER_RoomKey key;
- GNUNET_MESSENGER_create_room_key(&key, NULL, GNUNET_NO, GNUNET_NO);
+ GNUNET_MESSENGER_create_room_key(
+ &key,
+ NULL,
+ GNUNET_NO,
+ GNUNET_NO,
+ GNUNET_NO
+ );
struct GNUNET_MESSENGER_Room *room = GNUNET_MESSENGER_open_room(
lobby->handle->messenger,
diff --git a/tools/gnunet_messenger_ping.c b/tools/gnunet_messenger_ping.c
@@ -507,7 +507,8 @@ ego_lookup (void *cls,
&rkey,
tool->room_name,
tool->public_room? GNUNET_YES : GNUNET_NO,
- GNUNET_YES
+ GNUNET_YES,
+ GNUNET_NO
);
}
else
diff --git a/tools/gnunet_messenger_uml.c b/tools/gnunet_messenger_uml.c
@@ -431,7 +431,8 @@ ego_lookup (void *cls,
&rkey,
tool->room_name,
tool->public_room? GNUNET_YES : GNUNET_NO,
- GNUNET_YES
+ GNUNET_YES,
+ GNUNET_NO
);
GNUNET_MESSENGER_enter_room(