diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2021-09-19 16:59:05 +0200 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2022-03-01 17:09:53 +0100 |
commit | fff4901b230b314e34e738f26809ba7d675f45a5 (patch) | |
tree | d858b0fe19ec4c511d7be561c6037eb29d11b87b | |
parent | 8bd17292e898cfbd4dc2a75da3866887f35ff9e4 (diff) |
Added initial code required for a GNUnet application
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | src/messenger_cli.c | 43 |
2 files changed, 41 insertions, 4 deletions
@@ -6,7 +6,7 @@ BINARY = messenger-cli SOURCES = messenger_cli.c HEADERS = -LIBRARIES = gnunetchat +LIBRARIES = gnunetchat gnunetutil CC ?= gcc LD ?= gcc diff --git a/src/messenger_cli.c b/src/messenger_cli.c index cee3020..253a1ae 100644 --- a/src/messenger_cli.c +++ b/src/messenger_cli.c @@ -22,9 +22,46 @@ * @file messenger_cli.c */ +#include <gnunet/platform.h> #include <gnunet/gnunet_chat_lib.h> +#include <gnunet/gnunet_util_lib.h> -int main(int argc, const char** argv) { - GNUNET_CHAT_test("Hello world"); - return 0; +static void +run (void *cls, char* const* args, + const char *cfgfile, + const struct GNUNET_CONFIGURATION_Handle *cfg) +{ + struct GNUNET_CHAT_Handle *handle = GNUNET_CHAT_start( + cfg, + "appdir", + "username", + NULL, NULL, + NULL, NULL + ); + + // + + GNUNET_CHAT_stop(handle); +} + +int +main (int argc, char* const* argv) +{ + struct GNUNET_GETOPT_CommandLineOption options[] = { + GNUNET_GETOPT_OPTION_END + }; + + int result = GNUNET_PROGRAM_run( + argc, argv, + "messenger_cli", + gettext_noop("A CLI for the Messenger service of GNUnet."), + options, + &run, + NULL + ); + + if (result != GNUNET_OK) + return EXIT_FAILURE; + else + return EXIT_SUCCESS; } |