gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r37118 - gnunet/src/social


From: gnunet
Subject: [GNUnet-SVN] r37118 - gnunet/src/social
Date: Tue, 3 May 2016 22:39:59 +0200

Author: lynx
Date: 2016-05-03 22:39:58 +0200 (Tue, 03 May 2016)
New Revision: 37118

Modified:
   gnunet/src/social/gnunet-social.c
Log:
parsing parameters for gnunet-social.c a bit

Modified: gnunet/src/social/gnunet-social.c
===================================================================
--- gnunet/src/social/gnunet-social.c   2016-05-03 20:04:26 UTC (rev 37117)
+++ gnunet/src/social/gnunet-social.c   2016-05-03 20:39:58 UTC (rev 37118)
@@ -30,6 +30,9 @@
 #include "gnunet_util_lib.h"
 #include "gnunet_social_service.h"
 
+/** shell return code */
+static int ret = 0;
+
 /* operations corresponding to API calls */
 
 /** --host-enter */
@@ -56,6 +59,8 @@
 /** --history-replay-latest */
 static char *op_history_replay_latest;
 
+// FIXME: look-at and look-for
+
 /* options */
 
 /** --place */
@@ -68,7 +73,7 @@
 static char *method;
 
 /** --data */
-static char *data;
+static char *data;     // should come from stdin instead, FIXME
 
 /** --prefix */
 static char *prefix;
@@ -95,6 +100,56 @@
 run (void *cls, char *const *args, const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *cfg)
 {
+  if (op_host_enter) {
+     FPRINTF (stderr,
+               _("FIXME -C\n"));
+     if (flag_listen) {
+        FPRINTF (stderr,
+               _("Yes, yes!\n"));
+     }
+     return;
+  }
+  if (NULL == place) {
+     FPRINTF (stderr,
+               _("You did not provide me with a place to talk to.\n"));
+     ret = 1;
+     return;
+  }
+  if (op_guest_enter) {
+     FPRINTF (stderr,
+               _("FIXME -E\n"));
+     if (flag_listen) {
+        FPRINTF (stderr,
+               _("Yes, yes!\n"));
+     }
+     return;
+  }
+  if (flag_listen) {
+     FPRINTF (stderr,
+               _("The --listen flag is not defined for this operation.\n"));
+     ret = 1;
+     return;
+  }
+  if (op_host_leave) {
+     FPRINTF (stderr,
+               _("FIXME HARDER -D\n"));
+     return;
+  }
+  if (op_guest_leave) {
+     FPRINTF (stderr,
+               _("FIXME HARDER -L\n"));
+     return;
+  }
+  if (op_host_announce) {
+     FPRINTF (stderr,
+               _("FIXME -P\n"));
+     return;
+  }
+  if (op_guest_talk) {
+     FPRINTF (stderr,
+               _("FIXME -T\n"));
+     return;
+  }
   GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "TODO\n");
 }
 
@@ -116,8 +171,8 @@
       GNUNET_YES, &GNUNET_GETOPT_set_string, &place},
 
      {'l', "listen", NULL,
-     gettext_noop ("listen for incoming messages"),
-     GNUNET_NO, &GNUNET_GETOPT_set_one, &flag_listen},
+      gettext_noop ("listen for incoming messages"),
+      GNUNET_NO, &GNUNET_GETOPT_set_one, &flag_listen},
 
      {'m', "method", "METHOD_NAME",
       gettext_noop ("method name to transmit"),
@@ -132,29 +187,49 @@
       GNUNET_YES, &GNUNET_GETOPT_set_string, &prefix},
 
      {'s', "start", NULL,
-     gettext_noop ("start message ID for history replay"),
-     GNUNET_NO, &GNUNET_GETOPT_set_ulong, &start},
+      gettext_noop ("start message ID for history replay"),
+      GNUNET_NO, &GNUNET_GETOPT_set_ulong, &start},
 
      {'e', "end", NULL,
-     gettext_noop ("end message ID for history replay"),
-     GNUNET_NO, &GNUNET_GETOPT_set_ulong, &end},
+      gettext_noop ("end message ID for history replay"),
+      GNUNET_NO, &GNUNET_GETOPT_set_ulong, &end},
 
      {'n', "limit", NULL,
-     gettext_noop ("number of messages to replay from history"),
-     GNUNET_NO, &GNUNET_GETOPT_set_ulong, &limit},
+      gettext_noop ("number of messages to replay from history"),
+      GNUNET_NO, &GNUNET_GETOPT_set_ulong, &limit},
 
      {'C', "host-enter", NULL,
-     gettext_noop ("create a place for nyms to join"),
-     GNUNET_NO, &GNUNET_GETOPT_set_one, &op_host_enter},
+      gettext_noop ("create a place for nyms to join"),
+      GNUNET_NO, &GNUNET_GETOPT_set_one, &op_host_enter},
 
-/** --host-leave */
-/** --host-announce */
-/** --guest-enter */
-/** --guest-leave */
-/** --guest-talk */
-/** --history-replay */
-/** --history-replay-latest */
+     {'D', "host-leave", NULL,
+      gettext_noop ("destroy a place we were hosting"),
+      GNUNET_NO, &GNUNET_GETOPT_set_one, &op_host_leave},
 
+     {'P', "host-announce", NULL,
+      gettext_noop ("publish something to a place we are hosting"),
+      GNUNET_NO, &GNUNET_GETOPT_set_one, &op_host_announce},
+
+     {'E', "guest-enter", NULL,
+      gettext_noop ("join somebody else's place"),
+      GNUNET_NO, &GNUNET_GETOPT_set_one, &op_guest_enter},
+
+     {'L', "guest-leave", NULL,
+      gettext_noop ("leave somebody else's place"),
+      GNUNET_NO, &GNUNET_GETOPT_set_one, &op_guest_leave},
+
+     {'T', "guest-talk", NULL,
+      gettext_noop ("submit something to somebody's place"),
+      GNUNET_NO, &GNUNET_GETOPT_set_one, &op_guest_talk},
+
+     {'R', "history-replay", NULL,
+      gettext_noop ("FIXME"),
+      GNUNET_NO, &GNUNET_GETOPT_set_one, &op_history_replay},
+
+     {'H', "history-replay-latest", NULL,
+      gettext_noop ("FIXME"),
+      GNUNET_NO, &GNUNET_GETOPT_set_one, &op_history_replay_latest},
+
     GNUNET_GETOPT_OPTION_END
   };
 
@@ -185,7 +260,7 @@
   GNUNET_free ((void *) argv);
 
   if (GNUNET_OK == res)
-    return 0;
+    return ret;
   else
     return 1;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]