Ejemplo n.º 1
0
void IRoomPlayer::init(uint32_t nSessionID , uint32_t nUserUID)
{
	setSessionID(nSessionID) ;
	setUserUID(nUserUID) ;
	m_nStateFlag = 0 ;
	m_nCoin = 0 ;
}
Ejemplo n.º 2
0
void DiscoverabilityManager::handleHeartbeatResponse(QNetworkReply& requestReply) {
    auto dataObject = AccountManager::dataObjectFromResponse(requestReply);

    if (!dataObject.isEmpty()) {
        auto sessionID = dataObject[SESSION_ID_KEY].toString();

        // give that session ID to the account manager
        auto accountManager = DependencyManager::get<AccountManager>();
        accountManager->setSessionID(sessionID);
    }
}
Ejemplo n.º 3
0
void MyProxyEngine::createDialog(qint16 cmd, QString param)
{
    MyDialog *m_dialog=new MyDialog(this);
    connect(m_server, SIGNAL(receiveMessage(MyPacket &)),
            m_dialog, SLOT  (receiveMessage(MyPacket &)));
    connect(m_dialog, SIGNAL(Exit(MyDialog *,qint16,qint16)),
            this,     SLOT  (DialogAnswer(MyDialog *,qint16,qint16)));
    connect(m_dialog, SIGNAL(sendMessage(MyPacket &)),
            m_server, SLOT  (sendMessage(MyPacket &)));
    connect(m_dialog, SIGNAL(Logon(QString, QString, qint32)),
            m_config, SLOT  (setLogin(QString, QString, qint32)));
    connect(m_dialog, SIGNAL(SessionID(qint32)),
            m_server, SLOT  (setSessionID(qint32)));

    m_dialog->execute(cmd,
                      m_config->getSessionID(),
                      param,
                      m_config->getClientRSApublic());
}
Ejemplo n.º 4
0
/*
*******************************************************************
* Function:   
*
* Description: 
*    
* Parameters: 
*
* Returns: 
*
*******************************************************************
*/
void xDistributedSession::unpackUpdate(TNL::GhostConnection *connection, TNL::BitStream *stream)
{

	xNetInterface *netInterface  = (xNetInterface*) connection->getInterface();
	if (netInterface)
	{
		//////////////////////////////////////////////////////////////////////////
		//initial update  ? 
		if(stream->readFlag())
		{
			if(stream->readFlag())
			{
				char oName[256];stream->readString(oName);	// retrieve objects name : 
				char cName[256];stream->readString(cName);	// retrieve objects dist class name : 
				int type  = stream->readInt(32);							//read the dist class base type : 
				int userID = stream->readInt(32);	
				int serverID2 = stream->readInt(32);	
				float creationTime = 0.0f;
				stream->read(&creationTime);
				int sessionID = stream->readInt(32);	
				int MaxUsers = stream->readInt(32);	
				char pass[256];stream->readString(pass);





				//////////////////////////////////////////////////////////////////////////
				//now we store all in the dist object :

				//find and store the dist class : 
				xDistributedClassesArrayType *_classes = netInterface->getDistributedClassInterface()->getDistrutedClassesPtr();
				xDistributedClass *classTemplate = netInterface->getDistributedClassInterface()->get(cName,type);
				if (!classTemplate)
				{
					xLogger::xLog(ELOGERROR,E_LI_SESSION,"Warning initial unpack of session %s failed :  no related class found  : %s",oName,cName);
					//xLogger::xLog(ELOGINFO,XL_START,"Warning Initial Unpack Update, no related class found  : %s",cName);
					//xLogger::xLog(ELOGERROR,XL_SESSION,"Warning Initial Unpack Update, no related class found  : %s",cName);
					classTemplate  = netInterface->getDistributedClassInterface()->createClass(cName,type);

				}
				setDistributedClass(classTemplate);
				SetName(oName);
				setServerID(connection->getGhostIndex(this));
				setObjectFlags(E_DO_CREATION_CREATED);
				setUserID(userID);
				setNetInterface(netInterface);
				setCreationTime(creationTime);
				setSessionID(sessionID);
                			
				
				getOwnershipState().set( 1<<E_DO_OS_OWNER,  getUserID() == ((vtConnection*)connection)->getUserID() );

				setInterfaceFlags(E_DO_CREATED);
				getSessionFlags().set( 1 << E_SF_INCOMPLETE );


				xLogger::xLog(ELOGTRACE,E_LI_SESSION,"Retrieved initial state of session %s",oName);
				initProperties();
				setMaxUsers(MaxUsers);
				setPassword(xNString(pass));
				vtConnection *con  = (vtConnection*)connection;
				setOwnerConnection(con);
			}
		}



		int updateBits = stream->readSignedInt(32);
		TNL::BitSet32 updateBitsMask(updateBits);
		setGhostUpdateBits(updateBits);

		xDistributedPropertyArrayType &props = *getDistributedPorperties();
		int propCounter = 0;
		for (unsigned int i = 0  ;  i < props.size() ; i++ )
		{
			xDistributedProperty *prop  = props[i];
			xDistributedPropertyInfo*propInfo  = prop->getPropertyInfo();
			int blockIndex = prop->getBlockIndex();
			if (updateBitsMask.testStrict(1<<blockIndex))
			{
				prop->updateFromServer(stream);
				xLogger::xLog(ELOGTRACE,E_LI_SESSION,"Client : retrieving session property : %s |pred :%d",prop->getPropertyInfo()->mName.getString(),prop->getPropertyInfo()->mPredictionType);
				//xLogger::xLog(ELOGINFO,XL_START,"client : retrieving session property : %s",prop->getPropertyInfo()->mName.getString());
				getSessionFlags().set( 1 << E_SF_COMPLETE );
				propCounter++;
			}
		}

		if (propCounter == props.size())
		{
			getSessionFlags().set( 1 << E_SF_COMPLETE );
		}
	}
}