| 214 pending_update->gc = gc; |
214 pending_update->gc = gc; |
| 215 |
215 |
| 216 url = g_strdup_printf(GGP_AVATAR_BUDDY_URL, pending_update->uin); |
216 url = g_strdup_printf(GGP_AVATAR_BUDDY_URL, pending_update->uin); |
| 217 req = soup_message_new("GET", url); |
217 req = soup_message_new("GET", url); |
| 218 g_free(url); |
218 g_free(url); |
| 219 soup_message_headers_replace(req->request_headers, "User-Agent", |
219 soup_message_headers_replace(soup_message_get_request_headers(req), |
| 220 GGP_AVATAR_USERAGENT); |
220 "User-Agent", GGP_AVATAR_USERAGENT); |
| 221 // purple_http_request_set_max_len(req, GGP_AVATAR_SIZE_MAX); |
221 // purple_http_request_set_max_len(req, GGP_AVATAR_SIZE_MAX); |
| 222 soup_session_queue_message( |
222 soup_session_queue_message( |
| 223 info->http, req, ggp_avatar_buddy_update_received, pending_update); |
223 info->http, req, ggp_avatar_buddy_update_received, pending_update); |
| 224 } |
224 } |
| 225 |
225 |
| 257 gpointer _img) |
257 gpointer _img) |
| 258 { |
258 { |
| 259 GGPInfo *info = purple_connection_get_protocol_data(gc); |
259 GGPInfo *info = purple_connection_get_protocol_data(gc); |
| 260 ggp_avatar_session_data *avdata = ggp_avatar_get_avdata(gc); |
260 ggp_avatar_session_data *avdata = ggp_avatar_get_avdata(gc); |
| 261 SoupMessage *req; |
261 SoupMessage *req; |
| |
262 SoupMessageHeaders *headers; |
| 262 PurpleImage *img = _img; |
263 PurpleImage *img = _img; |
| 263 gchar *img_data, *uin_str; |
264 gchar *img_data, *uin_str; |
| 264 PurpleAccount *account = purple_connection_get_account(gc); |
265 PurpleAccount *account = purple_connection_get_account(gc); |
| 265 uin_t uin = ggp_str_to_uin(purple_account_get_username(account)); |
266 uin_t uin = ggp_str_to_uin(purple_account_get_username(account)); |
| 266 |
267 |
| 279 "uploading new avatar...\n"); |
280 "uploading new avatar...\n"); |
| 280 |
281 |
| 281 req = soup_form_request_new("POST", "http://avatars.nowe.gg/upload", "uin", |
282 req = soup_form_request_new("POST", "http://avatars.nowe.gg/upload", "uin", |
| 282 uin_str, "photo", img_data, NULL); |
283 uin_str, "photo", img_data, NULL); |
| 283 // purple_http_request_set_max_len(req, GGP_AVATAR_RESPONSE_MAX); |
284 // purple_http_request_set_max_len(req, GGP_AVATAR_RESPONSE_MAX); |
| 284 soup_message_headers_replace(req->request_headers, "Authorization", token); |
285 headers = soup_message_get_request_headers(req); |
| 285 soup_message_headers_replace(req->request_headers, "From", |
286 soup_message_headers_replace(headers, "Authorization", token); |
| 286 "avatars to avatars"); |
287 soup_message_headers_replace(headers, "From", "avatars to avatars"); |
| 287 soup_session_queue_message(info->http, req, ggp_avatar_own_sent, gc); |
288 soup_session_queue_message(info->http, req, ggp_avatar_own_sent, gc); |
| 288 g_free(img_data); |
289 g_free(img_data); |
| 289 g_free(uin_str); |
290 g_free(uin_str); |
| 290 } |
291 } |
| 291 |
292 |