Mercurial > pidgin.yaz
annotate src/buddyicon.h @ 7190:13c725566078
[gaim-migrate @ 7759]
See if this fixes the assertion error with gaim_notify_emails in MSN that
people seem to be getting.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Wed, 08 Oct 2003 15:11:45 +0000 |
parents | c47633e9e2a4 |
children | fa6395637e2c |
rev | line source |
---|---|
6846 | 1 /** |
6869 | 2 * @file buddyicon.h Buddy Icon API |
6846 | 3 * @ingroup core |
4 * | |
5 * gaim | |
6 * | |
7 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.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 #ifndef _GAIM_ICON_H_ | |
24 #define _GAIM_ICON_H_ | |
25 | |
26 typedef struct _GaimBuddyIcon GaimBuddyIcon; | |
27 | |
28 #include "account.h" | |
29 | |
30 struct _GaimBuddyIcon | |
31 { | |
32 GaimAccount *account; /**< The account the user is on. */ | |
33 char *username; /**< The username the icon belongs to. */ | |
34 | |
35 void *data; /**< The buddy icon data. */ | |
36 size_t len; /**< The length of the buddy icon data. */ | |
37 | |
38 int ref_count; /**< The buddy icon reference count. */ | |
39 }; | |
40 | |
41 /**************************************************************************/ | |
42 /** @name Buddy Icon API */ | |
43 /**************************************************************************/ | |
44 /*@{*/ | |
45 | |
46 /** | |
47 * Creates a new buddy icon structure. | |
48 * | |
49 * @param account The account the user is on. | |
50 * @param username The username the icon belongs to. | |
51 * @param icon_data The buddy icon data. | |
52 * @param icon_len The buddy icon length. | |
53 * | |
54 * @return The buddy icon structure. | |
55 */ | |
56 GaimBuddyIcon *gaim_buddy_icon_new(GaimAccount *account, const char *username, | |
57 void *icon_data, size_t icon_len); | |
58 | |
59 /** | |
60 * Destroys a buddy icon structure. | |
61 * | |
62 * If the buddy icon's reference count is greater than 1, this will | |
63 * just decrease the reference count and return. | |
64 * | |
65 * @param icon The buddy icon structure to destroy. | |
66 */ | |
67 void gaim_buddy_icon_destroy(GaimBuddyIcon *icon); | |
68 | |
69 /** | |
70 * Increments the reference count on a buddy icon. | |
71 * | |
72 * @param icon The buddy icon. | |
73 * | |
74 * @return @a icon. | |
75 */ | |
76 GaimBuddyIcon *gaim_buddy_icon_ref(GaimBuddyIcon *icon); | |
77 | |
78 /** | |
79 * Decrements the reference count on a buddy icon. | |
80 * | |
81 * If the reference count reaches 0, the icon will be destroyed. | |
82 * | |
83 * @param icon The buddy icon. | |
84 * | |
85 * @return @a icon, or @c NULL if the reference count reached 0. | |
86 */ | |
87 GaimBuddyIcon *gaim_buddy_icon_unref(GaimBuddyIcon *icon); | |
88 | |
89 /** | |
90 * Updates every instance of this icon. | |
91 * | |
92 * @param icon The buddy icon. | |
93 */ | |
94 void gaim_buddy_icon_update(GaimBuddyIcon *icon); | |
95 | |
96 /** | |
6886
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
97 * Caches a buddy icon associated with a specific buddy to disk. |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
98 * |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
99 * @param icon The buddy icon. |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
100 * @param buddy The buddy that this icon belongs to. |
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 void gaim_buddy_icon_cache(GaimBuddyIcon *icon, GaimBuddy *buddy); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
103 |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
104 /** |
6846 | 105 * Sets the buddy icon's account. |
106 * | |
107 * @param icon The buddy icon. | |
108 * @param account The account. | |
109 */ | |
110 void gaim_buddy_icon_set_account(GaimBuddyIcon *icon, GaimAccount *account); | |
111 | |
112 /** | |
113 * Sets the buddy icon's username. | |
114 * | |
115 * @param icon The buddy icon. | |
116 * @param username The username. | |
117 */ | |
118 void gaim_buddy_icon_set_username(GaimBuddyIcon *icon, const char *username); | |
119 | |
120 /** | |
121 * Sets the buddy icon's icon data. | |
122 * | |
123 * @param icon The buddy icon. | |
124 * @param data The buddy icon data. | |
125 * @param len The length of the icon data. | |
126 */ | |
127 void gaim_buddy_icon_set_data(GaimBuddyIcon *icon, void *data, size_t len); | |
128 | |
129 /** | |
130 * Returns the buddy icon's account. | |
131 * | |
132 * @param icon The buddy icon. | |
133 * | |
134 * @return The account. | |
135 */ | |
136 GaimAccount *gaim_buddy_icon_get_account(const GaimBuddyIcon *icon); | |
137 | |
138 /** | |
139 * Returns the buddy icon's username. | |
140 * | |
141 * @param icon The buddy icon. | |
142 * | |
143 * @return The username. | |
144 */ | |
145 const char *gaim_buddy_icon_get_username(const GaimBuddyIcon *icon); | |
146 | |
147 /** | |
148 * Returns the buddy icon's data. | |
149 * | |
150 * @param icon The buddy icon. | |
151 * @param len The returned icon length. | |
152 * | |
153 * @return The icon data. | |
154 */ | |
155 const void *gaim_buddy_icon_get_data(const GaimBuddyIcon *icon, size_t *len); | |
156 | |
157 /*@}*/ | |
158 | |
159 /**************************************************************************/ | |
160 /** @name Buddy Icon Subsystem API */ | |
161 /**************************************************************************/ | |
162 /*@{*/ | |
163 | |
164 /** | |
165 * Sets a buddy icon for a user. | |
166 * | |
167 * @param account The account the user is on. | |
168 * @param username The username of the user. | |
169 * @param icon_data The icon data. | |
170 * @param icon_len The length of the icon data. | |
171 */ | |
172 void gaim_buddy_icons_set_for_user(GaimAccount *account, const char *username, | |
173 void *icon_data, size_t icon_len); | |
174 | |
175 /** | |
176 * Returns the buddy icon information for a user. | |
177 * | |
178 * @param account The account the user is on. | |
179 * @param username The username of the user. | |
180 * | |
181 * @return The icon data if found, or @c NULL if not found. | |
182 */ | |
183 GaimBuddyIcon *gaim_buddy_icons_find(const GaimAccount *account, | |
184 const char *username); | |
185 | |
186 /** | |
6886
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
187 * Sets whether or not buddy icon caching is enabled. |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
188 * |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
189 * @param caching TRUE of buddy icon caching should be enabled, or |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
190 * FALSE otherwise. |
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 void gaim_buddy_icons_set_caching(gboolean caching); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
193 |
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 * Returns whether or not buddy icon caching should be enabled. |
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 * The default is TRUE, unless otherwise specified by |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
198 * gaim_buddy_icons_set_caching(). |
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 * @return TRUE if buddy icon caching is enabled, or FALSE otherwise. |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
201 */ |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
202 gboolean gaim_buddy_icons_is_caching(void); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
203 |
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 * Sets the directory used to store buddy icon cache files. |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
206 * |
7114
c47633e9e2a4
[gaim-migrate @ 7681]
Christian Hammond <chipx86@chipx86.com>
parents:
6886
diff
changeset
|
207 * @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
|
208 */ |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
209 void gaim_buddy_icons_set_cache_dir(const char *cache_dir); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
210 |
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 * Returns the directory used to store buddy icon cache files. |
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 * The default directory is GAIMDIR/icons, unless otherwise specified |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
215 * by gaim_buddy_icons_set_cache_dir(). |
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 * @return The directory to store buddy icon cache files to. |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
218 */ |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
219 const char *gaim_buddy_icons_get_cache_dir(void); |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
220 |
b5fb1d5282e5
[gaim-migrate @ 7432]
Christian Hammond <chipx86@chipx86.com>
parents:
6869
diff
changeset
|
221 /** |
6846 | 222 * Returns the buddy icon subsystem handle. |
223 * | |
224 * @return The subsystem handle. | |
225 */ | |
226 void *gaim_buddy_icons_get_handle(); | |
227 | |
228 /** | |
229 * Initializes the buddy icon subsystem. | |
230 */ | |
231 void gaim_buddy_icons_init(); | |
232 | |
233 /** | |
234 * Uninitializes the buddy icon subsystem. | |
235 */ | |
236 void gaim_buddy_icons_uninit(); | |
237 | |
238 /*@}*/ | |
239 | |
240 #endif /* _GAIM_ICON_H_ */ |