gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated: MESSENGER: Add function to delete messag


From: gnunet
Subject: [gnunet] branch master updated: MESSENGER: Add function to delete messages
Date: Sat, 20 Jan 2024 10:54:21 +0100

This is an automated email from the git hooks/post-receive script.

thejackimonster pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 24ebc1a6e MESSENGER: Add function to delete messages
24ebc1a6e is described below

commit 24ebc1a6e2ef727c1ceee2da47834c0737e1745e
Author: TheJackiMonster <thejackimonster@gmail.com>
AuthorDate: Sat Jan 20 10:51:00 2024 +0100

    MESSENGER: Add function to delete messages
    
    Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
---
 src/include/gnunet_messenger_service.h        | 16 ++++++++++++++++
 src/service/messenger/messenger_api.c         | 24 +++++++++++++++++++++++-
 src/service/messenger/messenger_api_message.c |  2 +-
 3 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/src/include/gnunet_messenger_service.h 
b/src/include/gnunet_messenger_service.h
index e0ccea27a..8e1cd666d 100644
--- a/src/include/gnunet_messenger_service.h
+++ b/src/include/gnunet_messenger_service.h
@@ -956,6 +956,22 @@ GNUNET_MESSENGER_send_message (struct 
GNUNET_MESSENGER_Room *room,
                                const struct GNUNET_MESSENGER_Message *message,
                                const struct GNUNET_MESSENGER_Contact *contact);
 
+/**
+ * Delete a message identified by its <i>hash</i> from a <i>room</i>. A 
deletion will be propagated to all members 
+ * of the room as with any other sent message. Notice that a deletion will 
only request other members of the room 
+ * to delete the selected message. If you are not permitted to delete the 
message, the deletion will be ignored.
+ *
+ * Depending on the implementation other clients may also ignore your deletion 
request in other circumstances.
+ *
+ * @param[in,out] room Room handle
+ * @param[in] message Message to delete
+ * @param[in] delay Delay to delete the message
+ */
+void
+GNUNET_MESSENGER_delete_message (struct GNUNET_MESSENGER_Room *room,
+                                 const struct GNUNET_HashCode *hash,
+                                 const struct GNUNET_TIME_Relative delay);
+
 /**
  * Get the message in a <i>room</i> identified by its <i>hash</i>.
  *
diff --git a/src/service/messenger/messenger_api.c 
b/src/service/messenger/messenger_api.c
index 2981b1a71..1756ac91b 100644
--- a/src/service/messenger/messenger_api.c
+++ b/src/service/messenger/messenger_api.c
@@ -30,6 +30,7 @@
 #include "gnunet-service-messenger.h"
 
 #include "gnunet_reclaim_service.h"
+#include "gnunet_time_lib.h"
 #include "messenger_api_contact.h"
 #include "messenger_api_contact_store.h"
 #include "messenger_api_handle.h"
@@ -1209,7 +1210,28 @@ GNUNET_MESSENGER_send_message (struct 
GNUNET_MESSENGER_Room *room,
   else
     public_key = NULL;
 
-  send_message_to_room_with_key (room, copy_message(message), public_key);
+  send_message_to_room_with_key (room, copy_message(message), NULL);
+}
+
+
+void
+GNUNET_MESSENGER_delete_message (struct GNUNET_MESSENGER_Room *room,
+                                 const struct GNUNET_HashCode *hash,
+                                 const struct GNUNET_TIME_Relative delay)
+{
+  if ((! room) || (! hash))
+    return;
+
+  struct GNUNET_MESSENGER_Message *message = create_message_delete(hash, 
delay);
+
+  if (! message)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "Sending deletion aborted: Message creation failed!\n");
+    return;
+  }
+
+  send_message_to_room_with_key (room, message, NULL);
 }
 
 
diff --git a/src/service/messenger/messenger_api_message.c 
b/src/service/messenger/messenger_api_message.c
index 884adabed..f6d8c31f7 100644
--- a/src/service/messenger/messenger_api_message.c
+++ b/src/service/messenger/messenger_api_message.c
@@ -1312,7 +1312,7 @@ filter_message_sending (const struct 
GNUNET_MESSENGER_Message *message)
   case GNUNET_MESSENGER_KIND_PRIVATE:
     return GNUNET_NO; // Use #GNUNET_MESSENGER_send_message(...) with a 
contact instead!
   case GNUNET_MESSENGER_KIND_DELETE:
-    return GNUNET_YES;
+    return GNUNET_NO; // Use #GNUNET_MESSENGER_delete_message(...) instead!
   case GNUNET_MESSENGER_KIND_CONNECTION:
     return GNUNET_SYSERR; // Reserved for connection handling only!
   case GNUNET_MESSENGER_KIND_TICKET:

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]