| |
1 /** |
| |
2 * @file object.h MSNObject API |
| |
3 * |
| |
4 * purple |
| |
5 * |
| |
6 * Purple is the legal property of its developers, whose names are too numerous |
| |
7 * to list here. Please refer to the COPYRIGHT file distributed with this |
| |
8 * source distribution. |
| |
9 * |
| |
10 * This program is free software; you can redistribute it and/or modify |
| |
11 * it under the terms of the GNU General Public License as published by |
| |
12 * the Free Software Foundation; either version 2 of the License, or |
| |
13 * (at your option) any later version. |
| |
14 * |
| |
15 * This program is distributed in the hope that it will be useful, |
| |
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| |
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| |
18 * GNU General Public License for more details. |
| |
19 * |
| |
20 * You should have received a copy of the GNU General Public License |
| |
21 * along with this program; if not, write to the Free Software |
| |
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| |
23 */ |
| |
24 #ifndef _MSN_OBJECT_H_ |
| |
25 #define _MSN_OBJECT_H_ |
| |
26 |
| |
27 #include "imgstore.h" |
| |
28 |
| |
29 #include "internal.h" |
| |
30 |
| |
31 typedef enum |
| |
32 { |
| |
33 MSN_OBJECT_UNKNOWN = -1, /**< Unknown object */ |
| |
34 MSN_OBJECT_RESERVED1 = 1, /**< Reserved */ |
| |
35 MSN_OBJECT_EMOTICON = 2, /**< Custom Emoticon */ |
| |
36 MSN_OBJECT_USERTILE = 3, /**< UserTile (buddy icon) */ |
| |
37 MSN_OBJECT_RESERVED2 = 4, /**< Reserved */ |
| |
38 MSN_OBJECT_BACKGROUND = 5 /**< Background */ |
| |
39 |
| |
40 } MsnObjectType; |
| |
41 |
| |
42 typedef struct |
| |
43 { |
| |
44 gboolean local; |
| |
45 |
| |
46 char *creator; |
| |
47 int size; |
| |
48 MsnObjectType type; |
| |
49 PurpleStoredImage *img; |
| |
50 char *location; |
| |
51 char *friendly; |
| |
52 char *sha1d; |
| |
53 char *sha1c; |
| |
54 |
| |
55 } MsnObject; |
| |
56 |
| |
57 /** |
| |
58 * Creates a MsnObject structure. |
| |
59 * |
| |
60 * @return A new MsnObject structure. |
| |
61 */ |
| |
62 MsnObject *msn_object_new(void); |
| |
63 |
| |
64 /** |
| |
65 * Creates a MsnObject structure from a string. |
| |
66 * |
| |
67 * @param str The string. |
| |
68 * |
| |
69 * @return The new MsnObject structure. |
| |
70 */ |
| |
71 MsnObject *msn_object_new_from_string(const char *str); |
| |
72 |
| |
73 /** |
| |
74 * Destroys an MsnObject structure. |
| |
75 * |
| |
76 * @param obj The object structure. |
| |
77 */ |
| |
78 void msn_object_destroy(MsnObject *obj); |
| |
79 |
| |
80 /** |
| |
81 * Outputs a string representation of an MsnObject. |
| |
82 * |
| |
83 * @param obj The object. |
| |
84 * |
| |
85 * @return The string representation. This must be freed. |
| |
86 */ |
| |
87 char *msn_object_to_string(const MsnObject *obj); |
| |
88 |
| |
89 /** |
| |
90 * Sets the creator field in a MsnObject. |
| |
91 * |
| |
92 * @param creator The creator value. |
| |
93 */ |
| |
94 void msn_object_set_creator(MsnObject *obj, const char *creator); |
| |
95 |
| |
96 /** |
| |
97 * Sets the size field in a MsnObject. |
| |
98 * |
| |
99 * @param size The size value. |
| |
100 */ |
| |
101 void msn_object_set_size(MsnObject *obj, int size); |
| |
102 |
| |
103 /** |
| |
104 * Sets the type field in a MsnObject. |
| |
105 * |
| |
106 * @param type The type value. |
| |
107 */ |
| |
108 void msn_object_set_type(MsnObject *obj, MsnObjectType type); |
| |
109 |
| |
110 /** |
| |
111 * Sets the location field in a MsnObject. |
| |
112 * |
| |
113 * @param location The location value. |
| |
114 */ |
| |
115 void msn_object_set_location(MsnObject *obj, const char *location); |
| |
116 |
| |
117 /** |
| |
118 * Sets the friendly name field in a MsnObject. |
| |
119 * |
| |
120 * @param friendly The friendly name value. |
| |
121 */ |
| |
122 void msn_object_set_friendly(MsnObject *obj, const char *friendly); |
| |
123 |
| |
124 /** |
| |
125 * Sets the SHA1D field in a MsnObject. |
| |
126 * |
| |
127 * @param sha1d The sha1d value. |
| |
128 */ |
| |
129 void msn_object_set_sha1d(MsnObject *obj, const char *sha1d); |
| |
130 |
| |
131 /** |
| |
132 * Sets the SHA1C field in a MsnObject. |
| |
133 * |
| |
134 * @param sha1c The sha1c value. |
| |
135 */ |
| |
136 void msn_object_set_sha1c(MsnObject *obj, const char *sha1c); |
| |
137 |
| |
138 /** |
| |
139 * Associates an image with a MsnObject. |
| |
140 * |
| |
141 * @param obj The object. |
| |
142 * @param img The image to associate. |
| |
143 */ |
| |
144 void msn_object_set_image(MsnObject *obj, PurpleStoredImage *img); |
| |
145 |
| |
146 /** |
| |
147 * Returns a MsnObject's creator value. |
| |
148 * |
| |
149 * @param obj The object. |
| |
150 * |
| |
151 * @return The creator value. |
| |
152 */ |
| |
153 const char *msn_object_get_creator(const MsnObject *obj); |
| |
154 |
| |
155 /** |
| |
156 * Returns a MsnObject's size value. |
| |
157 * |
| |
158 * @param obj The object. |
| |
159 * |
| |
160 * @return The size value. |
| |
161 */ |
| |
162 int msn_object_get_size(const MsnObject *obj); |
| |
163 |
| |
164 /** |
| |
165 * Returns a MsnObject's type. |
| |
166 * |
| |
167 * @param obj The object. |
| |
168 * |
| |
169 * @return The object type. |
| |
170 */ |
| |
171 MsnObjectType msn_object_get_type(const MsnObject *obj); |
| |
172 |
| |
173 /** |
| |
174 * Returns a MsnObject's location value. |
| |
175 * |
| |
176 * @param obj The object. |
| |
177 * |
| |
178 * @return The location value. |
| |
179 */ |
| |
180 const char *msn_object_get_location(const MsnObject *obj); |
| |
181 |
| |
182 /** |
| |
183 * Returns a MsnObject's friendly name value. |
| |
184 * |
| |
185 * @param obj The object. |
| |
186 * |
| |
187 * @return The friendly name value. |
| |
188 */ |
| |
189 const char *msn_object_get_friendly(const MsnObject *obj); |
| |
190 |
| |
191 /** |
| |
192 * Returns a MsnObject's SHA1D value. |
| |
193 * |
| |
194 * @param obj The object. |
| |
195 * |
| |
196 * @return The SHA1D value. |
| |
197 */ |
| |
198 const char *msn_object_get_sha1d(const MsnObject *obj); |
| |
199 |
| |
200 /** |
| |
201 * Returns a MsnObject's SHA1C value. |
| |
202 * |
| |
203 * @param obj The object. |
| |
204 * |
| |
205 * @return The SHA1C value. |
| |
206 */ |
| |
207 const char *msn_object_get_sha1c(const MsnObject *obj); |
| |
208 |
| |
209 /** |
| |
210 * Returns a MsnObject's SHA1C value if it exists, otherwise SHA1D. |
| |
211 * |
| |
212 * @param obj The object. |
| |
213 * |
| |
214 * @return The SHA1C value. |
| |
215 */ |
| |
216 const char *msn_object_get_sha1(const MsnObject *obj); |
| |
217 |
| |
218 /** |
| |
219 * Returns the image associated with the MsnObject. |
| |
220 * |
| |
221 * @param obj The object. |
| |
222 * |
| |
223 * @return The associated image. |
| |
224 */ |
| |
225 PurpleStoredImage *msn_object_get_image(const MsnObject *obj); |
| |
226 |
| |
227 void msn_object_set_local(MsnObject *obj); |
| |
228 |
| |
229 #endif /* _MSN_OBJECT_H_ */ |