diff options
Diffstat (limited to 'src/peerinfo/gnunet-peerinfo-gtk.c')
-rw-r--r-- | src/peerinfo/gnunet-peerinfo-gtk.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/src/peerinfo/gnunet-peerinfo-gtk.c b/src/peerinfo/gnunet-peerinfo-gtk.c index eb068aa0..e18b9315 100644 --- a/src/peerinfo/gnunet-peerinfo-gtk.c +++ b/src/peerinfo/gnunet-peerinfo-gtk.c | |||
@@ -127,7 +127,7 @@ static struct GNUNET_ATS_PerformanceHandle *ats; | |||
127 | /** | 127 | /** |
128 | * Map of peer identities to the respective PeerInfo for our view. | 128 | * Map of peer identities to the respective PeerInfo for our view. |
129 | */ | 129 | */ |
130 | static struct GNUNET_CONTAINER_MultiHashMap *peer2info; | 130 | static struct GNUNET_CONTAINER_MultiPeerMap *peer2info; |
131 | 131 | ||
132 | /** | 132 | /** |
133 | * Should gnunet-peerinfo-gtk start in tray mode? | 133 | * Should gnunet-peerinfo-gtk start in tray mode? |
@@ -181,10 +181,12 @@ get_object (const char *name) | |||
181 | * @param cls unused | 181 | * @param cls unused |
182 | * @param key peer identity | 182 | * @param key peer identity |
183 | * @param value the 'struct PeerInfo' | 183 | * @param value the 'struct PeerInfo' |
184 | * @return GNUNET_OK (continue to iterate) | 184 | * @return #GNUNET_OK (continue to iterate) |
185 | */ | 185 | */ |
186 | static int | 186 | static int |
187 | free_paths (void *cls, const struct GNUNET_HashCode * key, void *value) | 187 | free_paths (void *cls, |
188 | const struct GNUNET_PeerIdentity *key, | ||
189 | void *value) | ||
188 | { | 190 | { |
189 | struct PeerInfo *info = value; | 191 | struct PeerInfo *info = value; |
190 | 192 | ||
@@ -226,8 +228,8 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
226 | GNUNET_ATS_performance_done (ats); | 228 | GNUNET_ATS_performance_done (ats); |
227 | ats = NULL; | 229 | ats = NULL; |
228 | } | 230 | } |
229 | GNUNET_CONTAINER_multihashmap_iterate (peer2info, &free_paths, NULL); | 231 | GNUNET_CONTAINER_multipeermap_iterate (peer2info, &free_paths, NULL); |
230 | GNUNET_CONTAINER_multihashmap_destroy (peer2info); | 232 | GNUNET_CONTAINER_multipeermap_destroy (peer2info); |
231 | peer2info = NULL; | 233 | peer2info = NULL; |
232 | GNUNET_PEERINFO_GTK_flags_shutdown (); | 234 | GNUNET_PEERINFO_GTK_flags_shutdown (); |
233 | } | 235 | } |
@@ -352,20 +354,15 @@ peerinfo_processor (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
352 | const char *err_msg) | 354 | const char *err_msg) |
353 | { | 355 | { |
354 | GtkTreeIter iter; | 356 | GtkTreeIter iter; |
355 | char *npid; | ||
356 | struct GNUNET_CRYPTO_HashAsciiEncoded enc; | ||
357 | struct PeerInfo *info; | 357 | struct PeerInfo *info; |
358 | GtkTreePath *path; | 358 | GtkTreePath *path; |
359 | 359 | ||
360 | info = GNUNET_CONTAINER_multihashmap_get (peer2info, &peer->hashPubKey); | 360 | info = GNUNET_CONTAINER_multipeermap_get (peer2info, peer); |
361 | if (NULL == info) | 361 | if (NULL == info) |
362 | { | 362 | { |
363 | GNUNET_CRYPTO_hash_to_enc (&peer->hashPubKey, &enc); | ||
364 | npid = (char *) &enc; | ||
365 | npid[4] = '\0'; | ||
366 | gtk_list_store_append (ls, &iter); | 363 | gtk_list_store_append (ls, &iter); |
367 | gtk_list_store_set (ls, &iter, | 364 | gtk_list_store_set (ls, &iter, |
368 | PEERINFO_MC_PEER_IDENTITY_STRING, npid, | 365 | PEERINFO_MC_PEER_IDENTITY_STRING, GNUNET_i2s (peer), |
369 | PEERINFO_MC_NUMBER_OF_ADDRESSES, (guint) 0, | 366 | PEERINFO_MC_NUMBER_OF_ADDRESSES, (guint) 0, |
370 | PEERINFO_MC_COUNTRY_NAME, "", | 367 | PEERINFO_MC_COUNTRY_NAME, "", |
371 | PEERINFO_MC_COUNTRY_FLAG, NULL, | 368 | PEERINFO_MC_COUNTRY_FLAG, NULL, |
@@ -380,7 +377,7 @@ peerinfo_processor (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
380 | info->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (ls), path); | 377 | info->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (ls), path); |
381 | GNUNET_assert (NULL != info->rr); | 378 | GNUNET_assert (NULL != info->rr); |
382 | gtk_tree_path_free (path); | 379 | gtk_tree_path_free (path); |
383 | GNUNET_CONTAINER_multihashmap_put (peer2info, &peer->hashPubKey, info, | 380 | GNUNET_CONTAINER_multipeermap_put (peer2info, peer, info, |
384 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | 381 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); |
385 | } | 382 | } |
386 | if (NULL == info->palc) | 383 | if (NULL == info->palc) |
@@ -421,7 +418,7 @@ status_cb (void *cls, | |||
421 | 418 | ||
422 | if (GNUNET_YES != address_active) | 419 | if (GNUNET_YES != address_active) |
423 | return; | 420 | return; |
424 | info = GNUNET_CONTAINER_multihashmap_get (peer2info, &address->peer.hashPubKey); | 421 | info = GNUNET_CONTAINER_multipeermap_get (peer2info, &address->peer); |
425 | if (NULL == info) | 422 | if (NULL == info) |
426 | return; /* should rarely happen... */ | 423 | return; /* should rarely happen... */ |
427 | path = gtk_tree_row_reference_get_path (info->rr); | 424 | path = gtk_tree_row_reference_get_path (info->rr); |
@@ -493,7 +490,7 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
493 | led_red = load_led ("red"); | 490 | led_red = load_led ("red"); |
494 | GNUNET_GTK_set_icon_search_path (); | 491 | GNUNET_GTK_set_icon_search_path (); |
495 | GNUNET_GTK_setup_nls (); | 492 | GNUNET_GTK_setup_nls (); |
496 | peer2info = GNUNET_CONTAINER_multihashmap_create (256, GNUNET_NO); | 493 | peer2info = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_NO); |
497 | pnc = | 494 | pnc = |
498 | GNUNET_PEERINFO_notify (get_configuration (), | 495 | GNUNET_PEERINFO_notify (get_configuration (), |
499 | GNUNET_NO, | 496 | GNUNET_NO, |