Mercurial > pidgin
comparison libpurple/proxy.c @ 25894:a6e3cb32cdd2
Patch from Paul Aurich to add purple_strequal to help readability and simplicity of code. Ie, don't need to negate the value of strcmp, since this does a strcmp and does the negation for us
closes #7790
committer: Gary Kramlich <grim@reaperworld.com>
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Tue, 06 Jan 2009 03:39:51 +0000 |
parents | 95ef7beb926b |
children | be3ba7e07de5 |
comparison
equal
deleted
inserted
replaced
25893:991796129108 | 25894:a6e3cb32cdd2 |
---|---|
226 &tmp, &err, NULL, NULL)) | 226 &tmp, &err, NULL, NULL)) |
227 return purple_global_proxy_get_info(); | 227 return purple_global_proxy_get_info(); |
228 g_free(err); | 228 g_free(err); |
229 err = NULL; | 229 err = NULL; |
230 | 230 |
231 if (!strcmp(tmp, "none\n")) { | 231 if (purple_strequal(tmp, "none\n")) { |
232 info.type = PURPLE_PROXY_NONE; | 232 info.type = PURPLE_PROXY_NONE; |
233 g_free(tmp); | 233 g_free(tmp); |
234 return &info; | 234 return &info; |
235 } | 235 } |
236 | 236 |
237 if (strcmp(tmp, "manual\n")) { | 237 if (purple_strequal(tmp, "manual\n")) { |
238 /* Unknown setting. Fallback to using our global proxy settings. */ | 238 /* Unknown setting. Fallback to using our global proxy settings. */ |
239 g_free(tmp); | 239 g_free(tmp); |
240 return purple_global_proxy_get_info(); | 240 return purple_global_proxy_get_info(); |
241 } | 241 } |
242 | 242 |
261 &tmp, &err, NULL, NULL)) | 261 &tmp, &err, NULL, NULL)) |
262 return purple_global_proxy_get_info(); | 262 return purple_global_proxy_get_info(); |
263 g_free(err); | 263 g_free(err); |
264 err = NULL; | 264 err = NULL; |
265 | 265 |
266 if (!strcmp(tmp, "true\n")) | 266 if (purple_strequal(tmp, "true\n")) |
267 use_same_proxy = TRUE; | 267 use_same_proxy = TRUE; |
268 g_free(tmp); | 268 g_free(tmp); |
269 tmp = NULL; | 269 tmp = NULL; |
270 | 270 |
271 if (!use_same_proxy) { | 271 if (!use_same_proxy) { |
2240 proxy_pref_cb(const char *name, PurplePrefType type, | 2240 proxy_pref_cb(const char *name, PurplePrefType type, |
2241 gconstpointer value, gpointer data) | 2241 gconstpointer value, gpointer data) |
2242 { | 2242 { |
2243 PurpleProxyInfo *info = purple_global_proxy_get_info(); | 2243 PurpleProxyInfo *info = purple_global_proxy_get_info(); |
2244 | 2244 |
2245 if (!strcmp(name, "/purple/proxy/type")) { | 2245 if (purple_strequal(name, "/purple/proxy/type")) { |
2246 int proxytype; | 2246 int proxytype; |
2247 const char *type = value; | 2247 const char *type = value; |
2248 | 2248 |
2249 if (!strcmp(type, "none")) | 2249 if (purple_strequal(type, "none")) |
2250 proxytype = PURPLE_PROXY_NONE; | 2250 proxytype = PURPLE_PROXY_NONE; |
2251 else if (!strcmp(type, "http")) | 2251 else if (purple_strequal(type, "http")) |
2252 proxytype = PURPLE_PROXY_HTTP; | 2252 proxytype = PURPLE_PROXY_HTTP; |
2253 else if (!strcmp(type, "socks4")) | 2253 else if (purple_strequal(type, "socks4")) |
2254 proxytype = PURPLE_PROXY_SOCKS4; | 2254 proxytype = PURPLE_PROXY_SOCKS4; |
2255 else if (!strcmp(type, "socks5")) | 2255 else if (purple_strequal(type, "socks5")) |
2256 proxytype = PURPLE_PROXY_SOCKS5; | 2256 proxytype = PURPLE_PROXY_SOCKS5; |
2257 else if (!strcmp(type, "envvar")) | 2257 else if (purple_strequal(type, "envvar")) |
2258 proxytype = PURPLE_PROXY_USE_ENVVAR; | 2258 proxytype = PURPLE_PROXY_USE_ENVVAR; |
2259 else | 2259 else |
2260 proxytype = -1; | 2260 proxytype = -1; |
2261 | 2261 |
2262 purple_proxy_info_set_type(info, proxytype); | 2262 purple_proxy_info_set_type(info, proxytype); |
2263 } else if (!strcmp(name, "/purple/proxy/host")) | 2263 } else if (purple_strequal(name, "/purple/proxy/host")) |
2264 purple_proxy_info_set_host(info, value); | 2264 purple_proxy_info_set_host(info, value); |
2265 else if (!strcmp(name, "/purple/proxy/port")) | 2265 else if (purple_strequal(name, "/purple/proxy/port")) |
2266 purple_proxy_info_set_port(info, GPOINTER_TO_INT(value)); | 2266 purple_proxy_info_set_port(info, GPOINTER_TO_INT(value)); |
2267 else if (!strcmp(name, "/purple/proxy/username")) | 2267 else if (purple_strequal(name, "/purple/proxy/username")) |
2268 purple_proxy_info_set_username(info, value); | 2268 purple_proxy_info_set_username(info, value); |
2269 else if (!strcmp(name, "/purple/proxy/password")) | 2269 else if (purple_strequal(name, "/purple/proxy/password")) |
2270 purple_proxy_info_set_password(info, value); | 2270 purple_proxy_info_set_password(info, value); |
2271 } | 2271 } |
2272 | 2272 |
2273 void * | 2273 void * |
2274 purple_proxy_get_handle() | 2274 purple_proxy_get_handle() |