comparison libpurple/proxy.c @ 25918:bc8d1607f9b8

propagate from branch 'im.pidgin.pidgin' (head 566d2e86bfd45c806aba1b32d6f85a9a409ff9ea) to branch 'im.pidgin.pidgin.next.minor' (head ffd76856f93610f7cd6178e943d0b61e4220b549)
author Richard Laager <rlaager@wiktel.com>
date Mon, 26 Jan 2009 02:39:55 +0000
parents be3ba7e07de5
children 584063555949
comparison
equal deleted inserted replaced
25372:a8db457c421a 25918:bc8d1607f9b8
205 purple_global_proxy_get_info(void) 205 purple_global_proxy_get_info(void)
206 { 206 {
207 return global_proxy_info; 207 return global_proxy_info;
208 } 208 }
209 209
210 void
211 purple_global_proxy_set_info(PurpleProxyInfo *info)
212 {
213 g_return_if_fail(info != NULL);
214
215 purple_proxy_info_destroy(global_proxy_info);
216
217 global_proxy_info = info;
218 }
219
210 static PurpleProxyInfo * 220 static PurpleProxyInfo *
211 purple_gnome_proxy_get_info(void) 221 purple_gnome_proxy_get_info(void)
212 { 222 {
213 static PurpleProxyInfo info = {0, NULL, 0, NULL, NULL}; 223 static PurpleProxyInfo info = {0, NULL, 0, NULL, NULL};
214 gboolean use_same_proxy = FALSE; 224 gboolean use_same_proxy = FALSE;
226 &tmp, &err, NULL, NULL)) 236 &tmp, &err, NULL, NULL))
227 return purple_global_proxy_get_info(); 237 return purple_global_proxy_get_info();
228 g_free(err); 238 g_free(err);
229 err = NULL; 239 err = NULL;
230 240
231 if (!strcmp(tmp, "none\n")) { 241 if (purple_strequal(tmp, "none\n")) {
232 info.type = PURPLE_PROXY_NONE; 242 info.type = PURPLE_PROXY_NONE;
233 g_free(tmp); 243 g_free(tmp);
234 return &info; 244 return &info;
235 } 245 }
236 246
237 if (strcmp(tmp, "manual\n")) { 247 if (purple_strequal(tmp, "manual\n")) {
238 /* Unknown setting. Fallback to using our global proxy settings. */ 248 /* Unknown setting. Fallback to using our global proxy settings. */
239 g_free(tmp); 249 g_free(tmp);
240 return purple_global_proxy_get_info(); 250 return purple_global_proxy_get_info();
241 } 251 }
242 252
261 &tmp, &err, NULL, NULL)) 271 &tmp, &err, NULL, NULL))
262 return purple_global_proxy_get_info(); 272 return purple_global_proxy_get_info();
263 g_free(err); 273 g_free(err);
264 err = NULL; 274 err = NULL;
265 275
266 if (!strcmp(tmp, "true\n")) 276 if (purple_strequal(tmp, "true\n"))
267 use_same_proxy = TRUE; 277 use_same_proxy = TRUE;
268 g_free(tmp); 278 g_free(tmp);
269 tmp = NULL; 279 tmp = NULL;
270 280
271 if (!use_same_proxy) { 281 if (!use_same_proxy) {
2240 proxy_pref_cb(const char *name, PurplePrefType type, 2250 proxy_pref_cb(const char *name, PurplePrefType type,
2241 gconstpointer value, gpointer data) 2251 gconstpointer value, gpointer data)
2242 { 2252 {
2243 PurpleProxyInfo *info = purple_global_proxy_get_info(); 2253 PurpleProxyInfo *info = purple_global_proxy_get_info();
2244 2254
2245 if (!strcmp(name, "/purple/proxy/type")) { 2255 if (purple_strequal(name, "/purple/proxy/type")) {
2246 int proxytype; 2256 int proxytype;
2247 const char *type = value; 2257 const char *type = value;
2248 2258
2249 if (!strcmp(type, "none")) 2259 if (purple_strequal(type, "none"))
2250 proxytype = PURPLE_PROXY_NONE; 2260 proxytype = PURPLE_PROXY_NONE;
2251 else if (!strcmp(type, "http")) 2261 else if (purple_strequal(type, "http"))
2252 proxytype = PURPLE_PROXY_HTTP; 2262 proxytype = PURPLE_PROXY_HTTP;
2253 else if (!strcmp(type, "socks4")) 2263 else if (purple_strequal(type, "socks4"))
2254 proxytype = PURPLE_PROXY_SOCKS4; 2264 proxytype = PURPLE_PROXY_SOCKS4;
2255 else if (!strcmp(type, "socks5")) 2265 else if (purple_strequal(type, "socks5"))
2256 proxytype = PURPLE_PROXY_SOCKS5; 2266 proxytype = PURPLE_PROXY_SOCKS5;
2257 else if (!strcmp(type, "envvar")) 2267 else if (purple_strequal(type, "envvar"))
2258 proxytype = PURPLE_PROXY_USE_ENVVAR; 2268 proxytype = PURPLE_PROXY_USE_ENVVAR;
2259 else 2269 else
2260 proxytype = -1; 2270 proxytype = -1;
2261 2271
2262 purple_proxy_info_set_type(info, proxytype); 2272 purple_proxy_info_set_type(info, proxytype);
2263 } else if (!strcmp(name, "/purple/proxy/host")) 2273 } else if (purple_strequal(name, "/purple/proxy/host"))
2264 purple_proxy_info_set_host(info, value); 2274 purple_proxy_info_set_host(info, value);
2265 else if (!strcmp(name, "/purple/proxy/port")) 2275 else if (purple_strequal(name, "/purple/proxy/port"))
2266 purple_proxy_info_set_port(info, GPOINTER_TO_INT(value)); 2276 purple_proxy_info_set_port(info, GPOINTER_TO_INT(value));
2267 else if (!strcmp(name, "/purple/proxy/username")) 2277 else if (purple_strequal(name, "/purple/proxy/username"))
2268 purple_proxy_info_set_username(info, value); 2278 purple_proxy_info_set_username(info, value);
2269 else if (!strcmp(name, "/purple/proxy/password")) 2279 else if (purple_strequal(name, "/purple/proxy/password"))
2270 purple_proxy_info_set_password(info, value); 2280 purple_proxy_info_set_password(info, value);
2271 } 2281 }
2272 2282
2273 void * 2283 void *
2274 purple_proxy_get_handle() 2284 purple_proxy_get_handle()