Mercurial > pidgin
annotate src/buddyicon.h @ 10353:fc7168f9ecb0
[gaim-migrate @ 11570]
Gone to watch Vertigo with my gal
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 13 Dec 2004 02:02:05 +0000 |
parents | 78022bad9367 |
children | 748aa3c6de36 |
rev | line source |
---|---|
6846 | 1 /** |
6869 | 2 * @file buddyicon.h Buddy Icon API |
6846 | 3 * @ingroup core |
4 * | |
5 * gaim | |
6 * | |
8046 | 7 * Gaim is the legal property of its developers, whose names are too numerous |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
6846 | 10 * |
11 * This program is free software; you can redistribute it and/or modify | |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 */ | |
9713 | 25 #ifndef _GAIM_BUDDYICON_H_ |
26 #define _GAIM_BUDDYICON_H_ | |
6846 | 27 |
28 typedef struct _GaimBuddyIcon GaimBuddyIcon; | |
29 | |
30 #include "account.h" | |
9718 | 31 #include "blist.h" |
6846 | 32 |
33 struct _GaimBuddyIcon | |
34 { | |
35 GaimAccount *account; /**< The account the user is on. */ | |
36 char *username; /**< The username the icon belongs to. */ | |
37 | |
38 void *data; /**< The buddy icon data. */ | |
39 size_t len; /**< The length of the buddy icon data. */ | |
40 | |
41 int ref_count; /**< The buddy icon reference count. */ | |
42 }; | |
43 | |
44 /**************************************************************************/ | |
45 /** @name Buddy Icon API */ | |
46 /**************************************************************************/ | |
47 /*@{*/ | |
48 | |
49 /** | |
50 * Creates a new buddy icon structure. | |
51 * | |
52 * @param account The account the user is on. | |
53 * @param username The username the icon belongs to. | |
54 * @param icon_data The buddy icon data. | |
55 * @param icon_len The buddy icon length. | |
56 * | |
57 * @return The buddy icon structure. | |
58 */ | |
59 GaimBuddyIcon *gaim_buddy_icon_new(GaimAccount *account, const char *username, | |
60 void *icon_data, size_t icon_len); | |
61 | |
62 /** | |
63 * Destroys a buddy icon structure. | |
64 * | |
65 * If the buddy icon's reference count is greater than 1, this will | |
66 * just decrease the reference count and return. | |
67 * | |
68 * @param icon The buddy icon structure to destroy. | |
69 */ | |
70 void gaim_buddy_icon_destroy(GaimBuddyIcon *icon); | |
71 | |
72 /** | |
73 * Increments the reference count on a buddy icon. | |
74 * | |
75 * @param icon The buddy icon. | |
76 * | |
77 * @return @a icon. | |
78 */ | |
79 GaimBuddyIcon *gaim_buddy_icon_ref(GaimBuddyIcon *icon); | |
80 | |
81 /** | |
82 * Decrements the reference count on a buddy icon. | |
83 * | |
84 * If the reference count reaches 0, the icon will be destroyed. | |
85 * | |
86 * @param icon The buddy icon. | |
87 * | |
88 * @return @a icon, or @c NULL if the reference count reached 0. | |
89 */ | |
90 GaimBuddyIcon *gaim_buddy_icon_unref(GaimBuddyIcon *icon); | |
91 | |
92 /** | |
93 * Updates every instance of this icon. | |
94 * | |
95 * @param icon The buddy icon. | |
96 */ | |
97 void gaim_buddy_icon_update(GaimBuddyIcon *icon); | |
98 | |
99 /** | |
6886
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
100 * Caches a buddy icon associated with a specific buddy to disk. |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
101 * |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
102 * @param icon The buddy icon. |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
103 * @param buddy The buddy that this icon belongs to. |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
104 */ |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
105 void gaim_buddy_icon_cache(GaimBuddyIcon *icon, GaimBuddy *buddy); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
106 |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
107 /** |
6846 | 108 * Sets the buddy icon's account. |
109 * | |
110 * @param icon The buddy icon. | |
111 * @param account The account. | |
112 */ | |
113 void gaim_buddy_icon_set_account(GaimBuddyIcon *icon, GaimAccount *account); | |
114 | |
115 /** | |
116 * Sets the buddy icon's username. | |
117 * | |
118 * @param icon The buddy icon. | |
119 * @param username The username. | |
120 */ | |
121 void gaim_buddy_icon_set_username(GaimBuddyIcon *icon, const char *username); | |
122 | |
123 /** | |
124 * Sets the buddy icon's icon data. | |
125 * | |
126 * @param icon The buddy icon. | |
127 * @param data The buddy icon data. | |
128 * @param len The length of the icon data. | |
129 */ | |
130 void gaim_buddy_icon_set_data(GaimBuddyIcon *icon, void *data, size_t len); | |
131 | |
132 /** | |
133 * Returns the buddy icon's account. | |
134 * | |
135 * @param icon The buddy icon. | |
136 * | |
137 * @return The account. | |
138 */ | |
139 GaimAccount *gaim_buddy_icon_get_account(const GaimBuddyIcon *icon); | |
140 | |
141 /** | |
142 * Returns the buddy icon's username. | |
143 * | |
144 * @param icon The buddy icon. | |
145 * | |
146 * @return The username. | |
147 */ | |
148 const char *gaim_buddy_icon_get_username(const GaimBuddyIcon *icon); | |
149 | |
150 /** | |
151 * Returns the buddy icon's data. | |
152 * | |
153 * @param icon The buddy icon. | |
154 * @param len The returned icon length. | |
155 * | |
156 * @return The icon data. | |
157 */ | |
158 const void *gaim_buddy_icon_get_data(const GaimBuddyIcon *icon, size_t *len); | |
159 | |
160 /*@}*/ | |
161 | |
162 /**************************************************************************/ | |
163 /** @name Buddy Icon Subsystem API */ | |
164 /**************************************************************************/ | |
165 /*@{*/ | |
166 | |
167 /** | |
168 * Sets a buddy icon for a user. | |
169 * | |
170 * @param account The account the user is on. | |
171 * @param username The username of the user. | |
172 * @param icon_data The icon data. | |
173 * @param icon_len The length of the icon data. | |
174 */ | |
175 void gaim_buddy_icons_set_for_user(GaimAccount *account, const char *username, | |
176 void *icon_data, size_t icon_len); | |
177 | |
178 /** | |
179 * Returns the buddy icon information for a user. | |
180 * | |
181 * @param account The account the user is on. | |
182 * @param username The username of the user. | |
183 * | |
184 * @return The icon data if found, or @c NULL if not found. | |
185 */ | |
9396 | 186 GaimBuddyIcon *gaim_buddy_icons_find(GaimAccount *account, |
6846 | 187 const char *username); |
188 | |
189 /** | |
6886
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
190 * Sets whether or not buddy icon caching is enabled. |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
191 * |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
192 * @param caching TRUE of buddy icon caching should be enabled, or |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
193 * FALSE otherwise. |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
194 */ |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
195 void gaim_buddy_icons_set_caching(gboolean caching); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
196 |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
197 /** |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
198 * Returns whether or not buddy icon caching should be enabled. |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
199 * |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
200 * The default is TRUE, unless otherwise specified by |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
201 * gaim_buddy_icons_set_caching(). |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
202 * |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
203 * @return TRUE if buddy icon caching is enabled, or FALSE otherwise. |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
204 */ |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
205 gboolean gaim_buddy_icons_is_caching(void); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
206 |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
207 /** |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
208 * Sets the directory used to store buddy icon cache files. |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
209 * |
7114
c47633e9e2a4
[gaim-migrate @ 7681]
Christian Hammond <chipx86@chipx86.com>
parents:
6886
diff
changeset
|
210 * @param cache_dir The directory to store buddy icon cache files to. |
6886
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
211 */ |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
212 void gaim_buddy_icons_set_cache_dir(const char *cache_dir); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
213 |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
214 /** |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
215 * Returns the directory used to store buddy icon cache files. |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
216 * |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
217 * The default directory is GAIMDIR/icons, unless otherwise specified |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
218 * by gaim_buddy_icons_set_cache_dir(). |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
219 * |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
220 * @return The directory to store buddy icon cache files to. |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
221 */ |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
222 const char *gaim_buddy_icons_get_cache_dir(void); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
223 |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
224 /** |
6846 | 225 * Returns the buddy icon subsystem handle. |
226 * | |
227 * @return The subsystem handle. | |
228 */ | |
229 void *gaim_buddy_icons_get_handle(); | |
230 | |
231 /** | |
232 * Initializes the buddy icon subsystem. | |
233 */ | |
234 void gaim_buddy_icons_init(); | |
235 | |
236 /** | |
237 * Uninitializes the buddy icon subsystem. | |
238 */ | |
239 void gaim_buddy_icons_uninit(); | |
240 | |
241 /*@}*/ | |
242 | |
9713 | 243 #endif /* _GAIM_BUDDYICON_H_ */ |