aboutsummaryrefslogtreecommitdiff
path: root/src/peerinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/peerinfo.c')
-rw-r--r--src/peerinfo.c90
1 files changed, 0 insertions, 90 deletions
diff --git a/src/peerinfo.c b/src/peerinfo.c
deleted file mode 100644
index 147144cd..00000000
--- a/src/peerinfo.c
+++ /dev/null
@@ -1,90 +0,0 @@
1/*
2 This file is part of GNUnet.
3 (C) 2010 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21/**
22 * @file src/peerinfo.c
23 * @brief Updates the peerinfo view
24 * @author Christian Grothoff
25 */
26#include "peerinfo.h"
27
28/**
29 * Function called for peers that we know about.
30 *
31 * @param cls closure
32 * @param peer id of the peer, NULL for last call
33 * @param hello hello message for the peer (can be NULL)
34 * @param err_msg NULL if successful, otherwise contains error message
35 */
36void
37GNUNET_GTK_peerinfo_processor (void *cls,
38 const struct GNUNET_PeerIdentity * peer,
39 const struct GNUNET_HELLO_Message * hello,
40 const char * err_msg)
41{
42 GtkListStore *ls;
43 GtkTreeModel *tm;
44 GtkTreeIter iter;
45 int found;
46 gchar *pid;
47 const char *npid;
48 struct GNUNET_CRYPTO_HashAsciiEncoded enc;
49
50 GNUNET_CRYPTO_hash_to_enc (&peer->hashPubKey,
51 &enc);
52 npid = (const char*) &enc;
53 ls = GTK_LIST_STORE (GNUNET_GTK_get_main_window_object ("GNUNET_GTK_peer_info_list_store"));
54 tm = GTK_TREE_MODEL (ls);
55 found = GNUNET_NO;
56 if (TRUE == gtk_tree_model_get_iter_first (tm, &iter))
57 {
58 do
59 {
60 pid = NULL;
61 gtk_tree_model_get (tm,
62 &iter,
63 0, &pid, -1);
64 if (pid != NULL)
65 {
66 if (0 == strcmp (pid, npid))
67 {
68 found = GNUNET_YES;
69 g_free (pid);
70 break;
71 }
72 }
73 g_free (pid);
74 }
75 while ( (found == GNUNET_NO) &&
76 (TRUE == gtk_tree_model_iter_next (tm,
77 &iter)));
78 }
79 if (found == GNUNET_NO)
80 gtk_list_store_append (ls, &iter);
81 gtk_list_store_set (ls,
82 &iter,
83 0, npid,
84 1, 0 /* number of known addresses */,
85 2, "" /* country name */,
86 3, NULL /* country flag */,
87 -1);
88}
89
90/* end of peerinfo.c */