gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r29854 - gnunet/src/conversation


From: gnunet
Subject: [GNUnet-SVN] r29854 - gnunet/src/conversation
Date: Sat, 5 Oct 2013 00:47:09 +0200

Author: grothoff
Date: 2013-10-05 00:47:09 +0200 (Sat, 05 Oct 2013)
New Revision: 29854

Modified:
   gnunet/src/conversation/Makefile.am
   gnunet/src/conversation/conversation_api2.c
   gnunet/src/conversation/gnunet-conversation-new.c
Log:
-updated conversation command line tool

Modified: gnunet/src/conversation/Makefile.am
===================================================================
--- gnunet/src/conversation/Makefile.am 2013-10-04 18:44:53 UTC (rev 29853)
+++ gnunet/src/conversation/Makefile.am 2013-10-04 22:47:09 UTC (rev 29854)
@@ -44,8 +44,6 @@
   conversation_api.c \
   conversation_api2.c 
 libgnunetconversation_la_LIBADD = \
-  libgnunetmicrophone.la \
-  libgnunetspeaker.la \
   $(top_builddir)/src/gns/libgnunetgns.la \
   $(top_builddir)/src/namestore/libgnunetnamestore.la \
   $(top_builddir)/src/identity/libgnunetidentity.la \
@@ -110,8 +108,13 @@
 gnunet_service_conversation_new_SOURCES = \
   gnunet-service-conversation-new.c
 gnunet_service_conversation_new_LDADD = \
-  -lgnunetutil -lgnunetmesh \
-    $(INTLLIBS) 
+  libgnunetconversation.la \
+  libgnunetspeaker.la \
+  libgnunetmicrophone.la \
+  $(top_builddir)/src/mesh/libgnunetmesh.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(INTLLIBS) 
+
 gnunet_service_conversation_new_LDFLAGS = \
   $(GNUNET_LDFLAGS)  $(WINFLAGS) 
 
@@ -127,8 +130,13 @@
 gnunet_conversation_new_SOURCES = \
   gnunet-conversation-new.c
 gnunet_conversation_new_LDADD = \
+  libgnunetmicrophone.la \
+  libgnunetspeaker.la \
   libgnunetconversation.la \
-  -lgnunetutil \
+  $(top_builddir)/src/gns/libgnunetgns.la \
+  $(top_builddir)/src/namestore/libgnunetnamestore.la \
+  $(top_builddir)/src/identity/libgnunetidentity.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
   $(INTLLIBS) 
 gnunet_conversation_new_LDFLAGS = \
  $(GNUNET_LDFLAGS) $(WINFLAGS) 

Modified: gnunet/src/conversation/conversation_api2.c
===================================================================
--- gnunet/src/conversation/conversation_api2.c 2013-10-04 18:44:53 UTC (rev 
29853)
+++ gnunet/src/conversation/conversation_api2.c 2013-10-04 22:47:09 UTC (rev 
29854)
@@ -514,10 +514,10 @@
  * @param mic microphone to use
  */
 void
