diff options
author | Jacki <jacki@thejackimonster.de> | 2024-01-03 17:08:43 +0100 |
---|---|---|
committer | Jacki <jacki@thejackimonster.de> | 2024-01-03 17:08:43 +0100 |
commit | 9522abbeea36b629e2a2dfb729398363ed295a9c (patch) | |
tree | 51235c7f29ffa43f24eb601dce079c93edcdab81 | |
parent | 13b1e7f8e5d289b8da96a3d03e3e825a55944e7e (diff) | |
download | libgnunetchat-9522abbeea36b629e2a2dfb729398363ed295a9c.tar.gz libgnunetchat-9522abbeea36b629e2a2dfb729398363ed295a9c.zip |
Add function to check whether a message is recent
Signed-off-by: Jacki <jacki@thejackimonster.de>
-rw-r--r-- | include/gnunet/gnunet_chat_lib.h | 11 | ||||
-rw-r--r-- | src/gnunet_chat_lib.c | 16 |
2 files changed, 27 insertions, 0 deletions
diff --git a/include/gnunet/gnunet_chat_lib.h b/include/gnunet/gnunet_chat_lib.h index 6e3829e..8881619 100644 --- a/include/gnunet/gnunet_chat_lib.h +++ b/include/gnunet/gnunet_chat_lib.h | |||
@@ -1018,6 +1018,17 @@ enum GNUNET_GenericReturnValue | |||
1018 | GNUNET_CHAT_message_is_private (const struct GNUNET_CHAT_Message *message); | 1018 | GNUNET_CHAT_message_is_private (const struct GNUNET_CHAT_Message *message); |
1019 | 1019 | ||
1020 | /** | 1020 | /** |
1021 | * Returns #GNUNET_YES if the message was received recently by related chat | ||
1022 | * handle, otherwise it returns #GNUNET_NO. | ||
1023 | * | ||
1024 | * @param[in] message Message | ||
1025 | * @return #GNUNET_YES if the message was received recently, | ||
1026 | * otherwise #GNUNET_NO | ||
1027 | */ | ||
1028 | enum GNUNET_GenericReturnValue | ||
1029 | GNUNET_CHAT_message_is_recent (const struct GNUNET_CHAT_Message *message); | ||
1030 | |||
1031 | /** | ||
1021 | * Iterates through the contacts of the context related to a given chat | 1032 | * Iterates through the contacts of the context related to a given chat |
1022 | * <i>message</i> to check whether it was received by each of the contacts. | 1033 | * <i>message</i> to check whether it was received by each of the contacts. |
1023 | * | 1034 | * |
diff --git a/src/gnunet_chat_lib.c b/src/gnunet_chat_lib.c index d2e0e22..c10307c 100644 --- a/src/gnunet_chat_lib.c +++ b/src/gnunet_chat_lib.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include "gnunet_chat_lib.h" | 25 | #include "gnunet_chat_lib.h" |
26 | 26 | ||
27 | #include <gnunet/gnunet_common.h> | 27 | #include <gnunet/gnunet_common.h> |
28 | #include <gnunet/gnunet_messenger_service.h> | ||
28 | #include <libgen.h> | 29 | #include <libgen.h> |
29 | #include <limits.h> | 30 | #include <limits.h> |
30 | #include <strings.h> | 31 | #include <strings.h> |
@@ -1429,6 +1430,21 @@ GNUNET_CHAT_message_is_private (const struct GNUNET_CHAT_Message *message) | |||
1429 | } | 1430 | } |
1430 | 1431 | ||
1431 | 1432 | ||
1433 | enum GNUNET_GenericReturnValue | ||
1434 | GNUNET_CHAT_message_is_recent (const struct GNUNET_CHAT_Message *message) | ||
1435 | { | ||
1436 | GNUNET_CHAT_VERSION_ASSERT(); | ||
1437 | |||
1438 | if (!message) | ||
1439 | return GNUNET_SYSERR; | ||
1440 | |||
1441 | if (message->flags & GNUNET_MESSENGER_FLAG_RECENT) | ||
1442 | return GNUNET_YES; | ||
1443 | else | ||
1444 | return GNUNET_NO; | ||
1445 | } | ||
1446 | |||
1447 | |||
1432 | int | 1448 | int |
1433 | GNUNET_CHAT_message_get_read_receipt (const struct GNUNET_CHAT_Message *message, | 1449 | GNUNET_CHAT_message_get_read_receipt (const struct GNUNET_CHAT_Message *message, |
1434 | GNUNET_CHAT_MessageReadReceiptCallback callback, | 1450 | GNUNET_CHAT_MessageReadReceiptCallback callback, |