vp_friends_get

From Virtual Paradise Wiki
Revision as of 11:27, 13 December 2016 by Sleepy E (talk | contribs) (Basic layout)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Method call snippet vp_friends_get(instance);

Request the friend list.

Parameters

These are the parameters that this method requires:

Parameter Usage
VPInstance
instance
Pointer to the instance this method call is intended for

Returns

This method returns a return code integer, which indicates whether the call was successful or errored for any reason:

Return code Cause
VP_RC_SUCCESS Successful call (for methods that have a registered callback, it only means the request has been sent)

Behavior

There is no special behavior for this method

Examples

void handle_friend(VPInstance sdk)
{
  const char *name;
  int user_id, online;

  name = vp_string(sdk, VP_FRIEND_NAME);
  user_id = vp_int(sdk, VP_FRIEND_USER_ID);
  online = vp_int(sdk, VP_FRIEND_ONLINE);

  printf("Friend \"%s\" (id #%d) is %s\n", name, user_id, online ? "online" : "offline");
}

void handle_get_friends(VPInstance sdk, int rc, int ref)
{
  printf("Got the entire friend list!\n");
}

int main(int argc, const char* argv[])
{
  //...

  vp_callback_set(sdk, VP_CALLBACK_GET_FRIENDS, handle_get_friends);
  vp_event_set(sdk, VP_EVENT_FRIEND, handle_friend);
  vp_friends_get(sdk);

  //...
}

See also