libpurple/imgstore.h

Sat, 17 Aug 2013 23:27:20 +0530

author
Ankit Vani <a@nevitus.org>
date
Sat, 17 Aug 2013 23:27:20 +0530
branch
soc.2013.gobjectification.plugins
changeset 36543
a8c3fecee2d3
parent 34797
57724af9660d
child 35047
cf8ca70094ff
permissions
-rw-r--r--

Renamed prpl.[ch] to protocol.[ch]

6982
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
1 /**
33659
f84e542b30ea Merge from 2.x.y again.
Mark Doliner <mark@kingant.net>
parents: 33657 33658
diff changeset
2 * @file imgstore.h Utility functions for reference-counted in-memory
f84e542b30ea Merge from 2.x.y again.
Mark Doliner <mark@kingant.net>
parents: 33657 33658
diff changeset
3 * image data.
6982
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
4 * @ingroup core
20889
3d0ef192f98c All the links to libpurple signal pages were in the comment containing the
Will Thompson <resiak@pidgin.im>
parents: 20147
diff changeset
5 * @see @ref imgstore-signals
20147
66f05a854eee applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents: 19859
diff changeset
6 */
66f05a854eee applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents: 19859
diff changeset
7
66f05a854eee applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents: 19859
diff changeset
8 /* purple
6982
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
9 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
10 * Purple is the legal property of its developers, whose names are too numerous
8046
c581b20a47d6 [gaim-migrate @ 8730]
Sean Egan <seanegan@pidgin.im>
parents: 7118
diff changeset
11 * to list here. Please refer to the COPYRIGHT file distributed with this
c581b20a47d6 [gaim-migrate @ 8730]
Sean Egan <seanegan@pidgin.im>
parents: 7118
diff changeset
12 * source distribution.
6982
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
13 *
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
14 * This program is free software; you can redistribute it and/or modify
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
15 * it under the terms of the GNU General Public License as published by
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
16 * the Free Software Foundation; either version 2 of the License, or
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
17 * (at your option) any later version.
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
18 *
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
19 * This program is distributed in the hope that it will be useful,
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
22 * GNU General Public License for more details.
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
23 *
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
24 * You should have received a copy of the GNU General Public License
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
25 * along with this program; if not, write to the Free Software
19859
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 18412
diff changeset
26 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
6982
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
27 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
28 #ifndef _PURPLE_IMGSTORE_H_
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
29 #define _PURPLE_IMGSTORE_H_
6982
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
30
16538
c7e61e2917c9 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents: 16437
diff changeset
31 #include <glib.h>
c7e61e2917c9 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents: 16437
diff changeset
32
33052
df92c3d93904 From now on, prpls must specify images using SRC instead of ID.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32787
diff changeset
33 #define PURPLE_STORED_IMAGE_PROTOCOL "purple-image:"
df92c3d93904 From now on, prpls must specify images using SRC instead of ID.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32787
diff changeset
34
22613
1077236bf4fb Add docs to PurpleStoredImage so that doxygen links to it show up
Will Thompson <resiak@pidgin.im>
parents: 20889
diff changeset
35 /** A reference-counted immutable wrapper around an image's data and its
1077236bf4fb Add docs to PurpleStoredImage so that doxygen links to it show up
Will Thompson <resiak@pidgin.im>
parents: 20889
diff changeset
36 * filename.
1077236bf4fb Add docs to PurpleStoredImage so that doxygen links to it show up
Will Thompson <resiak@pidgin.im>
parents: 20889
diff changeset
37 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
38 typedef struct _PurpleStoredImage PurpleStoredImage;
6982
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
39
34797
57724af9660d Added temporary GBoxed to PurpleStoredImage
Ankit Vani <a@nevitus.org>
parents: 33661
diff changeset
40 #define PURPLE_TYPE_STORED_IMAGE (purple_imgstore_get_type())
57724af9660d Added temporary GBoxed to PurpleStoredImage
Ankit Vani <a@nevitus.org>
parents: 33661
diff changeset
41
32787
7072f190d6ad Use G_BEGIN/END_DECLS in public libpurple files. This was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32298
diff changeset
42 G_BEGIN_DECLS
6982
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
43
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
44 /**
34797
57724af9660d Added temporary GBoxed to PurpleStoredImage
Ankit Vani <a@nevitus.org>
parents: 33661
diff changeset
45 * Returns the GType for the PurpleStoredImage boxed structure.
57724af9660d Added temporary GBoxed to PurpleStoredImage
Ankit Vani <a@nevitus.org>
parents: 33661
diff changeset
46 * TODO Boxing of PurpleStoredImage is a temporary solution to having a GType
57724af9660d Added temporary GBoxed to PurpleStoredImage
Ankit Vani <a@nevitus.org>
parents: 33661
diff changeset
47 * for stored images. This should rather be a GObject instead of a GBoxed.
57724af9660d Added temporary GBoxed to PurpleStoredImage
Ankit Vani <a@nevitus.org>
parents: 33661
diff changeset
48 */
57724af9660d Added temporary GBoxed to PurpleStoredImage
Ankit Vani <a@nevitus.org>
parents: 33661
diff changeset
49 GType purple_imgstore_get_type(void);
57724af9660d Added temporary GBoxed to PurpleStoredImage
Ankit Vani <a@nevitus.org>
parents: 33661
diff changeset
50
57724af9660d Added temporary GBoxed to PurpleStoredImage
Ankit Vani <a@nevitus.org>
parents: 33661
diff changeset
51 /**
33656
d09413e12a04 Better documentation.
Mark Doliner <mark@kingant.net>
parents: 33655
diff changeset
52 * Create a new PurpleStoredImage.
16437
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
53 *
33661
2ebcb105e606 Rename two functions.
Mark Doliner <mark@kingant.net>
parents: 33660
diff changeset
54 * The image is not added to the image store and no ID is assigned. If you
2ebcb105e606 Rename two functions.
Mark Doliner <mark@kingant.net>
parents: 33660
diff changeset
55 * need to reference the image by an ID, use purple_imgstore_new_with_id()
2ebcb105e606 Rename two functions.
Mark Doliner <mark@kingant.net>
parents: 33660
diff changeset
56 * instead.
16437
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
57 *
33658
bf6e40d37a72 Ever better documentation!
Mark Doliner <mark@kingant.net>
parents: 33656
diff changeset
58 * The caller owns a reference to this image and must dereference it with
bf6e40d37a72 Ever better documentation!
Mark Doliner <mark@kingant.net>
parents: 33656
diff changeset
59 * purple_imgstore_unref() for it to be freed.
16437
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
60 *
33654
cf6979b92221 Spaces instead of tabs in doxygen comments.
Mark Doliner <mark@kingant.net>
parents: 22895
diff changeset
61 * @param data Pointer to the image data, which the imgstore will take
cf6979b92221 Spaces instead of tabs in doxygen comments.
Mark Doliner <mark@kingant.net>
parents: 22895
diff changeset
62 * ownership of and free as appropriate. If you want a
cf6979b92221 Spaces instead of tabs in doxygen comments.
Mark Doliner <mark@kingant.net>
parents: 22895
diff changeset
63 * copy of the data, make it before calling this function.
cf6979b92221 Spaces instead of tabs in doxygen comments.
Mark Doliner <mark@kingant.net>
parents: 22895
diff changeset
64 * @param size Image data's size.
cf6979b92221 Spaces instead of tabs in doxygen comments.
Mark Doliner <mark@kingant.net>
parents: 22895
diff changeset
65 * @param filename Filename associated with image. This is for your
22763
6e4bbebdf127 Better documentation.
Mark Doliner <markdoliner@pidgin.im>
parents: 22613
diff changeset
66 * convenience. It could be the full path to the
6e4bbebdf127 Better documentation.
Mark Doliner <markdoliner@pidgin.im>
parents: 22613
diff changeset
67 * image or, more commonly, the filename of the image
6e4bbebdf127 Better documentation.
Mark Doliner <markdoliner@pidgin.im>
parents: 22613
diff changeset
68 * without any directory information. It can also be
6e4bbebdf127 Better documentation.
Mark Doliner <markdoliner@pidgin.im>
parents: 22613
diff changeset
69 * NULL, if you don't need to keep track of a filename.
33660
632df42123db Implore people to escape filenames.
Mark Doliner <mark@kingant.net>
parents: 33659
diff changeset
70 * If you intend to use this filename to write the file to
632df42123db Implore people to escape filenames.
Mark Doliner <mark@kingant.net>
parents: 33659
diff changeset
71 * disk, make sure the filename is appropriately escaped.
632df42123db Implore people to escape filenames.
Mark Doliner <mark@kingant.net>
parents: 33659
diff changeset
72 * You may wish to use purple_escape_filename().
16437
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
73 *
33661
2ebcb105e606 Rename two functions.
Mark Doliner <mark@kingant.net>
parents: 33660
diff changeset
74 * @return The image, or NULL if the image could not be created (because of
33656
d09413e12a04 Better documentation.
Mark Doliner <mark@kingant.net>
parents: 33655
diff changeset
75 * empty data or size).
16437
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
76 */
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
77 PurpleStoredImage *
33661
2ebcb105e606 Rename two functions.
Mark Doliner <mark@kingant.net>
parents: 33660
diff changeset
78 purple_imgstore_new(gpointer data, size_t size, const char *filename);
16437
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
79
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
80 /**
33661
2ebcb105e606 Rename two functions.
Mark Doliner <mark@kingant.net>
parents: 33660
diff changeset
81 * Create a PurpleStoredImage using purple_imgstore_new() by reading the
33656
d09413e12a04 Better documentation.
Mark Doliner <mark@kingant.net>
parents: 33655
diff changeset
82 * given filename from disk.
d09413e12a04 Better documentation.
Mark Doliner <mark@kingant.net>
parents: 33655
diff changeset
83 *
33658
bf6e40d37a72 Ever better documentation!
Mark Doliner <mark@kingant.net>
parents: 33656
diff changeset
84 * The image is not added to the image store and no ID is assigned. If you
33661
2ebcb105e606 Rename two functions.
Mark Doliner <mark@kingant.net>
parents: 33660
diff changeset
85 * need to reference the image by an ID, use purple_imgstore_new_with_id()
33658
bf6e40d37a72 Ever better documentation!
Mark Doliner <mark@kingant.net>
parents: 33656
diff changeset
86 * instead.
bf6e40d37a72 Ever better documentation!
Mark Doliner <mark@kingant.net>
parents: 33656
diff changeset
87 *
33659
f84e542b30ea Merge from 2.x.y again.
Mark Doliner <mark@kingant.net>
parents: 33657 33658
diff changeset
88 * Make sure the filename is appropriately escaped. You may wish to use
f84e542b30ea Merge from 2.x.y again.
Mark Doliner <mark@kingant.net>
parents: 33657 33658
diff changeset
89 * purple_escape_filename(). The PurpleStoredImage's filename will be set
f84e542b30ea Merge from 2.x.y again.
Mark Doliner <mark@kingant.net>
parents: 33657 33658
diff changeset
90 * to the given path.
f84e542b30ea Merge from 2.x.y again.
Mark Doliner <mark@kingant.net>
parents: 33657 33658
diff changeset
91 *
33658
bf6e40d37a72 Ever better documentation!
Mark Doliner <mark@kingant.net>
parents: 33656
diff changeset
92 * The caller owns a reference to this image and must dereference it with
bf6e40d37a72 Ever better documentation!
Mark Doliner <mark@kingant.net>
parents: 33656
diff changeset
93 * purple_imgstore_unref() for it to be freed.
22652
ba50c2bc1adc Make it simple to create a stored-image from a filename.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20889
diff changeset
94 *
33661
2ebcb105e606 Rename two functions.
Mark Doliner <mark@kingant.net>
parents: 33660
diff changeset
95 * @param path The path to the image.
22652
ba50c2bc1adc Make it simple to create a stored-image from a filename.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20889
diff changeset
96 *
33661
2ebcb105e606 Rename two functions.
Mark Doliner <mark@kingant.net>
parents: 33660
diff changeset
97 * @return The image, or NULL if the image could not be created (because of
33656
d09413e12a04 Better documentation.
Mark Doliner <mark@kingant.net>
parents: 33655
diff changeset
98 * empty data or size).
22652
ba50c2bc1adc Make it simple to create a stored-image from a filename.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20889
diff changeset
99 */
ba50c2bc1adc Make it simple to create a stored-image from a filename.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20889
diff changeset
100 PurpleStoredImage *
ba50c2bc1adc Make it simple to create a stored-image from a filename.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20889
diff changeset
101 purple_imgstore_new_from_file(const char *path);
ba50c2bc1adc Make it simple to create a stored-image from a filename.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20889
diff changeset
102
ba50c2bc1adc Make it simple to create a stored-image from a filename.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20889
diff changeset
103 /**
33661
2ebcb105e606 Rename two functions.
Mark Doliner <mark@kingant.net>
parents: 33660
diff changeset
104 * Create a PurpleStoredImage using purple_imgstore_new() and add the
33656
d09413e12a04 Better documentation.
Mark Doliner <mark@kingant.net>
parents: 33655
diff changeset
105 * image to the image store. A unique ID will be assigned to the image.
16437
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
106 *
33658
bf6e40d37a72 Ever better documentation!
Mark Doliner <mark@kingant.net>
parents: 33656
diff changeset
107 * The caller owns a reference to the image and must dereference it with
bf6e40d37a72 Ever better documentation!
Mark Doliner <mark@kingant.net>
parents: 33656
diff changeset
108 * purple_imgstore_unref() or purple_imgstore_unref_by_id() for it to be
bf6e40d37a72 Ever better documentation!
Mark Doliner <mark@kingant.net>
parents: 33656
diff changeset
109 * freed.
6982
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
110 *
33654
cf6979b92221 Spaces instead of tabs in doxygen comments.
Mark Doliner <mark@kingant.net>
parents: 22895
diff changeset
111 * @param data Pointer to the image data, which the imgstore will take
cf6979b92221 Spaces instead of tabs in doxygen comments.
Mark Doliner <mark@kingant.net>
parents: 22895
diff changeset
112 * ownership of and free as appropriate. If you want a
cf6979b92221 Spaces instead of tabs in doxygen comments.
Mark Doliner <mark@kingant.net>
parents: 22895
diff changeset
113 * copy of the data, make it before calling this function.
cf6979b92221 Spaces instead of tabs in doxygen comments.
Mark Doliner <mark@kingant.net>
parents: 22895
diff changeset
114 * @param size Image data's size.
cf6979b92221 Spaces instead of tabs in doxygen comments.
Mark Doliner <mark@kingant.net>
parents: 22895
diff changeset
115 * @param filename Filename associated with image. This is for your
22763
6e4bbebdf127 Better documentation.
Mark Doliner <markdoliner@pidgin.im>
parents: 22613
diff changeset
116 * convenience. It could be the full path to the
6e4bbebdf127 Better documentation.
Mark Doliner <markdoliner@pidgin.im>
parents: 22613
diff changeset
117 * image or, more commonly, the filename of the image
6e4bbebdf127 Better documentation.
Mark Doliner <markdoliner@pidgin.im>
parents: 22613
diff changeset
118 * without any directory information. It can also be
6e4bbebdf127 Better documentation.
Mark Doliner <markdoliner@pidgin.im>
parents: 22613
diff changeset
119 * NULL, if you don't need to keep track of a filename.
33660
632df42123db Implore people to escape filenames.
Mark Doliner <mark@kingant.net>
parents: 33659
diff changeset
120 * If you intend to use this filename to write the file to
632df42123db Implore people to escape filenames.
Mark Doliner <mark@kingant.net>
parents: 33659
diff changeset
121 * disk, make sure the filename is appropriately escaped.
632df42123db Implore people to escape filenames.
Mark Doliner <mark@kingant.net>
parents: 33659
diff changeset
122 * You may wish to use purple_escape_filename()
632df42123db Implore people to escape filenames.
Mark Doliner <mark@kingant.net>
parents: 33659
diff changeset
123 *
22763
6e4bbebdf127 Better documentation.
Mark Doliner <markdoliner@pidgin.im>
parents: 22613
diff changeset
124 * @return ID for the image. This is a unique number that can be used
33655
732c94e8b7ec Document the error condition.
Mark Doliner <mark@kingant.net>
parents: 33654
diff changeset
125 * within libpurple to reference the image. 0 is returned if the
33661
2ebcb105e606 Rename two functions.
Mark Doliner <mark@kingant.net>
parents: 33660
diff changeset
126 * image could not be created (because of empty data or size).
6982
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
127 */
33661
2ebcb105e606 Rename two functions.
Mark Doliner <mark@kingant.net>
parents: 33660
diff changeset
128 int purple_imgstore_new_with_id(gpointer data, size_t size, const char *filename);
6982
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
129
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
130 /**
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
131 * Retrieve an image from the store. The caller does not own a
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
132 * reference to the image.
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
133 *
33654
cf6979b92221 Spaces instead of tabs in doxygen comments.
Mark Doliner <mark@kingant.net>
parents: 22895
diff changeset
134 * @param id The ID for the image.
6982
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
135 *
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
136 * @return A pointer to the requested image, or NULL if it was not found.
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
137 */
16437
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
138 PurpleStoredImage *purple_imgstore_find_by_id(int id);
6982
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
139
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
140 /**
8962
5cd12e525d95 [gaim-migrate @ 9736]
Tim Ringenbach <marv@pidgin.im>
parents: 8046
diff changeset
141 * Retrieves a pointer to the image's data.
5cd12e525d95 [gaim-migrate @ 9736]
Tim Ringenbach <marv@pidgin.im>
parents: 8046
diff changeset
142 *
33658
bf6e40d37a72 Ever better documentation!
Mark Doliner <mark@kingant.net>
parents: 33656
diff changeset
143 * @param img The Image.
8962
5cd12e525d95 [gaim-migrate @ 9736]
Tim Ringenbach <marv@pidgin.im>
parents: 8046
diff changeset
144 *
5cd12e525d95 [gaim-migrate @ 9736]
Tim Ringenbach <marv@pidgin.im>
parents: 8046
diff changeset
145 * @return A pointer to the data, which must not
5cd12e525d95 [gaim-migrate @ 9736]
Tim Ringenbach <marv@pidgin.im>
parents: 8046
diff changeset
146 * be freed or modified.
5cd12e525d95 [gaim-migrate @ 9736]
Tim Ringenbach <marv@pidgin.im>
parents: 8046
diff changeset
147 */
16437
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
148 gconstpointer purple_imgstore_get_data(PurpleStoredImage *img);
8962
5cd12e525d95 [gaim-migrate @ 9736]
Tim Ringenbach <marv@pidgin.im>
parents: 8046
diff changeset
149
5cd12e525d95 [gaim-migrate @ 9736]
Tim Ringenbach <marv@pidgin.im>
parents: 8046
diff changeset
150 /**
5cd12e525d95 [gaim-migrate @ 9736]
Tim Ringenbach <marv@pidgin.im>
parents: 8046
diff changeset
151 * Retrieves the length of the image's data.
5cd12e525d95 [gaim-migrate @ 9736]
Tim Ringenbach <marv@pidgin.im>
parents: 8046
diff changeset
152 *
33658
bf6e40d37a72 Ever better documentation!
Mark Doliner <mark@kingant.net>
parents: 33656
diff changeset
153 * @param img The Image.
8962
5cd12e525d95 [gaim-migrate @ 9736]
Tim Ringenbach <marv@pidgin.im>
parents: 8046
diff changeset
154 *
5cd12e525d95 [gaim-migrate @ 9736]
Tim Ringenbach <marv@pidgin.im>
parents: 8046
diff changeset
155 * @return The size of the data that the pointer returned by
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
156 * purple_imgstore_get_data points to.
8962
5cd12e525d95 [gaim-migrate @ 9736]
Tim Ringenbach <marv@pidgin.im>
parents: 8046
diff changeset
157 */
16599
43f9ca8adbef Fix the name of the parameter for purple_imgstore_get_size() so that Doxygen will stop crying.
Richard Laager <rlaager@pidgin.im>
parents: 16539
diff changeset
158 size_t purple_imgstore_get_size(PurpleStoredImage *img);
8962
5cd12e525d95 [gaim-migrate @ 9736]
Tim Ringenbach <marv@pidgin.im>
parents: 8046
diff changeset
159
5cd12e525d95 [gaim-migrate @ 9736]
Tim Ringenbach <marv@pidgin.im>
parents: 8046
diff changeset
160 /**
33660
632df42123db Implore people to escape filenames.
Mark Doliner <mark@kingant.net>
parents: 33659
diff changeset
161 * Retrieves a pointer to the image's filename. If you intend to use this
632df42123db Implore people to escape filenames.
Mark Doliner <mark@kingant.net>
parents: 33659
diff changeset
162 * filename to write the file to disk, make sure the filename was
632df42123db Implore people to escape filenames.
Mark Doliner <mark@kingant.net>
parents: 33659
diff changeset
163 * appropriately escaped when you created the PurpleStoredImage. You may
632df42123db Implore people to escape filenames.
Mark Doliner <mark@kingant.net>
parents: 33659
diff changeset
164 * wish to use purple_escape_filename().
8962
5cd12e525d95 [gaim-migrate @ 9736]
Tim Ringenbach <marv@pidgin.im>
parents: 8046
diff changeset
165 *
33658
bf6e40d37a72 Ever better documentation!
Mark Doliner <mark@kingant.net>
parents: 33656
diff changeset
166 * @param img The image.
8962
5cd12e525d95 [gaim-migrate @ 9736]
Tim Ringenbach <marv@pidgin.im>
parents: 8046
diff changeset
167 *
5cd12e525d95 [gaim-migrate @ 9736]
Tim Ringenbach <marv@pidgin.im>
parents: 8046
diff changeset
168 * @return A pointer to the filename, which must not
5cd12e525d95 [gaim-migrate @ 9736]
Tim Ringenbach <marv@pidgin.im>
parents: 8046
diff changeset
169 * be freed or modified.
5cd12e525d95 [gaim-migrate @ 9736]
Tim Ringenbach <marv@pidgin.im>
parents: 8046
diff changeset
170 */
16775
8627d2560d40 Get rid of two harmless warnings:
Mark Doliner <markdoliner@pidgin.im>
parents: 16599
diff changeset
171 const char *purple_imgstore_get_filename(const PurpleStoredImage *img);
16437
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
172
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
173 /**
22763
6e4bbebdf127 Better documentation.
Mark Doliner <markdoliner@pidgin.im>
parents: 22613
diff changeset
174 * Looks at the magic numbers of the image data (the first few bytes)
6e4bbebdf127 Better documentation.
Mark Doliner <markdoliner@pidgin.im>
parents: 22613
diff changeset
175 * and returns an extension corresponding to the image's file type.
16437
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
176 *
33658
bf6e40d37a72 Ever better documentation!
Mark Doliner <mark@kingant.net>
parents: 33656
diff changeset
177 * @param img The image.
16437
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
178 *
22763
6e4bbebdf127 Better documentation.
Mark Doliner <markdoliner@pidgin.im>
parents: 22613
diff changeset
179 * @return The image's extension (for example "png") or "icon"
6e4bbebdf127 Better documentation.
Mark Doliner <markdoliner@pidgin.im>
parents: 22613
diff changeset
180 * if unknown.
16437
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
181 */
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
182 const char *purple_imgstore_get_extension(PurpleStoredImage *img);
8962
5cd12e525d95 [gaim-migrate @ 9736]
Tim Ringenbach <marv@pidgin.im>
parents: 8046
diff changeset
183
5cd12e525d95 [gaim-migrate @ 9736]
Tim Ringenbach <marv@pidgin.im>
parents: 8046
diff changeset
184 /**
16437
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
185 * Increment the reference count.
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
186 *
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
187 * @param img The image.
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
188 *
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
189 * @return @a img
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
190 */
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
191 PurpleStoredImage *
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
192 purple_imgstore_ref(PurpleStoredImage *img);
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
193
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
194 /**
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
195 * Decrement the reference count.
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
196 *
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
197 * If the reference count reaches zero, the image will be freed.
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
198 *
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
199 * @param img The image.
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
200 *
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
201 * @return @a img or @c NULL if the reference count reached zero.
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
202 */
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
203 PurpleStoredImage *
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
204 purple_imgstore_unref(PurpleStoredImage *img);
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
205
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
206 /**
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
207 * Increment the reference count using an ID.
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
208 *
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
209 * This is a convience wrapper for purple_imgstore_find_by_id() and
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
210 * purple_imgstore_ref(), so if you have a PurpleStoredImage, it'll
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
211 * be more efficient to call purple_imgstore_ref() directly.
6982
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
212 *
33654
cf6979b92221 Spaces instead of tabs in doxygen comments.
Mark Doliner <mark@kingant.net>
parents: 22895
diff changeset
213 * @param id The ID for the image.
6982
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
214 */
16437
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
215 void purple_imgstore_ref_by_id(int id);
6982
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
216
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
217 /**
16437
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
218 * Decrement the reference count using an ID.
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
219 *
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
220 * This is a convience wrapper for purple_imgstore_find_by_id() and
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
221 * purple_imgstore_unref(), so if you have a PurpleStoredImage, it'll
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
222 * be more efficient to call purple_imgstore_unref() directly.
6982
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
223 *
33654
cf6979b92221 Spaces instead of tabs in doxygen comments.
Mark Doliner <mark@kingant.net>
parents: 22895
diff changeset
224 * @param id The ID for the image.
6982
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
225 */
16437
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
226 void purple_imgstore_unref_by_id(int id);
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
227
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
228 /**
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
229 * Returns the image store subsystem handle.
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
230 *
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
231 * @return The subsystem handle.
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
232 */
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
233 void *purple_imgstore_get_handle(void);
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
234
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
235 /**
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
236 * Initializes the image store subsystem.
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
237 */
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
238 void purple_imgstore_init(void);
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
239
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
240 /**
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
241 * Uninitializes the image store subsystem.
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
242 */
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
243 void purple_imgstore_uninit(void);
6982
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
244
32787
7072f190d6ad Use G_BEGIN/END_DECLS in public libpurple files. This was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32298
diff changeset
245 G_END_DECLS
6982
12f08de92674 [gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
246
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
247 #endif /* _PURPLE_IMGSTORE_H_ */

mercurial