-GNUNET_CONVERSTATION_phone_pick_up (struct GNUNET_CONVERSATION_Phone *phone,
-                                   const char *metadata,
-                                   struct GNUNET_SPEAKER_Handle *speaker,
-                                   struct GNUNET_MICROPHONE_Handle *mic)
+GNUNET_CONVERSATION_phone_pick_up (struct GNUNET_CONVERSATION_Phone *phone,
+                                   const char *metadata,
+                                   struct GNUNET_SPEAKER_Handle *speaker,
+                                   struct GNUNET_MICROPHONE_Handle *mic)
 {
   struct GNUNET_MQ_Envelope *e;
   struct ClientPhonePickupMessage *pick;
@@ -546,8 +546,8 @@
  * @param reason text we give to the other party about why we terminated the 
conversation
  */
 void
-GNUNET_CONVERSTATION_phone_hang_up (struct GNUNET_CONVERSATION_Phone *phone,
-                                   const char *reason)
+GNUNET_CONVERSATION_phone_hang_up (struct GNUNET_CONVERSATION_Phone *phone,
+                                   const char *reason)
 {
   struct GNUNET_MQ_Envelope *e;
   struct ClientPhoneHangupMessage *hang;

Modified: gnunet/src/conversation/gnunet-conversation-new.c
===================================================================
--- gnunet/src/conversation/gnunet-conversation-new.c   2013-10-04 18:44:53 UTC 
(rev 29853)
+++ gnunet/src/conversation/gnunet-conversation-new.c   2013-10-04 22:47:09 UTC 
(rev 29854)
@@ -14,7 +14,7 @@
   
   You should have received a copy of the GNU General Public License
   along with GNUnet; see the file COPYING.  If not, write to the
-  Free Software Foundation, InGNUNET_SERVERc., 59 Temple Place - Suite 330,
+  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.
 */
 /**
@@ -32,241 +32,285 @@
 #define MAX_MESSAGE_LENGTH   (32 * 1024)
 
 /**
- * CONVERSATION handle
+ * Phone handle
  */
-static struct GNUNET_CONVERSATION_Handle *conversation;
+static struct GNUNET_CONVERSATION_Phone *phone;
 
 /**
+ * Call handle
+ */
+static struct GNUNET_CONVERSATION_Call *call;
+
+/**
+ * Desired phone line.
+ */
+static unsigned int line;
+
+/**
  * Task which handles the commands
  */
 static GNUNET_SCHEDULER_TaskIdentifier handle_cmd_task;
 
 /**
- * Function declareation for executing a action
+ * Our speaker.
  */
-typedef int (*ActionFunction) (const char *argumetns, 
-                              const void *xtra);
+static struct GNUNET_SPEAKER_Handle *speaker;
 
 /**
-* Structure which defines a command
-*/
-struct VoipCommand
-{
-  const char *command;
-  ActionFunction Action;
-  const char *helptext;
-};
+ * Our microphone.
+ */
+static struct GNUNET_MICROPHONE_Handle *mic;
 
+/**
+ * Our configuration.
+ */
+static const struct GNUNET_CONFIGURATION_Handle *cfg;
 
-static int
-do_help (const char *args, 
-        const void *xtra);
+/**
+ * Our ego.
+ */
+static struct GNUNET_IDENTITY_Ego *caller_id;
 
+/**
+ * Handle to identity service.
+ */
+static struct GNUNET_IDENTITY_Handle *id;
 
 /**
- * Method called whenever a call is incoming
- *
- * @param cls closure
- * @param handle to the conversation session
- * @param caller peer that calls you
+ * Name of our ego.
  */
-static void
-call_handler (void *cls,
-             struct GNUNET_CONVERSATION_Handle *handle,
-             const struct GNUNET_PeerIdentity *caller)
-{
-  FPRINTF (stdout, 
-          _("Incoming call from peer: %s\n"),
-          GNUNET_i2s_full (caller));
-}
+static char *ego_name;
 
 
 /**
- * Method called whenever a call is rejected
+ * Function called with an event emitted by a phone.
  *
  * @param cls closure
- * @param handle to the conversation session
- * @param reason given reason why the call was rejected
- * @param peer peer that rejected your call
+ * @param code type of the event on the phone
+ * @param ... additional information, depends on @a code
  */
 static void
-reject_handler (void *cls, 
-               struct GNUNET_CONVERSATION_Handle *handle, 
-               enum GNUNET_CONVERSATION_RejectReason reason,
-               const struct GNUNET_PeerIdentity *peer)
+phone_event_handler (void *cls,
+                     enum GNUNET_CONVERSATION_EventCode code,
+                     ...)
 {
-  FPRINTF (stdout, 
-          _("Peer %s rejected your call. Reason: %d\n"),
-          GNUNET_i2s_full (peer), reason);
+  va_list va;
+  
+  va_start (va, code);
+  switch (code)
+  {
+  case GNUNET_CONVERSATION_EC_RING:
+    FPRINTF (stdout,
+             _("Incoming call from `%s'.  Enter /accept to take it.\n"),
+             va_arg (va, const char *));
+    break;
+  case GNUNET_CONVERSATION_EC_RINGING:
+    GNUNET_break (0);
+    break;
+  case GNUNET_CONVERSATION_EC_READY:
+    GNUNET_break (0);
+    break;
+  case GNUNET_CONVERSATION_EC_GNS_FAIL:
+    GNUNET_break (0);
+    break;
+  case GNUNET_CONVERSATION_EC_BUSY:
+    GNUNET_break (0);
+    break;
+  case GNUNET_CONVERSATION_EC_TERMINATED:
+    FPRINTF (stdout,
+             _("Call terminated: %s\n"),
+             va_arg (va, const char *));
+    break;
+  }
+  va_end (va);
 }
 
 
 /**
- * Method called whenever a notification is there
+ * Function called with an event emitted by a phone.
  *
  * @param cls closure
- * @param handle to the conversation session
- * @param type the type of the notification
- * @param peer peer that the notification is about
+ * @param code type of the event on the phone
+ * @param ... additional information, depends on @a code
  */
 static void
-notification_handler (void *cls, 
-                     struct GNUNET_CONVERSATION_Handle *handle, 
-                     enum GNUNET_CONVERSATION_NotificationType type,
-                     const struct GNUNET_PeerIdentity *peer)
+call_event_handler (void *cls,
+                    enum GNUNET_CONVERSATION_EventCode code,
+                    ...)
 {
-  switch (type)
+  va_list va;
+  
+  va_start (va, code);
+  switch (code)
   {
-  case GNUNET_CONVERSATION_NT_SERVICE_BLOCKED:
+  case GNUNET_CONVERSATION_EC_RING:
+    GNUNET_break (0);
+    break;
+  case GNUNET_CONVERSATION_EC_RINGING:
     FPRINTF (stdout,
-            _("The service is already in use. Try again later."));    
-    break;    
-  case GNUNET_CONVERSATION_NT_NO_PEER:
-    FPRINTF (stdout, 
-            _("The Peer you were calling is no correct peer.\n"));    
-    break;    
-  case GNUNET_CONVERSATION_NT_NO_ANSWER:
-    FPRINTF (stdout, 
-            _("Peer %s did not answer your call.\n"),
-            GNUNET_i2s_full (peer));    
-    break;    
-  case GNUNET_CONVERSATION_NT_AVAILABLE_AGAIN:
+             "%s",
+             _("Ringing other party\n"));
+    break;
+  case GNUNET_CONVERSATION_EC_READY:
     FPRINTF (stdout,
-            _("Peer %s is now available.\n"),
-            GNUNET_i2s_full (peer));    
-    break;    
-  case GNUNET_CONVERSATION_NT_CALL_ACCEPTED:
-    FPRINTF (stdout, 
-            _("Peer %s has accepted your call.\n"),
-            GNUNET_i2s_full (peer));    
-    break;    
-  case GNUNET_CONVERSATION_NT_CALL_TERMINATED:
+             _("Connection established: %s\n"),
+             va_arg (va, const char *));
+    break;
+  case GNUNET_CONVERSATION_EC_GNS_FAIL:
     FPRINTF (stdout,
-            _("Peer %s has terminated the call.\n"),
-            GNUNET_i2s_full (peer));
+             "%s",
+             _("Failed to resolve name\n"));
     break;
-  default:
-    GNUNET_break (0);
-  }  
+  case GNUNET_CONVERSATION_EC_BUSY:
+    FPRINTF (stdout,
+             "%s",
+             _("Line busy\n"));
+    break;
+  case GNUNET_CONVERSATION_EC_TERMINATED:
+    FPRINTF (stdout,
+             _("Call terminated: %s\n"),
+             va_arg (va, const char *));
+    GNUNET_CONVERSATION_call_stop (call, NULL);
+    call = NULL;
+    if (NULL == caller_id)
+    {
+      FPRINTF (stderr,
+               _("Ego `%s' no longer available, phone is now down.\n"),
+               ego_name);
+      return;
+    }
+    phone = GNUNET_CONVERSATION_phone_create (cfg,
+                                              caller_id,
+                                              &phone_event_handler, NULL);
+    break;
+  }
+  va_end (va);
 }
 
 
 /**
- * Method called whenever a notification for missed calls is there
+ * Function declareation for executing a action
  *
- * @param cls closure
- * @param handle to the conversation session
- * @param missed_calls a list of missed calls
+ * @param arguments arguments given to the function
  */
