Mercurial > pidgin
annotate src/protocols/novell/nmcontact.h @ 10999:56cfc50d2a81
[gaim-migrate @ 12841]
Fix the right-click menus on the tags disappearing when mouse released. Rlaager also noticed that if the buddy name contains an escaped entity, the offsets are screwy - fix that too.
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Thu, 09 Jun 2005 05:17:56 +0000 |
parents | 6663ad2386d9 |
children | fc464a0abccc |
rev | line source |
---|---|
8675 | 1 /* |
2 * nmcontact.h | |
3 * | |
8933 | 4 * Copyright (c) 2004 Novell, Inc. All Rights Reserved. |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; version 2 of the License. | |
8675 | 9 * |
8933 | 10 * This program is distributed in the hope that it will be useful, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 * GNU General Public License for more details. | |
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
14 * |
8933 | 15 * You should have received a copy of the GNU General Public License |
16 * along with this program; if not, write to the Free Software | |
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
8675 | 18 * |
19 */ | |
20 | |
21 #ifndef __NM_CONTACT_H__ | |
22 #define __NM_CONTACT_H__ | |
23 | |
24 #include <glib.h> | |
25 | |
26 typedef struct _NMContact NMContact; | |
27 typedef struct _NMContactProperty NMContactProperty; | |
28 typedef struct _NMFolder NMFolder; | |
29 | |
30 #include "nmfield.h" | |
31 #include "nmuser.h" | |
32 | |
33 /** | |
34 * Creates a contact | |
35 * | |
36 * Should be released by calling nm_release_contact | |
37 * | |
38 * @return The new NMContact | |
39 * | |
40 */ | |
41 NMContact *nm_create_contact(); | |
42 | |
43 /** | |
44 * Creates a contact from a field array representing the | |
45 * contact | |
46 * | |
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
47 * Should be released by calling nm_release_contact |
8675 | 48 * |
49 * @param fields Should be the NM_A_FA_CONTACT for | |
50 * the contact | |
51 * | |
52 * @return The new contact | |
53 * | |
54 */ | |
55 NMContact *nm_create_contact_from_fields(NMField * fields); | |
56 | |
57 /** | |
58 * Add a reference to an existing contact | |
59 * | |
60 * The reference should be released by calling | |
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
61 * nm_release_contact |
8675 | 62 * |
63 * @param contact The contact | |
64 * | |
65 */ | |
66 void nm_contact_add_ref(NMContact * contact); | |
67 | |
68 /** | |
69 * Update the contact list properties of the contact (sequence, parent id, etc.) | |
70 * | |
71 * @param contact The contact to update | |
72 * @param fields The fields to update from (should be a NM_A_FA_CONTACT array) | |
73 * | |
74 */ | |
75 void nm_contact_update_list_properties(NMContact * contact, NMField * fields); | |
76 | |
77 /** | |
78 * Release a contact reference | |
79 * | |
80 * @param contact The contact to release. | |
81 * | |
82 */ | |
83 void nm_release_contact(NMContact * contact); | |
84 | |
85 /** | |
86 * Get the display name of a contact | |
87 * | |
88 * @param contact The contact | |
89 * | |
90 * @return The display name of a contact | |
91 * | |
92 */ | |
93 const char *nm_contact_get_display_name(NMContact * contact); | |
94 | |
95 /** | |
96 * Get the DN of a contact | |
97 * | |
98 * @param contact The contact | |
99 * | |
100 * @return The DN of the contact | |
101 */ | |
102 const char *nm_contact_get_dn(NMContact * contact); | |
103 | |
104 /** | |
105 * Set the display name for a contact. This is called | |
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
106 * by nm_send_rename_contact. It should not be called |
8675 | 107 * directly (it does not change the display name on the |
108 * server side list -- nm_send_rename_conact does). | |
109 * | |
110 * @param contact The contact | |
111 * @param display_name The new display name | |
112 * | |
113 */ | |
114 void nm_contact_set_display_name(NMContact * contact, const char * display_name); | |
115 | |
116 /** | |
117 * Set the DN for the contact | |
118 * | |
119 * @param contact The contact | |
120 * @param dn The new DN for the contact | |
121 * | |
122 */ | |
123 void nm_contact_set_dn(NMContact * contact, const char * dn); | |
124 | |
125 /** | |
126 * Return a field array (NM_A_FA_CONTACT) representing the contact | |
127 * | |
128 * @param contact The contact | |
129 * | |
130 * @return A field array representing the contact | |
131 */ | |
132 NMField *nm_contact_to_fields(NMContact * contact); | |
133 | |
134 /** | |
135 * Set the user record for the contact | |
136 * | |
137 * @param contact The contact | |
138 * @param user_record The user record | |
139 * | |
140 */ | |
141 void nm_contact_set_user_record(NMContact * contact, NMUserRecord * user_record); | |
142 | |
143 /** | |
144 * Get the user record for the contact | |
145 * | |
146 * @param contact The contact | |
147 * | |
148 * @return The user record associated with the contact | |
149 * | |
150 */ | |
151 NMUserRecord *nm_contact_get_user_record(NMContact * contact); | |
152 | |
153 /** | |
154 * Get the user defined data for the contact | |
155 * | |
156 * @param contact The contact | |
157 * | |
158 * @return The user defined data for the contact | |
159 * | |
160 */ | |
161 gpointer nm_contact_get_data(NMContact * contact); | |
162 | |
163 /** | |
164 * Get the Object ID for the contact | |
165 * | |
166 * @param contact The contact | |
167 * | |
168 * @return The ID for the contact | |
169 */ | |
170 int nm_contact_get_id(NMContact * contact); | |
171 | |
172 /** | |
173 * Get the ID for the folder that the contact is in | |
174 * | |
175 * @param contact The contact | |
176 * | |
177 * @return The ID of the folder that contains the contact | |
178 * | |
179 */ | |
180 int nm_contact_get_parent_id(NMContact * contact); | |
181 | |
182 /** | |
183 * Get The userid of the contact. | |
184 * | |
185 * @param contact The contact | |
186 * | |
187 * @return The userid of the contact | |
188 * | |
189 */ | |
190 const char *nm_contact_get_userid(NMContact * contact); | |
191 | |
192 /** | |
193 * Get the display id of the contact | |
194 * | |
195 * @param contact The contact | |
196 * | |
197 * @return The display id of the contact | |
198 */ | |
199 const char *nm_contact_get_display_id(NMContact * contact); | |
200 | |
201 /** | |
202 * Set the user defined data for the contact | |
203 * | |
204 * @param contact The contact | |
205 * @param data The user defined data | |
206 * | |
207 */ | |
208 void nm_contact_set_data(NMContact * contact, gpointer data); | |
209 | |
210 /** | |
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
211 * Create a folder with the given name |
8675 | 212 * |
213 * @param name The name of the folder | |
214 * | |
215 * @return The new folder | |
216 * | |
217 */ | |
218 NMFolder *nm_create_folder(const char *name); | |
219 | |
220 /** | |
221 * Create a folder from a NM_A_FA_FOLDER field array | |
222 * | |
223 * @param fields The NM_A_FA_FOLDER field array | |
224 * | |
225 * @return The new folder | |
226 * | |
227 */ | |
228 NMFolder *nm_create_folder_from_fields(NMField * fields); | |
229 | |
230 /** | |
231 * Release a reference to a folder. | |
232 * | |
233 * @param folder The folder to release | |
234 * | |
235 */ | |
236 void nm_release_folder(NMFolder * folder); | |
237 | |
238 /** | |
239 * Return the number of subfolders for the given | |
240 * folder | |
241 * | |
242 * @param folder The folder | |
243 * | |
244 * @return The number of subfolders contained by folder | |
245 */ | |
246 int nm_folder_get_subfolder_count(NMFolder * folder); | |
247 | |
248 /** | |
249 * Get a subfolder | |
250 * | |
251 * @param folder The root folder | |
252 * @param index The index of the folder to get | |
253 * | |
254 * @return The subfolder at the given index | |
255 * | |
256 */ | |
257 NMFolder *nm_folder_get_subfolder(NMFolder * folder, int index); | |
258 | |
259 /** | |
260 * Get the number of contacts in the given folder | |
261 * | |
262 * @param folder The folder | |
263 * | |
264 * @return The number of contacts contained by folder | |
265 * | |
266 */ | |
267 int nm_folder_get_contact_count(NMFolder * folder); | |
268 | |
269 /** | |
270 * Get a contact in the given folder | |
271 * | |
272 * @param folder The folder | |
273 * @param index The index of the contact to get | |
274 * | |
275 * @return The contact at the given index | |
276 * | |
277 */ | |
278 NMContact *nm_folder_get_contact(NMFolder * folder, int index); | |
279 | |
280 /** | |
281 * Get the name of the folder | |
282 * | |
283 * @param folder The folder | |
284 * | |
285 * @return The name of the folder. | |
286 * | |
287 */ | |
288 const char *nm_folder_get_name(NMFolder * folder); | |
289 | |
290 /** | |
291 * Set the name of a folder. Do not call this directly. | |
292 * 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
|
293 * server side contact list. You must call |
8675 | 294 * nm_send_set_folder_name(). |
295 * | |
296 * @param folder The folder | |
297 * @param name The new name for the folder | |
298 * | |
299 */ | |
300 void nm_folder_set_name(NMFolder * folder, const char *name); | |
301 | |
302 /** | |
303 * Get Object ID for folder | |
304 * | |
305 * @param folder The folder | |
306 * | |
307 * @return The ID of the folder | |
308 * | |
309 */ | |
310 int nm_folder_get_id(NMFolder * folder); | |
311 | |
312 /** | |
313 * Add contacts and folders from fields into root | |
314 * | |
315 * @param user The logged in user | |
316 * @param root The root folder | |
317 * @param fields The contact list field array | |
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
318 * |
8675 | 319 */ |
320 void nm_folder_add_contacts_and_folders(NMUser * user, NMFolder * root, | |
321 NMField * fields); | |
322 /** | |
323 * Add a contact to the contact list. | |
324 * | |
325 * @param root_folder The root folder of the contact list | |
326 * @param contact The contact to add | |
327 * | |
328 */ | |
329 void nm_folder_add_contact_to_list(NMFolder * root_folder, | |
330 NMContact * contact); | |
331 | |
332 /** | |
333 * Update the contact list properties of the folder (sequence, parent id, etc.) | |
334 * | |
335 * @param folder The folder to update | |
336 * @param fields The fields to update from (should be a NM_A_FA_FOLDER array) | |
337 * | |
338 */ | |
339 void nm_folder_update_list_properties(NMFolder * folder, NMField * fields); | |
340 | |
341 /** | |
342 * Add folder to the contact list | |
343 * | |
344 * @param root_folder The root folder of the contact list | |
345 * @param folder The folder to add to the contact list | |
346 * | |
347 */ | |
348 void nm_folder_add_folder_to_list(NMFolder * root_folder, NMFolder * folder); | |
349 | |
350 /** | |
351 * Find the object with the given id | |
352 * | |
353 * @param root_folder The root folder of the contact list | |
354 * @param object_id The object id of the object to find | |
355 * | |
356 * @return The object with object id (either a contact or a folder) | |
357 */ | |
358 gpointer nm_folder_find_item_by_object_id(NMFolder * root_folder, | |
359 int object_id); | |
360 | |
361 /** | |
362 * Remove a contact from the folder | |
363 * | |
364 * @param folder The folder | |
365 * @param contact The contact to remove | |
366 * | |
367 */ | |
368 void nm_folder_remove_contact(NMFolder * folder, NMContact * contact); | |
369 | |
370 /** | |
371 * Find a contact in a folder by DN | |
372 * | |
373 * @param folder The folder to search | |
374 * @param dn The DN of the contact to find | |
375 * | |
376 * @return The contact if found, NULL otherwise | |
377 * | |
378 */ | |
379 NMContact *nm_folder_find_contact(NMFolder * folder, const char *dn); | |
380 | |
381 /** | |
382 * Find a contact in a folder by userid | |
383 * | |
384 * @param folder The folder to search | |
385 * @param userid The userid of the contact to find | |
386 * | |
387 * @return The contact if found, NULL otherwise | |
388 * | |
389 */ | |
390 NMContact *nm_folder_find_contact_by_userid(NMFolder * folder, | |
391 const char *userid); | |
8933 | 392 |
393 /** | |
394 * Find a contact in a folder by display id | |
395 * | |
396 * @param folder The folder to search | |
397 * @param display_id The userid of the contact to find | |
398 * | |
399 * @return The contact if found, NULL otherwise | |
400 * | |
401 */ | |
402 NMContact * | |
403 nm_folder_find_contact_by_display_id(NMFolder * folder, const char *display_id); | |
404 | |
8675 | 405 /** |
406 * Return a field array (NM_A_FA_FOLDER) representing the folder | |
407 * | |
408 * @param folder The folder | |
409 * | |
410 * @return A field array representing the folder | |
411 */ | |
412 NMField *nm_folder_to_fields(NMFolder * folder); | |
413 | |
414 #endif |