Fri, 11 Apr 2014 01:01:09 +0200
GG: reference images, not their ids
|
33348
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
1 | /* purple |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
2 | * |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
3 | * Purple is the legal property of its developers, whose names are too numerous |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
5 | * source distribution. |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
6 | * |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
7 | * Rewritten from scratch during Google Summer of Code 2012 |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
8 | * by Tomek Wasilczyk (http://www.wasilczyk.pl). |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
9 | * |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
10 | * Previously implemented by: |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
11 | * - Arkadiusz Miskiewicz <misiek@pld.org.pl> - first implementation (2001); |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
12 | * - Bartosz Oler <bartosz@bzimage.us> - reimplemented during GSoC 2005; |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
13 | * - Krzysztof Klinikowski <grommasher@gmail.com> - some parts (2009-2011). |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
14 | * |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
15 | * This program is free software; you can redistribute it and/or modify |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
16 | * it under the terms of the GNU General Public License as published by |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
17 | * the Free Software Foundation; either version 2 of the License, or |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
18 | * (at your option) any later version. |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
19 | * |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
20 | * This program is distributed in the hope that it will be useful, |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
23 | * GNU General Public License for more details. |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
24 | * |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
25 | * You should have received a copy of the GNU General Public License |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
26 | * along with this program; if not, write to the Free Software |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
27 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
28 | */ |
|
2394cd23ce8f
Gadu-Gadu: add GSoC copyright note
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33313
diff
changeset
|
29 | |
|
33298
519acf37d16e
Gadu-Gadu: fix receiving of inline images after 3.x changes; code refactoring here as well
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
30 | #ifndef _GGP_IMAGE_H |
|
519acf37d16e
Gadu-Gadu: fix receiving of inline images after 3.x changes; code refactoring here as well
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
31 | #define _GGP_IMAGE_H |
|
519acf37d16e
Gadu-Gadu: fix receiving of inline images after 3.x changes; code refactoring here as well
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
32 | |
|
519acf37d16e
Gadu-Gadu: fix receiving of inline images after 3.x changes; code refactoring here as well
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
33 | #include <internal.h> |
|
519acf37d16e
Gadu-Gadu: fix receiving of inline images after 3.x changes; code refactoring here as well
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
34 | #include <libgadu.h> |
|
519acf37d16e
Gadu-Gadu: fix receiving of inline images after 3.x changes; code refactoring here as well
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
35 | |
|
33301
3f18ba8aed0f
Gadu-Gadu sending images refactoring; notify about too large images
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
36 | #define GGP_IMAGE_SIZE_MAX 255000 |
|
34418
c27e31267e8d
Gadu-Gadu: fix compilation on 64-bit targets
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34365
diff
changeset
|
37 | #define GGP_IMAGE_ID_FORMAT "%016" G_GINT64_MODIFIER "x" |
|
33301
3f18ba8aed0f
Gadu-Gadu sending images refactoring; notify about too large images
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
38 | |
|
34362
758e72362ca4
Gadu-Gadu: code polishing
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34361
diff
changeset
|
39 | typedef struct _ggp_image_session_data ggp_image_session_data; |
|
33298
519acf37d16e
Gadu-Gadu: fix receiving of inline images after 3.x changes; code refactoring here as well
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
40 | |
|
33301
3f18ba8aed0f
Gadu-Gadu sending images refactoring; notify about too large images
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
41 | typedef enum |
|
3f18ba8aed0f
Gadu-Gadu sending images refactoring; notify about too large images
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
42 | { |
|
3f18ba8aed0f
Gadu-Gadu sending images refactoring; notify about too large images
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
43 | GGP_IMAGE_PREPARE_OK = 0, |
|
3f18ba8aed0f
Gadu-Gadu sending images refactoring; notify about too large images
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
44 | GGP_IMAGE_PREPARE_FAILURE, |
|
3f18ba8aed0f
Gadu-Gadu sending images refactoring; notify about too large images
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
45 | GGP_IMAGE_PREPARE_TOO_BIG |
|
3f18ba8aed0f
Gadu-Gadu sending images refactoring; notify about too large images
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
46 | } ggp_image_prepare_result; |
|
3f18ba8aed0f
Gadu-Gadu sending images refactoring; notify about too large images
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
47 | |
|
35820
9b4fccc8ceac
GG: reference images, not their ids
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35819
diff
changeset
|
48 | typedef void |
|
9b4fccc8ceac
GG: reference images, not their ids
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35819
diff
changeset
|
49 | (*ggp_image_request_cb)(PurpleConnection *gc, uint64_t id, PurpleImage *image, |
|
9b4fccc8ceac
GG: reference images, not their ids
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35819
diff
changeset
|
50 | gpointer user_data); |
|
34361
ddcc82637afa
Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33348
diff
changeset
|
51 | |
|
35820
9b4fccc8ceac
GG: reference images, not their ids
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35819
diff
changeset
|
52 | void |
|
9b4fccc8ceac
GG: reference images, not their ids
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35819
diff
changeset
|
53 | ggp_image_setup(PurpleConnection *gc); |
|
9b4fccc8ceac
GG: reference images, not their ids
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35819
diff
changeset
|
54 | |
|
9b4fccc8ceac
GG: reference images, not their ids
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35819
diff
changeset
|
55 | void |
|
9b4fccc8ceac
GG: reference images, not their ids
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35819
diff
changeset
|
56 | ggp_image_cleanup(PurpleConnection *gc); |
|
9b4fccc8ceac
GG: reference images, not their ids
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35819
diff
changeset
|
57 | |
|
9b4fccc8ceac
GG: reference images, not their ids
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35819
diff
changeset
|
58 | ggp_image_prepare_result |
|
9b4fccc8ceac
GG: reference images, not their ids
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35819
diff
changeset
|
59 | ggp_image_prepare(PurpleConversation *conv, PurpleImage *image, uint64_t *id); |
|
33298
519acf37d16e
Gadu-Gadu: fix receiving of inline images after 3.x changes; code refactoring here as well
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
60 | |
|
35820
9b4fccc8ceac
GG: reference images, not their ids
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35819
diff
changeset
|
61 | void |
|
9b4fccc8ceac
GG: reference images, not their ids
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35819
diff
changeset
|
62 | ggp_image_recv(PurpleConnection *gc, |
|
33298
519acf37d16e
Gadu-Gadu: fix receiving of inline images after 3.x changes; code refactoring here as well
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
63 | const struct gg_event_image_reply *image_reply); |
|
35820
9b4fccc8ceac
GG: reference images, not their ids
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35819
diff
changeset
|
64 | |
|
9b4fccc8ceac
GG: reference images, not their ids
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35819
diff
changeset
|
65 | void |
|
9b4fccc8ceac
GG: reference images, not their ids
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35819
diff
changeset
|
66 | ggp_image_send(PurpleConnection *gc, |
|
33301
3f18ba8aed0f
Gadu-Gadu sending images refactoring; notify about too large images
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33298
diff
changeset
|
67 | const struct gg_event_image_request *image_request); |
|
35820
9b4fccc8ceac
GG: reference images, not their ids
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35819
diff
changeset
|
68 | |
|
9b4fccc8ceac
GG: reference images, not their ids
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35819
diff
changeset
|
69 | void |
|
9b4fccc8ceac
GG: reference images, not their ids
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35819
diff
changeset
|
70 | ggp_image_request(PurpleConnection *gc, uin_t uin, uint64_t id, |
|
34361
ddcc82637afa
Gadu-Gadu: incoming images works again
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33348
diff
changeset
|
71 | ggp_image_request_cb cb, gpointer user_data); |
|
35820
9b4fccc8ceac
GG: reference images, not their ids
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35819
diff
changeset
|
72 | |
|
9b4fccc8ceac
GG: reference images, not their ids
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35819
diff
changeset
|
73 | PurpleImage * |
|
9b4fccc8ceac
GG: reference images, not their ids
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35819
diff
changeset
|
74 | ggp_image_get_cached(PurpleConnection *gc, uint64_t id); |
|
33298
519acf37d16e
Gadu-Gadu: fix receiving of inline images after 3.x changes; code refactoring here as well
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
75 | |
|
519acf37d16e
Gadu-Gadu: fix receiving of inline images after 3.x changes; code refactoring here as well
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
diff
changeset
|
76 | #endif /* _GGP_IMAGE_H */ |