{
case GNUNET_CONVERSATION_EC_PHONE_RING:
FPRINTF (stdout,
- _("Incoming call from `%s'.\nPlease /accept #%u or /cancel %u the call.\n"),
+ _("Incoming call from `%s'. Please /accept #%u or /cancel %u the call.\n"),
caller_id,
caller_num_gen,
caller_num_gen);
phone_state = PS_LOOKUP_EGO;
return;
}
+ GNUNET_assert (NULL == phone);
phone = GNUNET_CONVERSATION_phone_create (cfg,
caller_id,
&phone_event_handler, NULL);
address = GNUNET_GNSRECORD_value_to_string (rd.record_type,
rd.data,
rd.data_size);
- if (verbose)
- FPRINTF (stdout,
- _("Phone active on line %u\n"),
- (unsigned int) line);
+ FPRINTF (stdout,
+ _("Phone active on line %u. Type `/help' for a list of available commands\n"),
+ (unsigned int) line);
phone_state = PS_LISTEN;
}
}
{
case GNUNET_CONVERSATION_EC_CALL_RINGING:
GNUNET_break (CS_RESOLVING == call_state);
- if (verbose)
- FPRINTF (stdout,
- "%s",
- _("Resolved address. Now ringing other party.\n"));
+ FPRINTF (stdout,
+ _("Resolved address of `%s'. Now ringing other party.\n"),
+ peer_name);
call_state = CS_RINGING;
break;
case GNUNET_CONVERSATION_EC_CALL_PICKED_UP:
_("Connection to `%s' resumed (by other user)\n"),
peer_name);
break;
+ case GNUNET_CONVERSATION_EC_CALL_ERROR:
+ FPRINTF (stdout,
+ _("Error with the call, restarting it\n"));
+ call_state = CS_RESOLVING;
+ break;
}
}
break;
}
GNUNET_free_non_null (peer_name);
+ if (NULL == arg)
+ {
+ FPRINTF (stderr,
+ _("Call recipient missing.\n"));
+ do_help ("/call");
+ return;
+ }
peer_name = GNUNET_strdup (arg);
call_state = CS_RESOLVING;
+ GNUNET_assert (NULL == call);
call = GNUNET_CONVERSATION_call_start (cfg,
caller_id,
arg,
case PS_ERROR:
FPRINTF (stderr,
"%s",
- _("There is no call that could be suspended right now.\n"));
+ _("There is no call that could be resumed right now.\n"));
return;
case PS_LISTEN:
/* expected state, do resume logic */
static void
do_reject (const char *args)
{
+ struct CallList *cl;
+ char buf[32];
+
if (NULL != call)
{
GNUNET_CONVERSATION_call_stop (call);
switch (phone_state)
{
case PS_LOOKUP_EGO:
- case PS_LISTEN:
case PS_ERROR:
FPRINTF (stderr,
"%s",
_("There is no call that could be cancelled right now.\n"));
return;
+ case PS_LISTEN:
+ /* look for active incoming calls to refuse */
+ cl = cl_head;
+ if (NULL == cl)
+ {
+ FPRINTF (stderr,
+ _("There is no incoming call to refuse here!\n"));
+ return;
+ }
+ if ( (NULL != cl->next) || (NULL != args) )
+ {
+ for (cl = cl_head; NULL != cl; cl = cl->next)
+ {
+ GNUNET_snprintf (buf, sizeof (buf),
+ "%u",
+ cl->caller_num);
+ if (0 == strcmp (buf, args))
+ break;
+ }
+ }
+ if (NULL == cl)
+ {
+ FPRINTF (stderr,
+ _("There is no incoming call `%s' to refuse right now!\n"),
+ args);
+ return;
+ }
+ GNUNET_CONVERSATION_caller_hang_up (cl->caller);
+ GNUNET_CONTAINER_DLL_remove (cl_head,
+ cl_tail,
+ cl);
+ GNUNET_free (cl->caller_id);
+ GNUNET_free (cl);
+ break;
case PS_ACCEPTED:
/* expected state, do rejection logic */
+ GNUNET_assert (NULL != cl_active);
+ GNUNET_CONVERSATION_caller_hang_up (cl_active->caller);
+ cl_active = NULL;
+ phone_state = PS_LISTEN;
break;
}
- GNUNET_assert (NULL != cl_active);
- GNUNET_CONVERSATION_caller_hang_up (cl_active->caller);
- cl_active = NULL;
- phone_state = PS_LISTEN;
}
mic = NULL;
GNUNET_free (ego_name);
ego_name = NULL;
- GNUNET_CONFIGURATION_destroy (cfg);
- cfg = NULL;
GNUNET_free_non_null (peer_name);
phone_state = PS_ERROR;
}
ptr = &message[strlen (commands[i].command)];
while (isspace ((int) *ptr))
ptr++;
+ if ('\0' == *ptr)
+ ptr = NULL;
commands[i].Action (ptr);
}
gettext_noop ("Enables having a conversation with other GNUnet users."),
options, &run, NULL);
GNUNET_free ((void *) argv);
+ if (NULL != cfg)
+ {
+ GNUNET_CONFIGURATION_destroy (cfg);
+ cfg = NULL;
+ }
return (GNUNET_OK == ret) ? 0 : 1;
}