diff options
Diffstat (limited to 'src/messenger/messenger_api_room.h')
-rw-r--r-- | src/messenger/messenger_api_room.h | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/src/messenger/messenger_api_room.h b/src/messenger/messenger_api_room.h index d5ffc5c4b..62e4711d0 100644 --- a/src/messenger/messenger_api_room.h +++ b/src/messenger/messenger_api_room.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020--2021 GNUnet e.V. | 3 | Copyright (C) 2020--2023 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -34,6 +34,7 @@ | |||
34 | #include "messenger_api_list_tunnels.h" | 34 | #include "messenger_api_list_tunnels.h" |
35 | #include "messenger_api_contact.h" | 35 | #include "messenger_api_contact.h" |
36 | #include "messenger_api_message.h" | 36 | #include "messenger_api_message.h" |
37 | #include "messenger_api_queue_messages.h" | ||
37 | 38 | ||
38 | struct GNUNET_MESSENGER_RoomMessageEntry { | 39 | struct GNUNET_MESSENGER_RoomMessageEntry { |
39 | struct GNUNET_MESSENGER_Contact* sender; | 40 | struct GNUNET_MESSENGER_Contact* sender; |
@@ -45,14 +46,19 @@ struct GNUNET_MESSENGER_Room | |||
45 | struct GNUNET_MESSENGER_Handle *handle; | 46 | struct GNUNET_MESSENGER_Handle *handle; |
46 | struct GNUNET_HashCode key; | 47 | struct GNUNET_HashCode key; |
47 | 48 | ||
48 | int opened; | 49 | struct GNUNET_HashCode last_message; |
49 | 50 | ||
50 | struct GNUNET_ShortHashCode *contact_id; | 51 | enum GNUNET_GenericReturnValue opened; |
52 | enum GNUNET_GenericReturnValue use_handle_name; | ||
53 | |||
54 | struct GNUNET_ShortHashCode *sender_id; | ||
51 | 55 | ||
52 | struct GNUNET_MESSENGER_ListTunnels entries; | 56 | struct GNUNET_MESSENGER_ListTunnels entries; |
53 | 57 | ||
54 | struct GNUNET_CONTAINER_MultiHashMap *messages; | 58 | struct GNUNET_CONTAINER_MultiHashMap *messages; |
55 | struct GNUNET_CONTAINER_MultiShortmap *members; | 59 | struct GNUNET_CONTAINER_MultiShortmap *members; |
60 | |||
61 | struct GNUNET_MESSENGER_QueueMessages queue; | ||
56 | }; | 62 | }; |
57 | 63 | ||
58 | /** | 64 | /** |
@@ -75,6 +81,34 @@ void | |||
75 | destroy_room (struct GNUNET_MESSENGER_Room *room); | 81 | destroy_room (struct GNUNET_MESSENGER_Room *room); |
76 | 82 | ||
77 | /** | 83 | /** |
84 | * Checks whether a room is available to send messages. | ||
85 | * | ||
86 | * @param[in] room Room | ||
87 | * @return GNUNET_YES if the room is available, otherwise GNUNET_NO | ||
88 | */ | ||
89 | enum GNUNET_GenericReturnValue | ||
90 | is_room_available (const struct GNUNET_MESSENGER_Room *room); | ||
91 | |||
92 | /** | ||
93 | * Returns the member id of the <i>room</i>'s sender. | ||
94 | * | ||
95 | * @param[in] room Room | ||
96 | * @return Member id or NULL | ||
97 | */ | ||
98 | const struct GNUNET_ShortHashCode* | ||
99 | get_room_sender_id (const struct GNUNET_MESSENGER_Room *room); | ||
100 | |||
101 | /** | ||
102 | * Sets the member id of the <i>room</i>'s sender to a specific <i>id</i> or NULL. | ||
103 | * | ||
104 | * @param[in,out] room Room | ||
105 | * @param[in] id Member id or NULL | ||
106 | */ | ||
107 | void | ||
108 | set_room_sender_id (struct GNUNET_MESSENGER_Room *room, | ||
109 | const struct GNUNET_ShortHashCode *id); | ||
110 | |||
111 | /** | ||
78 | * Returns a message locally stored from a map for a given <i>hash</i> in a <i>room</i>. If no matching | 112 | * Returns a message locally stored from a map for a given <i>hash</i> in a <i>room</i>. If no matching |
79 | * message is found, NULL gets returned. | 113 | * message is found, NULL gets returned. |
80 | * | 114 | * |
@@ -109,13 +143,15 @@ get_room_sender (const struct GNUNET_MESSENGER_Room *room, | |||
109 | * @param[in,out] sender Contact of sender | 143 | * @param[in,out] sender Contact of sender |
110 | * @param[in] message Message | 144 | * @param[in] message Message |
111 | * @param[in] hash Hash of message | 145 | * @param[in] hash Hash of message |
146 | * @param[in] flags Flags of message | ||
112 | * @return Contact of sender | 147 | * @return Contact of sender |
113 | */ | 148 | */ |
114 | struct GNUNET_MESSENGER_Contact* | 149 | struct GNUNET_MESSENGER_Contact* |
115 | handle_room_message (struct GNUNET_MESSENGER_Room *room, | 150 | handle_room_message (struct GNUNET_MESSENGER_Room *room, |
116 | struct GNUNET_MESSENGER_Contact *sender, | 151 | struct GNUNET_MESSENGER_Contact *sender, |
117 | const struct GNUNET_MESSENGER_Message *message, | 152 | const struct GNUNET_MESSENGER_Message *message, |
118 | const struct GNUNET_HashCode *hash); | 153 | const struct GNUNET_HashCode *hash, |
154 | enum GNUNET_MESSENGER_MessageFlags flags); | ||
119 | 155 | ||
120 | /** | 156 | /** |
121 | * Iterates through all members of a given <i>room</i> to forward each of them to a selected | 157 | * Iterates through all members of a given <i>room</i> to forward each of them to a selected |