-static void
-missed_call_handler (void *cls,
-                    struct GNUNET_CONVERSATION_Handle *handle,
-                    struct GNUNET_CONVERSATION_MissedCallNotification 
*missed_calls)
-{
-  FPRINTF (stdout, 
-          _("You have missed calls.\n"));
-}
+typedef void (*ActionFunction) (const char *arguments);
 
 
 /**
- * Terminating the client
+ * Structure which defines a command
  */
-static int
-do_quit (const char *args, 
-        const void *xtra)
+struct VoipCommand
 {
-  return GNUNET_SYSERR;
-}
+  /**
+   * Command the user needs to enter.
+   */
+  const char *command;
+  
+  /**
+   * Function to call on command.
+   */
+  ActionFunction Action;
 
+  /**
+   * Help text for the command.
+   */
+  const char *helptext;
+};
 
+
 /**
+ * Action function to print help for the command shell.
  *
+ * @param arguments arguments given to the command
  */
-static int
-do_unknown (const char *msg, 
-           const void *xtra)
-{
-  FPRINTF (stderr, 
-          _("Unknown command `%s'\n"), 
-          msg);
-  return GNUNET_OK;
-}
+static void
+do_help (const char *args);
 
 
 /**
- * Initiating a new call
+ * Terminate the client
+ *
+ * @param args arguments given to the command
  */
