commit 9522abbeea36b629e2a2dfb729398363ed295a9c
parent 13b1e7f8e5d289b8da96a3d03e3e825a55944e7e
Author: Jacki <jacki@thejackimonster.de>
Date: Wed, 3 Jan 2024 17:08:43 +0100
Add function to check whether a message is recent
Signed-off-by: Jacki <jacki@thejackimonster.de>
Diffstat:
2 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/include/gnunet/gnunet_chat_lib.h b/include/gnunet/gnunet_chat_lib.h
@@ -1018,6 +1018,17 @@ enum GNUNET_GenericReturnValue
GNUNET_CHAT_message_is_private (const struct GNUNET_CHAT_Message *message);
/**
+ * Returns #GNUNET_YES if the message was received recently by related chat
+ * handle, otherwise it returns #GNUNET_NO.
+ *
+ * @param[in] message Message
+ * @return #GNUNET_YES if the message was received recently,
+ * otherwise #GNUNET_NO
+ */
+enum GNUNET_GenericReturnValue
+GNUNET_CHAT_message_is_recent (const struct GNUNET_CHAT_Message *message);
+
+/**
* Iterates through the contacts of the context related to a given chat
* <i>message</i> to check whether it was received by each of the contacts.
*
diff --git a/src/gnunet_chat_lib.c b/src/gnunet_chat_lib.c
@@ -25,6 +25,7 @@
#include "gnunet_chat_lib.h"
#include <gnunet/gnunet_common.h>
+#include <gnunet/gnunet_messenger_service.h>
#include <libgen.h>
#include <limits.h>
#include <strings.h>
@@ -1429,6 +1430,21 @@ GNUNET_CHAT_message_is_private (const struct GNUNET_CHAT_Message *message)
}
+enum GNUNET_GenericReturnValue
+GNUNET_CHAT_message_is_recent (const struct GNUNET_CHAT_Message *message)
+{
+ GNUNET_CHAT_VERSION_ASSERT();
+
+ if (!message)
+ return GNUNET_SYSERR;
+
+ if (message->flags & GNUNET_MESSENGER_FLAG_RECENT)
+ return GNUNET_YES;
+ else
+ return GNUNET_NO;
+}
+
+
int
GNUNET_CHAT_message_get_read_receipt (const struct GNUNET_CHAT_Message *message,
GNUNET_CHAT_MessageReadReceiptCallback callback,