| 146 struct callback_data *cb; |
146 struct callback_data *cb; |
| 147 const char *url; |
147 const char *url; |
| 148 char *request, *webpage, *webaddress; |
148 char *request, *webpage, *webaddress; |
| 149 PurpleUtilFetchUrlData *url_data; |
149 PurpleUtilFetchUrlData *url_data; |
| 150 |
150 |
| |
151 gboolean use_whole_url = FALSE; |
| |
152 |
| |
153 /* use whole URL if using HTTP Proxy */ |
| |
154 if ((gc->account->proxy_info) && (gc->account->proxy_info->type == PURPLE_PROXY_HTTP)) |
| |
155 use_whole_url = TRUE; |
| |
156 |
| 151 /* Using callback_data so I have access to gc in the callback function */ |
157 /* Using callback_data so I have access to gc in the callback function */ |
| 152 cb = g_new0(struct callback_data, 1); |
158 cb = g_new0(struct callback_data, 1); |
| 153 cb->gc = gc; |
159 cb->gc = gc; |
| 154 |
160 |
| 155 /* Build all the info to make the web request */ |
161 /* Build all the info to make the web request */ |
| 156 url = yd->jp ? YAHOOJP_ALIAS_FETCH_URL : YAHOO_ALIAS_FETCH_URL; |
162 url = yd->jp ? YAHOOJP_ALIAS_FETCH_URL : YAHOO_ALIAS_FETCH_URL; |
| 157 purple_url_parse(url, &webaddress, NULL, &webpage, NULL, NULL); |
163 purple_url_parse(url, &webaddress, NULL, &webpage, NULL, NULL); |
| 158 request = g_strdup_printf("GET /%s HTTP/1.1\r\n" |
164 request = g_strdup_printf("GET %s%s/%s HTTP/1.1\r\n" |
| 159 "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\n" |
165 "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\n" |
| 160 "Cookie: T=%s; Y=%s\r\n" |
166 "Cookie: T=%s; Y=%s\r\n" |
| 161 "Host: %s\r\n" |
167 "Host: %s\r\n" |
| 162 "Cache-Control: no-cache\r\n\r\n", |
168 "Cache-Control: no-cache\r\n\r\n", |
| 163 webpage, yd->cookie_t,yd->cookie_y, webaddress); |
169 use_whole_url ? "http://" : "", use_whole_url ? webaddress : "", webpage, yd->cookie_t,yd->cookie_y, webaddress); |
| 164 |
170 |
| 165 /* We have a URL and some header information, let's connect and get some aliases */ |
171 /* We have a URL and some header information, let's connect and get some aliases */ |
| 166 url_data = purple_util_fetch_url_request(url, FALSE, NULL, TRUE, request, FALSE, yahoo_fetch_aliases_cb, cb); |
172 url_data = purple_util_fetch_url_request(url, use_whole_url, NULL, TRUE, request, FALSE, yahoo_fetch_aliases_cb, cb); |
| 167 if (url_data != NULL) { |
173 if (url_data != NULL) { |
| 168 yd->url_datas = g_slist_prepend(yd->url_datas, url_data); |
174 yd->url_datas = g_slist_prepend(yd->url_datas, url_data); |
| 169 } |
175 } |
| 170 |
176 |
| 171 g_free(webaddress); |
177 g_free(webaddress); |
| 230 char *escaped_alias, *alias_jp, *converted_alias_jp; |
236 char *escaped_alias, *alias_jp, *converted_alias_jp; |
| 231 int inttmp; |
237 int inttmp; |
| 232 struct callback_data *cb; |
238 struct callback_data *cb; |
| 233 PurpleBuddy *buddy; |
239 PurpleBuddy *buddy; |
| 234 PurpleUtilFetchUrlData *url_data; |
240 PurpleUtilFetchUrlData *url_data; |
| |
241 gboolean use_whole_url = FALSE; |
| |
242 |
| |
243 /* use whole URL if using HTTP Proxy */ |
| |
244 if ((gc->account->proxy_info) && (gc->account->proxy_info->type == PURPLE_PROXY_HTTP)) |
| |
245 use_whole_url = TRUE; |
| 235 |
246 |
| 236 g_return_if_fail(alias != NULL); |
247 g_return_if_fail(alias != NULL); |
| 237 g_return_if_fail(who != NULL); |
248 g_return_if_fail(who != NULL); |
| 238 g_return_if_fail(gc != NULL); |
249 g_return_if_fail(gc != NULL); |
| 239 |
250 |
| 272 "<ct e=\"1\" yi='%s' id='%s' nn='%s' pr='0' />\n</ab>\r\n", |
283 "<ct e=\"1\" yi='%s' id='%s' nn='%s' pr='0' />\n</ab>\r\n", |
| 273 gc->account->username, who, yu->id, escaped_alias); |
284 gc->account->username, who, yu->id, escaped_alias); |
| 274 g_free(escaped_alias); |
285 g_free(escaped_alias); |
| 275 } |
286 } |
| 276 |
287 |
| 277 request = g_strdup_printf("POST /%s HTTP/1.1\r\n" |
288 request = g_strdup_printf("POST %s%s/%s HTTP/1.1\r\n" |
| 278 "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\n" |
289 "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\n" |
| 279 "Cookie: T=%s; Y=%s\r\n" |
290 "Cookie: T=%s; Y=%s\r\n" |
| 280 "Host: %s\r\n" |
291 "Host: %s\r\n" |
| 281 "Content-Length: %" G_GSIZE_FORMAT "\r\n" |
292 "Content-Length: %" G_GSIZE_FORMAT "\r\n" |
| 282 "Cache-Control: no-cache\r\n\r\n" |
293 "Cache-Control: no-cache\r\n\r\n" |
| 283 "%s", |
294 "%s", |
| 284 webpage, yd->cookie_t,yd->cookie_y, webaddress, |
295 use_whole_url ? "http://" : "", use_whole_url ? webaddress : "", webpage, yd->cookie_t,yd->cookie_y, webaddress, |
| 285 strlen(content), content); |
296 strlen(content), content); |
| 286 |
297 |
| 287 /* We have a URL and some header information, let's connect and update the alias */ |
298 /* We have a URL and some header information, let's connect and update the alias */ |
| 288 url_data = purple_util_fetch_url_request(url, FALSE, NULL, TRUE, request, FALSE, yahoo_update_alias_cb, cb); |
299 url_data = purple_util_fetch_url_request(url, use_whole_url, NULL, TRUE, request, FALSE, yahoo_update_alias_cb, cb); |
| 289 if (url_data != NULL) { |
300 if (url_data != NULL) { |
| 290 yd->url_datas = g_slist_prepend(yd->url_datas, url_data); |
301 yd->url_datas = g_slist_prepend(yd->url_datas, url_data); |
| 291 } |
302 } |
| 292 |
303 |
| 293 g_free(content); |
304 g_free(content); |