aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheJackiMonster <thejackimonster@gmail.com>2022-10-30 00:07:10 +0200
committerTheJackiMonster <thejackimonster@gmail.com>2022-10-30 00:07:10 +0200
commit4ab90069c9a94129cf6bc583687d817cebe8d1f3 (patch)
tree2d1dd20e67f4aff26589733dade967596f7c6d43
parent43a8fae35436910946742e551ff46a1549e2d262 (diff)
downloadlibgnunetchat-4ab90069c9a94129cf6bc583687d817cebe8d1f3.tar.gz
libgnunetchat-4ab90069c9a94129cf6bc583687d817cebe8d1f3.zip
Update code to newest GNUnet changes and improve automake
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-rw-r--r--configure.ac4
-rw-r--r--include/Makefile.am7
-rw-r--r--include/gnunet/gnunet_chat_lib.h (renamed from include/gnunet_chat_lib.h)0
-rw-r--r--src/gnunet_chat_context_intern.c9
-rw-r--r--src/gnunet_chat_handle_intern.c27
-rw-r--r--src/gnunet_chat_lobby_intern.c13
-rw-r--r--tests/Makefile.am5
7 files changed, 39 insertions, 26 deletions
diff --git a/configure.ac b/configure.ac
index fc58e40..052b856 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,14 +25,14 @@ AC_CONFIG_AUX_DIR([build-aux])
25AC_CONFIG_MACRO_DIRS([m4]) 25AC_CONFIG_MACRO_DIRS([m4])
26 26
27AC_CONFIG_HEADERS([ 27AC_CONFIG_HEADERS([
28 include/gnunet_chat_config.h 28 include/gnunet/gnunet_chat_config.h
29]) 29])
30 30
31AC_CANONICAL_TARGET 31AC_CANONICAL_TARGET
32AC_CANONICAL_HOST 32AC_CANONICAL_HOST
33 33
34AM_INIT_AUTOMAKE([tar-ustar]) 34AM_INIT_AUTOMAKE([tar-ustar])
35AM_SILENT_RULES([yes]) 35AM_SILENT_RULES
36 36
37# maybe use AC_USE_SYSTEM_EXTENSIONS? 37# maybe use AC_USE_SYSTEM_EXTENSIONS?
38AH_TOP([#define _GNU_SOURCE 1]) 38AH_TOP([#define _GNU_SOURCE 1])
diff --git a/include/Makefile.am b/include/Makefile.am
index 77cfc23..c1fed22 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,4 +1,7 @@
1# This Makefile.am is in the public domain 1# This Makefile.am is in the public domain
2include_HEADERS = \ 2
3 gnunet_chat_lib.h 3gnunetincludedir = $(includedir)/gnunet
4
5gnunetinclude_HEADERS = \
6 gnunet/gnunet_chat_lib.h
4 7
diff --git a/include/gnunet_chat_lib.h b/include/gnunet/gnunet_chat_lib.h
index 1f94391..1f94391 100644
--- 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
index b9fca1d..ca90e06 100644
--- a/src/gnunet_chat_context_intern.c
+++ b/src/gnunet_chat_context_intern.c
@@ -25,6 +25,8 @@
25#include "gnunet_chat_invitation.h" 25#include "gnunet_chat_invitation.h"
26#include "gnunet_chat_message.h" 26#include "gnunet_chat_message.h"
27 27
28#include <gnunet/gnunet_error_codes.h>
29
28#define GNUNET_UNUSED __attribute__ ((unused)) 30#define GNUNET_UNUSED __attribute__ ((unused))
29 31
30int 32int
@@ -65,8 +67,7 @@ it_destroy_context_invites (GNUNET_UNUSED void *cls,
65 67
66void 68void
67cont_context_write_records (void *cls, 69cont_context_write_records (void *cls,
68 GNUNET_UNUSED int32_t success, 70 enum GNUNET_ErrorCode ec)
69 const char *emsg)
70{ 71{
71 struct GNUNET_CHAT_Context *context = cls; 72 struct GNUNET_CHAT_Context *context = cls;
72 73
@@ -74,11 +75,11 @@ cont_context_write_records (void *cls,
74 75
75 context->query = NULL; 76 context->query = NULL;
76 77
77 if (emsg) 78 if (GNUNET_EC_NONE != ec)
78 handle_send_internal_message( 79 handle_send_internal_message(
79 context->handle, 80 context->handle,
80 context, 81 context,
81 GNUNET_CHAT_FLAG_WARNING, 82 GNUNET_CHAT_FLAG_WARNING,
82 emsg 83 GNUNET_ErrorCode_get_hint(ec)
83 ); 84 );
84} 85}
diff --git a/src/gnunet_chat_handle_intern.c b/src/gnunet_chat_handle_intern.c
index 04afcbc..3811344 100644
--- a/src/gnunet_chat_handle_intern.c
+++ b/src/gnunet_chat_handle_intern.c
@@ -315,7 +315,7 @@ send_refresh:
315void 315void
316cb_account_creation (void *cls, 316cb_account_creation (void *cls,
317 const struct GNUNET_IDENTITY_PrivateKey *key, 317 const struct GNUNET_IDENTITY_PrivateKey *key,
318 const char *emsg) 318 enum GNUNET_ErrorCode ec)
319{ 319{
320 GNUNET_assert(cls); 320 GNUNET_assert(cls);
321 321
@@ -333,15 +333,24 @@ cb_account_creation (void *cls,
333 333
334 GNUNET_free(accounts); 334 GNUNET_free(accounts);
335 335
336 if (emsg) 336 if (GNUNET_EC_NONE != ec)
337 handle_send_internal_message(handle, NULL, GNUNET_CHAT_FLAG_WARNING, emsg); 337 {
338 handle_send_internal_message(
339 handle,
340 NULL,
341 GNUNET_CHAT_FLAG_WARNING,
342 GNUNET_ErrorCode_get_hint(ec)
343 );
344
345 return;
346 }
338 else if (key) 347 else if (key)
339 handle_send_internal_message(handle, NULL, GNUNET_CHAT_FLAG_REFRESH, NULL); 348 handle_send_internal_message(handle, NULL, GNUNET_CHAT_FLAG_REFRESH, NULL);
340} 349}
341 350
342void 351void
343cb_account_deletion (void *cls, 352cb_account_deletion (void *cls,
344 const char *emsg) 353 enum GNUNET_ErrorCode ec)
345{ 354{
346 GNUNET_assert(cls); 355 GNUNET_assert(cls);
347 356
@@ -359,9 +368,15 @@ cb_account_deletion (void *cls,
359 368
360 GNUNET_free(accounts); 369 GNUNET_free(accounts);
361 370
362 if (emsg) 371 if (GNUNET_EC_NONE != ec)
363 { 372 {
364 handle_send_internal_message(handle, NULL, GNUNET_CHAT_FLAG_WARNING, emsg); 373 handle_send_internal_message(
374 handle,
375 NULL,
376 GNUNET_CHAT_FLAG_WARNING,
377 GNUNET_ErrorCode_get_hint(ec)
378 );
379
365 return; 380 return;
366 } 381 }
367} 382}
diff --git a/src/gnunet_chat_lobby_intern.c b/src/gnunet_chat_lobby_intern.c
index 135dfe5..1d031b0 100644
--- a/src/gnunet_chat_lobby_intern.c
+++ b/src/gnunet_chat_lobby_intern.c
@@ -26,8 +26,7 @@
26 26
27void 27void
28cont_lobby_write_records (void *cls, 28cont_lobby_write_records (void *cls,
29 GNUNET_UNUSED int32_t success, 29 enum GNUNET_ErrorCode ec)
30 const char *emsg)
31{ 30{
32 struct GNUNET_CHAT_Lobby *lobby = cls; 31 struct GNUNET_CHAT_Lobby *lobby = cls;
33 32
@@ -46,7 +45,7 @@ cont_lobby_write_records (void *cls,
46 45
47 GNUNET_free(name); 46 GNUNET_free(name);
48 47
49 if (!emsg) 48 if (GNUNET_EC_NONE == ec)
50 { 49 {
51 context_write_records(lobby->context); 50 context_write_records(lobby->context);
52 goto call_cb; 51 goto call_cb;
@@ -56,7 +55,7 @@ cont_lobby_write_records (void *cls,
56 lobby->handle, 55 lobby->handle,
57 lobby->context, 56 lobby->context,
58 GNUNET_CHAT_FLAG_WARNING, 57 GNUNET_CHAT_FLAG_WARNING,
59 emsg 58 GNUNET_ErrorCode_get_hint(ec)
60 ); 59 );
61 60
62 if (lobby->uri) 61 if (lobby->uri)
@@ -72,7 +71,7 @@ call_cb:
72void 71void
73cont_lobby_identity_create (void *cls, 72cont_lobby_identity_create (void *cls,
74 const struct GNUNET_IDENTITY_PrivateKey *zone, 73 const struct GNUNET_IDENTITY_PrivateKey *zone,
75 const char *emsg) 74 enum GNUNET_ErrorCode ec)
76{ 75{
77 struct GNUNET_CHAT_Lobby *lobby = cls; 76 struct GNUNET_CHAT_Lobby *lobby = cls;
78 77
@@ -80,13 +79,13 @@ cont_lobby_identity_create (void *cls,
80 79
81 lobby->op = NULL; 80 lobby->op = NULL;
82 81
83 if (emsg) 82 if (GNUNET_EC_NONE != ec)
84 { 83 {
85 handle_send_internal_message( 84 handle_send_internal_message(
86 lobby->handle, 85 lobby->handle,
87 lobby->context, 86 lobby->context,
88 GNUNET_CHAT_FLAG_WARNING, 87 GNUNET_CHAT_FLAG_WARNING,
89 emsg 88 GNUNET_ErrorCode_get_hint(ec)
90 ); 89 );
91 90
92 return; 91 return;
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8181235..1c0f55b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -8,7 +8,6 @@ check_PROGRAMS = \
8 test_gnunet_chat_file.test 8 test_gnunet_chat_file.test
9 9
10AM_TESTS_ENVIRONMENT = \ 10AM_TESTS_ENVIRONMENT = \
11 ln -sf $(top_srcdir)/include $(top_srcdir)/tests/gnunet;
12 export LD_LIBRARY_PATH=$(top_srcdir); 11 export LD_LIBRARY_PATH=$(top_srcdir);
13TESTS = \ 12TESTS = \
14 $(check_PROGRAMS) 13 $(check_PROGRAMS)
@@ -30,7 +29,3 @@ test_gnunet_chat_file_test_SOURCES = \
30test_gnunet_chat_file_test_LDADD = \ 29test_gnunet_chat_file_test_LDADD = \
31 -lcheck \ 30 -lcheck \
32 $(top_builddir)/src/libgnunetchat.la 31 $(top_builddir)/src/libgnunetchat.la
33
34clean:
35 rm $(top_srcdir)/tests/gnunet
36