src/protocols/novell/nmuser.h

changeset 8684
7ec649752daa
parent 8675
4a14d9ec84a5
child 8735
01248ea222d3
equal deleted inserted replaced
8683:3eb7902c2b4b 8684:7ec649752daa
7 * USED, PRACTICED, PERFORMED, COPIED, DISTRIBUTED, REVISED, MODIFIED, 7 * USED, PRACTICED, PERFORMED, COPIED, DISTRIBUTED, REVISED, MODIFIED,
8 * TRANSLATED, ABRIDGED, CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, 8 * TRANSLATED, ABRIDGED, CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED,
9 * RECAST, TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF NOVELL, 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 10 * INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT AUTHORIZATION COULD SUBJECT
11 * THE PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY. 11 * THE PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY.
12 * 12 *
13 * AS BETWEEN [GAIM] AND NOVELL, NOVELL GRANTS [GAIM] THE RIGHT TO REPUBLISH 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 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 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 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 17 * GRANTED BY [GAIM] UNDER THE GPL. IN CONNECTION WITH SUCH A REPUBLICATION, IF
141 #define NMERR_CONFERENCE_NOT_FOUND (NMERR_BASE + 0x0006) 141 #define NMERR_CONFERENCE_NOT_FOUND (NMERR_BASE + 0x0006)
142 #define NMERR_CONFERENCE_NOT_INSTANTIATED (NMERR_BASE + 0x0007) 142 #define NMERR_CONFERENCE_NOT_INSTANTIATED (NMERR_BASE + 0x0007)
143 #define NMERR_FOLDER_EXISTS (NMERR_BASE + 0x0008) 143 #define NMERR_FOLDER_EXISTS (NMERR_BASE + 0x0008)
144 144
145 145
146 /** 146 /**
147 * Initialize the user that we are going to login to the system as. 147 * Initialize the user that we are going to login to the system as.
148 * 148 *
149 * @param name The userid of the user 149 * @param name The userid of the user
150 * @param server IP Address of server 150 * @param server IP Address of server
151 * @param port Port to connect to on the server 151 * @param port Port to connect to on the server
157 */ 157 */
158 NMUser *nm_initialize_user(const char *name, const char *server, int port, 158 NMUser *nm_initialize_user(const char *name, const char *server, int port,
159 gpointer data, nm_event_cb event_callback); 159 gpointer data, nm_event_cb event_callback);
160 160
161 161
162 /** 162 /**
163 * Free up resources associated with the user object. 163 * Free up resources associated with the user object.
164 * 164 *
165 * @param user The user to deinitialize 165 * @param user The user to deinitialize
166 */ 166 */
167 void nm_deinitialize_user(NMUser * user); 167 void nm_deinitialize_user(NMUser * user);
168 168
169 /** 169 /**
170 * Send a login request to the server. 170 * Send a login request to the server.
171 * 171 *
172 * The response data sent to the callback will be NULL. 172 * The response data sent to the callback will be NULL.
173 * 173 *
174 * @param user The User to login -- must be initialized 174 * @param user The User to login -- must be initialized
175 * @param pwd The password of the user 175 * @param pwd The password of the user
176 * @param my_addr The address of the client machine 176 * @param my_addr The address of the client machine
177 * @param user_agent String describing the client (eg. "Gaim/0.76 (Linux; 2.4.20)") 177 * @param user_agent String describing the client (eg. "Gaim/0.76 (Linux; 2.4.20)")
178 * @param callback Function to call when we get the response from the server 178 * @param callback Function to call when we get the response from the server
179 * @param data User defined data to be passed to the callback function 179 * @param data User defined data to be passed to the callback function
180 * 180 *
181 * 181 *
182 * @return NM_OK if login is sent successfully, error otherwise. 182 * @return NM_OK if login is sent successfully, error otherwise.
183 */ 183 */
184 NMERR_T nm_send_login(NMUser * user, const char *pwd, const char *my_addr, 184 NMERR_T nm_send_login(NMUser * user, const char *pwd, const char *my_addr,
185 const char *user_agent, nm_response_cb callback, 185 const char *user_agent, nm_response_cb callback,
186 gpointer data); 186 gpointer data);
187 187
188 /** 188 /**
189 * Send a set status request to the server. 189 * Send a set status request to the server.
190 * 190 *
191 * The response data sent to the callback will be NULL. 191 * The response data sent to the callback will be NULL.
192 * 192 *
193 * @param user The logged in User 193 * @param user The logged in User
200 */ 200 */
201 NMERR_T nm_send_set_status(NMUser * user, int status, const char *text, 201 NMERR_T nm_send_set_status(NMUser * user, int status, const char *text,
202 const char *auto_resp, nm_response_cb callback, 202 const char *auto_resp, nm_response_cb callback,
203 gpointer data); 203 gpointer data);
204 204
205 /** 205 /**
206 * Send a create conference to the server. 206 * Send a create conference to the server.
207 * 207 *
208 * The response data sent to the callback will be NULL. 208 * The response data sent to the callback will be NULL.
209 * 209 *
210 * @param user The logged in User 210 * @param user The logged in User
215 * @return NM_OK if successfully sent, error otherwise 215 * @return NM_OK if successfully sent, error otherwise
216 */ 216 */
217 NMERR_T nm_send_create_conference(NMUser * user, NMConference * conference, 217 NMERR_T nm_send_create_conference(NMUser * user, NMConference * conference,
218 nm_response_cb callback, gpointer data); 218 nm_response_cb callback, gpointer data);
219 219
220 /** 220 /**
221 * Tell server we have left the conference. 221 * Tell server we have left the conference.
222 * 222 *
223 * The response data sent to the callback will be NULL. 223 * The response data sent to the callback will be NULL.
224 * 224 *
225 * @param user The logged in User 225 * @param user The logged in User
226 * @param conference Conference the user is leaving 226 * @param conference Conference the user is leaving
227 * @param callback Function to call when we get the response from the server 227 * @param callback Function to call when we get the response from the server
230 * @return NM_OK if successfully sent, error otherwise 230 * @return NM_OK if successfully sent, error otherwise
231 */ 231 */
232 NMERR_T nm_send_leave_conference(NMUser * user, NMConference * conference, 232 NMERR_T nm_send_leave_conference(NMUser * user, NMConference * conference,
233 nm_response_cb callback, gpointer data); 233 nm_response_cb callback, gpointer data);
234 234
235 /** 235 /**
236 * Send a join conference request to the server. 236 * Send a join conference request to the server.
237 * 237 *
238 * The response data sent to the callback will be NULL. 238 * The response data sent to the callback will be NULL.
239 * 239 *
240 * @param user The logged in User 240 * @param user The logged in User
246 * @return NM_OK if successfully sent, error otherwise 246 * @return NM_OK if successfully sent, error otherwise
247 */ 247 */
248 NMERR_T nm_send_join_conference(NMUser * user, NMConference * conference, 248 NMERR_T nm_send_join_conference(NMUser * user, NMConference * conference,
249 nm_response_cb callback, gpointer data); 249 nm_response_cb callback, gpointer data);
250 250
251 /** 251 /**
252 * Send a conference reject request to the server. 252 * Send a conference reject request to the server.
253 * 253 *
254 * The response data sent to the callback will be NULL. 254 * The response data sent to the callback will be NULL.
255 * 255 *
256 * @param user The logged in User 256 * @param user The logged in User
257 * @param conference Conference the user is rejecting 257 * @param conference Conference the user is rejecting
258 * @param callback Function to call when we get the response from the server 258 * @param callback Function to call when we get the response from the server
259 * @param data User defined data to be passed to the callback function 259 * @param data User defined data to be passed to the callback function
262 * @return NM_OK if successfully sent, error otherwise 262 * @return NM_OK if successfully sent, error otherwise
263 */ 263 */
264 NMERR_T nm_send_reject_conference(NMUser * user, NMConference * conference, 264 NMERR_T nm_send_reject_conference(NMUser * user, NMConference * conference,
265 nm_response_cb callback, gpointer data); 265 nm_response_cb callback, gpointer data);
266 266
267 /** 267 /**
268 * Get details for a user from the server. 268 * Get details for a user from the server.
269 * 269 *
270 * The response data sent to the callback will be an NMUserRecord which should be 270 * The response data sent to the callback will be an NMUserRecord which should be
271 * freed with nm_release_user_record 271 * freed with nm_release_user_record
272 * 272 *
273 * @param user The logged in User 273 * @param user The logged in User
274 * @param name Userid or DN of the user to look up 274 * @param name Userid or DN of the user to look up
278 * @return NM_OK if successfully sent, error otherwise 278 * @return NM_OK if successfully sent, error otherwise
279 */ 279 */
280 NMERR_T nm_send_get_details(NMUser * user, const char *name, 280 NMERR_T nm_send_get_details(NMUser * user, const char *name,
281 nm_response_cb callback, gpointer data); 281 nm_response_cb callback, gpointer data);
282 282
283 /** 283 /**
284 * Get details for multiple users from the server. 284 * Get details for multiple users from the server.
285 * 285 *
286 * The response data to the callback will be a list of NMUserRecord, which should be 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 287 * freed (each user record should be released with nm_release_user_record and the
288 * list should be freed) 288 * list should be freed)
289 * 289 *
290 * @param user The logged in User 290 * @param user The logged in User
291 * @param name Userid or DN of the user to look up 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 292 * @param callback Function to call when we get the response from the server
295 * @return NM_OK if successfully sent, error otherwise 295 * @return NM_OK if successfully sent, error otherwise
296 */ 296 */
297 NMERR_T nm_send_multiple_get_details(NMUser *user, GSList *names, 297 NMERR_T nm_send_multiple_get_details(NMUser *user, GSList *names,
298 nm_response_cb callback, gpointer data); 298 nm_response_cb callback, gpointer data);
299 299
300 /** 300 /**
301 * Send a message. 301 * Send a message.
302 * 302 *
303 * The response data sent to the callback will be NULL. 303 * The response data sent to the callback will be NULL.
304 * 304 *
305 * @param user The logged in User 305 * @param user The logged in User
309 * @return NM_OK if successfully sent, error otherwise 309 * @return NM_OK if successfully sent, error otherwise
310 */ 310 */
311 NMERR_T nm_send_message(NMUser * user, NMMessage * message, 311 NMERR_T nm_send_message(NMUser * user, NMMessage * message,
312 nm_response_cb callback); 312 nm_response_cb callback);
313 313
314 /** 314 /**
315 * Sends a typing event to the server. 315 * Sends a typing event to the server.
316 * 316 *
317 * The response data sent to the callback will be NULL. 317 * The response data sent to the callback will be NULL.
318 * 318 *
319 * @param user The logged in User 319 * @param user The logged in User
325 * @return NM_OK if successfully sent, error otherwise 325 * @return NM_OK if successfully sent, error otherwise
326 */ 326 */
327 NMERR_T nm_send_typing(NMUser * user, NMConference * conf, 327 NMERR_T nm_send_typing(NMUser * user, NMConference * conf,
328 gboolean typing, nm_response_cb callback); 328 gboolean typing, nm_response_cb callback);
329 329
330 /** 330 /**
331 * Send a create contact request to the server. 331 * Send a create contact request to the server.
332 * 332 *
333 * The given folder should already exist on the server. If not, 333 * The given folder should already exist on the server. If not,
334 * the call will fail. 334 * the call will fail.
335 * 335 *
346 */ 346 */
347 NMERR_T nm_send_create_contact(NMUser * user, NMFolder * folder, 347 NMERR_T nm_send_create_contact(NMUser * user, NMFolder * folder,
348 NMContact * contact, nm_response_cb callback, 348 NMContact * contact, nm_response_cb callback,
349 gpointer data); 349 gpointer data);
350 350
351 /** 351 /**
352 * Send a remove contact request to the server. 352 * Send a remove contact request to the server.
353 * 353 *
354 * The response data sent to the callback will be NULL. 354 * The response data sent to the callback will be NULL.
355 * 355 *
356 * @param user The logged in User 356 * @param user The logged in User
363 */ 363 */
364 NMERR_T nm_send_remove_contact(NMUser * user, NMFolder * folder, 364 NMERR_T nm_send_remove_contact(NMUser * user, NMFolder * folder,
365 NMContact * contact, nm_response_cb callback, 365 NMContact * contact, nm_response_cb callback,
366 gpointer data); 366 gpointer data);
367 367
368 /** 368 /**
369 * Send a create folder request to the server. 369 * Send a create folder request to the server.
370 * 370 *
371 * The response data sent to the callback will be a NMFolder which should be 371 * The response data sent to the callback will be a NMFolder which should be
372 * released with nm_release_folder 372 * released with nm_release_folder
373 * 373 *
379 * @return NM_OK if successfully sent, error otherwise 379 * @return NM_OK if successfully sent, error otherwise
380 */ 380 */
381 NMERR_T nm_send_create_folder(NMUser * user, const char *name, 381 NMERR_T nm_send_create_folder(NMUser * user, const char *name,
382 nm_response_cb callback, gpointer data); 382 nm_response_cb callback, gpointer data);
383 383
384 /** 384 /**
385 * Send a delete folder request to the server. 385 * Send a delete folder request to the server.
386 * 386 *
387 * The response data sent to the callback will be NULL. 387 * The response data sent to the callback will be NULL.
388 * 388 *
389 * @param user The logged in User 389 * @param user The logged in User
394 * @return NM_OK if successfully sent, error otherwise 394 * @return NM_OK if successfully sent, error otherwise
395 */ 395 */
396 NMERR_T nm_send_remove_folder(NMUser * user, NMFolder * folder, 396 NMERR_T nm_send_remove_folder(NMUser * user, NMFolder * folder,
397 nm_response_cb callback, gpointer data); 397 nm_response_cb callback, gpointer data);
398 398
399 /** 399 /**
400 * Send a rename contact request to the server. 400 * Send a rename contact request to the server.
401 * 401 *
402 * The response data sent to the callback will be NULL. 402 * The response data sent to the callback will be NULL.
403 * 403 *
404 * @param user The logged in User 404 * @param user The logged in User
411 */ 411 */
412 NMERR_T nm_send_rename_contact(NMUser * user, NMContact * contact, 412 NMERR_T nm_send_rename_contact(NMUser * user, NMContact * contact,
413 const char *new_name, nm_response_cb callback, 413 const char *new_name, nm_response_cb callback,
414 gpointer data); 414 gpointer data);
415 415
416 /** 416 /**
417 * Send a rename folder request to the server. 417 * Send a rename folder request to the server.
418 * 418 *
419 * The response data sent to the callback will be NULL. 419 * The response data sent to the callback will be NULL.
420 * 420 *
421 * @param user The logged in User 421 * @param user The logged in User
428 */ 428 */
429 NMERR_T nm_send_rename_folder(NMUser * user, NMFolder * folder, 429 NMERR_T nm_send_rename_folder(NMUser * user, NMFolder * folder,
430 const char *new_name, nm_response_cb callback, 430 const char *new_name, nm_response_cb callback,
431 gpointer data); 431 gpointer data);
432 432
433 /** 433 /**
434 * Send a move contact request to the server. 434 * Send a move contact request to the server.
435 * 435 *
436 * The response data sent to the callback will be NULL. 436 * The response data sent to the callback will be NULL.
437 * 437 *
438 * @param user The logged in User 438 * @param user The logged in User
445 */ 445 */
446 NMERR_T nm_send_move_contact(NMUser * user, NMContact * contact, 446 NMERR_T nm_send_move_contact(NMUser * user, NMContact * contact,
447 NMFolder * folder, nm_response_cb callback, 447 NMFolder * folder, nm_response_cb callback,
448 gpointer data); 448 gpointer data);
449 449
450 /** 450 /**
451 * Send a get status request to the server. 451 * Send a get status request to the server.
452 * 452 *
453 * The response data sent to the callback will be a NMUserRecord. 453 * The response data sent to the callback will be a NMUserRecord.
454 * 454 *
455 * @param user The logged in User 455 * @param user The logged in User
461 * @return NM_OK if successfully sent, error otherwise 461 * @return NM_OK if successfully sent, error otherwise
462 */ 462 */
463 NMERR_T nm_send_get_status(NMUser * user, NMUserRecord * user_record, 463 NMERR_T nm_send_get_status(NMUser * user, NMUserRecord * user_record,
464 nm_response_cb callback, gpointer data); 464 nm_response_cb callback, gpointer data);
465 465
466 /** 466 /**
467 * Reads a response/event from the server and processes it. 467 * Reads a response/event from the server and processes it.
468 * 468 *
469 * @param user The logged in User 469 * @param user The logged in User
470 */ 470 */
471 NMERR_T nm_process_new_data(NMUser * user); 471 NMERR_T nm_process_new_data(NMUser * user);
472 472
473 /** 473 /**
474 * Return the root folder of the contact list 474 * Return the root folder of the contact list
475 * 475 *
476 * @param user The logged in User 476 * @param user The logged in User
477 * 477 *
478 * @return Root folder 478 * @return Root folder
479 */ 479 */
480 NMFolder *nm_get_root_folder(NMUser * user); 480 NMFolder *nm_get_root_folder(NMUser * user);
481 481
482 /** 482 /**
483 * Create the contact list based on the login fields 483 * Create the contact list based on the login fields
484 * 484 *
485 * @param user The logged in User 485 * @param user The logged in User
486 * 486 *
487 */ 487 */
520 NMConn *nm_user_get_conn(NMUser * user); 520 NMConn *nm_user_get_conn(NMUser * user);
521 521
522 /** Some utility functions **/ 522 /** Some utility functions **/
523 523
524 /** 524 /**
525 * Check to see if the conference GUIDs are equivalent. 525 * Check to see if the conference GUIDs are equivalent.
526 * 526 *
527 * @param guid1 First guid to compare 527 * @param guid1 First guid to compare
528 * @param guid2 Second guid to compare 528 * @param guid2 Second guid to compare
529 * 529 *
530 * @return TRUE if conference GUIDs are equivalent, FALSE otherwise. 530 * @return TRUE if conference GUIDs are equivalent, FALSE otherwise.

mercurial