aboutsummaryrefslogtreecommitdiff
path: root/src/conversation/gnunet-conversation.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-03-05 20:44:15 +0100
committerChristian Grothoff <christian@grothoff.org>2018-03-05 20:44:15 +0100
commit1ac9fb8bc3555213fda82ef3dd974a6b30e45b25 (patch)
tree63cd58c378695174e22e1b39b32e7e21ba3a8315 /src/conversation/gnunet-conversation.c
parent0f4032609d5372978e0c038ee05f51ce9c131876 (diff)
downloadgnunet-1ac9fb8bc3555213fda82ef3dd974a6b30e45b25.tar.gz
gnunet-1ac9fb8bc3555213fda82ef3dd974a6b30e45b25.zip
update gnunet-conversation to match .gnu-less GNS
Diffstat (limited to 'src/conversation/gnunet-conversation.c')
-rw-r--r--src/conversation/gnunet-conversation.c50
1 files changed, 37 insertions, 13 deletions
diff --git a/src/conversation/gnunet-conversation.c b/src/conversation/gnunet-conversation.c
index 00ab65680..70ccedbee 100644
--- a/src/conversation/gnunet-conversation.c
+++ b/src/conversation/gnunet-conversation.c
@@ -262,6 +262,7 @@ phone_event_handler (void *cls,
262{ 262{
263 struct CallList *cl; 263 struct CallList *cl;
264 264
265 (void) cls;
265 switch (code) 266 switch (code)
266 { 267 {
267 case GNUNET_CONVERSATION_EC_PHONE_RING: 268 case GNUNET_CONVERSATION_EC_PHONE_RING:
@@ -393,6 +394,8 @@ static void
393call_event_handler (void *cls, 394call_event_handler (void *cls,
394 enum GNUNET_CONVERSATION_CallEventCode code) 395 enum GNUNET_CONVERSATION_CallEventCode code)
395{ 396{
397 (void) cls;
398
396 switch (code) 399 switch (code)
397 { 400 {
398 case GNUNET_CONVERSATION_EC_CALL_RINGING: 401 case GNUNET_CONVERSATION_EC_CALL_RINGING:
@@ -454,7 +457,8 @@ call_event_handler (void *cls,
454 * 457 *
455 * @param arguments arguments given to the function 458 * @param arguments arguments given to the function
456 */ 459 */
457typedef void (*ActionFunction) (const char *arguments); 460typedef void
461(*ActionFunction) (const char *arguments);
458 462
459 463
460/** 464/**
@@ -496,6 +500,7 @@ do_help (const char *args);
496static void 500static void
497do_quit (const char *args) 501do_quit (const char *args)
498{ 502{
503 (void) args;
499 GNUNET_SCHEDULER_shutdown (); 504 GNUNET_SCHEDULER_shutdown ();
500} 505}
501 506
@@ -566,7 +571,6 @@ do_call (const char *arg)
566 GNUNET_assert (NULL == call); 571 GNUNET_assert (NULL == call);
567 call = GNUNET_CONVERSATION_call_start (cfg, 572 call = GNUNET_CONVERSATION_call_start (cfg,
568 my_caller_id, 573 my_caller_id,
569 my_caller_id,
570 arg, 574 arg,
571 speaker, 575 speaker,
572 mic, 576 mic,
@@ -656,6 +660,7 @@ do_accept (const char *args)
656static void 660static void
657do_address (const char *args) 661do_address (const char *args)
658{ 662{
663 (void) args;
659 if (NULL == address) 664 if (NULL == address)
660 { 665 {
661 FPRINTF (stdout, 666 FPRINTF (stdout,
@@ -679,6 +684,7 @@ do_status (const char *args)
679{ 684{
680 struct CallList *cl; 685 struct CallList *cl;
681 686
687 (void) args;
682 switch (phone_state) 688 switch (phone_state)
683 { 689 {
684 case PS_LOOKUP_EGO: 690 case PS_LOOKUP_EGO:
@@ -757,6 +763,7 @@ do_status (const char *args)
757static void 763static void
758do_suspend (const char *args) 764do_suspend (const char *args)
759{ 765{
766 (void) args;
760 if (NULL != call) 767 if (NULL != call)
761 { 768 {
762 switch (call_state) 769 switch (call_state)
@@ -1025,6 +1032,7 @@ do_help (const char *args)
1025static void 1032static void
1026do_stop_task (void *cls) 1033do_stop_task (void *cls)
1027{ 1034{
1035 (void) cls;
1028#ifdef WINDOWS 1036#ifdef WINDOWS
1029 if (NULL != stdin_hlp) 1037 if (NULL != stdin_hlp)
1030 { 1038 {
@@ -1107,6 +1115,8 @@ console_reader_chars (void *cls,
1107{ 1115{
1108 char *chars; 1116 char *chars;
1109 size_t str_size; 1117 size_t str_size;
1118
1119 (void) cls;
1110 switch (ntohs (message->type)) 1120 switch (ntohs (message->type))
1111 { 1121 {
1112 case GNUNET_MESSAGE_TYPE_W32_CONSOLE_HELPER_CHARS: 1122 case GNUNET_MESSAGE_TYPE_W32_CONSOLE_HELPER_CHARS:
@@ -1127,6 +1137,7 @@ console_reader_chars (void *cls,
1127} 1137}
1128#endif 1138#endif
1129 1139
1140
1130/** 1141/**
1131 * Task to handle commands from the terminal. 1142 * Task to handle commands from the terminal.
1132 * 1143 *
@@ -1137,15 +1148,21 @@ handle_command (void *cls)
1137{ 1148{
1138 char message[MAX_MESSAGE_LENGTH + 1]; 1149 char message[MAX_MESSAGE_LENGTH + 1];
1139 1150
1151 (void) cls;
1140 handle_cmd_task = 1152 handle_cmd_task =
1141 GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, 1153 GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
1142 stdin_fh, 1154 stdin_fh,
1143 &handle_command, NULL); 1155 &handle_command, NULL);
1144 /* read message from command line and handle it */ 1156 /* read message from command line and handle it */
1145 memset (message, 0, MAX_MESSAGE_LENGTH + 1); 1157 memset (message,
1146 if (NULL == fgets (message, MAX_MESSAGE_LENGTH, stdin)) 1158 0,
1159 MAX_MESSAGE_LENGTH + 1);
1160 if (NULL == fgets (message,
1161 MAX_MESSAGE_LENGTH,
1162 stdin))
1147 return; 1163 return;
1148 handle_command_string (message, strlen (message)); 1164 handle_command_string (message,
1165 strlen (message));
1149} 1166}
1150 1167
1151 1168
@@ -1163,6 +1180,8 @@ identity_cb (void *cls,
1163 void **ctx, 1180 void **ctx,
1164 const char *name) 1181 const char *name)
1165{ 1182{
1183 (void) cls;
1184 (void) ctx;
1166 if (NULL == name) 1185 if (NULL == name)
1167 return; 1186 return;
1168 if (ego == my_caller_id) 1187 if (ego == my_caller_id)
@@ -1210,6 +1229,9 @@ run (void *cls,
1210 const char *cfgfile, 1229 const char *cfgfile,
1211 const struct GNUNET_CONFIGURATION_Handle *c) 1230 const struct GNUNET_CONFIGURATION_Handle *c)
1212{ 1231{
1232 (void) cls;
1233 (void) args;
1234 (void) cfgfile;
1213 cfg = GNUNET_CONFIGURATION_dup (c); 1235 cfg = GNUNET_CONFIGURATION_dup (c);
1214 speaker = GNUNET_SPEAKER_create_from_hardware (cfg); 1236 speaker = GNUNET_SPEAKER_create_from_hardware (cfg);
1215 mic = GNUNET_MICROPHONE_create_from_hardware (cfg); 1237 mic = GNUNET_MICROPHONE_create_from_hardware (cfg);
@@ -1263,22 +1285,20 @@ run (void *cls,
1263 * @return 0 ok, 1 on error 1285 * @return 0 ok, 1 on error
1264 */ 1286 */
1265int 1287int
1266main (int argc, char *const *argv) 1288main (int argc,
1289 char *const *argv)
1267{ 1290{
1268 struct GNUNET_GETOPT_CommandLineOption options[] = { 1291 struct GNUNET_GETOPT_CommandLineOption options[] = {
1269
1270 GNUNET_GETOPT_option_string ('e', 1292 GNUNET_GETOPT_option_string ('e',
1271 "ego", 1293 "ego",
1272 "NAME", 1294 "NAME",
1273 gettext_noop ("sets the NAME of the ego to use for the phone (and name resolution)"), 1295 gettext_noop ("sets the NAME of the ego to use for the caller ID"),
1274 &ego_name), 1296 &ego_name),
1275
1276 GNUNET_GETOPT_option_string ('p', 1297 GNUNET_GETOPT_option_string ('p',
1277 "phone", 1298 "phone",
1278 "LINE", 1299 "LINE",
1279 gettext_noop ("sets the LINE to use for the phone"), 1300 gettext_noop ("sets the LINE to use for the phone"),
1280 &line), 1301 &line),
1281
1282 GNUNET_GETOPT_OPTION_END 1302 GNUNET_GETOPT_OPTION_END
1283 }; 1303 };
1284 int ret; 1304 int ret;
@@ -1299,12 +1319,16 @@ main (int argc, char *const *argv)
1299 stdin_fh = GNUNET_DISK_get_handle_from_int_fd (0); 1319 stdin_fh = GNUNET_DISK_get_handle_from_int_fd (0);
1300#endif 1320#endif
1301 1321
1302 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) 1322 if (GNUNET_OK !=
1323 GNUNET_STRINGS_get_utf8_args (argc, argv,
1324 &argc, &argv))
1303 return 2; 1325 return 2;
1304 ret = GNUNET_PROGRAM_run (argc, argv, 1326 ret = GNUNET_PROGRAM_run (argc,
1327 argv,
1305 "gnunet-conversation", 1328 "gnunet-conversation",
1306 gettext_noop ("Enables having a conversation with other GNUnet users."), 1329 gettext_noop ("Enables having a conversation with other GNUnet users."),
1307 options, &run, NULL); 1330 options,
1331 &run, NULL);
1308 GNUNET_free ((void *) argv); 1332 GNUNET_free ((void *) argv);
1309 if (NULL != cfg) 1333 if (NULL != cfg)
1310 { 1334 {