aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheJackiMonster <thejackimonster@gmail.com>2021-06-27 22:18:12 +0200
committerTheJackiMonster <thejackimonster@gmail.com>2021-06-27 22:18:12 +0200
commit464a3abaef4fd7e11c5c535c2a719a33eccb5ae9 (patch)
treee29a7ab95f894e3a720454fe47e511ead8c1192f
parentfa9e2e2b89313349d653cbf4ce1df8a49280a8c2 (diff)
downloadgnunet-464a3abaef4fd7e11c5c535c2a719a33eccb5ae9.tar.gz
gnunet-464a3abaef4fd7e11c5c535c2a719a33eccb5ae9.zip
-added function to get the key of a room
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-rw-r--r--src/include/gnunet_messenger_service.h13
-rw-r--r--src/messenger/messenger_api.c9
2 files changed, 20 insertions, 2 deletions
diff --git a/src/include/gnunet_messenger_service.h b/src/include/gnunet_messenger_service.h
index 4567a63a4..81bc3aa12 100644
--- a/src/include/gnunet_messenger_service.h
+++ b/src/include/gnunet_messenger_service.h
@@ -666,8 +666,8 @@ GNUNET_MESSENGER_enter_room (struct GNUNET_MESSENGER_Handle *handle, const struc
666 const struct GNUNET_HashCode *key); 666 const struct GNUNET_HashCode *key);
667 667
668/** 668/**
669 * Close a room which was entered, opened or both in various order and variety. Closing a room will destroy all connections 669 * Close a <i>room</i> which was entered, opened or both in various order and variety. Closing a room will destroy all
670 * from your peer to another and the other way around. 670 * connections from your peer to another and the other way around.
671 * 671 *
672 * ( After a member closes a <b>door</b>, all members entered through that specific <b>door</b> have to use another one 672 * ( After a member closes a <b>door</b>, all members entered through that specific <b>door</b> have to use another one
673 * or open the room on their own. ) 673 * or open the room on their own. )
@@ -693,6 +693,15 @@ GNUNET_MESSENGER_find_rooms (const struct GNUNET_MESSENGER_Handle *handle, const
693 GNUNET_MESSENGER_MemberCallback callback, void *cls); 693 GNUNET_MESSENGER_MemberCallback callback, void *cls);
694 694
695/** 695/**
696 * Get the key of a given <i>room</i>.
697 *
698 * @param[in] room Room handle
699 * @return Hash identifying the port or NULL on failure
700 */
701const struct GNUNET_HashCode*
702GNUNET_MESSENGER_room_get_key (const struct GNUNET_MESSENGER_Room *room);
703
704/**
696 * Get the contact of a member in a <i>room</i> which sent a specific message identified with a given <i>hash</i>. 705 * Get the contact of a member in a <i>room</i> which sent a specific message identified with a given <i>hash</i>.
697 * 706 *
698 * Notice that contacts are independent of rooms but will be removed if all rooms containing these contacts get closed. 707 * Notice that contacts are independent of rooms but will be removed if all rooms containing these contacts get closed.
diff --git a/src/messenger/messenger_api.c b/src/messenger/messenger_api.c
index 1eedbd31b..f7c73f769 100644
--- a/src/messenger/messenger_api.c
+++ b/src/messenger/messenger_api.c
@@ -618,6 +618,15 @@ GNUNET_MESSENGER_find_rooms (const struct GNUNET_MESSENGER_Handle *handle, const
618 return GNUNET_CONTAINER_multihashmap_iterate(handle->rooms, iterate_find_room, &find); 618 return GNUNET_CONTAINER_multihashmap_iterate(handle->rooms, iterate_find_room, &find);
619} 619}
620 620
621const struct GNUNET_HashCode*
622GNUNET_MESSENGER_room_get_key (const struct GNUNET_MESSENGER_Room *room)
623{
624 if (!room)
625 return NULL;
626
627 return &(room->key);
628}
629
621const struct GNUNET_MESSENGER_Contact* 630const struct GNUNET_MESSENGER_Contact*
622GNUNET_MESSENGER_get_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) 631GNUNET_MESSENGER_get_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
623{ 632{