Mercurial > pidgin
annotate src/protocols/novell/nmuser.h @ 9125:668ffb8fec00
[gaim-migrate @ 9902]
(12:53:05) nosnilmot: LSchiere: not majorly important, but the pref changes
listed in the ChangeLog are out of sync
committer: Tailor Script <tailor@pidgin.im>
| author | Luke Schierer <lschiere@pidgin.im> |
|---|---|
| date | Sun, 30 May 2004 16:54:40 +0000 |
| parents | 6663ad2386d9 |
| children | 54fb1f466953 |
| rev | line source |
|---|---|
| 8675 | 1 /* |
| 2 * nmuser.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_USER_H__ | |
| 22 #define __NM_USER_H__ | |
| 23 | |
| 24 #include <glib.h> | |
| 25 #include <stdio.h> | |
| 26 #include <stdlib.h> | |
| 27 | |
| 28 typedef guint32 NMERR_T; | |
| 29 typedef int NMSTATUS_T; | |
| 30 | |
| 31 typedef struct _NMUser NMUser; | |
| 32 | |
| 33 typedef enum | |
| 34 { | |
| 35 NMREQUEST_TYPE_LOGIN = 0, | |
| 36 NMREQUEST_TYPE_LOGOUT, | |
| 37 NMREQUEST_TYPE_SETSTATUS, | |
| 38 NMREQUEST_TYPE_GETDETAILS, | |
| 39 NMREQUEST_TYPE_CREATECONF, | |
| 40 NMREQUEST_TYPE_SENDMESSAGE, | |
| 41 NMREQUEST_TYPE_JOINCONF, | |
| 42 NMREQUEST_TYPE_LEAVECONF, | |
| 43 NMREQUEST_TYPE_REJECTCONF, | |
| 44 NMREQUEST_TYPE_SENDTYPING, | |
| 45 NMREQUEST_TYPE_CREATECONTACT, | |
| 46 NMREQUEST_TYPE_DELETECONTACT | |
| 47 | |
| 48 } NMRequestType; | |
| 49 | |
| 50 #include "debug.h" | |
| 51 #include "nmmessage.h" | |
| 52 #include "nmconference.h" | |
| 53 #include "nmcontact.h" | |
| 54 #include "nmuserrecord.h" | |
| 55 #include "nmfield.h" | |
| 56 #include "nmevent.h" | |
| 57 | |
| 58 /* Callback typedefs */ | |
| 59 typedef void (*nm_response_cb) (NMUser * user, NMERR_T ret_code, | |
| 60 gpointer resp_data, gpointer user_data); | |
| 61 | |
| 62 typedef void (*nm_event_cb) (NMUser * user, NMEvent * event); | |
| 63 | |
| 64 #include "nmrequest.h" | |
| 65 #include "nmconn.h" | |
| 66 | |
| 67 /* This represents user that we are currently logged in as */ | |
| 68 struct _NMUser | |
| 69 { | |
| 70 | |
| 71 char *name; | |
| 72 | |
| 73 NMSTATUS_T status; | |
| 74 | |
| 75 /* A copy of the login response fields */ | |
| 76 NMField *fields; | |
| 77 | |
| 78 /* The user record for this user */ | |
| 79 NMUserRecord *user_record; | |
| 80 | |
| 81 /* Our connection information */ | |
| 82 NMConn *conn; | |
| 83 | |
| 84 /* Our public IP address */ | |
| 85 char *address; | |
| 86 | |
| 87 /* This is the contact list */ | |
| 88 NMFolder *root_folder; | |
| 89 | |
| 90 /* All contacts that we know about hashed by dn */ | |
| 91 GHashTable *contacts; | |
| 92 | |
| 93 /* All user records hashed by dn */ | |
| 94 GHashTable *user_records; | |
| 95 | |
| 96 /* DN lookup */ | |
| 97 GHashTable *display_id_to_dn; | |
| 98 | |
| 99 /* One on one conversations indexed by recipient's dn */ | |
| 100 GSList *conferences; | |
| 101 | |
| 102 guint32 conference_count; | |
| 103 | |
| 104 /* Called when we receive an event */ | |
| 105 nm_event_cb evt_callback; | |
| 106 | |
| 8933 | 107 /* Privacy settings */ |
| 108 gboolean privacy_locked; | |
| 109 gboolean default_deny; | |
| 110 GSList *allow_list; | |
| 111 GSList *deny_list; | |
| 112 | |
| 8675 | 113 /* Pending requests. If we need to go to the server to more info |
| 114 * before processing a request we will queue it up and process when | |
| 115 * we get a response | |
| 116 */ | |
| 117 GSList *pending_requests; | |
| 118 | |
| 119 /* Pending events. Same as above except for events. */ | |
| 120 GSList *pending_events; | |
| 121 | |
| 122 /* Generic pointer to data needed by the client | |
| 123 * using the API | |
| 124 */ | |
| 125 gpointer client_data; | |
| 126 | |
| 127 }; | |
| 128 | |
| 129 #define NM_STATUS_UNKNOWN 0 | |
| 130 #define NM_STATUS_OFFLINE 1 | |
| 131 #define NM_STATUS_AVAILABLE 2 | |
| 132 #define NM_STATUS_BUSY 3 | |
| 133 #define NM_STATUS_AWAY 4 | |
| 134 #define NM_STATUS_AWAY_IDLE 5 | |
| 135 #define NM_STATUS_INVALID 6 | |
| 136 | |
| 137 #define NMERR_BASE 0x2000L | |
| 138 #define NM_OK 0L | |
| 139 #define NMERR_BAD_PARM (NMERR_BASE + 0x0001) | |
| 140 #define NMERR_TCP_WRITE (NMERR_BASE + 0x0002) | |
| 141 #define NMERR_TCP_READ (NMERR_BASE + 0x0003) | |
| 142 #define NMERR_PROTOCOL (NMERR_BASE + 0x0004) | |
| 8933 | 143 #define NMERR_SERVER_REDIRECT (NMERR_BASE + 0x0005) |
| 8675 | 144 #define NMERR_CONFERENCE_NOT_FOUND (NMERR_BASE + 0x0006) |
| 145 #define NMERR_CONFERENCE_NOT_INSTANTIATED (NMERR_BASE + 0x0007) | |
| 146 #define NMERR_FOLDER_EXISTS (NMERR_BASE + 0x0008) | |
| 147 | |
| 8933 | 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) | |
| 8675 | 177 |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
178 /** |
| 8675 | 179 * Initialize the user that we are going to login to the system as. |
| 180 * | |
| 181 * @param name The userid of the user | |
| 182 * @param server IP Address of server | |
| 183 * @param port Port to connect to on the server | |
| 184 * @param data Client data to associate with the user | |
|
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8684
diff
changeset
|
185 * @param event_callback Function to call when we receive an event |
| 8675 | 186 * |
| 187 * @return The initialized user object. Must be freed by calling | |
| 188 * nm_deinitialize_user | |
| 189 */ | |
| 190 NMUser *nm_initialize_user(const char *name, const char *server, int port, | |
| 191 gpointer data, nm_event_cb event_callback); | |
| 192 | |
| 193 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
194 /** |
| 8675 | 195 * Free up resources associated with the user object. |
| 196 * | |
| 197 * @param user The user to deinitialize | |
| 198 */ | |
| 199 void nm_deinitialize_user(NMUser * user); | |
| 200 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
201 /** |
| 8675 | 202 * Send a login request to the server. |
| 203 * | |
| 204 * The response data sent to the callback will be NULL. | |
| 205 * | |
| 206 * @param user The User to login -- must be initialized | |
| 207 * @param pwd The password of the user | |
| 208 * @param my_addr The address of the client machine | |
| 209 * @param user_agent String describing the client (eg. "Gaim/0.76 (Linux; 2.4.20)") | |
| 210 * @param callback Function to call when we get the response from the server | |
| 211 * @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
|
212 * |
| 8675 | 213 * |
| 214 * @return NM_OK if login is sent successfully, error otherwise. | |
| 215 */ | |
| 216 NMERR_T nm_send_login(NMUser * user, const char *pwd, const char *my_addr, | |
| 217 const char *user_agent, nm_response_cb callback, | |
| 218 gpointer data); | |
| 219 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
220 /** |
| 8675 | 221 * Send a set status request to the server. |
| 222 * | |
| 223 * The response data sent to the callback will be NULL. | |
| 224 * | |
| 225 * @param user The logged in User | |
| 226 * @param dn The DN of the user (if known, or NULL if not known) | |
| 227 * @param address IP Address of server | |
| 228 * @param callback Function to call when we get the response from the server | |
| 229 * | |
| 230 * | |
| 231 * @return NM_OK if successfully sent, error otherwise | |
| 232 */ | |
| 233 NMERR_T nm_send_set_status(NMUser * user, int status, const char *text, | |
| 234 const char *auto_resp, nm_response_cb callback, | |
| 235 gpointer data); | |
| 236 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
237 /** |
| 8675 | 238 * Send a create conference to the server. |
| 239 * | |
| 240 * The response data sent to the callback will be NULL. | |
| 241 * | |
| 8933 | 242 * @param user The logged in User |
| 243 * @param conference Conference to create | |
| 244 * @param add_participants Add participant list on create? | |
| 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 | |
| 8675 | 247 * |
| 248 * @return NM_OK if successfully sent, error otherwise | |
| 249 */ | |
| 250 NMERR_T nm_send_create_conference(NMUser * user, NMConference * conference, | |
| 251 nm_response_cb callback, gpointer data); | |
| 252 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
253 /** |
| 8675 | 254 * Tell server we have left the conference. |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
255 * |
| 8675 | 256 * The response data sent to the callback will be NULL. |
| 257 * | |
| 258 * @param user The logged in User | |
| 259 * @param conference Conference the user is leaving | |
| 260 * @param callback Function to call when we get the response from the server | |
| 261 * @param data User defined data to be passed to the callback function | |
| 262 * | |
| 263 * @return NM_OK if successfully sent, error otherwise | |
| 264 */ | |
| 265 NMERR_T nm_send_leave_conference(NMUser * user, NMConference * conference, | |
| 266 nm_response_cb callback, gpointer data); | |
| 267 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
268 /** |
| 8675 | 269 * Send a join conference request to the server. |
| 270 * | |
| 271 * The response data sent to the callback will be NULL. | |
| 272 * | |
| 273 * @param user The logged in User | |
| 274 * @param conference Conference the user is joining | |
| 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 * | |
| 279 * @return NM_OK if successfully sent, error otherwise | |
| 280 */ | |
| 281 NMERR_T nm_send_join_conference(NMUser * user, NMConference * conference, | |
| 282 nm_response_cb callback, gpointer data); | |
| 283 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
284 /** |
| 8675 | 285 * Send a conference reject request to the server. |
| 286 * | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
287 * The response data sent to the callback will be NULL. |
| 8675 | 288 * |
| 289 * @param user The logged in User | |
| 290 * @param conference Conference the user is rejecting | |
| 291 * @param callback Function to call when we get the response from the server | |
| 292 * @param data User defined data to be passed to the callback function | |
| 293 * | |
| 294 * | |
| 295 * @return NM_OK if successfully sent, error otherwise | |
| 296 */ | |
| 297 NMERR_T nm_send_reject_conference(NMUser * user, NMConference * conference, | |
| 298 nm_response_cb callback, gpointer data); | |
| 299 | |
| 8933 | 300 |
| 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. | |
| 321 * | |
| 322 * The response data sent to the callback will be an NMUserRecord which should be | |
| 323 * freed with nm_release_user_record | |
| 324 * | |
| 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 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
335 /** |
| 8675 | 336 * Get details for a user from the server. |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
337 * |
| 8675 | 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 | |
| 342 * @param name Userid or DN of the user to look up | |
| 343 * @param callback Function to call when we get the response from the server | |
| 344 * @param data User defined data to be passed to the callback function | |
| 345 * | |
| 346 * @return NM_OK if successfully sent, error otherwise | |
| 347 */ | |
| 348 NMERR_T nm_send_get_details(NMUser * user, const char *name, | |
| 349 nm_response_cb callback, gpointer data); | |
| 350 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
351 /** |
| 8675 | 352 * Send a message. |
| 353 * | |
| 354 * The response data sent to the callback will be NULL. | |
| 355 * | |
| 356 * @param user The logged in User | |
| 357 * @param message The message to send. | |
| 358 * @param callback Function to call when we get the response from the server | |
| 359 * | |
| 360 * @return NM_OK if successfully sent, error otherwise | |
| 361 */ | |
| 362 NMERR_T nm_send_message(NMUser * user, NMMessage * message, | |
| 363 nm_response_cb callback); | |
| 364 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
365 /** |
| 8675 | 366 * Sends a typing event to the server. |
| 367 * | |
| 368 * The response data sent to the callback will be NULL. | |
| 369 * | |
| 370 * @param user The logged in User | |
| 371 * @param conf The conference that corresponds to the typing event | |
| 372 * @param typing TRUE if the user is typing | |
| 373 * FALSE if the user has stopped typing | |
| 374 * @param callback Function to call when we get the response from the server | |
| 375 * | |
| 376 * @return NM_OK if successfully sent, error otherwise | |
| 377 */ | |
| 378 NMERR_T nm_send_typing(NMUser * user, NMConference * conf, | |
| 379 gboolean typing, nm_response_cb callback); | |
| 380 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
381 /** |
| 8675 | 382 * Send a create contact request to the server. |
| 383 * | |
| 384 * The given folder should already exist on the server. If not, | |
| 385 * the call will fail. | |
| 386 * | |
| 387 * The response data sent to the callback will be a NMContact which should | |
| 388 * be released with nm_release_contact | |
| 389 * | |
| 390 * @param user The logged in User | |
| 391 * @param folder The folder that the contact should be created in | |
| 392 * @param contact The contact to add | |
| 393 * @param callback Function to call when we get the response from the server | |
| 394 * @param data User defined data | |
| 395 * | |
| 396 * @return NM_OK if successfully sent, error otherwise | |
| 397 */ | |
| 398 NMERR_T nm_send_create_contact(NMUser * user, NMFolder * folder, | |
| 399 NMContact * contact, nm_response_cb callback, | |
| 400 gpointer data); | |
| 401 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
402 /** |
| 8675 | 403 * Send a remove contact request to the server. |
| 404 * | |
| 405 * The response data sent to the callback will be NULL. | |
| 406 * | |
| 407 * @param user The logged in User | |
| 408 * @param folder The folder to remove contact from | |
| 409 * @param contact The contact to remove | |
| 410 * @param callback Function to call when we get the response from the server | |
| 411 * @param data User defined data | |
| 412 * | |
| 413 * @return NM_OK if successfully sent, error otherwise | |
| 414 */ | |
| 415 NMERR_T nm_send_remove_contact(NMUser * user, NMFolder * folder, | |
| 416 NMContact * contact, nm_response_cb callback, | |
| 417 gpointer data); | |
| 418 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
419 /** |
| 8675 | 420 * Send a create folder request to the server. |
| 421 * | |
| 422 * The response data sent to the callback will be a NMFolder which should be | |
| 423 * released with nm_release_folder | |
| 424 * | |
| 425 * @param user The logged in User | |
| 426 * @param name The name of the folder to create | |
| 427 * @param callback Function to call when we get the response from the server | |
| 428 * @param data User defined data | |
| 429 * | |
| 430 * @return NM_OK if successfully sent, error otherwise | |
| 431 */ | |
| 432 NMERR_T nm_send_create_folder(NMUser * user, const char *name, | |
| 433 nm_response_cb callback, gpointer data); | |
| 434 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
435 /** |
| 8675 | 436 * Send a delete folder request to the server. |
| 437 * | |
| 438 * The response data sent to the callback will be NULL. | |
| 439 * | |
| 440 * @param user The logged in User | |
| 441 * @param folder The name of the folder to remove | |
| 442 * @param callback Function to call when we get the response from the server | |
| 443 * @param data User defined data | |
| 444 * | |
| 445 * @return NM_OK if successfully sent, error otherwise | |
| 446 */ | |
| 447 NMERR_T nm_send_remove_folder(NMUser * user, NMFolder * folder, | |
| 448 nm_response_cb callback, gpointer data); | |
| 449 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
450 /** |
| 8675 | 451 * Send a rename contact request to the server. |
| 452 * | |
| 453 * The response data sent to the callback will be NULL. | |
| 454 * | |
| 455 * @param user The logged in User | |
| 456 * @param contact The contact to rename | |
| 457 * @param new_name The new display name for the contact | |
| 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_rename_contact(NMUser * user, NMContact * contact, | |
| 464 const char *new_name, nm_response_cb callback, | |
| 465 gpointer data); | |
| 466 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
467 /** |
| 8675 | 468 * Send a rename folder request to the server. |
| 469 * | |
| 470 * The response data sent to the callback will be NULL. | |
| 471 * | |
| 472 * @param user The logged in User | |
| 473 * @param folder The folder to rename | |
| 474 * @param new_name The new name of the folder | |
| 475 * @param callback Function to call when we get the response from the server | |
| 476 * @param data User defined data | |
| 477 * | |
| 478 * @return NM_OK if successfully sent, error otherwise | |
| 479 */ | |
| 480 NMERR_T nm_send_rename_folder(NMUser * user, NMFolder * folder, | |
| 481 const char *new_name, nm_response_cb callback, | |
| 482 gpointer data); | |
| 483 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
484 /** |
| 8675 | 485 * Send a move contact request to the server. |
| 486 * | |
| 487 * The response data sent to the callback will be NULL. | |
| 488 * | |
| 489 * @param user The logged in User | |
| 490 * @param contact The contact to move | |
| 491 * @param folder The folder to move the contact to | |
| 492 * @param callback Function to call when we get the response from the server | |
| 493 * @param data User defined data | |
| 494 * | |
| 495 * @return NM_OK if successfully sent, error otherwise | |
| 496 */ | |
| 497 NMERR_T nm_send_move_contact(NMUser * user, NMContact * contact, | |
| 498 NMFolder * folder, nm_response_cb callback, | |
| 499 gpointer data); | |
| 500 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
501 /** |
| 8675 | 502 * Send a get status request to the server. |
| 503 * | |
| 504 * The response data sent to the callback will be a NMUserRecord. | |
| 505 * | |
| 506 * @param user The logged in User | |
| 507 * @param contact The contact to move | |
| 508 * @param folder The folder to move the contact to | |
| 509 * @param callback Function to call when we get the response from the server | |
| 510 * @param data User defined data | |
| 511 * | |
| 512 * @return NM_OK if successfully sent, error otherwise | |
| 513 */ | |
| 514 NMERR_T nm_send_get_status(NMUser * user, NMUserRecord * user_record, | |
| 515 nm_response_cb callback, gpointer data); | |
| 516 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
517 /** |
| 8933 | 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 /** | |
| 8675 | 562 * Reads a response/event from the server and processes it. |
| 563 * | |
| 564 * @param user The logged in User | |
| 565 */ | |
| 566 NMERR_T nm_process_new_data(NMUser * user); | |
| 567 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
568 /** |
| 8675 | 569 * Return the root folder of the contact list |
| 570 * | |
| 571 * @param user The logged in User | |
| 572 * | |
| 573 * @return Root folder | |
| 574 */ | |
| 575 NMFolder *nm_get_root_folder(NMUser * user); | |
| 576 | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
577 /** |
| 8675 | 578 * Create the contact list based on the login fields |
| 579 * | |
| 580 * @param user The logged in User | |
| 581 * | |
| 582 */ | |
| 583 NMERR_T nm_create_contact_list(NMUser * user); | |
| 584 | |
| 585 void nm_destroy_contact_list(NMUser * user); | |
| 586 | |
| 587 void nm_user_add_contact(NMUser * user, NMContact * contact); | |
| 588 | |
| 589 void nm_user_add_user_record(NMUser * user, NMUserRecord * user_record); | |
| 590 | |
| 591 NMContact *nm_find_contact(NMUser * user, const char *dn); | |
| 592 | |
| 593 GList *nm_find_contacts(NMUser * user, const char *dn); | |
| 594 | |
| 595 NMUserRecord *nm_find_user_record(NMUser * user, const char *dn); | |
| 596 | |
| 597 NMFolder *nm_find_folder(NMUser * user, const char *name); | |
| 598 | |
| 599 NMFolder *nm_find_folder_by_id(NMUser * user, int object_id); | |
| 600 | |
| 601 NMConference *nm_find_conversation(NMUser * user, const char *who); | |
| 602 | |
| 603 void nm_conference_list_add(NMUser * user, NMConference * conf); | |
| 604 | |
| 605 void nm_conference_list_remove(NMUser * user, NMConference * conf); | |
| 606 | |
| 607 void nm_conference_list_free(NMUser * user); | |
| 608 | |
| 609 NMConference *nm_conference_list_find(NMUser * user, const char *guid); | |
| 610 | |
| 611 const char *nm_lookup_dn(NMUser * user, const char *display_id); | |
| 612 | |
| 613 nm_event_cb nm_user_get_event_callback(NMUser * user); | |
| 614 | |
| 615 NMConn *nm_user_get_conn(NMUser * user); | |
| 616 | |
| 8933 | 617 gboolean nm_user_is_privacy_locked(NMUser *user); |
| 618 | |
| 8675 | 619 /** Some utility functions **/ |
| 620 | |
| 621 /** | |
|
8684
046dd8ef2920
[gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents:
8675
diff
changeset
|
622 * Check to see if the conference GUIDs are equivalent. |
| 8675 | 623 * |
| 624 * @param guid1 First guid to compare | |
| 625 * @param guid2 Second guid to compare | |
| 626 * | |
| 627 * @return TRUE if conference GUIDs are equivalent, FALSE otherwise. | |
| 628 * | |
| 629 */ | |
| 630 gboolean nm_are_guids_equal(const char *guid1, const char *guid2); | |
| 631 | |
| 632 | |
| 633 /** | |
| 634 * Case insensitive compare for utf8 strings | |
| 635 * | |
| 636 * @param guid1 First string to compare | |
| 637 * @param guid2 Second string to compare | |
| 638 * | |
| 639 * @return -1 if str1 < str2, 0 if str1 = str2, 1 if str1 > str2 | |
| 640 * | |
| 641 */ | |
| 642 gint nm_utf8_strcasecmp(gconstpointer str1, gconstpointer str2); | |
| 643 | |
| 644 /** | |
| 645 * Compare UTF8 strings for equality only (case insensitive) | |
| 646 * | |
| 647 * @param guid1 First string to compare | |
| 648 * @param guid2 Second string to compare | |
| 649 * | |
| 650 * @return TRUE if strings are equal, FALSE otherwise | |
| 651 * | |
| 652 */ | |
| 653 gboolean nm_utf8_str_equal(gconstpointer str1, gconstpointer str2); | |
| 654 | |
| 655 /** | |
| 656 * Convert a fully typed LDAP DN to dotted, untype notation | |
| 657 * e.g. cn=mike,o=novell -> mike.novell | |
| 658 * | |
| 659 * @param typed Fully typed dn | |
| 660 * | |
| 661 * @return Dotted equivalent of typed (must be freed). | |
| 662 * | |
| 663 */ | |
| 664 char *nm_typed_to_dotted(const char *typed); | |
| 665 | |
| 8933 | 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 | |
| 8675 | 675 #endif |
