| 325 static void command_image(struct RXMsgData* mx, GHashTable* hash, GString* msg) |
325 static void command_image(struct RXMsgData* mx, GHashTable* hash, GString* msg) |
| 326 { |
326 { |
| 327 const char* img; |
327 const char* img; |
| 328 const char* reply; |
328 const char* reply; |
| 329 guchar* rawimg; |
329 guchar* rawimg; |
| 330 char link[256]; |
|
| 331 gsize rawimglen; |
330 gsize rawimglen; |
| 332 int imgid; |
331 int imgid; |
| 333 |
332 |
| 334 img = g_hash_table_lookup(hash, "dat"); |
333 img = g_hash_table_lookup(hash, "dat"); |
| 335 if (img) { |
334 if (img) { |
| 336 rawimg = purple_base64_decode(img, &rawimglen); |
335 rawimg = purple_base64_decode(img, &rawimglen); |
| 337 //purple_util_write_data_to_file_absolute("/tmp/mxitinline.png", (char*) rawimg, rawimglen); |
336 //purple_util_write_data_to_file_absolute("/tmp/mxitinline.png", (char*) rawimg, rawimglen); |
| 338 imgid = purple_imgstore_add_with_id(rawimg, rawimglen, NULL); |
337 imgid = purple_imgstore_add_with_id(rawimg, rawimglen, NULL); |
| 339 g_snprintf(link, sizeof(link), "<img id=\"%i\">", imgid); |
338 g_string_append_printf(msg, |
| 340 g_string_append_printf(msg, "%s", link); |
339 "<img src=\"" PURPLE_STORED_IMAGE_PROTOCOL "%i\">", |
| |
340 imgid); |
| 341 mx->flags |= PURPLE_MESSAGE_IMAGES; |
341 mx->flags |= PURPLE_MESSAGE_IMAGES; |
| 342 } |
342 } |
| 343 else { |
343 else { |
| 344 img = g_hash_table_lookup(hash, "src"); |
344 img = g_hash_table_lookup(hash, "src"); |
| 345 if (img) { |
345 if (img) { |