diff options
author | Christian Grothoff <christian@grothoff.org> | 2007-06-22 09:39:24 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2007-06-22 09:39:24 +0000 |
commit | 7ede91293d74a433eebb5443133885d13081516b (patch) | |
tree | 332293a41979300cc50bd76a5f6ef538f3dc22ea | |
parent | 67352dbcc4a670a85c96da20601d8416646ae682 (diff) | |
download | gnunet-gtk-7ede91293d74a433eebb5443133885d13081516b.tar.gz gnunet-gtk-7ede91293d74a433eebb5443133885d13081516b.zip |
fix
-rw-r--r-- | src/plugins/peers/peers.c | 73 |
1 files changed, 36 insertions, 37 deletions
diff --git a/src/plugins/peers/peers.c b/src/plugins/peers/peers.c index 2ec92848..79314a1a 100644 --- a/src/plugins/peers/peers.c +++ b/src/plugins/peers/peers.c | |||
@@ -105,48 +105,46 @@ static int collector(void * data, | |||
105 | addr_len, | 105 | addr_len, |
106 | YES); | 106 | YES); |
107 | if (hostname == NULL) | 107 | if (hostname == NULL) |
108 | hostname = "NAT"; | 108 | hostname = STRDUP("NAT"); |
109 | /* get flag */ | 109 | /* get flag */ |
110 | flagBuf = NULL; | 110 | flagBuf = NULL; |
111 | ledBuf = NULL; | 111 | ledBuf = NULL; |
112 | cc = NULL; | 112 | cc = NULL; |
113 | if (hostname != NULL) { | 113 | prefix = STRDUP(hostname); |
114 | prefix = STRDUP(hostname); | 114 | if (strstr(prefix, " ") != NULL) |
115 | if (strstr(prefix, " ") != NULL) | 115 | *strstr(prefix, " ") = '\0'; |
116 | *strstr(prefix, " ") = '\0'; | 116 | cc = prefix; |
117 | cc = prefix; | 117 | while (strstr(cc, ".") != NULL) |
118 | while (strstr(cc, ".") != NULL) | 118 | cc = strstr(cc, ".") + 1; |
119 | cc = strstr(cc, ".") + 1; | 119 | if (strstr(hostname, ".") == NULL) |
120 | if (strstr(hostname, ".") == NULL) | 120 | cc = NULL; |
121 | cc = NULL; | 121 | else if ( (0 == strcmp(cc, "edu")) || |
122 | else if ( (0 == strcmp(cc, "edu")) || | 122 | (0 == strcmp(cc, "com")) || |
123 | (0 == strcmp(cc, "com")) || | 123 | (0 == strcmp(cc, "net")) || |
124 | (0 == strcmp(cc, "net")) || | 124 | (0 == strcmp(cc, "org")) || |
125 | (0 == strcmp(cc, "org")) || | 125 | (0 == strcmp(cc, "gov")) || |
126 | (0 == strcmp(cc, "gov")) || | 126 | (0 == strcmp(cc, "mil")) ) |
127 | (0 == strcmp(cc, "mil")) ) | 127 | cc = "us"; |
128 | cc = "us"; | 128 | if ( (cc != NULL) && |
129 | if ( (cc != NULL) && | 129 | (strlen(cc) > 2) ) |
130 | (strlen(cc) > 2) ) | 130 | cc = NULL; |
131 | cc = NULL; | 131 | if (cc != NULL) { |
132 | if (cc != NULL) { | 132 | cc = STRDUP(cc); |
133 | cc = STRDUP(cc); | 133 | dir = os_get_installation_path(IPK_DATADIR); |
134 | dir = os_get_installation_path(IPK_DATADIR); | 134 | fn = MALLOC(strlen(dir) + 32); |
135 | fn = MALLOC(strlen(dir) + 32); | 135 | strcpy(fn, dir); |
136 | strcpy(fn, dir); | 136 | strcat(fn, |
137 | strcat(fn, | 137 | DIR_SEPARATOR_STR ".." |
138 | DIR_SEPARATOR_STR ".." | 138 | DIR_SEPARATOR_STR "gnunet-gtk" |
139 | DIR_SEPARATOR_STR "gnunet-gtk" | 139 | DIR_SEPARATOR_STR "flags" |
140 | DIR_SEPARATOR_STR "flags" | 140 | DIR_SEPARATOR_STR); |
141 | DIR_SEPARATOR_STR); | 141 | strcat(fn, cc); |
142 | strcat(fn, cc); | 142 | strcat(fn, ".png"); |
143 | strcat(fn, ".png"); | 143 | FREE(dir); |
144 | FREE(dir); | 144 | flagBuf = gdk_pixbuf_new_from_file(fn, NULL); |
145 | flagBuf = gdk_pixbuf_new_from_file(fn, NULL); | 145 | FREE(fn); |
146 | FREE(fn); | ||
147 | } | ||
148 | FREE(prefix); | ||
149 | } | 146 | } |
147 | FREE(prefix); | ||
150 | 148 | ||
151 | /* get LED */ | 149 | /* get LED */ |
152 | now = get_time(); | 150 | now = get_time(); |
@@ -177,6 +175,7 @@ static int collector(void * data, | |||
177 | 7, last_message, | 175 | 7, last_message, |
178 | -1); | 176 | -1); |
179 | FREENONNULL(cc); | 177 | FREENONNULL(cc); |
178 | FREE(hostname); | ||
180 | return OK; | 179 | return OK; |
181 | } | 180 | } |
182 | 181 | ||