diff options
Diffstat (limited to 'src/conversation/gnunet-conversation-gtk_contacts.c')
-rw-r--r-- | src/conversation/gnunet-conversation-gtk_contacts.c | 118 |
1 files changed, 59 insertions, 59 deletions
diff --git a/src/conversation/gnunet-conversation-gtk_contacts.c b/src/conversation/gnunet-conversation-gtk_contacts.c index bcb6d7ca..0316db5f 100644 --- a/src/conversation/gnunet-conversation-gtk_contacts.c +++ b/src/conversation/gnunet-conversation-gtk_contacts.c | |||
@@ -20,11 +20,10 @@ | |||
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file src/conversation/gnunet-conversation-gtk_contacts.c | 22 | * @file src/conversation/gnunet-conversation-gtk_contacts.c |
23 | * @brief | 23 | * @brief |
24 | * @author yids | 24 | * @author yids |
25 | * @author hark | 25 | * @author hark |
26 | */ | 26 | */ |
27 | #include "gnunet-conversation-gtk_common.h" | ||
28 | #include "gnunet-conversation-gtk.h" | 27 | #include "gnunet-conversation-gtk.h" |
29 | 28 | ||
30 | 29 | ||
@@ -43,10 +42,6 @@ | |||
43 | /************* | 42 | /************* |
44 | * contacts * | 43 | * contacts * |
45 | *************/ | 44 | *************/ |
46 | /** | ||
47 | * Our configurations. | ||
48 | */ | ||
49 | static struct GNUNET_CONFIGURATION_Handle *cfg; | ||
50 | 45 | ||
51 | /** | 46 | /** |
52 | * Our ego. | 47 | * Our ego. |
@@ -165,8 +160,10 @@ static struct GNUNET_NAMESTORE_QueueEntry *del_qe; | |||
165 | 160 | ||
166 | //////////////////////////// | 161 | //////////////////////////// |
167 | static void | 162 | static void |
168 | display_record (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 163 | display_record (void *cls, |
169 | const char *rname, unsigned int rd_len, | 164 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, |
165 | const char *rname, | ||
166 | unsigned int rd_len, | ||
170 | const struct GNUNET_GNSRECORD_Data *rd) | 167 | const struct GNUNET_GNSRECORD_Data *rd) |
171 | { | 168 | { |
172 | /* const char *typestring;*/ | 169 | /* const char *typestring;*/ |
@@ -180,7 +177,7 @@ display_record (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | |||
180 | 177 | ||
181 | if (NULL == rname) | 178 | if (NULL == rname) |
182 | { | 179 | { |
183 | 180 | ||
184 | list_it = NULL; | 181 | list_it = NULL; |
185 | //test_finished (); | 182 | //test_finished (); |
186 | return; | 183 | return; |
@@ -239,7 +236,7 @@ display_record (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | |||
239 | GNUNET_free (s); | 236 | GNUNET_free (s); |
240 | } | 237 | } |
241 | // FPRINTF (stdout, "%s", "\n"); | 238 | // FPRINTF (stdout, "%s", "\n"); |
242 | 239 | ||
243 | GNUNET_NAMESTORE_zone_iterator_next (list_it); | 240 | GNUNET_NAMESTORE_zone_iterator_next (list_it); |
244 | // GNUNET_NAMESTORE_zone_iteration_stop(list_it); | 241 | // GNUNET_NAMESTORE_zone_iteration_stop(list_it); |
245 | 242 | ||
@@ -256,7 +253,9 @@ display_record (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | |||
256 | * @param name name of the ego | 253 | * @param name name of the ego |
257 | */ | 254 | */ |
258 | static void | 255 | static void |
259 | identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, | 256 | identity_cb (void *cls, |
257 | struct GNUNET_IDENTITY_Ego *ego, | ||
258 | void **ctx, | ||
260 | const char *name) | 259 | const char *name) |
261 | { | 260 | { |
262 | /* | 261 | /* |
@@ -264,9 +263,9 @@ identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, | |||
264 | char *s; | 263 | char *s; |
265 | */ | 264 | */ |
266 | GtkTreeIter iter; | 265 | GtkTreeIter iter; |
267 | 266 | ||
268 | if (NULL != ego) | 267 | if (NULL != ego) |
269 | { | 268 | { |
270 | /* | 269 | /* |
271 | GNUNET_IDENTITY_ego_get_public_key (ego, &pk); | 270 | GNUNET_IDENTITY_ego_get_public_key (ego, &pk); |
272 | s = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); | 271 | s = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); |
@@ -279,17 +278,18 @@ identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, | |||
279 | &iter, -1, | 278 | &iter, -1, |
280 | 0, name, | 279 | 0, name, |
281 | 1, ego, | 280 | 1, ego, |
282 | -1); | 281 | -1); |
283 | 282 | ||
284 | } | 283 | } |
285 | 284 | ||
286 | contacts_ego = ego; | 285 | contacts_ego = ego; |
287 | 286 | ||
288 | 287 | ||
289 | // zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (caller_id); | 288 | // zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (caller_id); |
290 | ns = GNUNET_NAMESTORE_connect (cfg); | 289 | ns = GNUNET_NAMESTORE_connect (GCG_get_configuration ()); |
291 | |||
292 | } | 290 | } |
291 | |||
292 | |||
293 | /** | 293 | /** |
294 | * Continuation called to notify client about result of the | 294 | * Continuation called to notify client about result of the |
295 | * operation. | 295 | * operation. |
@@ -312,10 +312,10 @@ add_continuation (void *cls, int32_t success, const char *emsg) | |||
312 | fprintf (stderr, _("Adding record failed: %s\n"), | 312 | fprintf (stderr, _("Adding record failed: %s\n"), |
313 | (GNUNET_NO == success) ? "record exists" : emsg); | 313 | (GNUNET_NO == success) ? "record exists" : emsg); |
314 | if (GNUNET_NO != success) | 314 | if (GNUNET_NO != success) |
315 | LOG("GNUNET_NO != success"); | 315 | GCG_log("GNUNET_NO != success"); |
316 | //ret = 1; | 316 | //ret = 1; |
317 | } | 317 | } |
318 | LOG("blaat"); | 318 | GCG_log("blaat"); |
319 | //ret = 0; | 319 | //ret = 0; |
320 | //test_finished (); | 320 | //test_finished (); |
321 | } | 321 | } |
@@ -362,19 +362,19 @@ add_contact (const gchar * name, const gchar * address) | |||
362 | static void *data; | 362 | static void *data; |
363 | static size_t data_size; | 363 | static size_t data_size; |
364 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; | 364 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; |
365 | 365 | ||
366 | struct GNUNET_IDENTITY_Ego *tempEgo; | 366 | struct GNUNET_IDENTITY_Ego *tempEgo; |
367 | char *tempName; | 367 | char *tempName; |
368 | GtkTreeIter testIter; | 368 | GtkTreeIter testIter; |
369 | gtk_combo_box_get_active_iter(GTK_COMBO_BOX (GNUNET_CONVERSATION_GTK_get_main_window_object ("gnunet_conversation_gtk_contacts_zone_combobox")), &testIter); | 369 | gtk_combo_box_get_active_iter(GTK_COMBO_BOX (GCG_get_main_window_object ("gnunet_conversation_gtk_contacts_zone_combobox")), &testIter); |
370 | 370 | ||
371 | gtk_tree_model_get (GTK_TREE_MODEL (zone_liststore), | 371 | gtk_tree_model_get (GTK_TREE_MODEL (zone_liststore), |
372 | &testIter, | 372 | &testIter, |
373 | 0, &tempName, | 373 | 0, &tempName, |
374 | 1, &tempEgo, | 374 | 1, &tempEgo, |
375 | -1); | 375 | -1); |
376 | 376 | ||
377 | 377 | ||
378 | GNUNET_CRYPTO_ecdsa_public_key_from_string (address, strlen (address), &pkey); | 378 | GNUNET_CRYPTO_ecdsa_public_key_from_string (address, strlen (address), &pkey); |
379 | rde = &rd; | 379 | rde = &rd; |
380 | zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (tempEgo); | 380 | zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (tempEgo); |
@@ -401,24 +401,22 @@ add_contact (const gchar * name, const gchar * address) | |||
401 | gtk_list_store_set (contacts_liststore, &iter, 1, "PKEY", 0, name, -1); | 401 | gtk_list_store_set (contacts_liststore, &iter, 1, "PKEY", 0, name, -1); |
402 | } | 402 | } |
403 | } | 403 | } |
404 | /* | 404 | |
405 | |||
406 | /** | ||
405 | * executed when clicked on add contact | 407 | * executed when clicked on add contact |
406 | * @param button | 408 | * @param button |
407 | * @param user_data | 409 | * @param user_data |
408 | */ | 410 | */ |
409 | |||
410 | void | 411 | void |
411 | GNUNET_CONVERSATION_GTK_on_add_clicked (GtkButton * button, | 412 | GNUNET_CONVERSATION_GTK_on_add_clicked (GtkButton * button, |
412 | gpointer * user_data) | 413 | gpointer * user_data) |
413 | { | 414 | { |
415 | GtkEntry *nameEntry; | ||
416 | GtkEntry *addressEntry; | ||
414 | 417 | ||
415 | GtkEntry *nameEntry, *addressEntry; | 418 | nameEntry = GTK_ENTRY (GCG_get_main_window_object ("GNUNET_GTK_conversation_nameAdd")); |
416 | 419 | addressEntry = GTK_ENTRY (GCG_get_main_window_object ("GNUNET_GTK_conversation_addressAdd")); | |
417 | nameEntry = GTK_ENTRY (GNUNET_CONVERSATION_GTK_get_main_window_object ("GNUNET_GTK_conversation_nameAdd")); | ||
418 | addressEntry = GTK_ENTRY (GNUNET_CONVERSATION_GTK_get_main_window_object ("GNUNET_GTK_conversation_addressAdd")); | ||
419 | FPRINTF(stderr,"name %s \n", gtk_entry_get_text (nameEntry)); | ||
420 | FPRINTF(stderr,"addr %s \n", gtk_entry_get_text (addressEntry)); | ||
421 | |||
422 | add_contact (gtk_entry_get_text (nameEntry),gtk_entry_get_text(addressEntry)); | 420 | add_contact (gtk_entry_get_text (nameEntry),gtk_entry_get_text(addressEntry)); |
423 | } | 421 | } |
424 | 422 | ||
@@ -439,7 +437,7 @@ GNUNET_CONVERSATION_GTK_on_remove_clicked (GtkButton * button, | |||
439 | { | 437 | { |
440 | gtk_tree_model_get (model, &iter, 0, &name, -1); | 438 | gtk_tree_model_get (model, &iter, 0, &name, -1); |
441 | //FPRINTF (stderr, "selected %s \n", name); | 439 | //FPRINTF (stderr, "selected %s \n", name); |
442 | main_window = GTK_WINDOW (GNUNET_CONVERSATION_GTK_get_main_window_object ("GNUNET_GTK_conversation_window")); | 440 | main_window = GTK_WINDOW (GCG_get_main_window_object ("GNUNET_GTK_conversation_window")); |
443 | confirm = | 441 | confirm = |
444 | GTK_DIALOG (gtk_dialog_new_with_buttons | 442 | GTK_DIALOG (gtk_dialog_new_with_buttons |
445 | ("Removing contact", main_window, | 443 | ("Removing contact", main_window, |
@@ -477,11 +475,11 @@ GNUNET_CONVERSATION_GTK_on_current_clicked (GtkButton * button, | |||
477 | { | 475 | { |
478 | GtkEntry *addressEntry; | 476 | GtkEntry *addressEntry; |
479 | // FPRINTF(stderr,"on current clicked %s\n",callerName); | 477 | // FPRINTF(stderr,"on current clicked %s\n",callerName); |
480 | //char *strippedAddress; | 478 | //char *strippedAddress; |
481 | addressEntry = GTK_ENTRY (GNUNET_CONVERSATION_GTK_get_main_window_object ("GNUNET_GTK_conversation_addressAdd")); | 479 | addressEntry = GTK_ENTRY (GCG_get_main_window_object ("GNUNET_GTK_conversation_addressAdd")); |
482 | currentlySelectedCallAddress[52] = '\0'; | 480 | currentlySelectedCallAddress[52] = '\0'; |
483 | gtk_entry_set_text(addressEntry, currentlySelectedCallAddress); | 481 | gtk_entry_set_text(addressEntry, currentlySelectedCallAddress); |
484 | 482 | ||
485 | } | 483 | } |
486 | 484 | ||
487 | 485 | ||
@@ -526,7 +524,7 @@ GNUNET_CONVERSATION_GTK_row_activated () | |||
526 | g_print ("ego name %s\n", callAddress); | 524 | g_print ("ego name %s\n", callAddress); |
527 | GtkEntry *address_entry; | 525 | GtkEntry *address_entry; |
528 | 526 | ||
529 | address_entry = GTK_ENTRY ( GNUNET_CONVERSATION_GTK_get_main_window_object ("GNUNET_GTK_conversation_address")); | 527 | address_entry = GTK_ENTRY ( GCG_get_main_window_object ("GNUNET_GTK_conversation_address")); |
530 | gtk_entry_set_text (address_entry, callAddress); | 528 | gtk_entry_set_text (address_entry, callAddress); |
531 | do_call (callAddress); | 529 | do_call (callAddress); |
532 | } | 530 | } |
@@ -547,7 +545,7 @@ print_ego (void *cls, | |||
547 | } | 545 | } |
548 | */ | 546 | */ |
549 | /* | 547 | /* |
550 | static void | 548 | static void |
551 | setCurrentAddressbookEgo(void *cls, struct GNUNET_IDENTITY_Ego *ego) | 549 | setCurrentAddressbookEgo(void *cls, struct GNUNET_IDENTITY_Ego *ego) |
552 | { | 550 | { |
553 | currentAddressBookEgo = ego; | 551 | currentAddressBookEgo = ego; |
@@ -571,9 +569,9 @@ gnunet_conversation_gtk_contacts_zone_combobox_changed_cb (GtkComboBox *widget, | |||
571 | struct GNUNET_CRYPTO_EcdsaPrivateKey temp_zone_pkey; | 569 | struct GNUNET_CRYPTO_EcdsaPrivateKey temp_zone_pkey; |
572 | //GtkTreeSelection *selection; | 570 | //GtkTreeSelection *selection; |
573 | //GtkTreeIter iterA; | 571 | //GtkTreeIter iterA; |
574 | |||
575 | 572 | ||
576 | gtk_combo_box_get_active_iter(widget, &contacts_zone_iter); | 573 | |
574 | gtk_combo_box_get_active_iter(widget, &contacts_zone_iter); | ||
577 | 575 | ||
578 | gtk_tree_model_get (GTK_TREE_MODEL (zone_liststore), | 576 | gtk_tree_model_get (GTK_TREE_MODEL (zone_liststore), |
579 | &contacts_zone_iter, | 577 | &contacts_zone_iter, |
@@ -587,62 +585,64 @@ gnunet_conversation_gtk_contacts_zone_combobox_changed_cb (GtkComboBox *widget, | |||
587 | GNUNET_IDENTITY_ego_lookup (cfg, | 585 | GNUNET_IDENTITY_ego_lookup (cfg, |
588 | tempName, | 586 | tempName, |
589 | setCurrentAddressbookEgo, | 587 | setCurrentAddressbookEgo, |
590 | NULL); | 588 | NULL); |
591 | */ | 589 | */ |
592 | //selection = gtk_tree_view_get_selection (zone_treeview); | 590 | //selection = gtk_tree_view_get_selection (zone_treeview); |
593 | 591 | ||
594 | //gtk_tree_selection_get_selected (selection, &zone_treemodel, &iterA); | 592 | //gtk_tree_selection_get_selected (selection, &zone_treemodel, &iterA); |
595 | 593 | ||
596 | //gtk_tree_model_get_iter_first(zone_treemodel, &iterA); | 594 | //gtk_tree_model_get_iter_first(zone_treemodel, &iterA); |
597 | //gtk_tree_model_get (zone_treemodel, &iterA, 0, &tempName, 1, &tempEgo, -1); | 595 | //gtk_tree_model_get (zone_treemodel, &iterA, 0, &tempName, 1, &tempEgo, -1); |
598 | 596 | ||
599 | 597 | ||
600 | list_it = | 598 | list_it = |
601 | GNUNET_NAMESTORE_zone_iteration_start (ns, &temp_zone_pkey, &display_record, | 599 | GNUNET_NAMESTORE_zone_iteration_start (ns, &temp_zone_pkey, &display_record, |
602 | NULL); | 600 | NULL); |
603 | 601 | ||
604 | // GNUNET_IDENTITY_disconnect (id); | 602 | // GNUNET_IDENTITY_disconnect (id); |
605 | 603 | ||
606 | } | 604 | } |
607 | 605 | ||
608 | 606 | ||
609 | 607 | ||
610 | ////// | 608 | ////// |
611 | extern void | 609 | extern void |
612 | GNUNET_CONVERSATION_GTK_CONTACTS_init () | 610 | GNUNET_CONVERSATION_GTK_CONTACTS_init () |
613 | { | 611 | { |
614 | GtkTreeIter iterContactsInit; | 612 | GtkTreeIter iterContactsInit; |
615 | 613 | ||
616 | cfg = GIG_get_configuration (); | 614 | |
617 | 615 | ||
618 | 616 | ||
619 | // contacts | 617 | // contacts |
620 | contacts_liststore = | 618 | contacts_liststore = |
621 | GTK_LIST_STORE (GNUNET_CONVERSATION_GTK_get_main_window_object | 619 | GTK_LIST_STORE (GCG_get_main_window_object |
622 | ("gnunet_conversation_gtk_contacts_liststore")); | 620 | ("gnunet_conversation_gtk_contacts_liststore")); |
623 | contacts_treeview = | 621 | contacts_treeview = |
624 | GTK_TREE_VIEW (GNUNET_CONVERSATION_GTK_get_main_window_object ("gnunet_conversation_gtk_treeview")); | 622 | GTK_TREE_VIEW (GCG_get_main_window_object ("gnunet_conversation_gtk_treeview")); |
625 | contacts_treemodel = GTK_TREE_MODEL (contacts_liststore); | 623 | contacts_treemodel = GTK_TREE_MODEL (contacts_liststore); |
626 | 624 | ||
627 | // zone list | 625 | // zone list |
628 | zone_liststore = | 626 | zone_liststore = |
629 | GTK_LIST_STORE (GNUNET_CONVERSATION_GTK_get_main_window_object ("gnunet_conversation_gtk_contacts_zone_liststore")); | 627 | GTK_LIST_STORE (GCG_get_main_window_object ("gnunet_conversation_gtk_contacts_zone_liststore")); |
630 | 628 | ||
631 | // zone_treestore = | 629 | // zone_treestore = |
632 | // GTK_TREE_STORE (GNUNET_CONVERSATION_GTK_get_main_window_object ("gnunet_conversation_gtk_contacts_zone_treestore")); | 630 | // GTK_TREE_STORE (GCG_get_main_window_object ("gnunet_conversation_gtk_contacts_zone_treestore")); |
633 | zone_treemodel = GTK_TREE_MODEL (zone_liststore); | 631 | zone_treemodel = GTK_TREE_MODEL (zone_liststore); |
634 | zone_treeview = | 632 | zone_treeview = |
635 | GTK_TREE_VIEW (get_object ("gnunet_conversation_gtk_zone_treeview")); | 633 | GTK_TREE_VIEW (GCG_get_main_window_object ("gnunet_conversation_gtk_zone_treeview")); |
636 | 634 | ||
637 | gtk_tree_model_get_iter_first(zone_treemodel, &iterContactsInit); | 635 | gtk_tree_model_get_iter_first(zone_treemodel, &iterContactsInit); |
638 | gtk_tree_model_iter_next(zone_treemodel, &iterContactsInit); | 636 | gtk_tree_model_iter_next(zone_treemodel, &iterContactsInit); |
639 | 637 | ||
640 | gtk_combo_box_set_active_iter(GTK_COMBO_BOX (GNUNET_CONVERSATION_GTK_get_main_window_object ("gnunet_conversation_gtk_contacts_zone_combobox")), &iterContactsInit); | 638 | gtk_combo_box_set_active_iter(GTK_COMBO_BOX (GCG_get_main_window_object ("gnunet_conversation_gtk_contacts_zone_combobox")), &iterContactsInit); |
641 | 639 | ||
642 | id = GNUNET_IDENTITY_connect (cfg, &identity_cb, NULL); | 640 | id = GNUNET_IDENTITY_connect (GCG_get_configuration (), |
641 | &identity_cb, | ||
642 | NULL); | ||
643 | // zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (caller_id); | 643 | // zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (caller_id); |
644 | // gtk_combo_box_set_active(GTK_WIDGET (get_object ("gnunet_conversation_gtk_contacts_zone_combobox")), 1); | 644 | // gtk_combo_box_set_active(GTK_WIDGET (GCG_get_main_window_object ("gnunet_conversation_gtk_contacts_zone_combobox")), 1); |
645 | // gtk_combo_box_set_active(GTK_WIDGET (get_object (ml,"gnunet_conversation_gtk_outgoing_zone_combobox")), 1); | 645 | // gtk_combo_box_set_active(GTK_WIDGET (GCG_get_main_window_object (ml,"gnunet_conversation_gtk_outgoing_zone_combobox")), 1); |
646 | 646 | ||
647 | } | 647 | } |
648 | 648 | ||