commit a11f869069254bc8573964f2004d1f5cbbcf1c08
parent a480a1341c22f79468473908958eeeedf507c959
Author: TheJackiMonster <thejackimonster@gmail.com>
Date: Sat, 11 Nov 2023 01:53:15 +0100
Fix build issues regarding API changes in GNUnet
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
Diffstat:
4 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/include/gnunet/gnunet_chat_lib.h b/include/gnunet/gnunet_chat_lib.h
@@ -41,7 +41,7 @@
* the #GNUNET_MESSENGER_VERSION of the GNUnet Messenger
* service while the patch version is independent.
*/
-#define GNUNET_CHAT_VERSION 0x000000020000L
+#define GNUNET_CHAT_VERSION 0x000000030000L
#define GNUNET_CHAT_VERSION_MAJOR ((GNUNET_CHAT_VERSION >> 32L) & 0xFFFFL)
#define GNUNET_CHAT_VERSION_MINOR ((GNUNET_CHAT_VERSION >> 16L) & 0xFFFFL)
diff --git a/src/gnunet_chat_handle.c b/src/gnunet_chat_handle.c
@@ -241,6 +241,10 @@ handle_connect (struct GNUNET_CHAT_Handle *handle,
const char *name = account->name;
+ const struct GNUNET_IDENTITY_PrivateKey *key = NULL;
+ if (account->ego)
+ key = GNUNET_IDENTITY_ego_get_private_key(account->ego);
+
char* fs_client_name = NULL;
GNUNET_asprintf (
&fs_client_name,
@@ -261,13 +265,14 @@ handle_connect (struct GNUNET_CHAT_Handle *handle,
handle->gns = GNUNET_GNS_connect(handle->cfg);
handle->messenger = GNUNET_MESSENGER_connect(
- handle->cfg, name,
- on_handle_identity, handle,
+ handle->cfg, name, key,
on_handle_message, handle
);
handle->current = account;
handle_update_key(handle);
+
+ on_handle_identity(handle, handle->messenger);
}
void
@@ -509,6 +514,16 @@ handle_get_directory (const struct GNUNET_CHAT_Handle *handle)
return handle->current->directory;
}
+int
+handle_update (struct GNUNET_CHAT_Handle *handle)
+{
+ GNUNET_assert((handle) && (handle->current));
+
+ // TODO: Implement update function
+
+ return GNUNET_SYSERR;
+}
+
const struct GNUNET_IDENTITY_PrivateKey*
handle_get_key (const struct GNUNET_CHAT_Handle *handle)
{
diff --git a/src/gnunet_chat_handle.h b/src/gnunet_chat_handle.h
@@ -208,6 +208,17 @@ const char*
handle_get_directory (const struct GNUNET_CHAT_Handle *handle);
/**
+ * Updates the used private key by creating a new identity
+ * using the same identifier as currently in use, replacing
+ * the old identity.
+ *
+ * @param[in] handle Chat handle
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
+ */
+int
+handle_update (struct GNUNET_CHAT_Handle *handle);
+
+/**
* Returns the private key from the current connected chat
* account of a given chat <i>handle</i>.
*
diff --git a/src/gnunet_chat_lib.c b/src/gnunet_chat_lib.c
@@ -199,7 +199,7 @@ GNUNET_CHAT_update (struct GNUNET_CHAT_Handle *handle)
if ((!handle) || (handle->destruction))
return GNUNET_SYSERR;
- return GNUNET_MESSENGER_update(handle->messenger);
+ return handle_update(handle);
}