Mercurial > pidgin.yaz
annotate src/protocols/novell/nmcontact.h @ 8813:610bf83cbd93
[gaim-migrate @ 9575]
May Pavel's users contact him with abandon about his translations
committer: Tailor Script <tailor@pidgin.im>
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Mon, 26 Apr 2004 15:30:03 +0000 |
parents | 046dd8ef2920 |
children | 6663ad2386d9 |
rev | line source |
---|---|
8675 | 1 /* |
2 * nmcontact.h | |
3 * | |
4 * Copyright © 2004 Unpublished Work of Novell, Inc. All Rights Reserved. | |
5 * | |
6 * THIS WORK IS AN UNPUBLISHED WORK OF NOVELL, INC. NO PART OF THIS WORK MAY BE | |
7 * USED, PRACTICED, PERFORMED, COPIED, DISTRIBUTED, REVISED, MODIFIED, | |
8 * TRANSLATED, ABRIDGED, CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, | |
9 * RECAST, TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF NOVELL, | |
10 * INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT AUTHORIZATION COULD SUBJECT | |
11 * THE PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY. | |
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
12 * |
8675 | 13 * AS BETWEEN [GAIM] AND NOVELL, NOVELL GRANTS [GAIM] THE RIGHT TO REPUBLISH |
14 * THIS WORK UNDER THE GPL (GNU GENERAL PUBLIC LICENSE) WITH ALL RIGHTS AND | |
15 * LICENSES THEREUNDER. IF YOU HAVE RECEIVED THIS WORK DIRECTLY OR INDIRECTLY | |
16 * FROM [GAIM] AS PART OF SUCH A REPUBLICATION, YOU HAVE ALL RIGHTS AND LICENSES | |
17 * GRANTED BY [GAIM] UNDER THE GPL. IN CONNECTION WITH SUCH A REPUBLICATION, IF | |
18 * ANYTHING IN THIS NOTICE CONFLICTS WITH THE TERMS OF THE GPL, SUCH TERMS | |
19 * PREVAIL. | |
20 * | |
21 */ | |
22 | |
23 #ifndef __NM_CONTACT_H__ | |
24 #define __NM_CONTACT_H__ | |
25 | |
26 #include <glib.h> | |
27 | |
28 typedef struct _NMContact NMContact; | |
29 typedef struct _NMContactProperty NMContactProperty; | |
30 typedef struct _NMFolder NMFolder; | |
31 | |
32 #include "nmfield.h" | |
33 #include "nmuser.h" | |
34 | |
35 /** | |
36 * Creates a contact | |
37 * | |
38 * Should be released by calling nm_release_contact | |
39 * | |
40 * @return The new NMContact | |
41 * | |
42 */ | |
43 NMContact *nm_create_contact(); | |
44 | |
45 /** | |
46 * Creates a contact from a field array representing the | |
47 * contact | |
48 * | |
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
49 * Should be released by calling nm_release_contact |
8675 | 50 * |
51 * @param fields Should be the NM_A_FA_CONTACT for | |
52 * the contact | |
53 * | |
54 * @return The new contact | |
55 * | |
56 */ | |
57 NMContact *nm_create_contact_from_fields(NMField * fields); | |
58 | |
59 /** | |
60 * Add a reference to an existing contact | |
61 * | |
62 * The reference should be released by calling | |
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
63 * nm_release_contact |
8675 | 64 * |
65 * @param contact The contact | |
66 * | |
67 */ | |
68 void nm_contact_add_ref(NMContact * contact); | |
69 | |
70 /** | |
71 * Update the contact list properties of the contact (sequence, parent id, etc.) | |
72 * | |
73 * @param contact The contact to update | |
74 * @param fields The fields to update from (should be a NM_A_FA_CONTACT array) | |
75 * | |
76 */ | |
77 void nm_contact_update_list_properties(NMContact * contact, NMField * fields); | |
78 | |
79 /** | |
80 * Release a contact reference | |
81 * | |
82 * @param contact The contact to release. | |
83 * | |
84 */ | |
85 void nm_release_contact(NMContact * contact); | |
86 | |
87 /** | |
88 * Get the display name of a contact | |
89 * | |
90 * @param contact The contact | |
91 * | |
92 * @return The display name of a contact | |
93 * | |
94 */ | |
95 const char *nm_contact_get_display_name(NMContact * contact); | |
96 | |
97 /** | |
98 * Get the DN of a contact | |
99 * | |
100 * @param contact The contact | |
101 * | |
102 * @return The DN of the contact | |
103 */ | |
104 const char *nm_contact_get_dn(NMContact * contact); | |
105 | |
106 /** | |
107 * Set the display name for a contact. This is called | |
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
108 * by nm_send_rename_contact. It should not be called |
8675 | 109 * directly (it does not change the display name on the |
110 * server side list -- nm_send_rename_conact does). | |
111 * | |
112 * @param contact The contact | |
113 * @param display_name The new display name | |
114 * | |
115 */ | |
116 void nm_contact_set_display_name(NMContact * contact, const char * display_name); | |
117 | |
118 /** | |
119 * Set the DN for the contact | |
120 * | |
121 * @param contact The contact | |
122 * @param dn The new DN for the contact | |
123 * | |
124 */ | |
125 void nm_contact_set_dn(NMContact * contact, const char * dn); | |
126 | |
127 /** | |
128 * Return a field array (NM_A_FA_CONTACT) representing the contact | |
129 * | |
130 * @param contact The contact | |
131 * | |
132 * @return A field array representing the contact | |
133 */ | |
134 NMField *nm_contact_to_fields(NMContact * contact); | |
135 | |
136 /** | |
137 * Set the user record for the contact | |
138 * | |
139 * @param contact The contact | |
140 * @param user_record The user record | |
141 * | |
142 */ | |
143 void nm_contact_set_user_record(NMContact * contact, NMUserRecord * user_record); | |
144 | |
145 /** | |
146 * Get the user record for the contact | |
147 * | |
148 * @param contact The contact | |
149 * | |
150 * @return The user record associated with the contact | |
151 * | |
152 */ | |
153 NMUserRecord *nm_contact_get_user_record(NMContact * contact); | |
154 | |
155 /** | |
156 * Get the user defined data for the contact | |
157 * | |
158 * @param contact The contact | |
159 * | |
160 * @return The user defined data for the contact | |
161 * | |
162 */ | |
163 gpointer nm_contact_get_data(NMContact * contact); | |
164 | |
165 /** | |
166 * Get the Object ID for the contact | |
167 * | |
168 * @param contact The contact | |
169 * | |
170 * @return The ID for the contact | |
171 */ | |
172 int nm_contact_get_id(NMContact * contact); | |
173 | |
174 /** | |
175 * Get the ID for the folder that the contact is in | |
176 * | |
177 * @param contact The contact | |
178 * | |
179 * @return The ID of the folder that contains the contact | |
180 * | |
181 */ | |
182 int nm_contact_get_parent_id(NMContact * contact); | |
183 | |
184 /** | |
185 * Get The userid of the contact. | |
186 * | |
187 * @param contact The contact | |
188 * | |
189 * @return The userid of the contact | |
190 * | |
191 */ | |
192 const char *nm_contact_get_userid(NMContact * contact); | |
193 | |
194 /** | |
195 * Get the display id of the contact | |
196 * | |
197 * @param contact The contact | |
198 * | |
199 * @return The display id of the contact | |
200 */ | |
201 const char *nm_contact_get_display_id(NMContact * contact); | |
202 | |
203 /** | |
204 * Set the user defined data for the contact | |
205 * | |
206 * @param contact The contact | |
207 * @param data The user defined data | |
208 * | |
209 */ | |
210 void nm_contact_set_data(NMContact * contact, gpointer data); | |
211 | |
212 /** | |
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
213 * Create a folder with the given name |
8675 | 214 * |
215 * @param name The name of the folder | |
216 * | |
217 * @return The new folder | |
218 * | |
219 */ | |
220 NMFolder *nm_create_folder(const char *name); | |
221 | |
222 /** | |
223 * Create a folder from a NM_A_FA_FOLDER field array | |
224 * | |
225 * @param fields The NM_A_FA_FOLDER field array | |
226 * | |
227 * @return The new folder | |
228 * | |
229 */ | |
230 NMFolder *nm_create_folder_from_fields(NMField * fields); | |
231 | |
232 /** | |
233 * Release a reference to a folder. | |
234 * | |
235 * @param folder The folder to release | |
236 * | |
237 */ | |
238 void nm_release_folder(NMFolder * folder); | |
239 | |
240 /** | |
241 * Return the number of subfolders for the given | |
242 * folder | |
243 * | |
244 * @param folder The folder | |
245 * | |
246 * @return The number of subfolders contained by folder | |
247 */ | |
248 int nm_folder_get_subfolder_count(NMFolder * folder); | |
249 | |
250 /** | |
251 * Get a subfolder | |
252 * | |
253 * @param folder The root folder | |
254 * @param index The index of the folder to get | |
255 * | |
256 * @return The subfolder at the given index | |
257 * | |
258 */ | |
259 NMFolder *nm_folder_get_subfolder(NMFolder * folder, int index); | |
260 | |
261 /** | |
262 * Get the number of contacts in the given folder | |
263 * | |
264 * @param folder The folder | |
265 * | |
266 * @return The number of contacts contained by folder | |
267 * | |
268 */ | |
269 int nm_folder_get_contact_count(NMFolder * folder); | |
270 | |
271 /** | |
272 * Get a contact in the given folder | |
273 * | |
274 * @param folder The folder | |
275 * @param index The index of the contact to get | |
276 * | |
277 * @return The contact at the given index | |
278 * | |
279 */ | |
280 NMContact *nm_folder_get_contact(NMFolder * folder, int index); | |
281 | |
282 /** | |
283 * Get the name of the folder | |
284 * | |
285 * @param folder The folder | |
286 * | |
287 * @return The name of the folder. | |
288 * | |
289 */ | |
290 const char *nm_folder_get_name(NMFolder * folder); | |
291 | |
292 /** | |
293 * Set the name of a folder. Do not call this directly. | |
294 * It does not change the name of the folder in the | |
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
295 * server side contact list. You must call |
8675 | 296 * nm_send_set_folder_name(). |
297 * | |
298 * @param folder The folder | |
299 * @param name The new name for the folder | |
300 * | |
301 */ | |
302 void nm_folder_set_name(NMFolder * folder, const char *name); | |
303 | |
304 /** | |
305 * Get Object ID for folder | |
306 * | |
307 * @param folder The folder | |
308 * | |
309 * @return The ID of the folder | |
310 * | |
311 */ | |
312 int nm_folder_get_id(NMFolder * folder); | |
313 | |
314 /** | |
315 * Add contacts and folders from fields into root | |
316 * | |
317 * @param user The logged in user | |
318 * @param root The root folder | |
319 * @param fields The contact list field array | |
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
320 * |
8675 | 321 */ |
322 void nm_folder_add_contacts_and_folders(NMUser * user, NMFolder * root, | |
323 NMField * fields); | |
324 /** | |
325 * Add a contact to the contact list. | |
326 * | |
327 * @param root_folder The root folder of the contact list | |
328 * @param contact The contact to add | |
329 * | |
330 */ | |
331 void nm_folder_add_contact_to_list(NMFolder * root_folder, | |
332 NMContact * contact); | |
333 | |
334 /** | |
335 * Update the contact list properties of the folder (sequence, parent id, etc.) | |
336 * | |
337 * @param folder The folder to update | |
338 * @param fields The fields to update from (should be a NM_A_FA_FOLDER array) | |
339 * | |
340 */ | |
341 void nm_folder_update_list_properties(NMFolder * folder, NMField * fields); | |
342 | |
343 /** | |
344 * Add folder to the contact list | |
345 * | |
346 * @param root_folder The root folder of the contact list | |
347 * @param folder The folder to add to the contact list | |
348 * | |
349 */ | |
350 void nm_folder_add_folder_to_list(NMFolder * root_folder, NMFolder * folder); | |
351 | |
352 /** | |
353 * Find the object with the given id | |
354 * | |
355 * @param root_folder The root folder of the contact list | |
356 * @param object_id The object id of the object to find | |
357 * | |
358 * @return The object with object id (either a contact or a folder) | |
359 */ | |
360 gpointer nm_folder_find_item_by_object_id(NMFolder * root_folder, | |
361 int object_id); | |
362 | |
363 /** | |
364 * Remove a contact from the folder | |
365 * | |
366 * @param folder The folder | |
367 * @param contact The contact to remove | |
368 * | |
369 */ | |
370 void nm_folder_remove_contact(NMFolder * folder, NMContact * contact); | |
371 | |
372 /** | |
373 * Find a contact in a folder by DN | |
374 * | |
375 * @param folder The folder to search | |
376 * @param dn The DN of the contact to find | |
377 * | |
378 * @return The contact if found, NULL otherwise | |
379 * | |
380 */ | |
381 NMContact *nm_folder_find_contact(NMFolder * folder, const char *dn); | |
382 | |
383 /** | |
384 * Find a contact in a folder by userid | |
385 * | |
386 * @param folder The folder to search | |
387 * @param userid The userid of the contact to find | |
388 * | |
389 * @return The contact if found, NULL otherwise | |
390 * | |
391 */ | |
392 NMContact *nm_folder_find_contact_by_userid(NMFolder * folder, | |
393 const char *userid); | |
394 /** | |
395 * Return a field array (NM_A_FA_FOLDER) representing the folder | |
396 * | |
397 * @param folder The folder | |
398 * | |
399 * @return A field array representing the folder | |
400 */ | |
401 NMField *nm_folder_to_fields(NMFolder * folder); | |
402 | |
403 #endif |