commit 4ab90069c9a94129cf6bc583687d817cebe8d1f3
parent 43a8fae35436910946742e551ff46a1549e2d262
Author: TheJackiMonster <thejackimonster@gmail.com>
Date: Sun, 30 Oct 2022 00:07:10 +0200
Update code to newest GNUnet changes and improve automake
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
Diffstat:
7 files changed, 39 insertions(+), 26 deletions(-)
diff --git a/configure.ac b/configure.ac
@@ -25,14 +25,14 @@ AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([m4])
AC_CONFIG_HEADERS([
- include/gnunet_chat_config.h
+ include/gnunet/gnunet_chat_config.h
])
AC_CANONICAL_TARGET
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([tar-ustar])
-AM_SILENT_RULES([yes])
+AM_SILENT_RULES
# maybe use AC_USE_SYSTEM_EXTENSIONS?
AH_TOP([#define _GNU_SOURCE 1])
diff --git a/include/Makefile.am b/include/Makefile.am
@@ -1,4 +1,7 @@
# This Makefile.am is in the public domain
-include_HEADERS = \
- gnunet_chat_lib.h
+
+gnunetincludedir = $(includedir)/gnunet
+
+gnunetinclude_HEADERS = \
+ gnunet/gnunet_chat_lib.h
diff --git a/include/gnunet_chat_lib.h b/include/gnunet/gnunet_chat_lib.h
diff --git a/src/gnunet_chat_context_intern.c b/src/gnunet_chat_context_intern.c
@@ -25,6 +25,8 @@
#include "gnunet_chat_invitation.h"
#include "gnunet_chat_message.h"
+#include <gnunet/gnunet_error_codes.h>
+
#define GNUNET_UNUSED __attribute__ ((unused))
int
@@ -65,8 +67,7 @@ it_destroy_context_invites (GNUNET_UNUSED void *cls,
void
cont_context_write_records (void *cls,
- GNUNET_UNUSED int32_t success,
- const char *emsg)
+ enum GNUNET_ErrorCode ec)
{
struct GNUNET_CHAT_Context *context = cls;
@@ -74,11 +75,11 @@ cont_context_write_records (void *cls,
context->query = NULL;
- if (emsg)
+ if (GNUNET_EC_NONE != ec)
handle_send_internal_message(
context->handle,
context,
GNUNET_CHAT_FLAG_WARNING,
- emsg
+ GNUNET_ErrorCode_get_hint(ec)
);
}
diff --git a/src/gnunet_chat_handle_intern.c b/src/gnunet_chat_handle_intern.c
@@ -315,7 +315,7 @@ send_refresh:
void
cb_account_creation (void *cls,
const struct GNUNET_IDENTITY_PrivateKey *key,
- const char *emsg)
+ enum GNUNET_ErrorCode ec)
{
GNUNET_assert(cls);
@@ -333,15 +333,24 @@ cb_account_creation (void *cls,
GNUNET_free(accounts);
- if (emsg)
- handle_send_internal_message(handle, NULL, GNUNET_CHAT_FLAG_WARNING, emsg);
+ if (GNUNET_EC_NONE != ec)
+ {
+ handle_send_internal_message(
+ handle,
+ NULL,
+ GNUNET_CHAT_FLAG_WARNING,
+ GNUNET_ErrorCode_get_hint(ec)
+ );
+
+ return;
+ }
else if (key)
handle_send_internal_message(handle, NULL, GNUNET_CHAT_FLAG_REFRESH, NULL);
}
void
cb_account_deletion (void *cls,
- const char *emsg)
+ enum GNUNET_ErrorCode ec)
{
GNUNET_assert(cls);
@@ -359,9 +368,15 @@ cb_account_deletion (void *cls,
GNUNET_free(accounts);
- if (emsg)
+ if (GNUNET_EC_NONE != ec)
{
- handle_send_internal_message(handle, NULL, GNUNET_CHAT_FLAG_WARNING, emsg);
+ handle_send_internal_message(
+ handle,
+ NULL,
+ GNUNET_CHAT_FLAG_WARNING,
+ GNUNET_ErrorCode_get_hint(ec)
+ );
+
return;
}
}
diff --git a/src/gnunet_chat_lobby_intern.c b/src/gnunet_chat_lobby_intern.c
@@ -26,8 +26,7 @@
void
cont_lobby_write_records (void *cls,
- GNUNET_UNUSED int32_t success,
- const char *emsg)
+ enum GNUNET_ErrorCode ec)
{
struct GNUNET_CHAT_Lobby *lobby = cls;
@@ -46,7 +45,7 @@ cont_lobby_write_records (void *cls,
GNUNET_free(name);
- if (!emsg)
+ if (GNUNET_EC_NONE == ec)
{
context_write_records(lobby->context);
goto call_cb;
@@ -56,7 +55,7 @@ cont_lobby_write_records (void *cls,
lobby->handle,
lobby->context,
GNUNET_CHAT_FLAG_WARNING,
- emsg
+ GNUNET_ErrorCode_get_hint(ec)
);
if (lobby->uri)
@@ -72,7 +71,7 @@ call_cb:
void
cont_lobby_identity_create (void *cls,
const struct GNUNET_IDENTITY_PrivateKey *zone,
- const char *emsg)
+ enum GNUNET_ErrorCode ec)
{
struct GNUNET_CHAT_Lobby *lobby = cls;
@@ -80,13 +79,13 @@ cont_lobby_identity_create (void *cls,
lobby->op = NULL;
- if (emsg)
+ if (GNUNET_EC_NONE != ec)
{
handle_send_internal_message(
lobby->handle,
lobby->context,
GNUNET_CHAT_FLAG_WARNING,
- emsg
+ GNUNET_ErrorCode_get_hint(ec)
);
return;
diff --git a/tests/Makefile.am b/tests/Makefile.am
@@ -8,7 +8,6 @@ check_PROGRAMS = \
test_gnunet_chat_file.test
AM_TESTS_ENVIRONMENT = \
- ln -sf $(top_srcdir)/include $(top_srcdir)/tests/gnunet;
export LD_LIBRARY_PATH=$(top_srcdir);
TESTS = \
$(check_PROGRAMS)
@@ -30,7 +29,3 @@ test_gnunet_chat_file_test_SOURCES = \
test_gnunet_chat_file_test_LDADD = \
-lcheck \
$(top_builddir)/src/libgnunetchat.la
-
-clean:
- rm $(top_srcdir)/tests/gnunet
-