Mercurial > pidgin
annotate src/protocols/novell/nmuser.h @ 8735:92cbf9713795
[gaim-migrate @ 9490]
Patch by Jonathan Champ to corect the vairous speling mistakes we hav e in
the coments and documentaion. Thansk Jonathan!
committer: Tailor Script <tailor@pidgin.im>
| author | Christian Hammond <chipx86@chipx86.com> |
|---|---|
| date | Wed, 21 Apr 2004 01:34:26 +0000 |
| parents | 046dd8ef2920 |
| children | 6663ad2386d9 |
| rev | line source |
|---|---|
| 8675 | 1 /* |
| 2 * nmuser.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_USER_H__ | |
| 24 #define __NM_USER_H__ | |
| 25 | |
| 26 #include <glib.h> | |
| 27 #include <stdio.h> | |
| 28 #include <stdlib.h> | |
| 29 | |
| 30 typedef guint32 NMERR_T; | |
| 31 typedef int NMSTATUS_T; | |
| 32 | |
| 33 typedef struct _NMUser NMUser; | |
| 34 | |
| 35 typedef enum | |
| 36 { | |
| 37 NMREQUEST_TYPE_LOGIN = 0, | |
| 38 NMREQUEST_TYPE_LOGOUT, | |
| 39 NMREQUEST_TYPE_SETSTATUS, | |
| 40 NMREQUEST_TYPE_GETDETAILS, | |
| 41 NMREQUEST_TYPE_CREATECONF, | |
| 42 NMREQUEST_TYPE_SENDMESSAGE, | |
| 43 NMREQUEST_TYPE_JOINCONF, | |
| 44 NMREQUEST_TYPE_LEAVECONF, | |
| 45 NMREQUEST_TYPE_REJECTCONF, | |
| 46 NMREQUEST_TYPE_SENDTYPING, | |
| 47 NMREQUEST_TYPE_CREATECONTACT, | |
| 48 NMREQUEST_TYPE_DELETECONTACT | |
| 49 | |
| 50 } NMRequestType; | |
| 51 | |
| 52 #include "debug.h" | |
| 53 #include "nmmessage.h" | |
| 54 #include "nmconference.h" | |
| 55 #include "nmcontact.h" | |
| 56 #include "nmuserrecord.h" | |
| 57 #include "nmfield.h" | |
| 58 #include "nmevent.h" | |
| 59 | |
| 60 /* Callback typedefs */ | |
| 61 typedef void (*nm_response_cb) (NMUser * user, NMERR_T ret_code, | |
| 62 gpointer resp_data, gpointer user_data); | |
| 63 | |
| 64 typedef void (*nm_event_cb) (NMUser * user, NMEvent * event); | |
| 65 | |
| 66 #include "nmrequest.h" | |
| 67 #include "nmconn.h" | |
| 68 | |
| 69 /* This represents user that we are currently logged in as */ | |
| 70 struct _NMUser | |
| 71 { | |
| 72 | |
| 73 char *name; | |
| 74 | |
| 75 NMSTATUS_T status; | |
| 76 | |
| 77 /* A copy of the login response fields */ | |
| 78 NMField *fields; | |
| 79 | |
| 80 /* The user record for this user */ | |
| 81 NMUserRecord *user_record; | |
| 82 | |
| 83 /* Our connection information */ | |
| 84 NMConn *conn; | |
| 85 | |
| 86 /* Our public IP address */ | |
| 87 char *address; | |
| 88 | |
| 89 /* This is the contact list */ | |
| 90 NMFolder *root_folder; | |
| 91 | |
| 92 /* All contacts that we know about hashed by dn */ | |
| 93 GHashTable *contacts; | |
| 94 | |
| 95 /* All user records hashed by dn */ | |
| 96 GHashTable *user_records; | |
| 97 | |
| 98 /* DN lookup */ | |
| 99 GHashTable *display_id_to_dn; | |
| 100 | |
| 101 /* One on one conversations indexed by recipient's dn */ | |
| 102 GSList *conferences; | |
| 103 | |
| 104 guint32 conference_count; | |
| 105 | |
| 106 /* Called when we receive an event */ | |
| 107 nm_event_cb evt_callback; | |
| 108 | |
| 109 /* 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 | |
| 111 * we get a response | |
| 112 */ | |
| 113 GSList *pending_requests; | |
| 114 | |
| 115 /* Pending events. Same as above except for events. */ | |
| 116 GSList *pending_events; | |
| 117 | |
| 118 /* Generic pointer to data needed by the client | |
| 119 * using the API | |
| 120 */ | |
| 121 gpointer client_data; | |
| 122 | |
| 123 }; | |
| 124 | |
| 125 | |
| 126 #define NM_STATUS_UNKNOWN 0 | |
| 127 #define NM_STATUS_OFFLINE 1 | |
| 128 #define NM_STATUS_AVAILABLE 2 | |
| 129 #define NM_STATUS_BUSY 3 | |
| 130 #define NM_STATUS_AWAY 4 | |
| 131 #define NM_STATUS_AWAY_IDLE 5 | |
| 132 #define NM_STATUS_INVALID 6 | |
| 133 | |
| 134 #define NMERR_BASE 0x2000L | |
| 135 #define NM_OK 0L | |
| 136 #define NMERR_BAD_PARM (NMERR_BASE + 0x0001) | |
| 137 #define NMERR_TCP_WRITE (NMERR_BASE + 0x0002) | |
| 138 #define NMERR_TCP_READ (NMERR_BASE + 0x0003) | |
| 139 #define NMERR_PROTOCOL (NMERR_BASE + 0x0004) | |
| 140 #define NMERR_SSL_REDIRECT (NMERR_BASE + 0x0005) | |
| 141 #define NMERR_CONFERENCE_NOT_FOUND (NMERR_BASE + 0x0006) | |
| 142 #define NMERR_CONFERENCE_NOT_INSTANTIATED (NMERR_BASE + 0x0007) | |
| 143 #define NMERR_FOLDER_EXISTS (NMERR_BASE + 0x0008) | |
| 144 | |
| 145 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
146 /** |
| 8675 | 147 * Initialize the user that we are going to login to the system as. |
| 148 * | |
| 149 * @param name The userid of the user | |
| 150 * @param server IP Address of server | |
| 151 * @param port Port to connect to on the server | |
| 152 * @param data Client data to associate with the user | |
|
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8684
diff
changeset
|
153 * @param event_callback Function to call when we receive an event |
| 8675 | 154 * |
| 155 * @return The initialized user object. Must be freed by calling | |
| 156 * nm_deinitialize_user | |
| 157 */ | |
| 158 NMUser *nm_initialize_user(const char *name, const char *server, int port, | |
| 159 gpointer data, nm_event_cb event_callback); | |
| 160 | |
| 161 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
162 /** |
| 8675 | 163 * Free up resources associated with the user object. |
| 164 * | |
| 165 * @param user The user to deinitialize | |
| 166 */ | |
| 167 void nm_deinitialize_user(NMUser * user); | |
| 168 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
169 /** |
| 8675 | 170 * Send a login request to the server. |
| 171 * | |
| 172 * The response data sent to the callback will be NULL. | |
| 173 * | |
| 174 * @param user The User to login -- must be initialized | |
| 175 * @param pwd The password of the user | |
| 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)") | |
| 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 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
180 * |
| 8675 | 181 * |
| 182 * @return NM_OK if login is sent successfully, error otherwise. | |
| 183 */ | |
| 184 NMERR_T nm_send_login(NMUser * user, const char *pwd, const char *my_addr, | |
| 185 const char *user_agent, nm_response_cb callback, | |
| 186 gpointer data); | |
| 187 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
188 /** |
| 8675 | 189 * Send a set status request to the server. |
| 190 * | |
| 191 * The response data sent to the callback will be NULL. | |
| 192 * | |
| 193 * @param user The logged in User | |
| 194 * @param dn The DN of the user (if known, or NULL if not known) | |
| 195 * @param address IP Address of server | |
| 196 * @param callback Function to call when we get the response from the server | |
| 197 * | |
| 198 * | |
| 199 * @return NM_OK if successfully sent, error otherwise | |
| 200 */ | |
| 201 NMERR_T nm_send_set_status(NMUser * user, int status, const char *text, | |
| 202 const char *auto_resp, nm_response_cb callback, | |
| 203 gpointer data); | |
| 204 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
205 /** |
| 8675 | 206 * Send a create conference to the server. |
| 207 * | |
| 208 * The response data sent to the callback will be NULL. | |
| 209 * | |
| 210 * @param user The logged in User | |
| 211 * @param conference Conference to create | |
| 212 * @param callback Function to call when we get the response from the server | |
| 213 * @param data User defined data to be passed to the callback function | |
| 214 * | |
| 215 * @return NM_OK if successfully sent, error otherwise | |
| 216 */ | |
| 217 NMERR_T nm_send_create_conference(NMUser * user, NMConference * conference, | |
| 218 nm_response_cb callback, gpointer data); | |
| 219 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
220 /** |
| 8675 | 221 * Tell server we have left the conference. |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
222 * |
| 8675 | 223 * The response data sent to the callback will be NULL. |
| 224 * | |
| 225 * @param user The logged in User | |
| 226 * @param conference Conference the user is leaving | |
| 227 * @param callback Function to call when we get the response from the server | |
| 228 * @param data User defined data to be passed to the callback function | |
| 229 * | |
| 230 * @return NM_OK if successfully sent, error otherwise | |
| 231 */ | |
| 232 NMERR_T nm_send_leave_conference(NMUser * user, NMConference * conference, | |
| 233 nm_response_cb callback, gpointer data); | |
| 234 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
235 /** |
| 8675 | 236 * Send a join conference request to the server. |
| 237 * | |
| 238 * The response data sent to the callback will be NULL. | |
| 239 * | |
| 240 * @param user The logged in User | |
| 241 * @param conference Conference the user is joining | |
| 242 * @param callback Function to call when we get the response from the server | |
| 243 * @param data User defined data to be passed to the callback function | |
| 244 * | |
| 245 * | |
| 246 * @return NM_OK if successfully sent, error otherwise | |
| 247 */ | |
| 248 NMERR_T nm_send_join_conference(NMUser * user, NMConference * conference, | |
| 249 nm_response_cb callback, gpointer data); | |
| 250 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
251 /** |
| 8675 | 252 * Send a conference reject request to the server. |
| 253 * | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
254 * The response data sent to the callback will be NULL. |
| 8675 | 255 * |
| 256 * @param user The logged in User | |
| 257 * @param conference Conference the user is rejecting | |
| 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 | |
| 260 * | |
| 261 * | |
| 262 * @return NM_OK if successfully sent, error otherwise | |
| 263 */ | |
| 264 NMERR_T nm_send_reject_conference(NMUser * user, NMConference * conference, | |
| 265 nm_response_cb callback, gpointer data); | |
| 266 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
267 /** |
| 8675 | 268 * Get details for a user from the server. |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
269 * |
| 8675 | 270 * The response data sent to the callback will be an NMUserRecord which should be |
| 271 * freed with nm_release_user_record | |
| 272 * | |
| 273 * @param user The logged in User | |
| 274 * @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 | |
| 276 * @param data User defined data to be passed to the callback function | |
| 277 * | |
| 278 * @return NM_OK if successfully sent, error otherwise | |
| 279 */ | |
| 280 NMERR_T nm_send_get_details(NMUser * user, const char *name, | |
| 281 nm_response_cb callback, gpointer data); | |
| 282 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
283 /** |
| 8675 | 284 * Get details for multiple users from the server. |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
285 * |
| 8675 | 286 * The response data to the callback will be a list of NMUserRecord, which should be |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
287 * freed (each user record should be released with nm_release_user_record and the |
| 8675 | 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 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
300 /** |
| 8675 | 301 * Send a message. |
| 302 * | |
| 303 * The response data sent to the callback will be NULL. | |
| 304 * | |
| 305 * @param user The logged in User | |
| 306 * @param message The message to send. | |
| 307 * @param callback Function to call when we get the response from the server | |
| 308 * | |
| 309 * @return NM_OK if successfully sent, error otherwise | |
| 310 */ | |
| 311 NMERR_T nm_send_message(NMUser * user, NMMessage * message, | |
| 312 nm_response_cb callback); | |
| 313 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
314 /** |
| 8675 | 315 * Sends a typing event to the server. |
| 316 * | |
| 317 * The response data sent to the callback will be NULL. | |
| 318 * | |
| 319 * @param user The logged in User | |
| 320 * @param conf The conference that corresponds to the typing event | |
| 321 * @param typing TRUE if the user is typing | |
| 322 * FALSE if the user has stopped typing | |
| 323 * @param callback Function to call when we get the response from the server | |
| 324 * | |
| 325 * @return NM_OK if successfully sent, error otherwise | |
| 326 */ | |
| 327 NMERR_T nm_send_typing(NMUser * user, NMConference * conf, | |
| 328 gboolean typing, nm_response_cb callback); | |
| 329 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
330 /** |
| 8675 | 331 * Send a create contact request to the server. |
| 332 * | |
| 333 * The given folder should already exist on the server. If not, | |
| 334 * the call will fail. | |
| 335 * | |
| 336 * The response data sent to the callback will be a NMContact which should | |
| 337 * be released with nm_release_contact | |
| 338 * | |
| 339 * @param user The logged in User | |
| 340 * @param folder The folder that the contact should be created in | |
| 341 * @param contact The contact to add | |
| 342 * @param callback Function to call when we get the response from the server | |
| 343 * @param data User defined data | |
| 344 * | |
| 345 * @return NM_OK if successfully sent, error otherwise | |
| 346 */ | |
| 347 NMERR_T nm_send_create_contact(NMUser * user, NMFolder * folder, | |
| 348 NMContact * contact, nm_response_cb callback, | |
| 349 gpointer data); | |
| 350 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
351 /** |
| 8675 | 352 * Send a remove contact request to the server. |
| 353 * | |
| 354 * The response data sent to the callback will be NULL. | |
| 355 * | |
| 356 * @param user The logged in User | |
| 357 * @param folder The folder to remove contact from | |
| 358 * @param contact The contact to remove | |
| 359 * @param callback Function to call when we get the response from the server | |
| 360 * @param data User defined data | |
| 361 * | |
| 362 * @return NM_OK if successfully sent, error otherwise | |
| 363 */ | |
| 364 NMERR_T nm_send_remove_contact(NMUser * user, NMFolder * folder, | |
| 365 NMContact * contact, nm_response_cb callback, | |
| 366 gpointer data); | |
| 367 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
368 /** |
| 8675 | 369 * Send a create folder request to the server. |
| 370 * | |
| 371 * The response data sent to the callback will be a NMFolder which should be | |
| 372 * released with nm_release_folder | |
| 373 * | |
| 374 * @param user The logged in User | |
| 375 * @param name The name of the folder to create | |
| 376 * @param callback Function to call when we get the response from the server | |
| 377 * @param data User defined data | |
| 378 * | |
| 379 * @return NM_OK if successfully sent, error otherwise | |
| 380 */ | |
| 381 NMERR_T nm_send_create_folder(NMUser * user, const char *name, | |
| 382 nm_response_cb callback, gpointer data); | |
| 383 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
384 /** |
| 8675 | 385 * Send a delete folder request to the server. |
| 386 * | |
| 387 * The response data sent to the callback will be NULL. | |
| 388 * | |
| 389 * @param user The logged in User | |
| 390 * @param folder The name of the folder to remove | |
| 391 * @param callback Function to call when we get the response from the server | |
| 392 * @param data User defined data | |
| 393 * | |
| 394 * @return NM_OK if successfully sent, error otherwise | |
| 395 */ | |
| 396 NMERR_T nm_send_remove_folder(NMUser * user, NMFolder * folder, | |
| 397 nm_response_cb callback, gpointer data); | |
| 398 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
399 /** |
| 8675 | 400 * Send a rename contact request to the server. |
| 401 * | |
| 402 * The response data sent to the callback will be NULL. | |
| 403 * | |
| 404 * @param user The logged in User | |
| 405 * @param contact The contact to rename | |
| 406 * @param new_name The new display name for the contact | |
| 407 * @param callback Function to call when we get the response from the server | |
| 408 * @param data User defined data | |
| 409 * | |
| 410 * @return NM_OK if successfully sent, error otherwise | |
| 411 */ | |
| 412 NMERR_T nm_send_rename_contact(NMUser * user, NMContact * contact, | |
| 413 const char *new_name, nm_response_cb callback, | |
| 414 gpointer data); | |
| 415 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
416 /** |
| 8675 | 417 * Send a rename folder request to the server. |
| 418 * | |
| 419 * The response data sent to the callback will be NULL. | |
| 420 * | |
| 421 * @param user The logged in User | |
| 422 * @param folder The folder to rename | |
| 423 * @param new_name The new name of the folder | |
| 424 * @param callback Function to call when we get the response from the server | |
| 425 * @param data User defined data | |
| 426 * | |
| 427 * @return NM_OK if successfully sent, error otherwise | |
| 428 */ | |
| 429 NMERR_T nm_send_rename_folder(NMUser * user, NMFolder * folder, | |
| 430 const char *new_name, nm_response_cb callback, | |
| 431 gpointer data); | |
| 432 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
433 /** |
| 8675 | 434 * Send a move contact request to the server. |
| 435 * | |
| 436 * The response data sent to the callback will be NULL. | |
| 437 * | |
| 438 * @param user The logged in User | |
| 439 * @param contact The contact to move | |
| 440 * @param folder The folder to move the contact to | |
| 441 * @param callback Function to call when we get the response from the server | |
| 442 * @param data User defined data | |
| 443 * | |
| 444 * @return NM_OK if successfully sent, error otherwise | |
| 445 */ | |
| 446 NMERR_T nm_send_move_contact(NMUser * user, NMContact * contact, | |
| 447 NMFolder * folder, nm_response_cb callback, | |
| 448 gpointer data); | |
| 449 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
450 /** |
| 8675 | 451 * Send a get status request to the server. |
| 452 * | |
| 453 * The response data sent to the callback will be a NMUserRecord. | |
| 454 * | |
| 455 * @param user The logged in User | |
| 456 * @param contact The contact to move | |
| 457 * @param folder The folder to move the contact to | |
| 458 * @param callback Function to call when we get the response from the server | |
| 459 * @param data User defined data | |
| 460 * | |
| 461 * @return NM_OK if successfully sent, error otherwise | |
| 462 */ | |
| 463 NMERR_T nm_send_get_status(NMUser * user, NMUserRecord * user_record, | |
| 464 nm_response_cb callback, gpointer data); | |
| 465 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
466 /** |
| 8675 | 467 * Reads a response/event from the server and processes it. |
| 468 * | |
| 469 * @param user The logged in User | |
| 470 */ | |
| 471 NMERR_T nm_process_new_data(NMUser * user); | |
| 472 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
473 /** |
| 8675 | 474 * Return the root folder of the contact list |
| 475 * | |
| 476 * @param user The logged in User | |
| 477 * | |
| 478 * @return Root folder | |
| 479 */ | |
| 480 NMFolder *nm_get_root_folder(NMUser * user); | |
| 481 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
482 /** |
| 8675 | 483 * Create the contact list based on the login fields |
| 484 * | |
| 485 * @param user The logged in User | |
| 486 * | |
| 487 */ | |
| 488 NMERR_T nm_create_contact_list(NMUser * user); | |
| 489 | |
| 490 void nm_destroy_contact_list(NMUser * user); | |
| 491 | |
| 492 void nm_user_add_contact(NMUser * user, NMContact * contact); | |
| 493 | |
| 494 void nm_user_add_user_record(NMUser * user, NMUserRecord * user_record); | |
| 495 | |
| 496 NMContact *nm_find_contact(NMUser * user, const char *dn); | |
| 497 | |
| 498 GList *nm_find_contacts(NMUser * user, const char *dn); | |
| 499 | |
| 500 NMUserRecord *nm_find_user_record(NMUser * user, const char *dn); | |
| 501 | |
| 502 NMFolder *nm_find_folder(NMUser * user, const char *name); | |
| 503 | |
| 504 NMFolder *nm_find_folder_by_id(NMUser * user, int object_id); | |
| 505 | |
| 506 NMConference *nm_find_conversation(NMUser * user, const char *who); | |
| 507 | |
| 508 void nm_conference_list_add(NMUser * user, NMConference * conf); | |
| 509 | |
| 510 void nm_conference_list_remove(NMUser * user, NMConference * conf); | |
| 511 | |
| 512 void nm_conference_list_free(NMUser * user); | |
| 513 | |
| 514 NMConference *nm_conference_list_find(NMUser * user, const char *guid); | |
| 515 | |
| 516 const char *nm_lookup_dn(NMUser * user, const char *display_id); | |
| 517 | |
| 518 nm_event_cb nm_user_get_event_callback(NMUser * user); | |
| 519 | |
| 520 NMConn *nm_user_get_conn(NMUser * user); | |
| 521 | |
| 522 /** Some utility functions **/ | |
| 523 | |
| 524 /** | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
525 * Check to see if the conference GUIDs are equivalent. |
| 8675 | 526 * |
| 527 * @param guid1 First guid to compare | |
| 528 * @param guid2 Second guid to compare | |
| 529 * | |
| 530 * @return TRUE if conference GUIDs are equivalent, FALSE otherwise. | |
| 531 * | |
| 532 */ | |
| 533 gboolean nm_are_guids_equal(const char *guid1, const char *guid2); | |
| 534 | |
| 535 | |
| 536 /** | |
| 537 * Case insensitive compare for utf8 strings | |
| 538 * | |
| 539 * @param guid1 First string to compare | |
| 540 * @param guid2 Second string to compare | |
| 541 * | |
| 542 * @return -1 if str1 < str2, 0 if str1 = str2, 1 if str1 > str2 | |
| 543 * | |
| 544 */ | |
| 545 gint nm_utf8_strcasecmp(gconstpointer str1, gconstpointer str2); | |
| 546 | |
| 547 /** | |
| 548 * Compare UTF8 strings for equality only (case insensitive) | |
| 549 * | |
| 550 * @param guid1 First string to compare | |
| 551 * @param guid2 Second string to compare | |
| 552 * | |
| 553 * @return TRUE if strings are equal, FALSE otherwise | |
| 554 * | |
| 555 */ | |
| 556 gboolean nm_utf8_str_equal(gconstpointer str1, gconstpointer str2); | |
| 557 | |
| 558 /** | |
| 559 * Convert a fully typed LDAP DN to dotted, untype notation | |
| 560 * e.g. cn=mike,o=novell -> mike.novell | |
| 561 * | |
| 562 * @param typed Fully typed dn | |
| 563 * | |
| 564 * @return Dotted equivalent of typed (must be freed). | |
| 565 * | |
| 566 */ | |
| 567 char *nm_typed_to_dotted(const char *typed); | |
| 568 | |
| 569 #endif |
