diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2021-10-10 16:56:55 +0200 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2021-10-10 16:56:55 +0200 |
commit | 242d75e5ceb10403e62abfb52c9381fc4351d9b5 (patch) | |
tree | 46999c6817fe74d74570f3f28160422fac6dac46 /include | |
parent | 5e3ed6ef9f9d447a4ece18f79a4993c0630047c3 (diff) | |
download | libgnunetchat-242d75e5ceb10403e62abfb52c9381fc4351d9b5.tar.gz libgnunetchat-242d75e5ceb10403e62abfb52c9381fc4351d9b5.zip |
Merged callbacks and added meta messages
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/gnunet_chat_lib.h | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/include/gnunet_chat_lib.h b/include/gnunet_chat_lib.h index cf53464..06b7478 100644 --- a/include/gnunet_chat_lib.h +++ b/include/gnunet_chat_lib.h | |||
@@ -45,39 +45,49 @@ | |||
45 | enum GNUNET_CHAT_MessageKind | 45 | enum GNUNET_CHAT_MessageKind |
46 | { | 46 | { |
47 | /** | 47 | /** |
48 | * The kind to inform that something went wrong. | ||
49 | */ | ||
50 | GNUNET_CHAT_KIND_WARNING = 1, /**< GNUNET_CHAT_KIND_WARNING */ | ||
51 | |||
52 | /** | ||
53 | * The kind to inform that the application can be used. | ||
54 | */ | ||
55 | GNUNET_CHAT_KIND_LOGIN = 2, /**< GNUNET_CHAT_KIND_LOGIN */ | ||
56 | |||
57 | /** | ||
48 | * The kind to inform that a contact has joined a chat. | 58 | * The kind to inform that a contact has joined a chat. |
49 | */ | 59 | */ |
50 | GNUNET_CHAT_KIND_JOIN = 1, /**< GNUNET_CHAT_KIND_JOIN */ | 60 | GNUNET_CHAT_KIND_JOIN = 3, /**< GNUNET_CHAT_KIND_JOIN */ |
51 | 61 | ||
52 | /** | 62 | /** |
53 | * The kind to inform that a contact has left a chat. | 63 | * The kind to inform that a contact has left a chat. |
54 | */ | 64 | */ |
55 | GNUNET_CHAT_KIND_LEAVE = 2, /**< GNUNET_CHAT_KIND_LEAVE */ | 65 | GNUNET_CHAT_KIND_LEAVE = 4, /**< GNUNET_CHAT_KIND_LEAVE */ |
56 | 66 | ||
57 | /** | 67 | /** |
58 | * The kind to inform that a contact has changed. | 68 | * The kind to inform that a contact has changed. |
59 | */ | 69 | */ |
60 | GNUNET_CHAT_KIND_CONTACT = 3, /**< GNUNET_CHAT_KIND_CONTACT */ | 70 | GNUNET_CHAT_KIND_CONTACT = 5, /**< GNUNET_CHAT_KIND_CONTACT */ |
61 | 71 | ||
62 | /** | 72 | /** |
63 | * The kind to describe an invitation to a different chat. | 73 | * The kind to describe an invitation to a different chat. |
64 | */ | 74 | */ |
65 | GNUNET_CHAT_KIND_INVITATION = 4, /**< GNUNET_CHAT_KIND_INVITATION */ | 75 | GNUNET_CHAT_KIND_INVITATION = 6, /**< GNUNET_CHAT_KIND_INVITATION */ |
66 | 76 | ||
67 | /** | 77 | /** |
68 | * The kind to describe a text message. | 78 | * The kind to describe a text message. |
69 | */ | 79 | */ |
70 | GNUNET_CHAT_KIND_TEXT = 5, /**< GNUNET_CHAT_KIND_TEXT */ | 80 | GNUNET_CHAT_KIND_TEXT = 7, /**< GNUNET_CHAT_KIND_TEXT */ |
71 | 81 | ||
72 | /** | 82 | /** |
73 | * The kind to describe a shared file. | 83 | * The kind to describe a shared file. |
74 | */ | 84 | */ |
75 | GNUNET_CHAT_KIND_FILE = 6, /**< GNUNET_CHAT_KIND_FILE */ | 85 | GNUNET_CHAT_KIND_FILE = 8, /**< GNUNET_CHAT_KIND_FILE */ |
76 | 86 | ||
77 | /** | 87 | /** |
78 | * The kind to inform about a deletion of a previous message. | 88 | * The kind to inform about a deletion of a previous message. |
79 | */ | 89 | */ |
80 | GNUNET_CHAT_KIND_DELETION = 7, /**< GNUNET_CHAT_KIND_DELETION */ | 90 | GNUNET_CHAT_KIND_DELETION = 9, /**< GNUNET_CHAT_KIND_DELETION */ |
81 | 91 | ||
82 | /** | 92 | /** |
83 | * An unknown kind of message. | 93 | * An unknown kind of message. |
@@ -121,19 +131,6 @@ struct GNUNET_CHAT_File; | |||
121 | struct GNUNET_CHAT_Invitation; | 131 | struct GNUNET_CHAT_Invitation; |
122 | 132 | ||
123 | /** | 133 | /** |
124 | * Method called whenever an issue occurs regarding a certain chat context | ||
125 | * of a specific chat handle. | ||
126 | * | ||
127 | * @param[in,out] cls Closure from #GNUNET_CHAT_start | ||
128 | * @param[in,out] handle Chat handle | ||
129 | * @param[in,out] context Chat context | ||
130 | * @param[in] reason Reason indicating the issue | ||
131 | */ | ||
132 | typedef void | ||
133 | (*GNUNET_CHAT_WarningCallback) (void *cls, struct GNUNET_CHAT_Handle *handle, | ||
134 | struct GNUNET_CHAT_Context *context, int reason); | ||
135 | |||
136 | /** | ||
137 | * Iterator over chat contacts of a specific chat handle. | 134 | * Iterator over chat contacts of a specific chat handle. |
138 | * | 135 | * |
139 | * @param[in,out] cls Closure from #GNUNET_CHAT_iterate_contacts | 136 | * @param[in,out] cls Closure from #GNUNET_CHAT_iterate_contacts |
@@ -173,7 +170,7 @@ typedef int | |||
173 | * Iterator over chat messages in a specific chat context. | 170 | * Iterator over chat messages in a specific chat context. |
174 | * | 171 | * |
175 | * @param[in,out] cls Closure from #GNUNET_CHAT_context_iterate_messages | 172 | * @param[in,out] cls Closure from #GNUNET_CHAT_context_iterate_messages |
176 | * @param[in,out] context Chat context | 173 | * @param[in,out] context Chat context or NULL |
177 | * @param[in] message Chat message | 174 | * @param[in] message Chat message |
178 | * @return #GNUNET_YES if we should continue to iterate, #GNUNET_NO otherwise. | 175 | * @return #GNUNET_YES if we should continue to iterate, #GNUNET_NO otherwise. |
179 | */ | 176 | */ |
@@ -256,8 +253,6 @@ typedef void | |||
256 | * @param[in] cfg Configuration | 253 | * @param[in] cfg Configuration |
257 | * @param[in] directory Application directory path (optional) | 254 | * @param[in] directory Application directory path (optional) |
258 | * @param[in] name User name (optional) | 255 | * @param[in] name User name (optional) |
259 | * @param[in] warn_cb Callback for warnings (optional) | ||
260 | * @param[in,out] warn_cls Closure for warnings (optional) | ||
261 | * @param[in] msg_cb Callback for message events (optional) | 256 | * @param[in] msg_cb Callback for message events (optional) |
262 | * @param[in,out] msg_cls Closure for message events (optional) | 257 | * @param[in,out] msg_cls Closure for message events (optional) |
263 | * @return Chat handle | 258 | * @return Chat handle |
@@ -266,7 +261,6 @@ struct GNUNET_CHAT_Handle* | |||
266 | GNUNET_CHAT_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | 261 | GNUNET_CHAT_start (const struct GNUNET_CONFIGURATION_Handle *cfg, |
267 | const char *directory, | 262 | const char *directory, |
268 | const char *name, | 263 | const char *name, |
269 | GNUNET_CHAT_WarningCallback warn_cb, void *warn_cls, | ||
270 | GNUNET_CHAT_ContextMessageCallback msg_cb, void *msg_cls); | 264 | GNUNET_CHAT_ContextMessageCallback msg_cb, void *msg_cls); |
271 | 265 | ||
272 | /** | 266 | /** |
@@ -675,7 +669,8 @@ GNUNET_CHAT_message_get_read_receipt (const struct GNUNET_CHAT_Message *message, | |||
675 | 669 | ||
676 | /** | 670 | /** |
677 | * Returns the text of a given <i>message</i> if its kind is | 671 | * Returns the text of a given <i>message</i> if its kind is |
678 | * #GNUNET_CHAT_KIND_TEXT, otherwise it returns NULL. | 672 | * #GNUNET_CHAT_KIND_TEXT or #GNUNET_CHAT_KIND_WARNING, |
673 | * otherwise it returns NULL. | ||
679 | * | 674 | * |
680 | * @param[in] message Message | 675 | * @param[in] message Message |
681 | * @return The text of message or NULL | 676 | * @return The text of message or NULL |