vp_friends_get
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 |
Used attributes
This method uses data set in these attributes when called:
Attribute | Usage | |
---|---|---|
VP_REFERENCE_NUMBER | Is passed to the callback to identify for which method call it is fired |
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) |
VP_RC_NOT_IN_UNIVERSE |
Universe request made while not connected to a universe server |
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);
//...
}