diff options
author | Jacki <jacki@thejackimonster.de> | 2024-02-20 17:40:09 +0100 |
---|---|---|
committer | Jacki <jacki@thejackimonster.de> | 2024-02-20 17:40:09 +0100 |
commit | 9e578beeb63085bf51a0056a657f44ecea8c4d78 (patch) | |
tree | dda63076c32732cd54054f4d9e5d73ad5026dd33 /include | |
parent | 4bf5c1d2b40272db5c232bd499af4bb26ddab88e (diff) | |
download | libgnunetchat-9e578beeb63085bf51a0056a657f44ecea8c4d78.tar.gz libgnunetchat-9e578beeb63085bf51a0056a657f44ecea8c4d78.zip |
Add more functions to tag messages and iterate through tags
Signed-off-by: Jacki <jacki@thejackimonster.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/gnunet/gnunet_chat_lib.h | 73 |
1 files changed, 62 insertions, 11 deletions
diff --git a/include/gnunet/gnunet_chat_lib.h b/include/gnunet/gnunet_chat_lib.h index 6e89f62..0912237 100644 --- a/include/gnunet/gnunet_chat_lib.h +++ b/include/gnunet/gnunet_chat_lib.h | |||
@@ -316,6 +316,17 @@ typedef enum GNUNET_GenericReturnValue | |||
316 | int read_receipt); | 316 | int read_receipt); |
317 | 317 | ||
318 | /** | 318 | /** |
319 | * Iterator over chat messages. | ||
320 | * | ||
321 | * @param[in,out] cls Closure from #GNUNET_CHAT_context_iterate_messages | ||
322 | * @param[in] message Chat message | ||
323 | * @return #GNUNET_YES if we should continue to iterate, #GNUNET_NO otherwise. | ||
324 | */ | ||
325 | typedef enum GNUNET_GenericReturnValue | ||
326 | (*GNUNET_CHAT_MessageCallback) (void *cls, | ||
327 | const struct GNUNET_CHAT_Message *message); | ||
328 | |||
329 | /** | ||
319 | * Method called during an upload of a specific file in a chat to share it. | 330 | * Method called during an upload of a specific file in a chat to share it. |
320 | * | 331 | * |
321 | * @param[in,out] cls Closure from #GNUNET_CHAT_context_send_file | 332 | * @param[in,out] cls Closure from #GNUNET_CHAT_context_send_file |
@@ -1081,6 +1092,20 @@ GNUNET_CHAT_context_share_file (struct GNUNET_CHAT_Context *context, | |||
1081 | const struct GNUNET_CHAT_File *file); | 1092 | const struct GNUNET_CHAT_File *file); |
1082 | 1093 | ||
1083 | /** | 1094 | /** |
1095 | * Sends a tag message targeting a selected <i>message</i> into a given | ||
1096 | * chat <i>context</i> with a given <i>tag</i> value. | ||
1097 | * | ||
1098 | * @param[in,out] context Chat context | ||
1099 | * @param[in] message Message | ||
1100 | * @param[in] tag Tag value | ||
1101 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | ||
1102 | */ | ||
1103 | enum GNUNET_GenericReturnValue | ||
1104 | GNUNET_CHAT_context_send_tag (struct GNUNET_CHAT_Context *context, | ||
1105 | const struct GNUNET_CHAT_Message *message, | ||
1106 | const char *tag); | ||
1107 | |||
1108 | /** | ||
1084 | * Iterates through the contacts of a given chat <i>context</i> with a selected | 1109 | * Iterates through the contacts of a given chat <i>context</i> with a selected |
1085 | * callback and custom closure. | 1110 | * callback and custom closure. |
1086 | * | 1111 | * |
@@ -1146,8 +1171,8 @@ struct GNUNET_CHAT_Contact* | |||
1146 | GNUNET_CHAT_message_get_recipient (const struct GNUNET_CHAT_Message *message); | 1171 | GNUNET_CHAT_message_get_recipient (const struct GNUNET_CHAT_Message *message); |
1147 | 1172 | ||
1148 | /** | 1173 | /** |
1149 | * Returns #GNUNET_YES if the message was sent by the related chat handle, | 1174 | * Returns #GNUNET_YES if the <i>message</i> was sent by the related chat |
1150 | * otherwise it returns #GNUNET_NO. | 1175 | * handle, otherwise it returns #GNUNET_NO. |
1151 | * | 1176 | * |
1152 | * @param[in] message Message | 1177 | * @param[in] message Message |
1153 | * @return #GNUNET_YES if the message was sent, otherwise #GNUNET_NO | 1178 | * @return #GNUNET_YES if the message was sent, otherwise #GNUNET_NO |
@@ -1156,8 +1181,8 @@ enum GNUNET_GenericReturnValue | |||
1156 | GNUNET_CHAT_message_is_sent (const struct GNUNET_CHAT_Message *message); | 1181 | GNUNET_CHAT_message_is_sent (const struct GNUNET_CHAT_Message *message); |
1157 | 1182 | ||
1158 | /** | 1183 | /** |
1159 | * Returns #GNUNET_YES if the message was received privately encrypted by the | 1184 | * Returns #GNUNET_YES if the <i>message</i> was received privately encrypted |
1160 | * related chat handle, otherwise it returns #GNUNET_NO. | 1185 | * by the related chat handle, otherwise it returns #GNUNET_NO. |
1161 | * | 1186 | * |
1162 | * @param[in] message Message | 1187 | * @param[in] message Message |
1163 | * @return #GNUNET_YES if the message was privately received, | 1188 | * @return #GNUNET_YES if the message was privately received, |
@@ -1167,8 +1192,8 @@ enum GNUNET_GenericReturnValue | |||
1167 | GNUNET_CHAT_message_is_private (const struct GNUNET_CHAT_Message *message); | 1192 | GNUNET_CHAT_message_is_private (const struct GNUNET_CHAT_Message *message); |
1168 | 1193 | ||
1169 | /** | 1194 | /** |
1170 | * Returns #GNUNET_YES if the message was received recently by related chat | 1195 | * Returns #GNUNET_YES if the <i>message</i> was received recently by related |
1171 | * handle, otherwise it returns #GNUNET_NO. | 1196 | * chat handle, otherwise it returns #GNUNET_NO. |
1172 | * | 1197 | * |
1173 | * @param[in] message Message | 1198 | * @param[in] message Message |
1174 | * @return #GNUNET_YES if the message was received recently, | 1199 | * @return #GNUNET_YES if the message was received recently, |
@@ -1178,8 +1203,8 @@ enum GNUNET_GenericReturnValue | |||
1178 | GNUNET_CHAT_message_is_recent (const struct GNUNET_CHAT_Message *message); | 1203 | GNUNET_CHAT_message_is_recent (const struct GNUNET_CHAT_Message *message); |
1179 | 1204 | ||
1180 | /** | 1205 | /** |
1181 | * Returns #GNUNET_YES if the message was received because of an update by | 1206 | * Returns #GNUNET_YES if the <i>message</i> was received because of an |
1182 | * related chat handle, otherwise it returns #GNUNET_NO. | 1207 | * update by related chat handle, otherwise it returns #GNUNET_NO. |
1183 | * | 1208 | * |
1184 | * @param[in] message Message | 1209 | * @param[in] message Message |
1185 | * @return #GNUNET_YES if the message was received to update | 1210 | * @return #GNUNET_YES if the message was received to update |
@@ -1189,9 +1214,9 @@ enum GNUNET_GenericReturnValue | |||
1189 | GNUNET_CHAT_message_is_update (const struct GNUNET_CHAT_Message *message); | 1214 | GNUNET_CHAT_message_is_update (const struct GNUNET_CHAT_Message *message); |
1190 | 1215 | ||
1191 | /** | 1216 | /** |
1192 | * Returns #GNUNET_YES if the message was received because of a deletion by | 1217 | * Returns #GNUNET_YES if the <i>message</i> was received because of a |
1193 | * related chat handle or if it has been deleted internally, otherwise it | 1218 | * deletion by related chat handle or if it has been deleted internally, |
1194 | * returns #GNUNET_NO. | 1219 | * otherwise it returns #GNUNET_NO. |
1195 | * | 1220 | * |
1196 | * @param[in] message Message | 1221 | * @param[in] message Message |
1197 | * @return #GNUNET_YES if the message was received to delete | 1222 | * @return #GNUNET_YES if the message was received to delete |
@@ -1201,6 +1226,18 @@ enum GNUNET_GenericReturnValue | |||
1201 | GNUNET_CHAT_message_is_deleted (const struct GNUNET_CHAT_Message *message); | 1226 | GNUNET_CHAT_message_is_deleted (const struct GNUNET_CHAT_Message *message); |
1202 | 1227 | ||
1203 | /** | 1228 | /** |
1229 | * Returns #GNUNET_YES if the <i>message</i> was tagged with a custom | ||
1230 | * <i>tag</i> value, otherwise it returns #GNUNET_NO. | ||
1231 | * | ||
1232 | * @param[in] message Message | ||
1233 | * @return #GNUNET_YES if the message was tagged with | ||
1234 | * the given tag value, otherwise #GNUNET_NO | ||
1235 | */ | ||
1236 | enum GNUNET_GenericReturnValue | ||
1237 | GNUNET_CHAT_message_is_tagged (const struct GNUNET_CHAT_Message *message, | ||
1238 | const char *tag); | ||
1239 | |||
1240 | /** | ||
1204 | * Iterates through the contacts of the context related to a given chat | 1241 | * Iterates through the contacts of the context related to a given chat |
1205 | * <i>message</i> to check whether it was received by each of the contacts. | 1242 | * <i>message</i> to check whether it was received by each of the contacts. |
1206 | * | 1243 | * |
@@ -1269,6 +1306,20 @@ GNUNET_CHAT_message_delete (const struct GNUNET_CHAT_Message *message, | |||
1269 | struct GNUNET_TIME_Relative delay); | 1306 | struct GNUNET_TIME_Relative delay); |
1270 | 1307 | ||
1271 | /** | 1308 | /** |
1309 | * Iterates through the tag messages in the context of a given | ||
1310 | * <i>message</i>. | ||
1311 | * | ||
1312 | * @param[in] message Message | ||
1313 | * @param[in] callback Callback for tag message iteration (optional) | ||
1314 | * @param[in,out] cls Closure for tag message iteration (optional) | ||
1315 | * @return Amount of tag messages iterated or #GNUNET_SYSERR on failure | ||
1316 | */ | ||
1317 | int | ||
1318 | GNUNET_CHAT_message_iterate_tags (const struct GNUNET_CHAT_Message *message, | ||
1319 | GNUNET_CHAT_MessageCallback callback, | ||
1320 | void *cls); | ||
1321 | |||
1322 | /** | ||
1272 | * Returns the name of a given <i>file</i> handle. | 1323 | * Returns the name of a given <i>file</i> handle. |
1273 | * | 1324 | * |
1274 | * @param[in] file File handle | 1325 | * @param[in] file File handle |