22 |
|
|
23 |
#define GCVOTE_NONE -1 |
#define GCVOTE_NONE -1 |
24 |
|
|
25 |
int gcvote_get(appdata_t *appdata, char *url); |
#include "gconf.h" |
26 |
|
|
27 |
|
#include <curl/curl.h> |
28 |
|
#include <curl/types.h> |
29 |
|
|
30 |
|
/* the full vote structure used during parsing */ |
31 |
|
typedef struct gcvote_s { |
32 |
|
int quality; |
33 |
|
int votes; |
34 |
|
char *id; |
35 |
|
struct gcvote_s *next; |
36 |
|
} gcvote_t; |
37 |
|
|
38 |
|
/* a simple single vote */ |
39 |
|
typedef struct { |
40 |
|
int quality; |
41 |
|
int votes; |
42 |
|
} vote_t; |
43 |
|
|
44 |
|
typedef struct { |
45 |
|
char *ptr; |
46 |
|
int len; |
47 |
|
} curl_mem_t; |
48 |
|
|
49 |
|
typedef void (*gcvote_cb)(vote_t *, gpointer data); |
50 |
|
|
51 |
|
/* structure shared between worker and master thread */ |
52 |
|
typedef struct { |
53 |
|
gint refcount; /* reference counter for master and worker thread */ |
54 |
|
|
55 |
|
char *url, *id; |
56 |
|
|
57 |
|
/* curl/http related stuff: */ |
58 |
|
CURLcode res; |
59 |
|
long response; |
60 |
|
char buffer[CURL_ERROR_SIZE]; |
61 |
|
|
62 |
|
curl_mem_t mem; /* used for NET_IO_DL_MEM */ |
63 |
|
|
64 |
|
gcvote_cb cb; |
65 |
|
gpointer userdata; |
66 |
|
|
67 |
|
/* system proxy settings if present */ |
68 |
|
proxy_t *proxy; |
69 |
|
|
70 |
|
} gcvote_request_t; |
71 |
|
|
72 |
|
gcvote_request_t *gcvote_request(appdata_t *appdata, gcvote_cb, |
73 |
|
char *url, gpointer); |
74 |
|
void gcvote_request_free(gcvote_request_t *request); |
75 |
|
|
76 |
#endif // GCVOTE_H |
#endif // GCVOTE_H |