comparison src/protocols/novell/nmuser.h @ 8933:6663ad2386d9

[gaim-migrate @ 9703] "Initial Comment: * Added support for privacy settings * Added support for invites - ability to initiate multi-user conferences (chats). * Changed the license notice (to the standard GPL notice) * Fixed 64 bit issues * Incorporated Joe Shaw's patch for better error messages * Fixed the buddy list sync problems" --Mike Stoddard of Novell committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Sat, 15 May 2004 14:00:31 +0000
parents 92cbf9713795
children 54fb1f466953
comparison
equal deleted inserted replaced
8932:849507541e86 8933:6663ad2386d9
1 /* 1 /*
2 * nmuser.h 2 * nmuser.h
3 * 3 *
4 * Copyright © 2004 Unpublished Work of Novell, Inc. All Rights Reserved. 4 * Copyright (c) 2004 Novell, Inc. All Rights Reserved.
5 * 5 *
6 * THIS WORK IS AN UNPUBLISHED WORK OF NOVELL, INC. NO PART OF THIS WORK MAY BE 6 * This program is free software; you can redistribute it and/or modify
7 * USED, PRACTICED, PERFORMED, COPIED, DISTRIBUTED, REVISED, MODIFIED, 7 * it under the terms of the GNU General Public License as published by
8 * TRANSLATED, ABRIDGED, CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, 8 * the Free Software Foundation; version 2 of the License.
9 * RECAST, TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF NOVELL, 9 *
10 * INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT AUTHORIZATION COULD SUBJECT 10 * This program is distributed in the hope that it will be useful,
11 * THE PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY. 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * AS BETWEEN [GAIM] AND NOVELL, NOVELL GRANTS [GAIM] THE RIGHT TO REPUBLISH 13 * GNU General Public License for more details.
14 * THIS WORK UNDER THE GPL (GNU GENERAL PUBLIC LICENSE) WITH ALL RIGHTS AND 14 *
15 * LICENSES THEREUNDER. IF YOU HAVE RECEIVED THIS WORK DIRECTLY OR INDIRECTLY 15 * You should have received a copy of the GNU General Public License
16 * FROM [GAIM] AS PART OF SUCH A REPUBLICATION, YOU HAVE ALL RIGHTS AND LICENSES 16 * along with this program; if not, write to the Free Software
17 * GRANTED BY [GAIM] UNDER THE GPL. IN CONNECTION WITH SUCH A REPUBLICATION, IF 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * ANYTHING IN THIS NOTICE CONFLICTS WITH THE TERMS OF THE GPL, SUCH TERMS
19 * PREVAIL.
20 * 18 *
21 */ 19 */
22 20
23 #ifndef __NM_USER_H__ 21 #ifndef __NM_USER_H__
24 #define __NM_USER_H__ 22 #define __NM_USER_H__
104 guint32 conference_count; 102 guint32 conference_count;
105 103
106 /* Called when we receive an event */ 104 /* Called when we receive an event */
107 nm_event_cb evt_callback; 105 nm_event_cb evt_callback;
108 106
107 /* Privacy settings */
108 gboolean privacy_locked;
109 gboolean default_deny;
110 GSList *allow_list;
111 GSList *deny_list;
112
109 /* Pending requests. If we need to go to the server to more info 113 /* Pending requests. If we need to go to the server to more info
110 * before processing a request we will queue it up and process when 114 * before processing a request we will queue it up and process when
111 * we get a response 115 * we get a response
112 */ 116 */
113 GSList *pending_requests; 117 GSList *pending_requests;
119 * using the API 123 * using the API
120 */ 124 */
121 gpointer client_data; 125 gpointer client_data;
122 126
123 }; 127 };
124
125 128
126 #define NM_STATUS_UNKNOWN 0 129 #define NM_STATUS_UNKNOWN 0
127 #define NM_STATUS_OFFLINE 1 130 #define NM_STATUS_OFFLINE 1
128 #define NM_STATUS_AVAILABLE 2 131 #define NM_STATUS_AVAILABLE 2
129 #define NM_STATUS_BUSY 3 132 #define NM_STATUS_BUSY 3
135 #define NM_OK 0L 138 #define NM_OK 0L
136 #define NMERR_BAD_PARM (NMERR_BASE + 0x0001) 139 #define NMERR_BAD_PARM (NMERR_BASE + 0x0001)
137 #define NMERR_TCP_WRITE (NMERR_BASE + 0x0002) 140 #define NMERR_TCP_WRITE (NMERR_BASE + 0x0002)
138 #define NMERR_TCP_READ (NMERR_BASE + 0x0003) 141 #define NMERR_TCP_READ (NMERR_BASE + 0x0003)
139 #define NMERR_PROTOCOL (NMERR_BASE + 0x0004) 142 #define NMERR_PROTOCOL (NMERR_BASE + 0x0004)
140 #define NMERR_SSL_REDIRECT (NMERR_BASE + 0x0005) 143 #define NMERR_SERVER_REDIRECT (NMERR_BASE + 0x0005)
141 #define NMERR_CONFERENCE_NOT_FOUND (NMERR_BASE + 0x0006) 144 #define NMERR_CONFERENCE_NOT_FOUND (NMERR_BASE + 0x0006)
142 #define NMERR_CONFERENCE_NOT_INSTANTIATED (NMERR_BASE + 0x0007) 145 #define NMERR_CONFERENCE_NOT_INSTANTIATED (NMERR_BASE + 0x0007)
143 #define NMERR_FOLDER_EXISTS (NMERR_BASE + 0x0008) 146 #define NMERR_FOLDER_EXISTS (NMERR_BASE + 0x0008)
144 147
148 /* Errors that are returned from the server */
149 #define NMERR_SERVER_BASE 0xD100L
150 #define NMERR_ACCESS_DENIED (NMERR_SERVER_BASE + 0x0006)
151 #define NMERR_NOT_SUPPORTED (NMERR_SERVER_BASE + 0x000A)
152 #define NMERR_PASSWORD_EXPIRED (NMERR_SERVER_BASE + 0x000B)
153 #define NMERR_PASSWORD_INVALID (NMERR_SERVER_BASE + 0x000C)
154 #define NMERR_USER_NOT_FOUND (NMERR_SERVER_BASE + 0x000D)
155 #define NMERR_USER_DISABLED (NMERR_SERVER_BASE + 0x0010)
156 #define NMERR_DIRECTORY_FAILURE (NMERR_SERVER_BASE + 0x0011)
157 #define NMERR_HOST_NOT_FOUND (NMERR_SERVER_BASE + 0x0019)
158 #define NMERR_ADMIN_LOCKED (NMERR_SERVER_BASE + 0x001C)
159 #define NMERR_DUPLICATE_PARTICIPANT (NMERR_SERVER_BASE + 0x001F)
160 #define NMERR_SERVER_BUSY (NMERR_SERVER_BASE + 0x0023)
161 #define NMERR_OBJECT_NOT_FOUND (NMERR_SERVER_BASE + 0x0024)
162 #define NMERR_DIRECTORY_UPDATE (NMERR_SERVER_BASE + 0x0025)
163 #define NMERR_DUPLICATE_FOLDER (NMERR_SERVER_BASE + 0x0026)
164 #define NMERR_DUPLICATE_CONTACT (NMERR_SERVER_BASE + 0x0027)
165 #define NMERR_USER_NOT_ALLOWED (NMERR_SERVER_BASE + 0x0028)
166 #define NMERR_TOO_MANY_CONTACTS (NMERR_SERVER_BASE + 0x0029)
167 #define NMERR_CONFERENCE_NOT_FOUND_2 (NMERR_SERVER_BASE + 0x002B)
168 #define NMERR_TOO_MANY_FOLDERS (NMERR_SERVER_BASE + 0x002C)
169 #define NMERR_SERVER_PROTOCOL (NMERR_SERVER_BASE + 0x0030)
170 #define NMERR_CONVERSATION_INVITE (NMERR_SERVER_BASE + 0x0035)
171 #define NMERR_USER_BLOCKED (NMERR_SERVER_BASE + 0x0039)
172 #define NMERR_MASTER_ARCHIVE_MISSING (NMERR_SERVER_BASE + 0x003A)
173 #define NMERR_PASSWORD_EXPIRED_2 (NMERR_SERVER_BASE + 0x0042)
174 #define NMERR_CREDENTIALS_MISSING (NMERR_SERVER_BASE + 0x0046)
175 #define NMERR_AUTHENTICATION_FAILED (NMERR_SERVER_BASE + 0x0049)
176 #define NMERR_EVAL_CONNECTION_LIMIT (NMERR_SERVER_BASE + 0x004A)
145 177
146 /** 178 /**
147 * Initialize the user that we are going to login to the system as. 179 * Initialize the user that we are going to login to the system as.
148 * 180 *
149 * @param name The userid of the user 181 * @param name The userid of the user
205 /** 237 /**
206 * Send a create conference to the server. 238 * Send a create conference to the server.
207 * 239 *
208 * The response data sent to the callback will be NULL. 240 * The response data sent to the callback will be NULL.
209 * 241 *
210 * @param user The logged in User 242 * @param user The logged in User
211 * @param conference Conference to create 243 * @param conference Conference to create
212 * @param callback Function to call when we get the response from the server 244 * @param add_participants Add participant list on create?
213 * @param data User defined data to be passed to the callback function 245 * @param callback Function to call when we get the response from the server
246 * @param data User defined data to be passed to the callback function
214 * 247 *
215 * @return NM_OK if successfully sent, error otherwise 248 * @return NM_OK if successfully sent, error otherwise
216 */ 249 */
217 NMERR_T nm_send_create_conference(NMUser * user, NMConference * conference, 250 NMERR_T nm_send_create_conference(NMUser * user, NMConference * conference,
218 nm_response_cb callback, gpointer data); 251 nm_response_cb callback, gpointer data);
262 * @return NM_OK if successfully sent, error otherwise 295 * @return NM_OK if successfully sent, error otherwise
263 */ 296 */
264 NMERR_T nm_send_reject_conference(NMUser * user, NMConference * conference, 297 NMERR_T nm_send_reject_conference(NMUser * user, NMConference * conference,
265 nm_response_cb callback, gpointer data); 298 nm_response_cb callback, gpointer data);
266 299
267 /** 300
268 * Get details for a user from the server. 301 /**
302 * Send a conference invitation to the server.
303 *
304 * The response data sent to the callback will be NULL.
305 *
306 * @param user The logged in User
307 * @param conference Conference the user is rejecting
308 * @param user_record The user to invite
309 * @param message The invite message if there is one, NULL otherwise
310 * @param callback Function to call when we get the response from the server
311 * @param data User defined data to be passed to the callback function
312 *
313 *
314 * @return NM_OK if successfully sent, error otherwise
315 */
316 NMERR_T nm_send_conference_invite(NMUser *user, NMConference *conference, NMUserRecord *user_record,
317 const char *message, nm_response_cb callback, gpointer data);
318
319 /**
320 * Get details for a more than one user from the server.
269 * 321 *
270 * The response data sent to the callback will be an NMUserRecord which should be 322 * The response data sent to the callback will be an NMUserRecord which should be
271 * freed with nm_release_user_record 323 * freed with nm_release_user_record
272 * 324 *
273 * @param user The logged in User 325 * @param user The logged in User
326 * @param names Link list of user id's or dn's
327 * @param callback Function to call when we get the response from the server
328 * @param data User defined data to be passed to the callback function
329 *
330 * @return NM_OK if successfully sent, error otherwise
331 */
332 NMERR_T nm_send_multiple_get_details(NMUser * user, GSList *names,
333 nm_response_cb callback, gpointer data);
334
335 /**
336 * Get details for a user from the server.
337 *
338 * The response data sent to the callback will be an NMUserRecord which should be
339 * freed with nm_release_user_record
340 *
341 * @param user The logged in User
274 * @param name Userid or DN of the user to look up 342 * @param name Userid or DN of the user to look up
275 * @param callback Function to call when we get the response from the server 343 * @param callback Function to call when we get the response from the server
276 * @param data User defined data to be passed to the callback function 344 * @param data User defined data to be passed to the callback function
277 * 345 *
278 * @return NM_OK if successfully sent, error otherwise 346 * @return NM_OK if successfully sent, error otherwise
279 */ 347 */
280 NMERR_T nm_send_get_details(NMUser * user, const char *name, 348 NMERR_T nm_send_get_details(NMUser * user, const char *name,
281 nm_response_cb callback, gpointer data); 349 nm_response_cb callback, gpointer data);
282
283 /**
284 * Get details for multiple users from the server.
285 *
286 * The response data to the callback will be a list of NMUserRecord, which should be
287 * freed (each user record should be released with nm_release_user_record and the
288 * list should be freed)
289 *
290 * @param user The logged in User
291 * @param name Userid or DN of the user to look up
292 * @param callback Function to call when we get the response from the server
293 * @param data User defined data to be passed to the callback function
294 *
295 * @return NM_OK if successfully sent, error otherwise
296 */
297 NMERR_T nm_send_multiple_get_details(NMUser *user, GSList *names,
298 nm_response_cb callback, gpointer data);
299 350
300 /** 351 /**
301 * Send a message. 352 * Send a message.
302 * 353 *
303 * The response data sent to the callback will be NULL. 354 * The response data sent to the callback will be NULL.
462 */ 513 */
463 NMERR_T nm_send_get_status(NMUser * user, NMUserRecord * user_record, 514 NMERR_T nm_send_get_status(NMUser * user, NMUserRecord * user_record,
464 nm_response_cb callback, gpointer data); 515 nm_response_cb callback, gpointer data);
465 516
466 /** 517 /**
518 * Send a request to add an item to the allow or deny list.
519 *
520 * @param user The logged in User
521 * @param who The userid or DN of the user to add to list
522 * @param allow_list TRUE if adding to allow list, FALSE if adding to deny list
523 * @param callback Function to call when we get the response from the server
524 * @param data User defined data
525 *
526 * @return NM_OK if successfully sent, error otherwise
527 */
528 NMERR_T
529 nm_send_create_privacy_item(NMUser *user, const char *who, gboolean is_allowed,
530 nm_response_cb callback, gpointer data);
531
532 /**
533 * Send a request to remove an item from the allow or deny list.
534 *
535 * @param user The logged in User
536 * @param who The userid or DN of the user to add to list
537 * @param allow_list TRUE if removing from allow list, FALSE if removing from deny list
538 * @param callback Function to call when we get the response from the server
539 * @param data User defined data
540 *
541 * @return NM_OK if successfully sent, error otherwise
542 */
543 NMERR_T
544 nm_send_remove_privacy_item(NMUser *user, const char *dn, gboolean allow_list,
545 nm_response_cb callback, gpointer data);
546
547 /**
548 * Send a request to change the default privacy setting to deny all or allow all
549 *
550 * @param user The logged in User
551 * @param default_deny TRUE if default should be changed to deny all
552 * @param callback Function to call when we get the response from the server
553 * @param data User defined data
554 *
555 * @return NM_OK if successfully sent, error otherwise
556 */
557 NMERR_T
558 nm_send_set_privacy_default(NMUser *user, gboolean default_deny,
559 nm_response_cb callback, gpointer data);
560
561 /**
467 * Reads a response/event from the server and processes it. 562 * Reads a response/event from the server and processes it.
468 * 563 *
469 * @param user The logged in User 564 * @param user The logged in User
470 */ 565 */
471 NMERR_T nm_process_new_data(NMUser * user); 566 NMERR_T nm_process_new_data(NMUser * user);
516 const char *nm_lookup_dn(NMUser * user, const char *display_id); 611 const char *nm_lookup_dn(NMUser * user, const char *display_id);
517 612
518 nm_event_cb nm_user_get_event_callback(NMUser * user); 613 nm_event_cb nm_user_get_event_callback(NMUser * user);
519 614
520 NMConn *nm_user_get_conn(NMUser * user); 615 NMConn *nm_user_get_conn(NMUser * user);
616
617 gboolean nm_user_is_privacy_locked(NMUser *user);
521 618
522 /** Some utility functions **/ 619 /** Some utility functions **/
523 620
524 /** 621 /**
525 * Check to see if the conference GUIDs are equivalent. 622 * Check to see if the conference GUIDs are equivalent.
564 * @return Dotted equivalent of typed (must be freed). 661 * @return Dotted equivalent of typed (must be freed).
565 * 662 *
566 */ 663 */
567 char *nm_typed_to_dotted(const char *typed); 664 char *nm_typed_to_dotted(const char *typed);
568 665
666 /**
667 * Return a string representation of the error code.
668 *
669 * @param error NMERR_T to convert to string
670 *
671 * @return String representation.
672 */
673 const char *nm_error_to_string (NMERR_T err);
674
569 #endif 675 #endif