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.c120
1 files changed, 60 insertions, 60 deletions
diff --git a/src/conversation/gnunet-conversation-gtk.c b/src/conversation/gnunet-conversation-gtk.c
index ad950a5d..61abfe23 100644
--- a/src/conversation/gnunet-conversation-gtk.c
+++ b/src/conversation/gnunet-conversation-gtk.c
@@ -21,7 +21,7 @@
21/** 21/**
22 * @file src/conversation/gnunet-conversation-gtk.c 22 * @file src/conversation/gnunet-conversation-gtk.c
23 * @brief Main function of gnunet-conversation-gtk 23 * @brief Main function of gnunet-conversation-gtk
24 * @author yids 24 * @author yids
25 * @author hark 25 * @author hark
26 */ 26 */
27#include "gnunet_gtk.h" 27#include "gnunet_gtk.h"
@@ -70,7 +70,7 @@ get_object (const char *name)
70void 70void
71log_message (const char *message) 71log_message (const char *message)
72{ 72{
73 // 73 //
74 // log 74 // log
75 // 75 //
76 GtkTextBuffer *logbuff; 76 GtkTextBuffer *logbuff;
@@ -131,10 +131,10 @@ update_status (const gchar * message)
131} 131}
132 132
133/* 133/*
134 * adds a item to the call history 134 * adds a item to the call history
135 * 135 *
136 * @param type type of call: 0: accepted 1: rejected 2: outgoing call 136 * @param type type of call: 0: accepted 1: rejected 2: outgoing call
137 * @return void 137 * @return void
138 */ 138 */
139 139
140void 140void
@@ -143,16 +143,16 @@ history_add (int type, char *contactName)
143 GtkTreeIter iter; 143 GtkTreeIter iter;
144 time_t t; 144 time_t t;
145 char *event; 145 char *event;
146 146
147 switch (type) 147 switch (type)
148 { 148 {
149 case CH_ACCEPTED: 149 case CH_ACCEPTED:
150 event = "Accepted"; 150 event = "Accepted";
151 break; 151 break;
152 case CH_REJECTED: 152 case CH_REJECTED:
153 event = "Rejected"; 153 event = "Rejected";
154 break; 154 break;
155 case CH_OUTGOING: 155 case CH_OUTGOING:
156 event = "Outgoing"; 156 event = "Outgoing";
157 break; 157 break;
158 case CH_HANGUP: 158 case CH_HANGUP:
@@ -163,7 +163,7 @@ history_add (int type, char *contactName)
163 break; 163 break;
164 default: 164 default:
165 event = "UNKNOWN"; 165 event = "UNKNOWN";
166 break; 166 break;
167 } 167 }
168 time (&t); 168 time (&t);
169 gtk_list_store_append (history_liststore, &iter); 169 gtk_list_store_append (history_liststore, &iter);
@@ -483,7 +483,7 @@ do_call (const char *arg)
483 call = 483 call =
484 GNUNET_CONVERSATION_call_start (cfg, caller_id, arg, speaker, mic, 484 GNUNET_CONVERSATION_call_start (cfg, caller_id, arg, speaker, mic,
485 &call_event_handler, NULL); 485 &call_event_handler, NULL);
486 UPDATE_STATUS (_("We are calling `%s', his phone should be ringing.\n"), 486 UPDATE_STATUS (_("We are calling `%s', his phone should be ringing."),
487 peer_name); 487 peer_name);
488 history_add(2,peer_name); 488 history_add(2,peer_name);
489} 489}
@@ -549,7 +549,7 @@ do_accept (const char *args)
549 phone_state = PS_ACCEPTED; 549 phone_state = PS_ACCEPTED;
550 GNUNET_CONVERSATION_caller_pick_up (cl->caller, &caller_event_handler, cl, 550 GNUNET_CONVERSATION_caller_pick_up (cl->caller, &caller_event_handler, cl,
551 speaker, mic); 551 speaker, mic);
552 552
553 history_add (0, peer_name); 553 history_add (0, peer_name);
554 554
555} 555}
@@ -574,13 +574,13 @@ do_status (const char *args)
574 { 574 {
575 case PS_LOOKUP_EGO: 575 case PS_LOOKUP_EGO:
576 UPDATE_STATUS (_ 576 UPDATE_STATUS (_
577 ("We are currently trying to locate the private key for the ego `%s'.\n"), 577 ("We are currently trying to locate the private key for the ego `%s'."),
578 ego_name); 578 ego_name);
579 579
580 break; 580 break;
581 case PS_LISTEN: 581 case PS_LISTEN:
582 UPDATE_STATUS (_ 582 UPDATE_STATUS (_
583 ("We are listening for incoming calls for ego `%s' on line %u.\n"), 583 ("We are listening for incoming calls for ego `%s' on line %u."),
584 ego_name, line); 584 ego_name, line);
585 break; 585 break;
586 case PS_ACCEPTED: 586 case PS_ACCEPTED:
@@ -588,7 +588,7 @@ do_status (const char *args)
588 break; 588 break;
589 case PS_ERROR: 589 case PS_ERROR:
590 UPDATE_STATUS (_ 590 UPDATE_STATUS (_
591 ("We had an internal error setting up our phone line. You can still make calls.\n")); 591 ("We had an internal error setting up our phone line. You can still make calls."));
592 break; 592 break;
593 } 593 }
594 if (NULL != call) 594 if (NULL != call)
@@ -597,15 +597,15 @@ do_status (const char *args)
597 { 597 {
598 case CS_RESOLVING: 598 case CS_RESOLVING:
599 UPDATE_STATUS (_ 599 UPDATE_STATUS (_
600 ("We are trying to find the network address to call `%s'.\n"), 600 ("We are trying to find the network address to call `%s'."),
601 peer_name); 601 peer_name);
602 break; 602 break;
603 case CS_RINGING: 603 case CS_RINGING:
604 UPDATE_STATUS (_("We are calling `%s', his phone should be ringing.\n"), 604 UPDATE_STATUS (_("We are calling `%s', his phone should be ringing."),
605 peer_name); 605 peer_name);
606 break; 606 break;
607 case CS_CONNECTED: 607 case CS_CONNECTED:
608 UPDATE_STATUS (_("You are having a conversation with `%s'.\n"), 608 UPDATE_STATUS (_("You are having a conversation with `%s'."),
609 peer_name); 609 peer_name);
610 break; 610 break;
611 case CS_SUSPENDED: 611 case CS_SUSPENDED:
@@ -615,7 +615,7 @@ do_status (const char *args)
615 } 615 }
616 if ((NULL != cl_head) && ((cl_head != cl_active) || (cl_head != cl_tail))) 616 if ((NULL != cl_head) && ((cl_head != cl_active) || (cl_head != cl_tail)))
617 { 617 {
618 618
619 for (cl = cl_head; NULL != cl; cl = cl->next) 619 for (cl = cl_head; NULL != cl; cl = cl->next)
620 { 620 {
621 if (cl == cl_active) 621 if (cl == cl_active)
@@ -916,7 +916,7 @@ add_continuation (void *cls, int32_t success, const char *emsg)
916 //test_finished (); 916 //test_finished ();
917} 917}
918 918
919/** 919/**
920 * Continuation called to notify client about result of the 920 * Continuation called to notify client about result of the
921 * operation. 921 * operation.
922 * 922 *
@@ -926,15 +926,15 @@ add_continuation (void *cls, int32_t success, const char *emsg)
926 * #GNUNET_YES (or other positive value) on success 926 * #GNUNET_YES (or other positive value) on success
927 * @param emsg NULL on success, otherwise an error message 927 * @param emsg NULL on success, otherwise an error message
928 */ 928 */
929static void 929static void
930del_continuation (void *cls, 930del_continuation (void *cls,
931 int32_t success, 931 int32_t success,
932 const char *emsg) 932 const char *emsg)
933{ 933{
934 del_qe = NULL; 934 del_qe = NULL;
935 if (GNUNET_NO == success) 935 if (GNUNET_NO == success)
936 { 936 {
937 fprintf (stderr, 937 fprintf (stderr,
938 _("Deleting record failed, record does not exist%s%s\n"), 938 _("Deleting record failed, record does not exist%s%s\n"),
939 (NULL != emsg) ? ": " : "", 939 (NULL != emsg) ? ": " : "",
940 (NULL != emsg) ? emsg : ""); 940 (NULL != emsg) ? emsg : "");
@@ -1022,7 +1022,7 @@ GIG_get_configuration ()
1022static void 1022static void
1023shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 1023shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1024{ 1024{
1025 1025
1026//TODO: make this work 1026//TODO: make this work
1027 //struct OperationContext *oc; 1027 //struct OperationContext *oc;
1028 1028
@@ -1112,7 +1112,7 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1112{ 1112{
1113 //GtkTreeIter iter; 1113 //GtkTreeIter iter;
1114 GtkWindow *main_window; 1114 GtkWindow *main_window;
1115 1115
1116 //line = 0; 1116 //line = 0;
1117 1117
1118 ml = cls; 1118 ml = cls;
@@ -1143,7 +1143,7 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1143 GTK_TREE_STORE (get_object ("gnunet_conversation_gtk_history_treestore")); 1143 GTK_TREE_STORE (get_object ("gnunet_conversation_gtk_history_treestore"));
1144 history_treemodel = GTK_TREE_MODEL (history_treestore); 1144 history_treemodel = GTK_TREE_MODEL (history_treestore);
1145 1145
1146 //gtk_tree_view_set_activate_on_single_click(contacts_treeview, TRUE); 1146 //gtk_tree_view_set_activate_on_single_click(contacts_treeview, TRUE);
1147 1147
1148 GNUNET_assert (NULL != contacts_liststore); 1148 GNUNET_assert (NULL != contacts_liststore);
1149 1149
@@ -1179,7 +1179,7 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1179 { 1179 {
1180 ego_name = "phone-ego"; 1180 ego_name = "phone-ego";
1181 LOG (_("No ego given, using default: %s "), ego_name); 1181 LOG (_("No ego given, using default: %s "), ego_name);
1182 1182
1183 } 1183 }
1184 1184
1185 id = GNUNET_IDENTITY_connect (cfg, &identity_cb, NULL); 1185 id = GNUNET_IDENTITY_connect (cfg, &identity_cb, NULL);
@@ -1225,9 +1225,9 @@ main (int argc, char *const *argv)
1225} 1225}
1226 1226
1227/* gui stuff start */ 1227/* gui stuff start */
1228/* 1228/*
1229 * Accept call window 1229 * Accept call window
1230 * TODO: rename this 1230 * TODO: rename this
1231 * 1231 *
1232 * @param message message in the dialogbox 1232 * @param message message in the dialogbox
1233 * @param caller_id 1233 * @param caller_id
@@ -1240,9 +1240,9 @@ quick_message (gchar * message, const char *caller_id)
1240 GtkWidget *dialog; 1240 GtkWidget *dialog;
1241 GtkWindow *main_window; 1241 GtkWindow *main_window;
1242 main_window = GTK_WINDOW(get_object("GNUNET_GTK_conversation_window")); 1242 main_window = GTK_WINDOW(get_object("GNUNET_GTK_conversation_window"));
1243 // Create the widgets 1243 // Create the widgets
1244
1244 1245
1245
1246 dialog = gtk_dialog_new_with_buttons ("Incoming call!", 1246 dialog = gtk_dialog_new_with_buttons ("Incoming call!",
1247 main_window, 1247 main_window,
1248 GTK_DIALOG_DESTROY_WITH_PARENT, 1248 GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -1256,11 +1256,11 @@ quick_message (gchar * message, const char *caller_id)
1256 NULL); 1256 NULL);
1257 content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); 1257 content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
1258 1258
1259 1259
1260 notification = gtk_label_new ("Incoming call from:"); 1260 notification = gtk_label_new ("Incoming call from:");
1261 caller_name = gtk_label_new (caller_id); 1261 caller_name = gtk_label_new (caller_id);
1262 1262
1263 // Add the labels, and show everything we've added to the dialog 1263 // Add the labels, and show everything we've added to the dialog
1264 gtk_container_add (GTK_CONTAINER (content_area), notification); 1264 gtk_container_add (GTK_CONTAINER (content_area), notification);
1265 gtk_container_add (GTK_CONTAINER (content_area), caller_name); 1265 gtk_container_add (GTK_CONTAINER (content_area), caller_name);
1266 gtk_widget_show_all (GTK_WIDGET(dialog)); 1266 gtk_widget_show_all (GTK_WIDGET(dialog));
@@ -1269,18 +1269,18 @@ quick_message (gchar * message, const char *caller_id)
1269 case GTK_RESPONSE_ACCEPT : 1269 case GTK_RESPONSE_ACCEPT :
1270 do_status(""); 1270 do_status("");
1271 gtk_widget_destroy(GTK_WIDGET(dialog)); 1271 gtk_widget_destroy(GTK_WIDGET(dialog));
1272 do_accept("0"); 1272 do_accept("0");
1273 break; 1273 break;
1274 case GTK_RESPONSE_REJECT : 1274 case GTK_RESPONSE_REJECT :
1275 do_reject("0"); 1275 do_reject("0");
1276 do_status(""); 1276 do_status("");
1277 gtk_widget_destroy(GTK_WIDGET(dialog)); 1277 gtk_widget_destroy(GTK_WIDGET(dialog));
1278 break; 1278 break;
1279 case GTK_RESPONSE_CANCEL : 1279 case GTK_RESPONSE_CANCEL :
1280 do_status(""); 1280 do_status("");
1281 gtk_widget_destroy(GTK_WIDGET(dialog)); 1281 gtk_widget_destroy(GTK_WIDGET(dialog));
1282 break; 1282 break;
1283 } 1283 }
1284 1284
1285 1285
1286} 1286}
@@ -1303,7 +1303,7 @@ GNUNET_CONVERSATION_GTK_on_call_clicked ()
1303 1303
1304// strncpy(to_addr, gtk_entry_get_text (address_entry), MAX_TO_ADDR); 1304// strncpy(to_addr, gtk_entry_get_text (address_entry), MAX_TO_ADDR);
1305// to_addr[strlen(to_addr)+1] = '\0'; 1305// to_addr[strlen(to_addr)+1] = '\0';
1306// FPRINTF (stderr, _("calling: %s \n"), to_addr ); 1306// FPRINTF (stderr, _("calling: %s \n"), to_addr );
1307 1307
1308 do_call (to_addr); 1308 do_call (to_addr);
1309 disable_button ("GNUNET_GTK_conversation_accept_button"); 1309 disable_button ("GNUNET_GTK_conversation_accept_button");
@@ -1356,7 +1356,7 @@ GNUNET_CONVERSATION_GTK_on_reject_clicked ()
1356void 1356void
1357GNUNET_CONVERSATION_GTK_on_pause_clicked () 1357GNUNET_CONVERSATION_GTK_on_pause_clicked ()
1358{ 1358{
1359// GtkEntry *entry; 1359// GtkEntry *entry;
1360do_suspend("0"); 1360do_suspend("0");
1361 //FPRINTF (stderr, "pause clicked \n"); 1361 //FPRINTF (stderr, "pause clicked \n");
1362 //do_pause(""); 1362 //do_pause("");
@@ -1384,7 +1384,7 @@ GNUNET_CONVERSATION_GTK_on_status_clicked ()
1384{ 1384{
1385 1385
1386 1386
1387// do_accept("0"); 1387// do_accept("0");
1388 do_status (" "); 1388 do_status (" ");
1389 //quick_message('hee blaaat you have a call from blaat'); 1389 //quick_message('hee blaaat you have a call from blaat');
1390} 1390}
@@ -1401,7 +1401,7 @@ void add_contact(const gchar *name, const gchar *address)
1401 GtkTreeIter iter; 1401 GtkTreeIter iter;
1402 struct GNUNET_GNSRECORD_Data rd; 1402 struct GNUNET_GNSRECORD_Data rd;
1403 struct GNUNET_GNSRECORD_Data *rde; 1403 struct GNUNET_GNSRECORD_Data *rde;
1404 static void *data; 1404 static void *data;
1405 static size_t data_size; 1405 static size_t data_size;
1406 struct GNUNET_CRYPTO_EcdsaPublicKey pkey; 1406 struct GNUNET_CRYPTO_EcdsaPublicKey pkey;
1407 1407
@@ -1428,11 +1428,11 @@ void add_contact(const gchar *name, const gchar *address)
1428 else 1428 else
1429 { 1429 {
1430 add_qe = 1430 add_qe =
1431 GNUNET_NAMESTORE_records_store (ns, 1431 GNUNET_NAMESTORE_records_store (ns,
1432 &zone_pkey, 1432 &zone_pkey,
1433 name, 1433 name,
1434 1, 1434 1,
1435 rde, 1435 rde,
1436 &add_continuation, 1436 &add_continuation,
1437 &add_qe); 1437 &add_qe);
1438 gtk_list_store_append (contacts_liststore, &iter); 1438 gtk_list_store_append (contacts_liststore, &iter);
@@ -1442,7 +1442,7 @@ void add_contact(const gchar *name, const gchar *address)
1442 1442
1443/* 1443/*
1444 * executed when clicked on add contact 1444 * executed when clicked on add contact
1445 * @param button 1445 * @param button
1446 * @param user_data 1446 * @param user_data
1447 */ 1447 */
1448 1448
@@ -1454,7 +1454,7 @@ GNUNET_CONVERSATION_GTK_on_add_clicked (GtkButton * button,
1454 1454
1455 //unused: *anotherArea, *labelName, *labelAddres *caller_name 1455 //unused: *anotherArea, *labelName, *labelAddres *caller_name
1456 1456
1457 GtkLabel *notification; 1457 GtkLabel *notification;
1458// GtkHBox *content_area; 1458// GtkHBox *content_area;
1459 GtkContainer *content_area; 1459 GtkContainer *content_area;
1460 GtkButton *currentCheckButton; 1460 GtkButton *currentCheckButton;
@@ -1492,7 +1492,7 @@ GNUNET_CONVERSATION_GTK_on_add_clicked (GtkButton * button,
1492 notification = GTK_LABEL(gtk_label_new ("Adding contact")); 1492 notification = GTK_LABEL(gtk_label_new ("Adding contact"));
1493// caller_name = gtk_label_new (caller_id); 1493// caller_name = gtk_label_new (caller_id);
1494 1494
1495 // Add the labels, and show everything we've added to the dialog 1495 // Add the labels, and show everything we've added to the dialog
1496 gtk_container_add (GTK_CONTAINER (content_area), GTK_WIDGET(notification)); 1496 gtk_container_add (GTK_CONTAINER (content_area), GTK_WIDGET(notification));
1497// gtk_container_add (GTK_CONTAINER (content_area), caller_name); 1497// gtk_container_add (GTK_CONTAINER (content_area), caller_name);
1498 gtk_widget_show_all (GTK_WIDGET(dialog)); 1498 gtk_widget_show_all (GTK_WIDGET(dialog));
@@ -1513,7 +1513,7 @@ GNUNET_CONVERSATION_GTK_on_add_clicked (GtkButton * button,
1513 case GTK_RESPONSE_OK: 1513 case GTK_RESPONSE_OK:
1514 //use_current_incoming_address(); 1514 //use_current_incoming_address();
1515 gtk_entry_set_text (GTK_ENTRY(addressEntry), callerName); 1515 gtk_entry_set_text (GTK_ENTRY(addressEntry), callerName);
1516 add_contact (gtk_entry_get_text (nameEntry), 1516 add_contact (gtk_entry_get_text (nameEntry),
1517 callerName); 1517 callerName);
1518// add_contact(gtk_entry_get_text(nameEntry),memmove(&callerName,&callerName+52,1)); 1518// add_contact(gtk_entry_get_text(nameEntry),memmove(&callerName,&callerName+52,1));
1519 gtk_widget_destroy (GTK_WIDGET(dialog)); 1519 gtk_widget_destroy (GTK_WIDGET(dialog));
@@ -1532,11 +1532,11 @@ GNUNET_CONVERSATION_GTK_on_remove_clicked (GtkButton * button,
1532 GtkTreeSelection *selection; 1532 GtkTreeSelection *selection;
1533 GtkTreeModel *model; 1533 GtkTreeModel *model;
1534 GtkTreeIter iter; 1534 GtkTreeIter iter;
1535 GtkDialog *confirm; 1535 GtkDialog *confirm;
1536 GtkWindow *main_window; 1536 GtkWindow *main_window;
1537 GtkLabel *notification; 1537 GtkLabel *notification;
1538 GtkHBox *content_area; 1538 GtkHBox *content_area;
1539 1539
1540 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(contacts_treeview)); 1540 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(contacts_treeview));
1541 if (gtk_tree_selection_get_selected(selection, &model, &iter)) 1541 if (gtk_tree_selection_get_selected(selection, &model, &iter))
1542 { 1542 {
@@ -1547,7 +1547,7 @@ GNUNET_CONVERSATION_GTK_on_remove_clicked (GtkButton * button,
1547 GTK_DIALOG(gtk_dialog_new_with_buttons ("Removing contact", main_window, 1547 GTK_DIALOG(gtk_dialog_new_with_buttons ("Removing contact", main_window,
1548 GTK_DIALOG_DESTROY_WITH_PARENT, 1548 GTK_DIALOG_DESTROY_WITH_PARENT,
1549 _("Yes"), GTK_RESPONSE_ACCEPT, 1549 _("Yes"), GTK_RESPONSE_ACCEPT,
1550 _("No"), GTK_RESPONSE_CANCEL, NULL)); 1550 _("No"), GTK_RESPONSE_CANCEL, NULL));
1551 content_area = GTK_CONTAINER(gtk_dialog_get_content_area (GTK_DIALOG (confirm))); 1551 content_area = GTK_CONTAINER(gtk_dialog_get_content_area (GTK_DIALOG (confirm)));
1552 notification = GTK_LABEL(gtk_label_new ("Do you really want to remove this contact?")); 1552 notification = GTK_LABEL(gtk_label_new ("Do you really want to remove this contact?"));
1553 gtk_container_add (GTK_CONTAINER (content_area), GTK_WIDGET(notification)); 1553 gtk_container_add (GTK_CONTAINER (content_area), GTK_WIDGET(notification));
@@ -1555,7 +1555,7 @@ GNUNET_CONVERSATION_GTK_on_remove_clicked (GtkButton * button,
1555 switch (gtk_dialog_run(confirm)) 1555 switch (gtk_dialog_run(confirm))
1556 { 1556 {
1557 case GTK_RESPONSE_ACCEPT: 1557 case GTK_RESPONSE_ACCEPT:
1558 zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (caller_id); 1558 zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (caller_id);
1559 del_qe = GNUNET_NAMESTORE_records_store (ns, 1559 del_qe = GNUNET_NAMESTORE_records_store (ns,
1560 &zone_pkey, 1560 &zone_pkey,
1561 name, 1561 name,
@@ -1611,7 +1611,7 @@ GNUNET_CONVERSATION_GTK_row_activated ()
1611 { 1611 {
1612 GNUNET_asprintf (&callAddress, "%s\.gnu", name); 1612 GNUNET_asprintf (&callAddress, "%s\.gnu", name);
1613 } 1613 }
1614// else { GNUNET_asprintf(&callAddress, "%s", peer_id);} 1614// else { GNUNET_asprintf(&callAddress, "%s", peer_id);}
1615 1615
1616 g_print ("ego name %s\n", callAddress); 1616 g_print ("ego name %s\n", callAddress);
1617 GtkEntry *address_entry; 1617 GtkEntry *address_entry;