| 137 void |
137 void |
| 138 yahoo_fetch_aliases(PurpleConnection *gc) |
138 yahoo_fetch_aliases(PurpleConnection *gc) |
| 139 { |
139 { |
| 140 struct yahoo_data *yd = gc->proto_data; |
140 struct yahoo_data *yd = gc->proto_data; |
| 141 struct callback_data *cb; |
141 struct callback_data *cb; |
| 142 char *url, *request, *webpage, *webaddress, *strtmp; |
142 const char *url = YAHOO_ALIAS_FETCH_URL; |
| 143 int inttmp; |
143 char *request, *webpage, *webaddress; |
| 144 PurpleUtilFetchUrlData *url_data; |
144 PurpleUtilFetchUrlData *url_data; |
| 145 |
145 |
| 146 /* Using callback_data so I have access to gc in the callback function */ |
146 /* Using callback_data so I have access to gc in the callback function */ |
| 147 cb = g_new0(struct callback_data, 1); |
147 cb = g_new0(struct callback_data, 1); |
| 148 cb->gc = gc; |
148 cb->gc = gc; |
| 149 |
149 |
| 150 /* Build all the info to make the web request */ |
150 /* Build all the info to make the web request */ |
| 151 url = g_strdup(YAHOO_ALIAS_FETCH_URL); |
151 purple_url_parse(url, &webaddress, NULL, &webpage, NULL, NULL); |
| 152 purple_url_parse(url, &webaddress, &inttmp, &webpage, &strtmp, &strtmp); |
|
| 153 request = g_strdup_printf("GET /%s HTTP/1.1\r\n" |
152 request = g_strdup_printf("GET /%s HTTP/1.1\r\n" |
| 154 "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\n" |
153 "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\n" |
| 155 "Cookie: T=%s; Y=%s\r\n" |
154 "Cookie: T=%s; Y=%s\r\n" |
| 156 "Host: %s\r\n" |
155 "Host: %s\r\n" |
| 157 "Cache-Control: no-cache\r\n\r\n", |
156 "Cache-Control: no-cache\r\n\r\n", |
| 161 url_data = purple_util_fetch_url_request(url, FALSE, NULL, TRUE, request, FALSE, yahoo_fetch_aliases_cb, cb); |
160 url_data = purple_util_fetch_url_request(url, FALSE, NULL, TRUE, request, FALSE, yahoo_fetch_aliases_cb, cb); |
| 162 if (url_data != NULL) { |
161 if (url_data != NULL) { |
| 163 yd->url_datas = g_slist_prepend(yd->url_datas, url_data); |
162 yd->url_datas = g_slist_prepend(yd->url_datas, url_data); |
| 164 } |
163 } |
| 165 |
164 |
| 166 g_free(url); |
165 g_free(webaddress); |
| |
166 g_free(webpage); |
| 167 g_free(request); |
167 g_free(request); |
| 168 } |
168 } |
| 169 |
169 |
| 170 /************************************************************************** |
170 /************************************************************************** |
| 171 * Alias Update Functions |
171 * Alias Update Functions |