peerConnectLogin
Connects a peer object to the backend chat server and then logs in using an account from the GameSpy Presence system. A title must be set with peerSetTitle() before this function is called.
- void peerConnectLogin(
- PEER peer,
- int namespaceID,
- const gsi_char * email,
- const gsi_char * profilenick,
- const gsi_char * uniquenick,
- const gsi_char * password,
- peerNickErrorCallback nickErrorCallback,
- peerConnectCallback connectCallback,
- void * param,
- PEERBool blocking );
Routine | Required Header | Distribution |
---|---|---|
peerConnectLogin | <peer.h> | SDKZIP |
Parameters
- peer
- [in] Initialized peer object.
- namespaceID
- [in] Namespace identifier, assigned by GameSpy.
- [in] Email address of the profile to login with.
- profilenick
- [in] Nickname of the profile to login with.
- uniquenick
- [in] Registered uniquenick of the profile to login with.
- password
- [in] Password of the profile to login with.
- nickErrorCallback
- [in] Callback function to be called if a nickname error occurs.
- connectCallback
- [in] Callback function to be called when the operation completes
- param
- [in] Pointer to user data. This is optional and will be passed unmodified to the callback function.
- blocking
- [in] When set to PEERTrue this function will not return until the operation has completed.
Remarks
The peerConnectLogin function attempts to connect a peer object to the backend chat server and then login using an account from the GameSpy Presence system.. The connection can be ended at any time by called peerDisconnect() (peerShutdown() will also close the connection). If the connection gets disconnected for any other reason (such as an intermediate router going down), the peerDisconnectedCallback() callback will be called. This function will fail if the Peer object is already connected.
Once connected to the backend chat server, Peer is fully enabled, and the user can join rooms, create rooms, list games, message other players, etc. Typically at this point the user would be joined up to the game’s title room with peerJoinTitleRoom().
There are two ways of specifying the account information. One way is to specify a uniquenick and password combination. In this case, email and profilenick should be NULL, and namespaceID should be greater than 0. The other way is to specify an email, profilenick, and password. In this case, uniquenick should be NULL, and namespaceID should be 0 for no namespace or 1 for the default GameSpy namespace (used by GameSpy Arcade). If you are using a custom namespace, specify its namespace ID. You can contact GameSpy Developer Support for further help in using a custom namespace.
The uniquenick and password combination should only be used in custom namespaces where uniquenicks do not expire. This is because if a uniquenick expires, then another user that registers that uniquenick, the original user will no longer be able to login with only his (old) uniquenick and password.
Section Reference: Gamespy Peer SDK