diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-10-05 13:20:56 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-10-05 13:20:56 +0000 |
commit | d710c7df91151dde63d3304e4fdb27dc5fa8c781 (patch) | |
tree | 378ca6abbe2ea90d6452ed694fd1f2eeb07a846b /src/conversation | |
parent | 51197efdfb417a9388a7f5f46b51ffe3077d9b24 (diff) | |
download | gnunet-d710c7df91151dde63d3304e4fdb27dc5fa8c781.tar.gz gnunet-d710c7df91151dde63d3304e4fdb27dc5fa8c781.zip |
-enable address printing
Diffstat (limited to 'src/conversation')
-rw-r--r-- | src/conversation/gnunet-conversation.c | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/src/conversation/gnunet-conversation.c b/src/conversation/gnunet-conversation.c index fdf6155fd..f3fcb0b1e 100644 --- a/src/conversation/gnunet-conversation.c +++ b/src/conversation/gnunet-conversation.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "gnunet_util_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | #include "gnunet_constants.h" | 28 | #include "gnunet_constants.h" |
29 | #include "gnunet_conversation_service.h" | 29 | #include "gnunet_conversation_service.h" |
30 | #include "gnunet_namestore_service.h" | ||
30 | 31 | ||
31 | 32 | ||
32 | /** | 33 | /** |
@@ -149,6 +150,11 @@ static struct GNUNET_DISK_FileHandle *stdin_fh; | |||
149 | static enum ConversationState state; | 150 | static enum ConversationState state; |
150 | 151 | ||
151 | /** | 152 | /** |
153 | * GNS address for this phone. | ||
154 | */ | ||
155 | static char *address; | ||
156 | |||
157 | /** | ||
152 | * Be verbose. | 158 | * Be verbose. |
153 | */ | 159 | */ |
154 | static int verbose; | 160 | static int verbose; |
@@ -211,6 +217,8 @@ phone_event_handler (void *cls, | |||
211 | static void | 217 | static void |
212 | start_phone () | 218 | start_phone () |
213 | { | 219 | { |
220 | struct GNUNET_NAMESTORE_RecordData rd; | ||
221 | |||
214 | if (NULL == caller_id) | 222 | if (NULL == caller_id) |
215 | { | 223 | { |
216 | FPRINTF (stderr, | 224 | FPRINTF (stderr, |
@@ -232,6 +240,12 @@ start_phone () | |||
232 | } | 240 | } |
233 | else | 241 | else |
234 | { | 242 | { |
243 | GNUNET_CONVERSATION_phone_get_record (phone, | ||
244 | &rd); | ||
245 | GNUNET_free_non_null (address); | ||
246 | address = GNUNET_NAMESTORE_value_to_string (rd.record_type, | ||
247 | rd.data, | ||
248 | rd.data_size); | ||
235 | if (verbose) | 249 | if (verbose) |
236 | FPRINTF (stdout, | 250 | FPRINTF (stdout, |
237 | _("Phone active on line %u\n"), | 251 | _("Phone active on line %u\n"), |
@@ -494,6 +508,27 @@ do_accept (const char *args) | |||
494 | 508 | ||
495 | 509 | ||
496 | /** | 510 | /** |
511 | * Print address information for this phone. | ||
512 | * | ||
513 | * @param args arguments given to the command | ||
514 | */ | ||
515 | static void | ||
516 | do_address (const char *args) | ||
517 | { | ||
518 | if (NULL == address) | ||
519 | { | ||
520 | FPRINTF (stdout, | ||
521 | "%s", | ||
522 | _("We currently do not have an address.\n")); | ||
523 | return; | ||
524 | } | ||
525 | FPRINTF (stdout, | ||
526 | "%s", | ||
527 | address); | ||
528 | } | ||
529 | |||
530 | |||
531 | /** | ||
497 | * Accepting an incoming call | 532 | * Accepting an incoming call |
498 | * | 533 | * |
499 | * @param args arguments given to the command | 534 | * @param args arguments given to the command |
@@ -588,14 +623,16 @@ do_reject (const char *args) | |||
588 | * List of supported commands. | 623 | * List of supported commands. |
589 | */ | 624 | */ |
590 | static struct VoipCommand commands[] = { | 625 | static struct VoipCommand commands[] = { |
626 | {"/address", &do_address, | ||
627 | gettext_noop ("Use `/address' to find out which address this phone should have in GNS")}, | ||
591 | {"/call", &do_call, | 628 | {"/call", &do_call, |
592 | gettext_noop ("Use `/call USER.gnu'")}, | 629 | gettext_noop ("Use `/call USER.gnu' to call USER")}, |
593 | {"/accept", &do_accept, | 630 | {"/accept", &do_accept, |
594 | gettext_noop ("Use `/accept MESSAGE' to accept an incoming call")}, | 631 | gettext_noop ("Use `/accept MESSAGE' to accept an incoming call")}, |
595 | {"/cancel", &do_reject, | 632 | {"/cancel", &do_reject, |
596 | gettext_noop ("Use `/cancel MESSAGE' to reject or terminate a call")}, | 633 | gettext_noop ("Use `/cancel MESSAGE' to reject or terminate a call")}, |
597 | {"/status", &do_status, | 634 | {"/status", &do_status, |
598 | gettext_noop ("Use `/status to print status information")}, | 635 | gettext_noop ("Use `/status' to print status information")}, |
599 | {"/quit", &do_quit, | 636 | {"/quit", &do_quit, |
600 | gettext_noop ("Use `/quit' to terminate gnunet-conversation")}, | 637 | gettext_noop ("Use `/quit' to terminate gnunet-conversation")}, |
601 | {"/help", &do_help, | 638 | {"/help", &do_help, |