comparison src/proxy.c @ 12156:c5f12ada46d1

[gaim-migrate @ 14457] Unleaky the gnome proxy things committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Sat, 19 Nov 2005 13:56:22 +0000
parents f672349cfc1c
children b7a51e68d0b8
comparison
equal deleted inserted replaced
12155:6b6da0ca09a2 12156:c5f12ada46d1
188 { 188 {
189 static GaimProxyInfo info = {0, NULL, 0, NULL, NULL}; 189 static GaimProxyInfo info = {0, NULL, 0, NULL, NULL};
190 gchar *path; 190 gchar *path;
191 if ((path = g_find_program_in_path("gconftool-2"))) { 191 if ((path = g_find_program_in_path("gconftool-2"))) {
192 gchar *tmp; 192 gchar *tmp;
193 193
194 g_free(path);
195
194 /* See whether to use a proxy. */ 196 /* See whether to use a proxy. */
195 if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/use_http_proxy", &tmp, 197 if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/use_http_proxy", &tmp,
196 NULL, NULL, NULL)) 198 NULL, NULL, NULL))
197 return gaim_global_proxy_get_info(); 199 return gaim_global_proxy_get_info();
198 if (strcmp(tmp, "true\n")) { 200 if (strcmp(tmp, "true\n")) {
199 info.type = GAIM_PROXY_NONE; 201 info.type = GAIM_PROXY_NONE;
200 g_free(tmp); 202 g_free(tmp);
201 return gaim_global_proxy_get_info(); 203 return gaim_global_proxy_get_info();
202 } 204 }
203 205
204 g_free(tmp); 206 g_free(tmp);
205 info.type = GAIM_PROXY_HTTP; 207 info.type = GAIM_PROXY_HTTP;
206 208
207 /* Free the old fields */ 209 /* Free the old fields */
208 if (info.host) { 210 if (info.host) {
209 g_free(info.host); 211 g_free(info.host);
210 info.host = NULL; 212 info.host = NULL;
211 } 213 }
215 } 217 }
216 if (info.password) { 218 if (info.password) {
217 g_free(info.password); 219 g_free(info.password);
218 info.password = NULL; 220 info.password = NULL;
219 } 221 }
220 222
221 /* Get the new ones */ 223 /* Get the new ones */
222 if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/host", &info.host, 224 if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/host", &info.host,
223 NULL, NULL, NULL)) 225 NULL, NULL, NULL))
224 return gaim_global_proxy_get_info(); 226 return gaim_global_proxy_get_info();
225 g_strchomp(info.host); 227 g_strchomp(info.host);
226 228
227 if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/authentication_user", &info.username, 229 if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/authentication_user", &info.username,
228 NULL, NULL, NULL)) 230 NULL, NULL, NULL))
229 return gaim_global_proxy_get_info(); 231 return gaim_global_proxy_get_info();
230 g_strchomp(info.username); 232 g_strchomp(info.username);
231 233
236 238
237 if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/port", &tmp, 239 if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/port", &tmp,
238 NULL, NULL, NULL)) 240 NULL, NULL, NULL))
239 return gaim_global_proxy_get_info(); 241 return gaim_global_proxy_get_info();
240 info.port = atoi(tmp); 242 info.port = atoi(tmp);
241 243 g_free(tmp);
242 g_free(path); 244
243 return &info; 245 return &info;
244 } 246 }
245 return gaim_global_proxy_get_info(); 247 return gaim_global_proxy_get_info();
246 } 248 }
247 /************************************************************************** 249 /**************************************************************************