-static int
-do_call (const char *arg, 
-        const void *xtra)
+static void
+do_quit (const char *args)
 {
-  FPRINTF (stdout, 
-          _("Initiating call to: %s\n"), 
-          arg);
-  GNUNET_CONVERSATION_call (conversation, 
-                           arg, 
-                           GNUNET_YES);
-  return GNUNET_OK;
+  GNUNET_SCHEDULER_shutdown ();
 }
 
 
 /**
- * Initiating a new call
+ * Handler for unknown command.
+ *
+ * @param args arguments given to the command
  */
-static int
-do_call_peer (const char *arg, 
-             const void *xtra)
+static void
+do_unknown (const char *msg)
 {
-  FPRINTF (stdout, 
-          _("Initiating call to: %s\n"), 
-          arg);
-  GNUNET_CONVERSATION_call (conversation, 
-                           arg,
-                           GNUNET_NO);
-  return GNUNET_OK;
+  FPRINTF (stderr, 
+          _("Unknown command `%s'\n"), 
+          msg);
 }
 
 
 /**
- * Accepting an incoming call
+ * Initiating a new call
+ *
+ * @param args arguments given to the command
  */
-static int
-do_accept (const char *args, 
-          const void *xtra)
+static void
+do_call (const char *arg)
 {
-  FPRINTF (stdout,
-          _("Accepting the call\n"));
-  GNUNET_CONVERSATION_accept (conversation);
-
-  return GNUNET_OK;
+  if (NULL != call)
+    return;
+  if (NULL == caller_id)
+  {
+    FPRINTF (stderr,
+             _("Ego `%s' not available\n"),
+             ego_name);
+    return;
+  }
+  /* FIXME: also check that we do NOT have a running conversation or ring */
+  GNUNET_CONVERSATION_phone_destroy (phone);
+  phone = NULL;
+  call = GNUNET_CONVERSATION_call_start (cfg,
+                                         caller_id,
+                                         arg,
+                                         speaker,
+                                         mic,
+                                         &call_event_handler, NULL);
 }
 
 
 /**
- * Rejecting a call
+ * Accepting an incoming call
+ *
+ * @param args arguments given to the command
  */
-static int
-do_reject (const char *args, 
-          const void *xtra)
+static void
+do_accept (const char *args)
 {
-  FPRINTF (stdout,
-          _("Rejecting the call\n"));
-  GNUNET_CONVERSATION_reject (conversation);
-  return GNUNET_OK;
+  if (NULL == phone)
+    return;
+  /* FIXME: also check that we don't have a running conversation */
+  GNUNET_CONVERSATION_phone_pick_up (phone, 
+                                     args,
+                                     speaker,
+                                     mic);
 }
 
 
 /**
- * Terminating a call
+ * Rejecting a call
+ *
+ * @param args arguments given to the command
  */
-static int
-do_hang_up (const char *args, 
-           const void *xtra)
+static void
+do_reject (const char *args)
 {
-  FPRINTF (stdout, 
-          _("Terminating the call\n"));
-  GNUNET_CONVERSATION_hangup (conversation);  
-  return GNUNET_OK;
+  /* FIXME: also check that we do have a running conversation or ring */
+  GNUNET_CONVERSATION_phone_hang_up (phone, 
+                                     args);
 }
 
 
