SC_UserController

The SC_UserController is used to retrieve information about an arbitrary user from the server.

It is also used to update the attributes and buddy list of the current session user.

Some of the basic Use Cases are listed below:

UseCase_1: To retrieve information for the current session user:
  1. Create an instance of UserController, or re-use an existing instance.

  2. Call SC_UserController_LoadUser().

  3. Wait for notification of success via delegate callbacks.

  4. After a successful request, access the attributes of the user by calling SC_UserController_GetUser().

UseCase_2: To retrieve information about an arbitrary user:
  1. Create an instance of UserController, or re-use an existing one.

  2. Request the user's information by passing the user's unique ID to SC_UserController_LoadUserFromHandle()

  3. Wait for notification of success via delegate callbacks.

  4. After a successful request, access the retrieved user by using SC_UserController_GetUser().

Alternatively,
  1. Set the user property of the controller equal to the user for whom the information is to be requested by calling the SC_UserController_SetUser() method.

  2. Call SC_UserController_LoadUser().

  3. Wait for notification of success via delegate callbacks.

  4. After a successful request, access the retrieved user by using SC_UserController_GetUser().

UseCase_3: To add a user to the buddy list of the session user:
  1. Create an instance of UserController, or re-use an existing instance.

  2. Set the user property of the controller equal to the buddy to be added by calling the SC_UserController_SetUser() method.

  3. Call SC_UserController_AddAsBuddy().

  4. Wait for notification of success via delegate callbacks.

UseCase_4: To update the user profile:
  1. Create an instance of UserController, or re-use an existing instance.

  2. Call SC_UserController_UpdateUser() to push updates of the current session user's attributes to the server.

  3. if SC_UserController_UpdateUser() returns a failure with SC_INVALID_USER_DATA, call SC_UserController_GetValidationErrors() to check what went wrong.

NOTE: Do not modify a user object or one of its sub-objects while one of the following asynchronous methods is in progress, as this might cause undefined results:

Last modified: 2014-05-14



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus