4 * Copyright (c) 2004 Novell, Inc. All Rights Reserved.
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.
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
21 #ifndef PURPLE_NOVELL_NMUSERRECORD_H
22 #define PURPLE_NOVELL_NMUSERRECORD_H
26 typedef struct _NMUserRecord NMUserRecord
;
27 typedef struct _NMProperty NMProperty
;
33 * Creates an NMUserRecord
35 * The NMUserRecord should be released by calling
36 * nm_release_user_record
38 * @return The new user record
41 NMUserRecord
*nm_create_user_record(void);
44 * Creates an NMUserRecord
46 * The NMUserRecord should be released by calling
47 * nm_release_user_record
49 * @param details Should be a NM_A_FA_USER_DETAILS
52 * @return The new user record
55 NMUserRecord
*nm_create_user_record_from_fields(NMField
* details
);
58 * Add a reference to an existing user_record
60 * The reference should be released by calling
61 * nm_release_user_record
63 * @param user_record The contact to addref
66 void nm_user_record_add_ref(NMUserRecord
* user_record
);
69 * Release a reference to the user record
71 * @param user_record The user record
74 void nm_release_user_record(NMUserRecord
* user_record
);
77 * Set the status for the user record
79 * @param user_record The user record
80 * @param status The status for the user
81 * @param text The status text for the user
84 void nm_user_record_set_status(NMUserRecord
* user_record
, NMSTATUS_T status
,
88 * Get the status for the user record
90 * @param user_record The user record
92 * @return The status for the user record
94 NMSTATUS_T
nm_user_record_get_status(NMUserRecord
* user_record
);
97 * Get the status text for the user record
99 * @param user_record The user record
101 * @return The status text if there is any, NULL otherwise
104 const char *nm_user_record_get_status_text(NMUserRecord
* user_record
);
107 * Set the DN for the user record
109 * @param user_record The user record
110 * @param dn The new DN for the user record
113 void nm_user_record_set_dn(NMUserRecord
* user_record
, const char *dn
);
116 * Get the DN for the user record
118 * @param user_record The user record
120 * @return The DN for the user record
122 const char *nm_user_record_get_dn(NMUserRecord
* user_record
);
125 * Set the user id for the
127 * @param user_record The user record
128 * @param userid The userid (CN) for the user record
131 void nm_user_record_set_userid(NMUserRecord
* user_record
, const char *userid
);
134 * Get the user id for the user record
136 * @param user_record The user record
138 * @return The user id for the user record
140 const char *nm_user_record_get_userid(NMUserRecord
* user_record
);
143 * Set the display id for the user record
145 * @param user_record The user record
146 * @param display_id The new display id for the user
149 void nm_user_record_set_display_id(NMUserRecord
* user_record
,
150 const char *display_id
);
153 * Get the display id for the user record
155 * @param user_record The user record
157 * @return The display id for the user record
159 const char *nm_user_record_get_display_id(NMUserRecord
* user_record
);
162 * Return whether or not the display id is an auth attribute or not.
164 * @param user_record The user record
166 * @return TRUE if display_id is an auth attribute, FALSE otherwise.
169 nm_user_record_get_auth_attr(NMUserRecord
*user_record
);
172 * Get the full name for the user record
174 * @param user_record The user record
176 * @return The full name for the user
178 const char *nm_user_record_get_full_name(NMUserRecord
* user_record
);
181 * Get the first name for the user record
183 * @param user_record The user record
185 * @return The first name for the user
187 const char *nm_user_record_get_first_name(NMUserRecord
* user_record
);
190 * Get the last name for the user record
192 * @param user_record The user record
194 * @return The last name for the user
196 const char *nm_user_record_get_last_name(NMUserRecord
* user_record
);
199 * Set the user defined data for the user record
201 * @param user_record The user record
202 * @param data The user defined data for the user record
205 void nm_user_record_set_data(NMUserRecord
* user_record
, gpointer data
);
208 * Get the user defined data for the user record
210 * @param user_record The user record
212 * @return The user defined data for the user record
214 gpointer
nm_user_record_get_data(NMUserRecord
* user_record
);
217 * Get the property count for the user record
219 * @param user_record The user record
221 * @return The number of information properties for the user record
224 int nm_user_record_get_property_count(NMUserRecord
* user_record
);
227 * Get an info property for the user record. The property must be released
228 * by calling nm_release_property()
230 * @param user_record The user record
231 * @param index The index of the property to get (zero based)
233 * @return The property
235 NMProperty
*nm_user_record_get_property(NMUserRecord
* user_record
, int index
);
238 * Release a property object
240 * @param property The property
243 void nm_release_property(NMProperty
* property
);
246 * Get the tag for the property
248 * @param property The property
250 * @return The tag of the property (i.e. "Email Address")
252 const char *nm_property_get_tag(NMProperty
* property
);
255 * Get the value for the property
257 * @param property The property
259 * @return The value of the property (i.e. "nobody@nowhere.com")
261 const char *nm_property_get_value(NMProperty
* property
);
264 * Copy a user record (deep copy). The dest user record must have already been
265 * created (nm_create_user_record)
267 * @param dest The destination of the copy
268 * @param src The source of the copy
271 void nm_user_record_copy(NMUserRecord
* dest
, NMUserRecord
* src
);
273 #endif /* PURPLE_NOVELL_NMUSERRECORD_H */