diff options
Diffstat (limited to 'src/gnunet_chat_handle.h')
-rw-r--r-- | src/gnunet_chat_handle.h | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/src/gnunet_chat_handle.h b/src/gnunet_chat_handle.h index 2cc6349..3028186 100644 --- a/src/gnunet_chat_handle.h +++ b/src/gnunet_chat_handle.h | |||
@@ -124,52 +124,154 @@ struct GNUNET_CHAT_Handle | |||
124 | void *user_pointer; | 124 | void *user_pointer; |
125 | }; | 125 | }; |
126 | 126 | ||
127 | /** | ||
128 | * Creates a chat handle with a selected configuration, | ||
129 | * a custom message callback and a custom closure for | ||
130 | * the callback. | ||
131 | * | ||
132 | * @param[in] cfg Configuration | ||
133 | * @param[in] msg_cb Message callback | ||
134 | * @param[in,out] msg_cls Closure | ||
135 | * @return New chat handle | ||
136 | */ | ||
127 | struct GNUNET_CHAT_Handle* | 137 | struct GNUNET_CHAT_Handle* |
128 | handle_create_from_config (const struct GNUNET_CONFIGURATION_Handle* cfg, | 138 | handle_create_from_config (const struct GNUNET_CONFIGURATION_Handle* cfg, |
129 | GNUNET_CHAT_ContextMessageCallback msg_cb, | 139 | GNUNET_CHAT_ContextMessageCallback msg_cb, |
130 | void *msg_cls); | 140 | void *msg_cls); |
131 | 141 | ||
142 | /** | ||
143 | * Updates the string representation of the public key from | ||
144 | * a given chat <i>handle</i>. | ||
145 | * | ||
146 | * @param[in,out] handle Chat handle | ||
147 | */ | ||
132 | void | 148 | void |
133 | handle_update_key (struct GNUNET_CHAT_Handle *handle); | 149 | handle_update_key (struct GNUNET_CHAT_Handle *handle); |
134 | 150 | ||
151 | /** | ||
152 | * Destroys a chat <i>handle</i> and frees its memory. | ||
153 | * | ||
154 | * @param[in,out] handle Chat handle | ||
155 | */ | ||
135 | void | 156 | void |
136 | handle_destroy (struct GNUNET_CHAT_Handle *handle); | 157 | handle_destroy (struct GNUNET_CHAT_Handle *handle); |
137 | 158 | ||
159 | /** | ||
160 | * Connects a given chat <i>handle</i> to a selected | ||
161 | * chat <i>account</i> using it for further operations. | ||
162 | * | ||
163 | * @param[in,out] handle Chat handle | ||
164 | * @param[in] account Chat account | ||
165 | */ | ||
138 | void | 166 | void |
139 | handle_connect (struct GNUNET_CHAT_Handle *handle, | 167 | handle_connect (struct GNUNET_CHAT_Handle *handle, |
140 | const struct GNUNET_CHAT_Account *account); | 168 | const struct GNUNET_CHAT_Account *account); |
141 | 169 | ||
170 | /** | ||
171 | * Disconnects a given chat <i>handle</i> from its current | ||
172 | * connected chat account. | ||
173 | * | ||
174 | * @param[in,out] handle Chat handle | ||
175 | */ | ||
142 | void | 176 | void |
143 | handle_disconnect (struct GNUNET_CHAT_Handle *handle); | 177 | handle_disconnect (struct GNUNET_CHAT_Handle *handle); |
144 | 178 | ||
179 | /** | ||
180 | * Returns the main directory path to store information | ||
181 | * of a given chat <i>handle</i>. | ||
182 | * | ||
183 | * @param[in] handle Chat handle | ||
184 | * @return Directory path | ||
185 | */ | ||
145 | const char* | 186 | const char* |
146 | handle_get_directory (const struct GNUNET_CHAT_Handle *handle); | 187 | handle_get_directory (const struct GNUNET_CHAT_Handle *handle); |
147 | 188 | ||
189 | /** | ||
190 | * Returns the private key from the current connected chat | ||
191 | * account of a given chat <i>handle</i>. | ||
192 | * | ||
193 | * @param[in] handle Chat handle | ||
194 | * @return EGOs private key or NULL | ||
195 | */ | ||
148 | const struct GNUNET_IDENTITY_PrivateKey* | 196 | const struct GNUNET_IDENTITY_PrivateKey* |
149 | handle_get_key (const struct GNUNET_CHAT_Handle *handle); | 197 | handle_get_key (const struct GNUNET_CHAT_Handle *handle); |
150 | 198 | ||
199 | /** | ||
200 | * Sends an internal chat message from a given chat | ||
201 | * <i>handle</i> with an optional chat <i>context</i>, | ||
202 | * a custom <i>flag</i> and an optional <i>warning</i> text. | ||
203 | * | ||
204 | * @param[in,out] handle Chat handle | ||
205 | * @param[in,out] context Chat context or NULL | ||
206 | * @param[in] flag Chat message flag | ||
207 | * @param[in] warning Warning text | ||
208 | */ | ||
151 | void | 209 | void |
152 | handle_send_internal_message (struct GNUNET_CHAT_Handle *handle, | 210 | handle_send_internal_message (struct GNUNET_CHAT_Handle *handle, |
153 | struct GNUNET_CHAT_Context *context, | 211 | struct GNUNET_CHAT_Context *context, |
154 | enum GNUNET_CHAT_MessageFlag flag, | 212 | enum GNUNET_CHAT_MessageFlag flag, |
155 | const char *warning); | 213 | const char *warning); |
156 | 214 | ||
215 | /** | ||
216 | * Sends a name message to a messenger <i>room</i> with | ||
217 | * a selected chat <i>handle</i>. | ||
218 | * | ||
219 | * @param[in,out] handle Chat handle | ||
220 | * @param[in,out] room Messenger room | ||
221 | */ | ||
157 | void | 222 | void |
158 | handle_send_room_name (struct GNUNET_CHAT_Handle *handle, | 223 | handle_send_room_name (struct GNUNET_CHAT_Handle *handle, |
159 | struct GNUNET_MESSENGER_Room *room); | 224 | struct GNUNET_MESSENGER_Room *room); |
160 | 225 | ||
226 | /** | ||
227 | * Checks a given chat <i>handle</i> for any chat context | ||
228 | * connected with a messenger <i>room</i>, creates it if | ||
229 | * necessary and manages its context type. | ||
230 | * | ||
231 | * @param[in,out] handle Chat handle | ||
232 | * @param[in,out] room Messenger room | ||
233 | * @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR | ||
234 | */ | ||
161 | int | 235 | int |
162 | handle_request_context_by_room (struct GNUNET_CHAT_Handle *handle, | 236 | handle_request_context_by_room (struct GNUNET_CHAT_Handle *handle, |
163 | struct GNUNET_MESSENGER_Room *room); | 237 | struct GNUNET_MESSENGER_Room *room); |
164 | 238 | ||
239 | /** | ||
240 | * Returns the chat contact registered for a given messenger | ||
241 | * <i>contact</i> by a selected chat <i>handle</i>. | ||
242 | * | ||
243 | * @param[in] handle Chat handle | ||
244 | * @param[in] contact Messenger contact | ||
245 | * @return Chat contact or NULL | ||
246 | */ | ||
165 | struct GNUNET_CHAT_Contact* | 247 | struct GNUNET_CHAT_Contact* |
166 | handle_get_contact_from_messenger (const struct GNUNET_CHAT_Handle *handle, | 248 | handle_get_contact_from_messenger (const struct GNUNET_CHAT_Handle *handle, |
167 | const struct GNUNET_MESSENGER_Contact *contact); | 249 | const struct GNUNET_MESSENGER_Contact *contact); |
168 | 250 | ||
251 | /** | ||
252 | * Returns the chat group registered for a given messenger | ||
253 | * <i>room</i> by a selected chat <i>handle</i>. | ||
254 | * | ||
255 | * @param[in] handle Chat handle | ||
256 | * @param[in] room Messenger room | ||
257 | * @return Chat group or NULL | ||
258 | */ | ||
169 | struct GNUNET_CHAT_Group* | 259 | struct GNUNET_CHAT_Group* |
170 | handle_get_group_from_messenger (const struct GNUNET_CHAT_Handle *handle, | 260 | handle_get_group_from_messenger (const struct GNUNET_CHAT_Handle *handle, |
171 | const struct GNUNET_MESSENGER_Room *room); | 261 | const struct GNUNET_MESSENGER_Room *room); |
172 | 262 | ||
263 | /** | ||
264 | * Processes the <i>data</i> of records under a given | ||
265 | * <i>label</i> and creates a matching chat <i>context</i> | ||
266 | * with it if it does not exist already, registered by a chat | ||
267 | * <i>handle</i>, to be updated. | ||
268 | * | ||
269 | * @param[in,out] handle Chat handle | ||
270 | * @param[in] label Namestore label | ||
271 | * @param[in] count Count of data | ||
272 | * @param[in] data Records data | ||
273 | * @return Chat context or NULL | ||
274 | */ | ||
173 | struct GNUNET_CHAT_Context* | 275 | struct GNUNET_CHAT_Context* |
174 | handle_process_records (struct GNUNET_CHAT_Handle *handle, | 276 | handle_process_records (struct GNUNET_CHAT_Handle *handle, |
175 | const char *label, | 277 | const char *label, |