@@ -274,36 +318,36 @@
  * List of supported commands.
  */
 static struct VoipCommand commands[] = {
-  {"/call ", &do_call, gettext_noop ("Use `/call gns_name'")},
-  {"/callpeer ", &do_call_peer,
-   gettext_noop ("Use `/call private_key' to call a person")},
+  {"/call ", &do_call, 
+   gettext_noop ("Use `/call USER.gnu'")},
   {"/accept", &do_accept,
-   gettext_noop ("Use `/accept' to accept an incoming call")},
-  {"/terminate", &do_hang_up,
-   gettext_noop ("Use `/terminate' to end a call")},
-  {"/reject", &do_reject,
-   gettext_noop ("Use `/rejet' to reject an incoming call")},
-  {"/quit", &do_quit, gettext_noop ("Use `/quit' to terminate 
gnunet-conversation")},
+   gettext_noop ("Use `/accept MESSAGE' to accept an incoming call")},
+  {"/cancel", &do_reject,
+   gettext_noop ("Use `/cancel MESSAGE' to reject or terminate a call")},
+  {"/quit", &do_quit, 
+   gettext_noop ("Use `/quit' to terminate gnunet-conversation")},
   {"/help", &do_help,
    gettext_noop ("Use `/help command' to get help for a specific command")},
-  {"/", &do_unknown, NULL},
-  {"", &do_unknown, NULL},
+  {"", &do_unknown, 
+   NULL},
   {NULL, NULL, NULL},
 };
 
 
 /**
+ * Action function to print help for the command shell.
  *
+ * @param arguments arguments given to the command
  */
-static int
-do_help (const char *args, 
-        const void *xtra)
+static void
+do_help (const char *args)
 {
-  int i;
-
-  i = 0;
-  while ((NULL != args) && (0 != strlen (args)) &&
-        (commands[i].Action != &do_help))
+  unsigned int i;
+  
+  i = 0; 
+  while ( (NULL != args) &&
+          (0 != strlen (args)) &&
+          (commands[i].Action != &do_help))
   {
     if (0 ==
        strncasecmp (&args[1], &commands[i].command[1], strlen (args) - 1))
@@ -311,7 +355,7 @@
       FPRINTF (stdout, 
               "%s\n",
               gettext (commands[i].helptext));
-      return GNUNET_OK;
+      return;
     }
     i++;
   }
@@ -322,7 +366,7 @@
   while (commands[i].Action != &do_help)
   {
     FPRINTF (stdout, 
-            " %s", 
+            "%s", 
             gettext (commands[i].command));
     i++;
   }
@@ -332,33 +376,53 @@
   FPRINTF (stdout,
           "%s\n",
           gettext (commands[i].helptext));
-  return GNUNET_OK;
 }
 
 
 /**
+ * Task run during shutdown.
  *
+ * @param cls NULL
+ * @param tc unused
  */
 static void
 do_stop_task (void *cls,
              const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, 
-             "Running shutdown task\n");
-  GNUNET_CONVERSATION_disconnect (conversation);
-  
-  if (handle_cmd_task != GNUNET_SCHEDULER_NO_TASK)
+  if (NULL != call)
   {
+    GNUNET_CONVERSATION_call_stop (call, NULL);
+    call = NULL;
+  }
+  if (NULL != phone)
+  {
+    GNUNET_CONVERSATION_phone_destroy (phone);
+    phone = NULL;
+  }
+  if (GNUNET_SCHEDULER_NO_TASK != handle_cmd_task)
+  {
     GNUNET_SCHEDULER_cancel (handle_cmd_task);
     handle_cmd_task = GNUNET_SCHEDULER_NO_TASK;
   } 
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, 
-             "Running shutdown task finished\n");
+  if (NULL != id)
+  {
+    GNUNET_IDENTITY_disconnect (id);
+    id = NULL;
+  }
+  GNUNET_SPEAKER_destroy (speaker);
+  speaker = NULL;
+  GNUNET_MICROPHONE_destroy (mic);
+  mic = NULL;
+  GNUNET_free (ego_name);
+  ego_name = NULL;
 }
 
 
 /**
+ * Task to handle commands from the terminal.
  *
+ * @param cls NULL
+ * @param tc scheduler context
  */
 static void
 handle_command (void *cls,
@@ -367,38 +431,66 @@
   char message[MAX_MESSAGE_LENGTH + 1];
   int i;
 
+  handle_cmd_task =
+    GNUNET_SCHEDULER_add_delayed_with_priority (GNUNET_TIME_UNIT_FOREVER_REL,
+                                               GNUNET_SCHEDULER_PRIORITY_UI,
+                                               &handle_command, NULL);
   /* read message from command line and handle it */
   memset (message, 0, MAX_MESSAGE_LENGTH + 1);
   if (NULL == fgets (message, MAX_MESSAGE_LENGTH, stdin))
-    goto next;
-  if (strlen (message) == 0)
-    goto next;
+    return;
+  if (0 == strlen (message))
+    return;
   if (message[strlen (message) - 1] == '\n')
     message[strlen (message) - 1] = '\0';
-  if (strlen (message) == 0)
-    goto next;
+  if (0 == strlen (message))
+    return;
   i = 0;
   while ((NULL != commands[i].command) &&
-        (0 !=
-         strncasecmp (commands[i].command, message,
-                      strlen (commands[i].command))))
+        (0 != strncasecmp (commands[i].command, message,
+                            strlen (commands[i].command))))
     i++;
