gpSetCallback

GameSpy SDK

gpSetCallback

This function is used to set callbacks. The callbacks that get set with this function are called as a result of data received from the server, such as messages or status updates.

GPResult gpSetCallback(
GPConnection * connection,
GPEnum func,
GPCallback callback,
void * param );
RoutineRequired HeaderDistribution
gpSetCallback<gp.h>SDKZIP

Return Value

This function returns GP_NO_ERROR upon success. Otherwise a valid GPResult is returned.

Parameters

connection
[in] A GP connection interface.
func
[in] An enum that indicates which callback is being set.
callback
[in] The user-supplied function that will be called.
param
[in] Pointer to user-defined data. This value will be passed unmodified to the callback function.

Remarks

This function sets what callback to call when data is received from the server, such as messages or status updates, or an error is generated. If no callback is set for a certain situation, then no alert will be given when that situation occurs. For example, if no GP_RECV_BUDDY_REQUEST callback is set, then there will be no way of detecting when a remote profile wants to add the local profile as a buddy.
These callbacks can be generated during any function that checks for data received from the server, typically gpProcess or a blocking operation function.

The following can be used as parameters for callback type:
GP_ERROR,
GP_RECV_BUDDY_REQUEST,
GP_RECV_BUDDY_STATUS,
GP_RECV_BUDDY_MESSAGE,
GP_RECV_GAME_INVITE,
GP_TRANSFER_CALLBACK,
GP_RECV_BUDDY_AUTH,
GP_RECV_BUDDY_REVOKE.

Section Reference: Gamespy Presence SDK