aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheJackiMonster <thejackimonster@gmail.com>2022-04-19 00:31:14 +0200
committerTheJackiMonster <thejackimonster@gmail.com>2022-04-19 00:31:14 +0200
commitfc56c6148f22d363a27c7a39d8d97a2d4d908a92 (patch)
treea6f7a81785104dbfab204fa3566d243c52415604
parent9ad1e9f834085b034262f9724400bcb52b55b70c (diff)
downloadmessenger-gtk-fc56c6148f22d363a27c7a39d8d97a2d4d908a92.tar.gz
messenger-gtk-fc56c6148f22d363a27c7a39d8d97a2d4d908a92.zip
Added doxygen comments to some headers
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-rw-r--r--src/application.h52
-rw-r--r--src/chat/messenger.h9
-rw-r--r--src/contact.h46
-rw-r--r--src/event.h72
-rw-r--r--src/file.h38
-rw-r--r--src/resources.h6
-rw-r--r--src/ui.h21
7 files changed, 244 insertions, 0 deletions
diff --git a/src/application.h b/src/application.h
index 2c0972b..ab082a0 100644
--- a/src/application.h
+++ b/src/application.h
@@ -134,15 +134,38 @@ typedef struct MESSENGER_Application
134 } settings; 134 } settings;
135} MESSENGER_Application; 135} MESSENGER_Application;
136 136
137/**
138 * Initializes the messenger application with
139 * startup arguments.
140 *
141 * @param app Messenger application
142 * @param argc Amount of arguments
143 * @param argv Arguments
144 */
137void 145void
138application_init(MESSENGER_Application *app, 146application_init(MESSENGER_Application *app,
139 int argc, 147 int argc,
140 char **argv); 148 char **argv);
141 149
150/**
151 * Returns the path from resources of the
152 * messenger application relative to its storage.
153 *
154 * @param app Messenger application
155 * @param path Path
156 * @return Resource path
157 */
142const gchar* 158const gchar*
143application_get_resource_path(MESSENGER_Application *app, 159application_get_resource_path(MESSENGER_Application *app,
144 const char *path); 160 const char *path);
145 161
162/**
163 * Runs the messenger application starting the
164 * second thread and waiting for the application
165 * to finish.
166 *
167 * @param app Messenger application
168 */
146void 169void
147application_run(MESSENGER_Application *app); 170application_run(MESSENGER_Application *app);
148 171
@@ -156,20 +179,49 @@ typedef void (*MESSENGER_ApplicationMessageEvent) (
156 const struct GNUNET_CHAT_Message *msg 179 const struct GNUNET_CHAT_Message *msg
157); 180);
158 181
182/**
183 * Calls a given event with the messenger application
184 * asyncronously but explicitly synchronized via mutex.
185 *
186 * @param app Messenger application
187 * @param event Event
188 */
159void 189void
160application_call_event(MESSENGER_Application *app, 190application_call_event(MESSENGER_Application *app,
161 MESSENGER_ApplicationEvent event); 191 MESSENGER_ApplicationEvent event);
162 192
193/**
194 * Calls a given message event with the messenger
195 * application asyncronously but explicitly synchronized
196 * via mutex.
197 *
198 * @param app Messenger application
199 * @param event Message event
200 * @param context Chat context
201 * @param message Message
202 */
163void 203void
164application_call_message_event(MESSENGER_Application *app, 204application_call_message_event(MESSENGER_Application *app,
165 MESSENGER_ApplicationMessageEvent event, 205 MESSENGER_ApplicationMessageEvent event,
166 struct GNUNET_CHAT_Context *context, 206 struct GNUNET_CHAT_Context *context,
167 const struct GNUNET_CHAT_Message *message); 207 const struct GNUNET_CHAT_Message *message);
168 208
209/**
210 * Signals the second thread to exit the application.
211 *
212 * @param app Messenger application
213 * @param signal Exit signal
214 */
169void 215void
170application_exit(MESSENGER_Application *app, 216application_exit(MESSENGER_Application *app,
171 MESSENGER_ApplicationSignal signal); 217 MESSENGER_ApplicationSignal signal);
172 218
219/**
220 * Returns the exit status of the messenger application.
221 *
222 * @param app Messenger application
223 * @return Exit status
224 */
173int 225int
174application_status(MESSENGER_Application *app); 226application_status(MESSENGER_Application *app);
175 227
diff --git a/src/chat/messenger.h b/src/chat/messenger.h
index bc07119..4cceec7 100644
--- a/src/chat/messenger.h
+++ b/src/chat/messenger.h
@@ -39,6 +39,15 @@ typedef struct CHAT_MESSENGER_Handle
39 struct GNUNET_SCHEDULER_Task *idle; 39 struct GNUNET_SCHEDULER_Task *idle;
40} CHAT_MESSENGER_Handle; 40} CHAT_MESSENGER_Handle;
41 41
42/**
43 * Startup event of the GNUnet scheduler thread to
44 * handle the messenger application startup.
45 *
46 * @param cls Closure
47 * @param args Arguments
48 * @param cfgfile Configuration file path
49 * @param cfg Configuration
50 */
42void 51void
43chat_messenger_run(void *cls, 52chat_messenger_run(void *cls,
44 char *const *args, 53 char *const *args,
diff --git a/src/contact.h b/src/contact.h
index 8a6dd4c..61d41e7 100644
--- a/src/contact.h
+++ b/src/contact.h
@@ -35,27 +35,73 @@ typedef struct MESSENGER_ContactInfo
35 GList *name_avatars; 35 GList *name_avatars;
36} MESSENGER_ContactInfo; 36} MESSENGER_ContactInfo;
37 37
38/**
39 * Creates a contact information struct to potentially
40 * update all GUI appearances of a specific contact at
41 * once.
42 *
43 * @param contact Chat contact
44 */
38void 45void
39contact_create_info(struct GNUNET_CHAT_Contact *contact); 46contact_create_info(struct GNUNET_CHAT_Contact *contact);
40 47
48/**
49 * Destroys and frees resources allocated for a given
50 * contact information struct.
51 *
52 * @param contact Chat contact
53 */
41void 54void
42contact_destroy_info(struct GNUNET_CHAT_Contact *contact); 55contact_destroy_info(struct GNUNET_CHAT_Contact *contact);
43 56
57/**
58 * Sets the latest join/leave UI message handle so that
59 * the application can check whether a contact is available.
60 *
61 * @param contact Chat contact
62 * @param message Pointer to UI message handle
63 */
44void 64void
45contact_set_last_message_to_info(const struct GNUNET_CHAT_Contact *contact, 65contact_set_last_message_to_info(const struct GNUNET_CHAT_Contact *contact,
46 void *message); 66 void *message);
47 67
68/**
69 * Returns the latest join/leave UI message handle of
70 * a specific contact.
71 *
72 * @param contact Chat contact
73 */
48void* 74void*
49contact_get_last_message_from_info(const struct GNUNET_CHAT_Contact *contact); 75contact_get_last_message_from_info(const struct GNUNET_CHAT_Contact *contact);
50 76
77/**
78 * Adds a GtkLabel to the list of labels
79 * which get updated by state changes.
80 *
81 * @param contact Chat contact
82 * @param label Label
83 */
51void 84void
52contact_add_name_label_to_info(const struct GNUNET_CHAT_Contact *contact, 85contact_add_name_label_to_info(const struct GNUNET_CHAT_Contact *contact,
53 GtkLabel *label); 86 GtkLabel *label);
54 87
88/**
89 * Adds a HdyAvatar to the list of avatars
90 * which get updated by state changes.
91 *
92 * @param contact Chat contact
93 * @param avatar Avatar
94 */
55void 95void
56contact_add_name_avatar_to_info(const struct GNUNET_CHAT_Contact *contact, 96contact_add_name_avatar_to_info(const struct GNUNET_CHAT_Contact *contact,
57 HdyAvatar *avatar); 97 HdyAvatar *avatar);
58 98
99/**
100 * Updates the connected UI elements for a given
101 * contact depending on the current state.
102 *
103 * @param contact Chat contact
104 */
59void 105void
60contact_update_info(const struct GNUNET_CHAT_Contact *contact); 106contact_update_info(const struct GNUNET_CHAT_Contact *contact);
61 107
diff --git a/src/event.h b/src/event.h
index 505309c..d89e453 100644
--- a/src/event.h
+++ b/src/event.h
@@ -27,42 +27,114 @@
27 27
28#include "application.h" 28#include "application.h"
29 29
30/**
31 * Event for the UI to be called whenever the application
32 * causes any issue in back-end throwing a warning. This
33 * might be specific to a given context or none if its
34 * a general warning.
35 *
36 * @param app Messenger application
37 * @param context Chat context or NULL
38 * @param msg Warning message
39 */
30void 40void
31event_handle_warning(MESSENGER_Application *app, 41event_handle_warning(MESSENGER_Application *app,
32 struct GNUNET_CHAT_Context *context, 42 struct GNUNET_CHAT_Context *context,
33 const struct GNUNET_CHAT_Message *msg); 43 const struct GNUNET_CHAT_Message *msg);
34 44
45/**
46 * Event for the UI to be called whenever the accounts
47 * might add or remove an account from their list.
48 *
49 * @param app Messenger application
50 */
35void 51void
36event_refresh_accounts(MESSENGER_Application *app); 52event_refresh_accounts(MESSENGER_Application *app);
37 53
54/**
55 * Event for the UI to be called whenever the user
56 * updates their information.
57 *
58 * @param app Messenger application
59 */
38void 60void
39event_update_profile(MESSENGER_Application *app); 61event_update_profile(MESSENGER_Application *app);
40 62
63/**
64 * Event for the UI to be called whenever a the user
65 * joins or leaves a chat (context) via message.
66 *
67 * @param app Messenger application
68 * @param context Chat context
69 * @param msg Join/Leave message
70 */
41void 71void
42event_update_chats(MESSENGER_Application *app, 72event_update_chats(MESSENGER_Application *app,
43 struct GNUNET_CHAT_Context *context, 73 struct GNUNET_CHAT_Context *context,
44 const struct GNUNET_CHAT_Message *msg); 74 const struct GNUNET_CHAT_Message *msg);
45 75
76/**
77 * Event for the UI to be called whenever a contact
78 * joins or leaves a given context via message.
79 *
80 * @param app Messenger application
81 * @param context Chat context
82 * @param msg Join/Leave message
83 */
46void 84void
47event_presence_contact(MESSENGER_Application *app, 85event_presence_contact(MESSENGER_Application *app,
48 struct GNUNET_CHAT_Context *context, 86 struct GNUNET_CHAT_Context *context,
49 const struct GNUNET_CHAT_Message *msg); 87 const struct GNUNET_CHAT_Message *msg);
50 88
89/**
90 * Event for the UI to be called whenever a contact
91 * updates their information with a message in a
92 * given context.
93 *
94 * @param app Messenger application
95 * @param context Chat context
96 * @param msg Update message
97 */
51void 98void
52event_update_contacts(MESSENGER_Application *app, 99event_update_contacts(MESSENGER_Application *app,
53 struct GNUNET_CHAT_Context *context, 100 struct GNUNET_CHAT_Context *context,
54 const struct GNUNET_CHAT_Message *msg); 101 const struct GNUNET_CHAT_Message *msg);
55 102
103/**
104 * Event for the UI to be called whenever an invitation
105 * message gets received in a given context.
106 *
107 * @param app Messenger application
108 * @param context Chat context
109 * @param msg Invitation message
110 */
56void 111void
57event_invitation(MESSENGER_Application *app, 112event_invitation(MESSENGER_Application *app,
58 struct GNUNET_CHAT_Context *context, 113 struct GNUNET_CHAT_Context *context,
59 const struct GNUNET_CHAT_Message *msg); 114 const struct GNUNET_CHAT_Message *msg);
60 115
116/**
117 * Event for the UI to be called whenever a content
118 * message (text or file) gets received in a given
119 * context.
120 *
121 * @param app Messenger application
122 * @param context Chat context
123 * @param msg Message
124 */
61void 125void
62event_receive_message(MESSENGER_Application *app, 126event_receive_message(MESSENGER_Application *app,
63 struct GNUNET_CHAT_Context *context, 127 struct GNUNET_CHAT_Context *context,
64 const struct GNUNET_CHAT_Message *msg); 128 const struct GNUNET_CHAT_Message *msg);
65 129
130/**
131 * Event for the UI to be called whenever a message
132 * gets deleted in a given context.
133 *
134 * @param app Messenger application
135 * @param context Chat context
136 * @param msg Delete message
137 */
66void 138void
67event_delete_message(MESSENGER_Application *app, 139event_delete_message(MESSENGER_Application *app,
68 struct GNUNET_CHAT_Context *context, 140 struct GNUNET_CHAT_Context *context,
diff --git a/src/file.h b/src/file.h
index d9bb090..939ac34 100644
--- a/src/file.h
+++ b/src/file.h
@@ -33,21 +33,59 @@ typedef struct MESSENGER_FileInfo
33 GList *file_messages; 33 GList *file_messages;
34} MESSENGER_FileInfo; 34} MESSENGER_FileInfo;
35 35
36/**
37 * Creates a file information struct to potentially update
38 * all GUI appearances of a specific file at once.
39 *
40 * @param file Chat file
41 */
36void 42void
37file_create_info(struct GNUNET_CHAT_File *file); 43file_create_info(struct GNUNET_CHAT_File *file);
38 44
45/**
46 * Destroys and frees resources allocated for a given
47 * file information struct.
48 *
49 * @param file Chat file
50 */
39void 51void
40file_destroy_info(struct GNUNET_CHAT_File *file); 52file_destroy_info(struct GNUNET_CHAT_File *file);
41 53
54/**
55 * Adds a UI message handle to the list of handles
56 * which get updated by state changes.
57 *
58 * @param file Chat file
59 * @param message UI message handle
60 */
42void 61void
43file_add_ui_message_to_info(const struct GNUNET_CHAT_File *file, 62file_add_ui_message_to_info(const struct GNUNET_CHAT_File *file,
44 UI_MESSAGE_Handle *message); 63 UI_MESSAGE_Handle *message);
45 64
65/**
66 * Updates the connected UI elements for a given
67 * file depending on the current state of its upload
68 * process.
69 *
70 * @param file Chat file
71 * @param completed Amount of uploaded bytes
72 * @param size Size of the file in bytes
73 */
46void 74void
47file_update_upload_info(const struct GNUNET_CHAT_File *file, 75file_update_upload_info(const struct GNUNET_CHAT_File *file,
48 uint64_t completed, 76 uint64_t completed,
49 uint64_t size); 77 uint64_t size);
50 78
79/**
80 * Updates the connected UI elements for a given
81 * file depending on the current state of its download
82 * process.
83 *
84 * @param file Chat file
85 * @param app Messenger application
86 * @param completed Amount of downloaded bytes
87 * @param size Size of the file in bytes
88 */
51void 89void
52file_update_download_info(const struct GNUNET_CHAT_File *file, 90file_update_download_info(const struct GNUNET_CHAT_File *file,
53 MESSENGER_Application *app, 91 MESSENGER_Application *app,
diff --git a/src/resources.h b/src/resources.h
index 82e8534..2080364 100644
--- a/src/resources.h
+++ b/src/resources.h
@@ -25,9 +25,15 @@
25#ifndef RESOURCES_H_ 25#ifndef RESOURCES_H_
26#define RESOURCES_H_ 26#define RESOURCES_H_
27 27
28/**
29 * Registers the CSS and UI components for the application.
30 */
28void 31void
29resources_register(); 32resources_register();
30 33
34/**
35 * Unregisters the CSS and UI components for the application.
36 */
31void 37void
32resources_unregister(); 38resources_unregister();
33 39
diff --git a/src/ui.h b/src/ui.h
index 3c06bcc..7547b0c 100644
--- a/src/ui.h
+++ b/src/ui.h
@@ -28,12 +28,33 @@
28#include <gtk-3.0/gtk/gtk.h> 28#include <gtk-3.0/gtk/gtk.h>
29#include <libhandy-1/handy.h> 29#include <libhandy-1/handy.h>
30 30
31/**
32 * Sets the text of a GtkLabel applying automatic utf8
33 * conversion.
34 *
35 * @param label Label
36 * @param text Non-utf8 text
37 */
31void 38void
32ui_label_set_text(GtkLabel *label, const char *text); 39ui_label_set_text(GtkLabel *label, const char *text);
33 40
41/**
42 * Sets the text of a GtkEntry applying automatic utf8
43 * conversion.
44 *
45 * @param entry Entry
46 * @param text Non-utf8 text
47 */
34void 48void
35ui_entry_set_text(GtkEntry *entry, const char *text); 49ui_entry_set_text(GtkEntry *entry, const char *text);
36 50
51/**
52 * Sets the text of a HdyAvatar applying automatic utf8
53 * conversion.
54 *
55 * @param avatar Avatar
56 * @param text Non-utf8 text
57 */
37void 58void
38ui_avatar_set_text(HdyAvatar *avatar, const char *text); 59ui_avatar_set_text(HdyAvatar *avatar, const char *text);
39 60