Mercurial > audlegacy-plugins
comparison src/scrobbler/plugin.c @ 2904:ff9b4776b938
now scrobbler uses proxy settings;
whole scrobbler plugin needs to be re-written using neon
author | Andrew O. Shadoura <bugzilla@tut.by> |
---|---|
date | Wed, 13 Aug 2008 16:15:29 +0300 |
parents | bd3a24b39058 |
children | 3868d67e7d19 |
comparison
equal
deleted
inserted
replaced
2903:9c623f4ac901 | 2904:ff9b4776b938 |
---|---|
16 #include <stdlib.h> | 16 #include <stdlib.h> |
17 #include <string.h> | 17 #include <string.h> |
18 #include <ctype.h> | 18 #include <ctype.h> |
19 #include <wchar.h> | 19 #include <wchar.h> |
20 #include <sys/time.h> | 20 #include <sys/time.h> |
21 | |
22 #include <curl/curl.h> | |
21 | 23 |
22 #include "plugin.h" | 24 #include "plugin.h" |
23 #include "scrobbler.h" | 25 #include "scrobbler.h" |
24 #include "gerpok.h" | 26 #include "gerpok.h" |
25 #include "gtkstuff.h" | 27 #include "gtkstuff.h" |
336 g_thread_exit(NULL); | 338 g_thread_exit(NULL); |
337 | 339 |
338 return NULL; | 340 return NULL; |
339 } | 341 } |
340 | 342 |
343 void setup_proxy(CURL *curl) | |
344 { | |
345 mcs_handle_t *db; | |
346 gboolean use_proxy; | |
347 | |
348 db = aud_cfg_db_open(); | |
349 aud_cfg_db_get_bool(db, NULL, "use_proxy", &use_proxy); | |
350 if (use_proxy == FALSE) | |
351 { | |
352 curl_easy_setopt(curl, CURLOPT_PROXY, ""); | |
353 } | |
354 else | |
355 { | |
356 gchar *proxy_host, *proxy_port; | |
357 gboolean proxy_use_auth; | |
358 aud_cfg_db_get_string(db, NULL, "proxy_host", &proxy_host); | |
359 aud_cfg_db_get_string(db, NULL, "proxy_port", &proxy_port); | |
360 curl_easy_setopt(curl, CURLOPT_PROXY, proxy_host); | |
361 curl_easy_setopt(curl, CURLOPT_PROXYPORT, proxy_port); | |
362 aud_cfg_db_get_bool(db, NULL, "proxy_use_auth", &proxy_use_auth); | |
363 if (proxy_use_auth != FALSE) | |
364 { | |
365 gchar *userpwd, *user, *pass; | |
366 aud_cfg_db_get_string(db, NULL, "proxy_user", &user); | |
367 aud_cfg_db_get_string(db, NULL, "proxy_pass", &pass); | |
368 userpwd = g_strdup_printf("%s:%s", user, pass); | |
369 curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, userpwd); | |
370 g_free(userpwd); | |
371 } | |
372 } | |
373 aud_cfg_db_close(db); | |
374 } | |
375 | |
341 GeneralPlugin *scrobbler_gplist[] = { &scrobbler_gp, NULL }; | 376 GeneralPlugin *scrobbler_gplist[] = { &scrobbler_gp, NULL }; |
342 | 377 |
343 DECLARE_PLUGIN(scrobbler, NULL, NULL, NULL, NULL, NULL, scrobbler_gplist, NULL, NULL); | 378 DECLARE_PLUGIN(scrobbler, NULL, NULL, NULL, NULL, NULL, scrobbler_gplist, NULL, NULL); |