aboutsummaryrefslogtreecommitdiff
path: root/src/conversation/gnunet-conversation-gtk.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/conversation/gnunet-conversation-gtk.c')
-rw-r--r--src/conversation/gnunet-conversation-gtk.c123
1 files changed, 34 insertions, 89 deletions
diff --git a/src/conversation/gnunet-conversation-gtk.c b/src/conversation/gnunet-conversation-gtk.c
index 0d1120fb..094b41b2 100644
--- a/src/conversation/gnunet-conversation-gtk.c
+++ b/src/conversation/gnunet-conversation-gtk.c
@@ -297,8 +297,8 @@ phone_event_handler (void *cls, enum GNUNET_CONVERSATION_PhoneEventCode code,
297 cl->caller_id = GNUNET_strdup (caller_id); 297 cl->caller_id = GNUNET_strdup (caller_id);
298 cl->caller_num = caller_num_gen++; 298 cl->caller_num = caller_num_gen++;
299 GNUNET_CONTAINER_DLL_insert (cl_head, cl_tail, cl); 299 GNUNET_CONTAINER_DLL_insert (cl_head, cl_tail, cl);
300 //strncpy (&callerName, &caller_id, 50); 300 strncpy (&callerName, &caller_id, 50);
301 //callerName[52] = '\0'; 301 callerName[52] = '\0';
302 quick_message ("der is een beller", caller_id); 302 quick_message ("der is een beller", caller_id);
303 303
304 break; 304 break;
@@ -313,7 +313,7 @@ phone_event_handler (void *cls, enum GNUNET_CONVERSATION_PhoneEventCode code,
313 return; 313 return;
314 } 314 }
315 LOG (_("Call from `%s' terminated\n"), cl->caller_id); 315 LOG (_("Call from `%s' terminated\n"), cl->caller_id);
316 316 history_add(3, cl->caller_id);
317 GNUNET_CONTAINER_DLL_remove (cl_head, cl_tail, cl); 317 GNUNET_CONTAINER_DLL_remove (cl_head, cl_tail, cl);
318 GNUNET_free (cl->caller_id); 318 GNUNET_free (cl->caller_id);
319 if (cl == cl_active) 319 if (cl == cl_active)
@@ -543,11 +543,15 @@ do_accept (const char *args)
543 LOG (_("There is no incoming call `%s' to accept right now!\n"), args); 543 LOG (_("There is no incoming call `%s' to accept right now!\n"), args);
544 return; 544 return;
545 } 545 }
546 cl_active = cl; 546
547 GNUNET_free_non_null (peer_name); 547 GNUNET_CONTAINER_DLL_remove (cl_head,
548 peer_name = GNUNET_strdup (cl->caller_id); 548 cl_tail,
549 phone_state = PS_ACCEPTED; 549 cl);
550 GNUNET_CONVERSATION_caller_pick_up (cl->caller, &caller_event_handler, cl, 550 cl_active = cl;
551 GNUNET_free_non_null (peer_name);
552 peer_name = GNUNET_strdup (cl->caller_id);
553 phone_state = PS_ACCEPTED;
554 GNUNET_CONVERSATION_caller_pick_up (cl->caller, &caller_event_handler, cl,
551 speaker, mic); 555 speaker, mic);
552 556
553 history_add (CH_ACCEPTED, peer_name); 557 history_add (CH_ACCEPTED, peer_name);
@@ -884,8 +888,11 @@ display_record (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key,
884 type = "PHONE"; 888 type = "PHONE";
885 } 889 }
886// FPRINTF (stdout, "%s", rname); 890// FPRINTF (stdout, "%s", rname);
887 gtk_list_store_append (contacts_liststore, &iter); 891 if (rd[i].record_type == 65536 || rd[i].record_type == 65536)
888 gtk_list_store_set (contacts_liststore, &iter, 1, type, 0, rname, -1); 892 {
893 gtk_list_store_append (contacts_liststore, &iter);
894 gtk_list_store_set (contacts_liststore, &iter, 1, type, 0, rname, -1);
895 }
889 896
890/* FPRINTF (stdout, 897/* FPRINTF (stdout,
891 "\t%s: %s (%s)\t%s\t%s\t%s\n", 898 "\t%s: %s (%s)\t%s\t%s\t%s\n",
@@ -1424,9 +1431,6 @@ add_contact (const gchar * name, const gchar * address)
1424 static size_t data_size; 1431 static size_t data_size;
1425 struct GNUNET_CRYPTO_EcdsaPublicKey pkey; 1432 struct GNUNET_CRYPTO_EcdsaPublicKey pkey;
1426 1433
1427 FPRINTF (stderr, 'address: %s', address);
1428 FPRINTF (stderr, 'address-len: %i', strlen (address));
1429
1430 GNUNET_CRYPTO_ecdsa_public_key_from_string (address, strlen (address), &pkey); 1434 GNUNET_CRYPTO_ecdsa_public_key_from_string (address, strlen (address), &pkey);
1431 rde = &rd; 1435 rde = &rd;
1432 zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (caller_id); 1436 zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (caller_id);
@@ -1464,85 +1468,14 @@ void
1464GNUNET_CONVERSATION_GTK_on_add_clicked (GtkButton * button, 1468GNUNET_CONVERSATION_GTK_on_add_clicked (GtkButton * button,
1465 gpointer * user_data) 1469 gpointer * user_data)
1466{ 1470{
1467// gint response_id;
1468
1469 //unused: *anotherArea, *labelName, *labelAddres *caller_name
1470
1471 GtkLabel *notification;
1472 1471
1473// GtkHBox *content_area;
1474 GtkContainer *content_area;
1475 GtkButton *currentCheckButton;
1476 GtkEntry *nameEntry, *addressEntry; 1472 GtkEntry *nameEntry, *addressEntry;
1477 GtkDialog *dialog;
1478 GtkWindow *main_window;
1479
1480 currentCheckButton =
1481 GTK_BUTTON (gtk_button_new_with_label ("use currently incoming addres"));
1482
1483 nameEntry = gtk_entry_new ();
1484 gtk_entry_set_text (nameEntry, "Name");
1485 addressEntry = gtk_entry_new ();
1486 gtk_entry_set_text (addressEntry, "Address");
1487
1488 main_window = GTK_WINDOW (get_object ("GNUNET_GTK_conversation_window"));
1489
1490 dialog =
1491 GTK_DIALOG (gtk_dialog_new_with_buttons
1492 ("Adding contact", main_window,
1493 GTK_DIALOG_DESTROY_WITH_PARENT, _("Add contact"),
1494 GTK_RESPONSE_ACCEPT, _("Cancel"), GTK_RESPONSE_CANCEL,
1495 NULL));
1496 gtk_dialog_add_action_widget (dialog, GTK_WIDGET (currentCheckButton),
1497 GTK_RESPONSE_OK);
1498// FPRINTF (stderr, "response id : %u", response_id);
1499// g_signal_connect (GTK_BUTTON (currentCheckButton), "clicked",
1500// G_CALLBACK (use_current_incoming_address), NULL);
1501
1502
1503 gtk_dialog_add_action_widget (dialog, GTK_WIDGET (nameEntry), 2);
1504 gtk_dialog_add_action_widget (dialog, GTK_WIDGET (addressEntry), 3);
1505
1506 content_area =
1507 GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog)));
1508
1509
1510 notification = GTK_LABEL (gtk_label_new ("Adding contact"));
1511// caller_name = gtk_label_new (caller_id);
1512
1513 // Add the labels, and show everything we've added to the dialog
1514 gtk_container_add (GTK_CONTAINER (content_area), GTK_WIDGET (notification));
1515// gtk_container_add (GTK_CONTAINER (content_area), caller_name);
1516 gtk_widget_show_all (GTK_WIDGET (dialog));
1517
1518 switch (gtk_dialog_run (dialog))
1519 {
1520 case GTK_RESPONSE_ACCEPT:
1521 do_status ("");
1522 add_contact (gtk_entry_get_text (nameEntry),
1523 gtk_entry_get_text (addressEntry));
1524 gtk_widget_destroy (GTK_WIDGET (dialog));
1525 break;
1526 case GTK_RESPONSE_CANCEL:
1527 FPRINTF (stderr, "cancel clicked");
1528 do_status ("");
1529 FPRINTF (stderr, 'use_current: callername: %s', callerName);
1530
1531
1532 gtk_widget_destroy (GTK_WIDGET (dialog));
1533 break;
1534 case GTK_RESPONSE_OK:
1535 //use_current_incoming_address();
1536 gtk_entry_set_text (GTK_ENTRY (addressEntry), callerName);
1537 add_contact (gtk_entry_get_text (nameEntry), callerName);
1538// add_contact(gtk_entry_get_text(nameEntry),memmove(&callerName,&callerName+52,1));
1539 gtk_widget_destroy (GTK_WIDGET (dialog));
1540
1541// memmove(&address+1,&address+51,1);
1542 break;
1543 }
1544
1545 1473
1474 nameEntry = GTK_ENTRY (get_object ("GNUNET_GTK_conversation_nameAdd"));
1475 addressEntry = GTK_ENTRY (get_object ("GNUNET_GTK_conversation_addressAdd"));
1476 FPRINTF(stderr,"name %s \n", gtk_entry_get_text (nameEntry));
1477 FPRINTF(stderr,"addr %s \n", gtk_entry_get_text (addressEntry));
1478 add_contact (gtk_entry_get_text (nameEntry),gtk_entry_get_text(addressEntry));
1546} 1479}
1547 1480
1548void 1481void
@@ -1594,6 +1527,18 @@ GNUNET_CONVERSATION_GTK_on_remove_clicked (GtkButton * button,
1594 } 1527 }
1595} 1528}
1596 1529
1530void
1531GNUNET_CONVERSATION_GTK_on_current_clicked (GtkButton * button,
1532 gpointer * user_data)
1533{
1534 GtkEntry *addressEntry;
1535 FPRINTF(stderr,"on current clicked %s\n",callerName);
1536
1537 addressEntry = GTK_ENTRY (get_object ("GNUNET_GTK_conversation_addressAdd"));
1538 gtk_entry_set_text(addressEntry, callerName);
1539
1540}
1541
1597 1542
1598/* 1543/*
1599 * row activated 1544 * row activated