Beispiel #1
0
Matchmaker::~Matchmaker()
{
#ifdef DLLSAMPLE
	WONRoutingCloseSessionHandle(mRoutingServer);
	if (mAuthH) { WONAuthCloseHandle(mAuthH); }
#endif // DLLSAMPLE

	delete[] mDirServers;
	delete[] mAuthServers;
	delete[] mContestServers;
	delete[] mEventServers;
	delete[] mFactoryServers;
	delete[] mFirewallServers;
	delete[] mProfileServers;
}
Beispiel #2
0
void Matchmaker::CreateWONAccount(const char* theUserName, const char* thePassword)
{
#ifdef DLLSAMPLE
	WONError aError;
	if (mAuthH) { WONAuthCloseHandle(mAuthH); mAuthH = NULL; }
	mAuthH = WONAuthLoginNewAccountA(&aError, mAuthServers, mNumAuthServers, theUserName, COMMUNITY_SAMPLE, thePassword, "", gRequestTimeout);
#else
	mIdentity = Identity(theUserName, COMMUNITY_SAMPLE, thePassword, "", mAuthServers, mNumAuthServers);
	Error aError = mIdentity.AuthenticateNewAccount(gRequestTimeout);
#endif // DLLSAMPLE

	switch (aError)
	{
		case StatusCommon_Success:
			OutputError("Successfully created new account and logged in");

#ifdef DLLSAMPLE
			WONProfileCreate(mAuthH, mProfileServers, mNumProfileServers, "*****@*****.**", gRequestTimeout);
#else
			CreateProfile(&mIdentity, mProfileServers, mNumProfileServers, "*****@*****.**", gRequestTimeout);
#endif

			ListRooms();
			break;
		case StatusAuth_CDKeyInUse:
			OutputError("CD key is already in use");
			break;
		case StatusAuth_CRCFailed:
			OutputError("Invalid version of game");
			break;
		case StatusAuth_UserExists:
			OutputError("User already exists");
			break;
		default:
			OutputError("Account creation failed!", aError);
			break;
	}
}
Beispiel #3
0
void main()
{
	WONIPAddress anAddr;
	WONError anError;

	WONInitialize();
	mEvent = CreateEvent(NULL,FALSE,FALSE,NULL);
	WONAuthLoadVerifierKeyFromRegistry("SOFTWARE\\WON\\Titan", "AuthVerifierKey");
	if(!GetCertificate("Brian123","WON","suck"))
		return;

	mSession = WONRoutingCreateSession();

	WONIPAddressSetFromString(&anAddr,"localhost:8200");
	anError = WONRoutingConnect(mSession, &anAddr, mAuth, 10000);
	printf("Connection result: %s\n",WONErrorToString(anError));
	if(anError!=WONError_Success)
		return;

	WONRoutingRegisterA(mSession,"Brian123","",FALSE,FALSE,TRUE,MyRoutingRegisterClientCallback,"RegisterA");
	WaitForSingleObject(mEvent, INFINITE);

	WONRoutingGetNumUsers(mSession,MyRoutingGetNumUsersCallback,"GetNumUsers");
	WONRoutingIsUserPresentA(mSession,"test",TRUE,TRUE,MyRoutingBoolCallback,"Good IsUserPresent");
	WONRoutingIsUserPresentA(mSession,"test2",TRUE,TRUE,MyRoutingBoolCallback,"Good IsUserPresent");
	WONRoutingGetClientList(mSession,TRUE,TRUE,TRUE,MyRoutingClientListCallback,"GetClientList");
	WONRoutingGetMembersOfGroup(mSession,4,TRUE,TRUE,TRUE,MyRoutingClientListCallback,"GetChatGroup");
	WONRoutingGetMembersOfGroup(mSession,5,TRUE,TRUE,TRUE,MyRoutingClientListCallback,"GetBadGroup");
	WONRoutingGetGroupList(mSession,MyRoutingGroupListCallback,"GetGroupList");
	WONRoutingSubscribeDataObject(mSession,2,"",0,FALSE,TRUE,MyRoutingReadDataObjectCallback,"SubscribeDataObject");
	WONRoutingBroadcastChatA(mSession,"YO YO YO!!!",FALSE);
	WONRoutingBroadcastChatAndGetResultA(mSession,"YO YO YO!!!",FALSE,MyRoutingStatusCallback, "Send Chat");


	WONRoutingInstallClientJoinAttemptCallback(mSession, MyRoutingClientNameCallback, "Join Attempt");      
	WONRoutingInstallClientEnterCallback(mSession, MyRoutingClientIdWithReasonCallback, "Client Enter");     
	WONRoutingInstallClientEnterExCallback(mSession, MyRoutingClientDataWithReasonCallback, "Client Enter Ex"); 
	WONRoutingInstallClientLeaveCallback(mSession, MyRoutingClientIdWithReasonCallback, "Client Leave");     
	WONRoutingInstallSpectatorCountCallback(mSession, MyRoutingSpectatorCallback, "Spectator Count");                       
	WONRoutingInstallGroupEnterCallback(mSession, MyRoutingGroupIdAndClientIdWithReasonCallback, "Group Enter");      
	WONRoutingInstallGroupEnterExCallback(mSession, MyRoutingGroupIdAndClientDataWithReasonCallback, "Group Enter Ex");  
	WONRoutingInstallGroupLeaveCallback(mSession, MyRoutingGroupIdAndClientIdWithReasonCallback, "Group Leave");      
	WONRoutingInstallGroupSpectatorCountCallback(mSession, MyRoutingGroupIdAndSpectatorCountCallback, "Group Spectator Count"); 
	WONRoutingInstallMuteClientCallback(mSession, MyRoutingClientIdWithFlagCallback, "Mute Client");                   
	WONRoutingInstallBecomeModeratorCallback(mSession, MyRoutingClientIdWithFlagCallback, "Become Moderator");              
	WONRoutingInstallHostChangeCallback(mSession, MyRoutingClientIdCallback, "Host Change");                                 
	WONRoutingInstallDataObjectCreationCallback(mSession, MyRoutingDataObjectWithLifespanCallback, "Data Object Creation");    
	WONRoutingInstallDataObjectDeletionCallback(mSession, MyRoutingDataObjectCallback, "Data Object Deletion");                
	WONRoutingInstallDataObjectModificationCallback(mSession, MyRoutingDataObjectModificationCallback, "Data Object Modification");
	WONRoutingInstallDataObjectReplacementCallback(mSession, MyRoutingDataObjectCallback, "Data Object Replacement");             
	WONRoutingInstallKeepAliveCallback(mSession, MyRoutingVoidCallback, "Keep Alive");                                      
	WONRoutingInstallPeerDataCallback(mSession, MyRoutingMessageWithClientIdCallback, "Peer Data");                 
	WONRoutingInstallRawPeerChatCallback(mSession, MyRoutingRawChatMessageCallback, "Raw Peer Chat");                   
	WONRoutingInstallASCIIPeerChatCallback(mSession, MyRoutingASCIIChatMessageCallback, "ASCII Peer Chat");               
	WONRoutingInstallUnicodePeerChatCallback(mSession, MyRoutingUnicodeChatMessageCallback, "Unicode Peer Chat");           
	WONRoutingInstallReconnectFailureCallback(mSession, MyRoutingVoidCallback, "Reconnect Failure");                               
	

	getch();

	WONRoutingCloseSessionHandle(mSession);
	WONAuthCloseHandle(mAuth);

	WONTerminate();
	
}