diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2022-02-18 00:55:52 +0100 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2022-02-18 00:55:52 +0100 |
commit | fc3e6095465c119e9b58777ccb385ae91181eafe (patch) | |
tree | 2e6aeac1a42aa75bae5c0c920a590c1ad23fa2dc | |
parent | 2d86ca47e55589718307872999b8cb362b818ba0 (diff) | |
download | libgnunetchat-fc3e6095465c119e9b58777ccb385ae91181eafe.tar.gz libgnunetchat-fc3e6095465c119e9b58777ccb385ae91181eafe.zip |
Added message target for deletions
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-rw-r--r-- | include/gnunet_chat_lib.h | 11 | ||||
-rw-r--r-- | src/gnunet_chat_lib.c | 24 |
2 files changed, 30 insertions, 5 deletions
diff --git a/include/gnunet_chat_lib.h b/include/gnunet_chat_lib.h index 6eb5c70..e09643e 100644 --- a/include/gnunet_chat_lib.h +++ b/include/gnunet_chat_lib.h | |||
@@ -876,6 +876,17 @@ struct GNUNET_CHAT_Invitation* | |||
876 | GNUNET_CHAT_message_get_invitation (const struct GNUNET_CHAT_Message *message); | 876 | GNUNET_CHAT_message_get_invitation (const struct GNUNET_CHAT_Message *message); |
877 | 877 | ||
878 | /** | 878 | /** |
879 | * Returns the target message of an operation represented by a given | ||
880 | * <i>message</i> if its kind is #GNUNET_CHAT_KIND_DELETION, otherwise it | ||
881 | * returns NULL. | ||
882 | * | ||
883 | * @param[in] message Message | ||
884 | * @return The target of message or NULL | ||
885 | */ | ||
886 | const struct GNUNET_CHAT_Message* | ||
887 | GNUNET_CHAT_message_get_target (const struct GNUNET_CHAT_Message *message); | ||
888 | |||
889 | /** | ||
879 | * Deletes a given <i>message</i> with a specific relative <i>delay</i>. | 890 | * Deletes a given <i>message</i> with a specific relative <i>delay</i>. |
880 | * | 891 | * |
881 | * @param[in] message Message | 892 | * @param[in] message Message |
diff --git a/src/gnunet_chat_lib.c b/src/gnunet_chat_lib.c index f4e8d42..16fb27d 100644 --- a/src/gnunet_chat_lib.c +++ b/src/gnunet_chat_lib.c | |||
@@ -1080,6 +1080,25 @@ GNUNET_CHAT_message_get_invitation (const struct GNUNET_CHAT_Message *message) | |||
1080 | } | 1080 | } |
1081 | 1081 | ||
1082 | 1082 | ||
1083 | const struct GNUNET_CHAT_Message* | ||
1084 | GNUNET_CHAT_message_get_target (const struct GNUNET_CHAT_Message *message) | ||
1085 | { | ||
1086 | if ((!message) || (!(message->msg)) || (!(message->context))) | ||
1087 | return NULL; | ||
1088 | |||
1089 | struct GNUNET_CHAT_Message *target; | ||
1090 | |||
1091 | if (GNUNET_MESSENGER_KIND_DELETE == message->msg->header.kind) | ||
1092 | target = GNUNET_CONTAINER_multihashmap_get( | ||
1093 | message->context->messages, &(message->msg->body.deletion.hash) | ||
1094 | ); | ||
1095 | else | ||
1096 | target = NULL; | ||
1097 | |||
1098 | return target; | ||
1099 | } | ||
1100 | |||
1101 | |||
1083 | int | 1102 | int |
1084 | GNUNET_CHAT_message_delete (const struct GNUNET_CHAT_Message *message, | 1103 | GNUNET_CHAT_message_delete (const struct GNUNET_CHAT_Message *message, |
1085 | struct GNUNET_TIME_Relative delay) | 1104 | struct GNUNET_TIME_Relative delay) |
@@ -1360,8 +1379,6 @@ GNUNET_CHAT_file_is_unindexing (const struct GNUNET_CHAT_File *file) | |||
1360 | } | 1379 | } |
1361 | 1380 | ||
1362 | 1381 | ||
1363 | |||
1364 | |||
1365 | int | 1382 | int |
1366 | GNUNET_CHAT_file_unindex (struct GNUNET_CHAT_File *file, | 1383 | GNUNET_CHAT_file_unindex (struct GNUNET_CHAT_File *file, |
1367 | GNUNET_CHAT_FileUnindexCallback callback, | 1384 | GNUNET_CHAT_FileUnindexCallback callback, |
@@ -1404,8 +1421,6 @@ GNUNET_CHAT_file_unindex (struct GNUNET_CHAT_File *file, | |||
1404 | } | 1421 | } |
1405 | 1422 | ||
1406 | 1423 | ||
1407 | |||
1408 | |||
1409 | void | 1424 | void |
1410 | GNUNET_CHAT_invitation_accept (struct GNUNET_CHAT_Invitation *invitation) | 1425 | GNUNET_CHAT_invitation_accept (struct GNUNET_CHAT_Invitation *invitation) |
1411 | { | 1426 | { |
@@ -1420,4 +1435,3 @@ GNUNET_CHAT_invitation_accept (struct GNUNET_CHAT_Invitation *invitation) | |||
1420 | &door, &(invitation->key) | 1435 | &door, &(invitation->key) |
1421 | ); | 1436 | ); |
1422 | } | 1437 | } |
1423 | |||