| 22 #include "internal.h" |
22 #include "internal.h" |
| 23 #include "glibcompat.h" |
23 #include "glibcompat.h" |
| 24 |
24 |
| 25 #include "dbus-maybe.h" |
25 #include "dbus-maybe.h" |
| 26 #include "enums.h" |
26 #include "enums.h" |
| |
27 #include "image-store.h" |
| 27 #include "xfer.h" |
28 #include "xfer.h" |
| 28 #include "network.h" |
29 #include "network.h" |
| 29 #include "notify.h" |
30 #include "notify.h" |
| 30 #include "prefs.h" |
31 #include "prefs.h" |
| 31 #include "proxy.h" |
32 #include "proxy.h" |
| 32 #include "request.h" |
33 #include "request.h" |
| 33 #include "util.h" |
34 #include "util.h" |
| 34 #include "debug.h" |
35 #include "debug.h" |
| 35 #include "imgstore.h" /* TODO: temp */ |
|
| 36 |
36 |
| 37 #define FT_INITIAL_BUFFER_SIZE 4096 |
37 #define FT_INITIAL_BUFFER_SIZE 4096 |
| 38 #define FT_MAX_BUFFER_SIZE 65535 |
38 #define FT_MAX_BUFFER_SIZE 65535 |
| 39 |
39 |
| 40 #define PURPLE_XFER_GET_PRIVATE(obj) \ |
40 #define PURPLE_XFER_GET_PRIVATE(obj) \ |
| 257 flags |= PURPLE_MESSAGE_ERROR; |
257 flags |= PURPLE_MESSAGE_ERROR; |
| 258 |
258 |
| 259 if (print_thumbnail && thumbnail_data) { |
259 if (print_thumbnail && thumbnail_data) { |
| 260 gchar *message_with_img; |
260 gchar *message_with_img; |
| 261 gpointer data = g_memdup(thumbnail_data, size); |
261 gpointer data = g_memdup(thumbnail_data, size); |
| 262 int id = purple_imgstore_new_with_id(data, size, NULL); |
262 PurpleImage *img; |
| 263 |
263 guint id; |
| 264 message_with_img = |
264 |
| 265 g_strdup_printf("<img src='" PURPLE_STORED_IMAGE_PROTOCOL "%d'> %s", |
265 img = purple_image_new_from_data(data, size); |
| 266 id, escaped); |
266 id = purple_image_store_add(img); |
| |
267 g_object_unref(img); |
| |
268 |
| |
269 message_with_img = g_strdup_printf("<img src=\"" |
| |
270 PURPLE_IMAGE_STORE_PROTOCOL "%u\"> %s", id, escaped); |
| 267 purple_conversation_write(PURPLE_CONVERSATION(im), NULL, |
271 purple_conversation_write(PURPLE_CONVERSATION(im), NULL, |
| 268 message_with_img, flags, time(NULL)); |
272 message_with_img, flags, time(NULL)); |
| 269 purple_imgstore_unref_by_id(id); |
|
| 270 g_free(message_with_img); |
273 g_free(message_with_img); |
| 271 } else { |
274 } else { |
| 272 purple_conversation_write(PURPLE_CONVERSATION(im), NULL, escaped, flags, |
275 purple_conversation_write(PURPLE_CONVERSATION(im), NULL, escaped, flags, |
| 273 time(NULL)); |
276 time(NULL)); |
| 274 } |
277 } |