-  if (GNUNET_OK !=
-      commands[i].Action (&message[strlen (commands[i].command)], NULL))
-    goto out;
+  commands[i].Action (&message[strlen (commands[i].command)]);
+}
 
-next:
-  handle_cmd_task =
-    GNUNET_SCHEDULER_add_delayed_with_priority (GNUNET_TIME_relative_multiply
-                                               (GNUNET_TIME_UNIT_MILLISECONDS,
-                                                100),
-                                               GNUNET_SCHEDULER_PRIORITY_UI,
-                                               &handle_command, NULL);
-  return;
 
-out:
-  handle_cmd_task = GNUNET_SCHEDULER_NO_TASK;
-  GNUNET_SCHEDULER_shutdown ();
+/**
+ * Function called by identity service with information about egos.
+ *
+ * @param cls NULL
+ * @param ego ego handle
+ * @param ctx unused
+ * @param name name of the ego
+ */
+static void
+identity_cb (void *cls,
+             struct GNUNET_IDENTITY_Ego *ego,
+             void **ctx,
+             const char *name)
+{
+  if (NULL == name)
+    return;
+  if (ego == caller_id)
+  {
+    FPRINTF (stdout,
+             _("Name of our ego changed to `%s'\n"),
+             name);
+    GNUNET_free (ego_name);
+    ego_name = GNUNET_strdup (name);
+    return;
+  }
+  if (0 != strcmp (name,
+                   ego_name))
+    return;
+  if (NULL == ego)
+  {    
+    caller_id = NULL;
+    return;
+  }
+  caller_id = ego;
+  phone = GNUNET_CONVERSATION_phone_create (cfg,
+                                            caller_id,
+                                            &phone_event_handler, NULL);
 }
 
 
@@ -416,20 +508,19 @@
      const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *c)
 {
-  if (NULL ==
-      (conversation =
-       GNUNET_CONVERSATION_connect (c, NULL, 
-                                   &call_handler,
-                                   &reject_handler,
-                                   &notification_handler,
-                                   &missed_call_handler)))
+  cfg = c;
+  speaker = GNUNET_SPEAKER_create_from_hardware (cfg);
+  mic = GNUNET_MICROPHONE_create_from_hardware (cfg);
+  if (NULL == ego_name)
   {
     FPRINTF (stderr,
-            "%s",
-            _("Could not access CONVERSATION service.  Exiting.\n"));
+             "%s",
+             _("You must specify the NAME of an ego to use\n"));
     return;
   }
-
+  id = GNUNET_IDENTITY_connect (cfg,
+                                &identity_cb,
+                                NULL);
   handle_cmd_task =
     GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_UI,
                                        &handle_command, NULL);
@@ -449,9 +540,14 @@
 main (int argc, char *const *argv)
 {
   static const struct GNUNET_GETOPT_CommandLineOption options[] = {
+    {'p', "phone", "LINE",
+      gettext_noop ("sets the LINE to use for the phone"),
+     1, &GNUNET_GETOPT_set_uint, &line},
+    {'e', "ego", "NAME",
+     gettext_noop ("sets the NAME of the ego to use for the phone (and name 
resolution)"),
+     1, &GNUNET_GETOPT_set_string, &ego_name},
     GNUNET_GETOPT_OPTION_END
   };
-
   int flags;
   int ret;
 
@@ -461,13 +557,12 @@
 
   if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
     return 2;
-
-  ret = GNUNET_PROGRAM_run (argc, argv, "gnunet-conversation",
-                           gettext_noop ("Print information about 
conversation."),
+  ret = GNUNET_PROGRAM_run (argc, argv,
+                            "gnunet-conversation",
+                           gettext_noop ("Enables having a conversation with 
other GNUnet users."),
                            options, &run, NULL);
   GNUNET_free ((void *) argv);
-
-  return ret;
+  return (GNUNET_OK == ret) ? 0 : 1;
 }
 
 /* end of gnunet-conversation.c */




reply via email to

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