commit 45c585bcb71556e1b3d5c3a8310b8f12641c35a3
parent a0004f4a14cd15eac1ec3ad5f02e2d13887f46b8
Author: Jacki <jacki@thejackimonster.de>
Date: Thu, 26 Sep 2024 17:51:00 +0200
Fix issue with providing expiration datetime in setting attribute
Diffstat:
4 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/include/gnunet/gnunet_chat_lib.h b/include/gnunet/gnunet_chat_lib.h
@@ -658,13 +658,11 @@ GNUNET_CHAT_get_key (const struct GNUNET_CHAT_Handle *handle);
* @param[in,out] handle Chat handle
* @param[in] name Attribute name
* @param[in] value Attribute value
- * @param[in] expires Expiration time
*/
void
GNUNET_CHAT_set_attribute (struct GNUNET_CHAT_Handle *handle,
const char *name,
- const char *value,
- time_t expires);
+ const char *value);
/**
* Deletes an attribute of a chat <i>handle</i> for related communication
diff --git a/src/gnunet_chat_lib.c b/src/gnunet_chat_lib.c
@@ -329,8 +329,7 @@ GNUNET_CHAT_get_key (const struct GNUNET_CHAT_Handle *handle)
void
GNUNET_CHAT_set_attribute (struct GNUNET_CHAT_Handle *handle,
const char *name,
- const char *value,
- time_t expires)
+ const char *value)
{
GNUNET_CHAT_VERSION_ASSERT();
@@ -344,11 +343,8 @@ GNUNET_CHAT_set_attribute (struct GNUNET_CHAT_Handle *handle,
if ((!key) || (!name))
return;
- const double delay = difftime(expires, time(NULL));
-
- struct GNUNET_TIME_Relative rel = GNUNET_TIME_relative_multiply_double(
- GNUNET_TIME_relative_get_second_(), delay
- );
+ struct GNUNET_TIME_Relative rel;
+ rel = GNUNET_TIME_relative_get_forever_();
struct GNUNET_CHAT_AttributeProcess *attributes;
attributes = internal_attributes_create_store(handle, name, rel);
diff --git a/tests/attribute/test_gnunet_chat_attribute_check.c b/tests/attribute/test_gnunet_chat_attribute_check.c
@@ -89,8 +89,7 @@ on_gnunet_chat_attribute_check_msg(void *cls,
GNUNET_CHAT_set_attribute(
handle,
TEST_CHECK_NAME,
- TEST_CHECK_VALUE,
- time(NULL) + 60
+ TEST_CHECK_VALUE
);
break;
case GNUNET_CHAT_KIND_LOGOUT:
diff --git a/tests/attribute/test_gnunet_chat_attribute_share.c b/tests/attribute/test_gnunet_chat_attribute_share.c
@@ -121,8 +121,7 @@ on_gnunet_chat_attribute_share_msg(void *cls,
GNUNET_CHAT_set_attribute(
handle,
TEST_SHARE_NAME,
- TEST_SHARE_VALUE,
- time(NULL) + 60
+ TEST_SHARE_VALUE
);
share_stage = 5;