aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheJackiMonster <thejackimonster@gmail.com>2022-02-18 00:55:52 +0100
committerTheJackiMonster <thejackimonster@gmail.com>2022-02-18 00:55:52 +0100
commitfc3e6095465c119e9b58777ccb385ae91181eafe (patch)
tree2e6aeac1a42aa75bae5c0c920a590c1ad23fa2dc
parent2d86ca47e55589718307872999b8cb362b818ba0 (diff)
downloadlibgnunetchat-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.h11
-rw-r--r--src/gnunet_chat_lib.c24
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*
876GNUNET_CHAT_message_get_invitation (const struct GNUNET_CHAT_Message *message); 876GNUNET_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 */
886const struct GNUNET_CHAT_Message*
887GNUNET_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
1083const struct GNUNET_CHAT_Message*
1084GNUNET_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
1083int 1102int
1084GNUNET_CHAT_message_delete (const struct GNUNET_CHAT_Message *message, 1103GNUNET_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
1365int 1382int
1366GNUNET_CHAT_file_unindex (struct GNUNET_CHAT_File *file, 1383GNUNET_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
1409void 1424void
1410GNUNET_CHAT_invitation_accept (struct GNUNET_CHAT_Invitation *invitation) 1425GNUNET_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