Mercurial > pidgin
comparison src/imgstore.h @ 6982:083d1e4a9c78
[gaim-migrate @ 7538]
This is Mr. Holland's Opus. And by Mr. Holland I mean Robot101. He
rewrote the coreish IM image support so that the binary data gets
ripped out in the prpl and put in an imgstore instead of just being
passed in the same huge as char string as the actual message. This
is good because it's prpl agnostic, or something. It also means
we don't have a silly length of "-1" with pretty much every send or
receive IM function.
It should be crash free, bug free, and memleak free, but additional
testing is always a good thing.
If you like good stuff then you'll love this patch. But don't take
my word for it--ba dun dunt!
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sat, 27 Sep 2003 19:17:21 +0000 |
parents | |
children | bf630f7dfdcd |
comparison
equal
deleted
inserted
replaced
6981:abd3c684da31 | 6982:083d1e4a9c78 |
---|---|
1 /** | |
2 * @file imgstore.h IM Image Store API | |
3 * @ingroup core | |
4 * | |
5 * gaim | |
6 * | |
7 * Copyright (C) 2003 Robert McQueen <robot101@debian.org> | |
8 * | |
9 * This program is free software; you can redistribute it and/or modify | |
10 * it under the terms of the GNU General Public License as published by | |
11 * the Free Software Foundation; either version 2 of the License, or | |
12 * (at your option) any later version. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 * | |
23 */ | |
24 #ifndef _GAIM_IMGSTORE_H_ | |
25 #define _GAIM_IMGSTORE_H_ | |
26 | |
27 /** | |
28 * Stored image | |
29 * | |
30 * Represents a single IM image awaiting display and/or transmission. | |
31 */ | |
32 typedef struct | |
33 { | |
34 char *data; /**< The image data. */ | |
35 size_t size; /**< The image data's size. */ | |
36 char *filename; /**< The filename (for the UI) */ | |
37 } GaimStoredImage; | |
38 | |
39 #ifdef __cplusplus | |
40 extern "C" { | |
41 #endif | |
42 | |
43 /** | |
44 * Add an image to the store. The caller owns a reference | |
45 * to the image in the store, and must dereference the image | |
46 * with gaim_imgstore_unref for it to be freed. | |
47 * | |
48 * @param data Pointer to the image data. | |
49 * @param size Image data's size. | |
50 * @param filename Filename associated with image. | |
51 | |
52 * @return ID for the image. | |
53 */ | |
54 int gaim_imgstore_add(const void *data, size_t size, const char *filename); | |
55 | |
56 /** | |
57 * Retrieve an image from the store. The caller does not own a | |
58 * reference to the image. | |
59 * | |
60 * @param id The ID for the image. | |
61 * | |
62 * @return A pointer to the requested image, or NULL if it was not found. | |
63 */ | |
64 GaimStoredImage *gaim_imgstore_get(int id); | |
65 | |
66 /** | |
67 * Increment the reference count for an image in the store. The | |
68 * image will be removed from the store when the reference count | |
69 * is zero. | |
70 * | |
71 * @param id The ID for the image. | |
72 */ | |
73 void gaim_imgstore_ref(int id); | |
74 | |
75 /** | |
76 * Decrement the reference count for an image in the store. The | |
77 * image will be removed from the store when the reference count | |
78 * is zero. | |
79 * | |
80 * @param id The ID for the image. | |
81 */ | |
82 void gaim_imgstore_unref(int id); | |
83 | |
84 #ifdef __cplusplus | |
85 } | |
86 #endif | |
87 | |
88 #endif /* _GAIM_IMGSTORE_H_ */ |