Exemplo n.º 1
0
void Almoco::on_pushButton_editar_clicked()
{
    if( ui->listWidget_lista->currentItem()  == 0 )
        return ;

    operacao = EDITAR;

    QString sTexto = ui->listWidget_lista->currentItem()->text();
    int iDoisPontos = sTexto.indexOf( ":" );
    int iEnter = sTexto.indexOf( "\n" );

    QString sData("Teste");

    sData = sTexto.mid( iDoisPontos + 2, iEnter - (iDoisPontos + 2) ).trimmed();
    qDebug() << "iDoisPontos: " << iDoisPontos ;
    qDebug() << "iEnter: " << iEnter ;
    qDebug() << "sData: " << sData ;
    qDebug() << "sTexto: " << sTexto ;

    ui->dateEdit_data->setDate( QDate::fromString( sData, "dd-MM-yyyy" ) );

    iDoisPontos = sTexto.indexOf( ":", iEnter );
    iEnter = sTexto.indexOf( "\n", iDoisPontos );

    ui->lineEdit_valor->setText( sTexto.mid( iDoisPontos + 1, iEnter - iDoisPontos -1 ) );

    HabilitaBotoes( false );
}
Exemplo n.º 2
0
ALERROR WriteHeader (CTDBCompiler &Ctx, int iGameFile, CDataFile &Out)
	{
	ALERROR error;
	CMemoryWriteStream Stream;

	if (error = Stream.Create())
		{
		Ctx.ReportError(CONSTLIT("Out of memory"));
		return error;
		}

	//	Write it

	CString sError;
	if (!Ctx.WriteHeader(Stream, iGameFile, &sError))
		{
		Ctx.ReportError(strPatternSubst(CONSTLIT("Unable to write header: %s"), sError));
		return ERR_FAIL;
		}

	//	Write out the header

	Stream.Close();
	CString sData(Stream.GetPointer(), Stream.GetLength(), TRUE);
	int iEntry;
	if (error = Out.AddEntry(sData, &iEntry))
		{
		Ctx.ReportError(CONSTLIT("Unable to write header"));
		return error;
		}

	Out.SetDefaultEntry(iEntry);

	return NOERROR;
	}
Exemplo n.º 3
0
void XMLCALL KML::dataHandler(void* pUserData, const char* pszData, int nLen)
{
    KML* poKML = (KML*) pUserData;

    poKML->nWithoutEventCounter = 0;

    if(nLen < 1 || poKML->poCurrent_ == NULL)
        return;

    poKML->nDataHandlerCounter ++;
    if (poKML->nDataHandlerCounter >= BUFSIZ)
    {
        CPLError(CE_Failure, CPLE_AppDefined, "File probably corrupted (million laugh pattern)");
        XML_StopParser(poKML->oCurrentParser, XML_FALSE);
    }

    try
    {
        std::string sData(pszData, nLen);

        if(poKML->poCurrent_->numContent() == 0)
            poKML->poCurrent_->addContent(sData);
        else
            poKML->poCurrent_->appendContent(sData);
    }
    catch(const std::exception& ex)
    {
        CPLError(CE_Failure, CPLE_AppDefined, "libstdc++ exception : %s", ex.what());
        XML_StopParser(poKML->oCurrentParser, XML_FALSE);
    }
}
Exemplo n.º 4
0
ALERROR WriteResource (const CString &sFilename, const CString &sFolder, CSymbolTable &Resources, CDataFile &Out)
	{
	ALERROR error;
	CString sFilespec = pathAddComponent(sFolder, sFilename);

	CFileReadBlock theFile(sFilespec);
	if (error = theFile.Open())
		{
		printf("Unable to open '%s'\n", sFilespec.GetASCIIZPointer());
		return error;
		}

	CString sData(theFile.GetPointer(0, -1), theFile.GetLength(), TRUE);
	int iEntry;
	if (error = Out.AddEntry(sData, &iEntry))
		{
		printf("Unable to store '%s'\n", sFilespec.GetASCIIZPointer());
		return error;
		}

	Resources.AddEntry(sFilespec, (CObject *)iEntry);
	printf("   %s\n", sFilespec.GetASCIIZPointer());

	return NOERROR;
	}
Exemplo n.º 5
0
ALERROR WriteHeader (int iGameFile, CSymbolTable &Resources, CDataFile &Out)
	{
	ALERROR error;
	CMemoryWriteStream Stream;
	DWORD dwSave;

	if (error = Stream.Create())
		{
		printf("Out of memory\n");
		return error;
		}

	//	Signature

	dwSave = TDB_SIGNATURE;
	Stream.Write((char *)&dwSave, sizeof(dwSave));

	//	Version

	dwSave = TDB_VERSION;
	Stream.Write((char *)&dwSave, sizeof(dwSave));

	//	Game file entry

	dwSave = iGameFile;
	Stream.Write((char *)&dwSave, sizeof(dwSave));

	//	Game title

	CString sGameTitle = CONSTLIT("Transcendence: The March of the Heretic");
	sGameTitle.WriteToStream(&Stream);

	//	Resource map

	CString sSave;
	if (error = CObject::Flatten(&Resources, &sSave))
		{
		printf("Unable to flatten resources map\n");
		return error;
		}

	sSave.WriteToStream(&Stream);

	//	Write out the header

	Stream.Close();
	CString sData(Stream.GetPointer(), Stream.GetLength(), TRUE);
	int iEntry;
	if (error = Out.AddEntry(sData, &iEntry))
		{
		printf("Unable to write out header\n");
		return error;
		}

	Out.SetDefaultEntry(iEntry);

	return NOERROR;
	}
Exemplo n.º 6
0
int Authentication::login(const std::string &sUsername, const std::string &sPassword)
{
    CURL *curl;
    CURLcode res;

    curl = curl_easy_init();
    if (!curl)
    {
        return 1;
    }

    curl_easy_setopt(curl, CURLOPT_URL, "https://login.minecraft.net");

    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
    curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);

    // TODO: urlencode
    curl_easy_setopt(curl, CURLOPT_POST, 1L);
    std::string sPost = "user="******"&password="******"&version=12";
    curl_easy_setopt(curl, CURLOPT_POSTFIELDS, sPost.c_str());

    ContentCallbackInfo info;
    info.pThis = this;
    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &Authentication::ContentCallback);
    curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&info);

    res = curl_easy_perform(curl);

    curl_easy_cleanup(curl);

    std::string sData(info.sBuffer);

    std::string::size_type idx = sData.find(':');
    if (idx != std::string::npos)
    {
        std::string sTimestamp = sData.substr(0, idx);
        std::string sDeprecated = sData.substr(idx + 1);
        idx = sDeprecated.find(':');
        if (idx != std::string::npos)
        {
            m_sUsername = sDeprecated.substr(idx + 1);
            sDeprecated = sDeprecated.substr(0, idx);
            idx = m_sUsername.find(':');
            if (idx != std::string::npos)
            {
                m_sSessionId = m_sUsername.substr(idx + 1);
                m_sUsername = m_sUsername.substr(0, idx);
                idx = m_sSessionId.find(':');
                if (idx != std::string::npos)
                {
                    m_sSessionId = m_sSessionId.substr(idx);
                }
            }
        }
    }

    return 0;
}
Exemplo n.º 7
0
   bool
   FileUtilities::ReadLine(HANDLE hFile, String &sLine)
   {
      BYTE buf[2048];
      memset(buf, 0, 2048);

      unsigned long nbytes = 0;

      // Get current position in file.
      DWORD dwCurrentFilePosition = SetFilePointer( 
         hFile, // must have GENERIC_READ and/or GENERIC_WRITE 
         0,     // do not move pointer 
         NULL,  // hFile is not large enough to need this pointer 
         FILE_CURRENT);  // provides offset from current position    


      // read buffer from file.
      BOOL bMoreData = ReadFile(hFile,buf,2048, &nbytes, NULL);

      // Search for line end
      String sData((char*) buf);
      int iEndPos = sData.Find(_T("\r\n"), 0);

      if (iEndPos < 0)
      {
         // Couldn't find end of line. Assume that all 
         // the remaining data is on the current line.
         iEndPos = nbytes;
      }

      if (iEndPos >= 0)
      {
         sLine = sData.Mid(0, iEndPos);  
         iEndPos = iEndPos + 2;

      }

      // Set new position in file.
      SetFilePointer( 
         hFile, // must have GENERIC_READ and/or GENERIC_WRITE 
         iEndPos + dwCurrentFilePosition,     // do not move pointer 
         NULL,  // hFile is not large enough to need this pointer 
         FILE_BEGIN);  // provides offset from current position    

      if (bMoreData && nbytes > 0)
         return true;
      else
         return false;
   }
Exemplo n.º 8
0
bool AflMapData::createMap(INT iWidth,INT iHeight)
{
	int i;
	for(i=0;i<5;i++)
	{
    	std::auto_ptr<SHORT> sData(NEW SHORT[iWidth*iHeight]);
		m_ptrData[i] = sData;
		ZeroMemory(m_ptrData[i].get(),sizeof(SHORT)*iWidth*iHeight);
	}
	createTipFlag(iWidth,iHeight);

	m_iMapWidth = iWidth;
	m_iMapHeight = iHeight;
	return true;
}
Exemplo n.º 9
0
ALERROR WriteResource (CTDBCompiler &Ctx, const CString &sFilename, const CString &sFolder, bool bCompress, CDataFile &Out)
	{
	ALERROR error;
	CString sFilespec = pathAddComponent(sFolder, sFilename);

	CFileReadBlock theFile(pathAddComponent(Ctx.GetRootPath(), sFilespec));
	if (error = theFile.Open())
		{
		Ctx.ReportError(strPatternSubst(CONSTLIT("Unable to open '%s'."), sFilespec));
		return error;
		}

	CString sData(theFile.GetPointer(0, -1), theFile.GetLength(), TRUE);

	if (bCompress)
		{
		CBufferReadBlock Input(sData);

		CMemoryWriteStream Output;
		if (error = Output.Create())
			return ERR_FAIL;

		CString sError;
		if (!zipCompress(Input, compressionZlib, Output, &sError))
			{
			Ctx.ReportError(sError);
			return ERR_FAIL;
			}

		sData = CString(Output.GetPointer(), Output.GetLength());
		}

	int iEntry;
	if (error = Out.AddEntry(sData, &iEntry))
		{
		Ctx.ReportError(strPatternSubst(CONSTLIT("Unable to store '%s'."), sFilespec));
		return error;
		}

	Ctx.AddResource(sFilespec, iEntry, bCompress);

	printf("   %s\n", sFilespec.GetASCIIZPointer());

	return NOERROR;
	}
Exemplo n.º 10
0
/**
 * Constructor.
 *
 * @param           
 * @return          
 * @exception       -
 * @see             
*/
CXMLDocument::CXMLDocument()
{
    HRESULT hr = m_domDocument.CoCreateInstance(CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER);
    ASSERT(hr == S_OK);
    // create processing instruction node
    CComPtr<IXMLDOMProcessingInstruction> pPINode;
    CComBSTR sTarget("xml");
    CComBSTR sData("version=\"1.0\" encoding=\"UTF-8\"");
    hr = m_domDocument->createProcessingInstruction(sTarget, sData, &pPINode);
    if(hr == S_OK)
    {
        // add processing instruction node to document
        CComQIPtr<IXMLDOMNode, &IID_IXMLDOMNode> docNode = m_domDocument;
        CComPtr<IXMLDOMNode> pOutNode;
        hr = docNode->appendChild(pPINode, &pOutNode);
		ASSERT(hr == S_OK);
    }
}
Exemplo n.º 11
0
bool AflMapData::setMapSize(INT iWidth,INT iHeight)
{
	int i,j,k;
	for(i=0;i<5;i++)
	{
		PSHORT pData = NEW SHORT[iWidth*iHeight];
		ZeroMemory(pData,sizeof(SHORT)*iWidth*iHeight);
		for(j=0;j < iHeight ;j++)
		{
			for(k=0;k < iWidth ;k++)
				pData[iWidth*j+k] = getMapIndex(i,k,j);
		}

    	std::auto_ptr<SHORT> sData(pData);
		m_ptrData[i] = sData;
	}

	m_iMapWidth = iWidth;
	m_iMapHeight = iHeight;
	return true;
}
Exemplo n.º 12
0
bool MusikAppConnection::OnPoke(const wxString& WXUNUSED(topic), const wxString& item, wxChar *data, int size, wxIPCFormat format)

{
#if wxUSE_UNICODE
	if((item == wxT("PlayFiles")) && (format == wxIPC_UNICODETEXT) )
#else
	if((item == wxT("PlayFiles")) && (format == wxIPC_TEXT) )
#endif
	{
		wxString sData(data,size/sizeof(wxChar));
		wxArrayString aFilelist;
		DelimitStr(sData,wxT("\n"),aFilelist);
		wxGetApp().OnPlayFiles(aFilelist);
	}
	else if(item == wxT("RaiseFrame"))
	{
		g_MusikFrame->Show();
		g_MusikFrame->Raise();
	}
	return TRUE;
}
Exemplo n.º 13
0
void CWebSocket::OnRequestReceived(char* pHeader, DWORD dwHeaderLen, char* pData, DWORD dwDataLen, in_addr inad)
{
	CStringA sHeader(pHeader, dwHeaderLen);
	CStringA sData(pData, dwDataLen);
	CStringA sURL;
	bool filereq=false;

	if(sHeader.Left(3) == "GET")
		sURL = sHeader.Trim();

	else if(sHeader.Left(4) == "POST")
		sURL = "?" + sData.Trim();	// '?' to imitate GET syntax for ParseURL

	if(sURL.Find(" ") > -1)
		sURL = sURL.Mid(sURL.Find(" ")+1, sURL.GetLength());
	if(sURL.Find(" ") > -1)
		sURL = sURL.Left(sURL.Find(" "));

	if (sURL.GetLength()>4 &&	// min length (for valid extentions)
		(sURL.Right(4).MakeLower()==".gif" || sURL.Right(4).MakeLower()==".jpg" || sURL.Right(4).MakeLower()==".png" ||
		sURL.Right(4).MakeLower()==".ico" ||sURL.Right(4).MakeLower()==".css" ||sURL.Right(3).MakeLower()==".js" ||
		sURL.Right(4).MakeLower()==".bmp" || sURL.Right(5).MakeLower()==".jpeg"
		)
		&& sURL.Find("..")==-1	// dont allow leaving the emule-webserver-folder for accessing files
		)
			filereq=true;

	ThreadData Data;
	Data.sURL = sURL;
	Data.pThis = m_pParent;
	Data.inadr = inad;
	Data.pSocket = this;

	if (!filereq)
		m_pParent->ProcessURL(Data);
	else
		m_pParent->ProcessFileReq(Data);

	Disconnect();
}
Exemplo n.º 14
0
ALERROR WriteGameFile (const CString &sFilespec, CDataFile &Out, int *retiGameFile)
	{
	ALERROR error;

	CFileReadBlock theFile(sFilespec);
	if (error = theFile.Open())
		{
		printf("Unable to open '%s'\n", sFilespec.GetASCIIZPointer());
		return error;
		}

	CString sData(theFile.GetPointer(0, -1), theFile.GetLength(), TRUE);
	if (error = Out.AddEntry(sData, retiGameFile))
		{
		printf("Unable to store '%s'\n", sFilespec.GetASCIIZPointer());
		return error;
		}

	printf("%s\n", sFilespec.GetASCIIZPointer());

	return NOERROR;
	}
Exemplo n.º 15
0
void ReadScriptsFromPath(const QDir &path, QScriptEngine &scriptEngine)
{
    QStringList list = path.entryList(QStringList("*.js"));

    for (QStringList::Iterator iter = list.begin(); iter != list.end(); iter++)
    {
        QString sFullFilename = path.absolutePath();
        sFullFilename.append("/");
        sFullFilename.append(*iter);

        QFile scriptFile(sFullFilename);
        scriptFile.open(QIODevice::ReadOnly | QIODevice::Text);

        Q_ASSERT(scriptFile.isOpen());

        QByteArray ReadData = scriptFile.readAll();
        scriptFile.close();

        std::cerr << "read " << scriptFile.fileName().toStdString() << std::endl;

        QString sData(ReadData);
        std::cerr << scriptEngine.evaluate(sData).toString().toStdString() << std::endl;
    }
}
Exemplo n.º 16
0
void CWebSocket::OnRequestReceived(char *pHeader, DWORD dwHeaderLen, char *pData, DWORD dwDataLen)
{
	EMULE_TRY

	CStringA	sHeader(pHeader, dwHeaderLen);
	CStringA	sURL;
	int			iIdx;
	bool		bFileReq = false;

	if (sHeader.Left(3) == "GET")
	{
		sURL = sHeader.TrimRight();
	}
	else if (sHeader.Left(4) == "POST")
	{
		CStringA		sData(pData, dwDataLen);

		sURL = '?';
		sURL += sData.Trim();	// '?' to imitate GET syntax for ParseURL
	}
	iIdx = sURL.Find(' ');
	if (iIdx >= 0)
		sURL = sURL.Mid(iIdx + 1);
	iIdx = sURL.Find(' ');
	if (iIdx >= 0)
		sURL = sURL.Left(iIdx);

	if (sURL.GetLength() > 4)
	{
		CStringA	strExt4 = sURL.Right(4).MakeLower();

		if (( (strExt4 == ".gif") || (strExt4 == ".jpg") || (strExt4 == ".png") ||
			(strExt4 == ".ico") || (strExt4 == ".css") || (sURL.Right(3).MakeLower() == ".js") ||
			(strExt4 == ".bmp") || (sURL.Right(5).MakeLower() == ".jpeg") || (strExt4 == ".xml") || (strExt4 == ".txt") )
			&& sURL.Find("..") < 0 )	// don't allow leaving the emule-webserver-folder for accessing files
		{
			bFileReq = true;
		}
	}

// HTTP header AcceptEncoding
	CStringA	strAcceptEncoding;
	iIdx = sHeader.Find("Accept-Encoding: ");
	if (iIdx >= 0)
	{
		int	iIdx2 = sHeader.Find("\r\n", iIdx += 17);

		strAcceptEncoding = sHeader.Mid(iIdx, iIdx2 - iIdx);
	}
// End AcceptEncoding

// HTTP header IfModifiedSince
	CStringA	strIfModifiedSince;
	iIdx = sHeader.Find("If-Modified-Since: ");
	if (iIdx >= 0)
	{
		int	iIdx2 = sHeader.Find("\r\n", iIdx += 19);

		strIfModifiedSince = sHeader.Mid(iIdx, iIdx2 - iIdx);
	}
// End IfModifiedSince

	ThreadData Data;

	Data.sURL = sURL;
	Data.pThis = m_pParent;
	Data.pSocket = this;
	Data.strAcceptEncoding = strAcceptEncoding;
	Data.strIfModifiedSince = strIfModifiedSince;

	if (!bFileReq)
		m_pParent->ProcessGeneralReq(Data);
	else
		m_pParent->ProcessFileReq(Data);

	Disconnect();

	EMULE_CATCH2
}
Exemplo n.º 17
0
void call_once(void (*func)(), once_flag& flag)
{
#if defined(BOOST_HAS_WINTHREADS)
    if (compare_exchange(&flag, 1, 1) == 0)
    {
#if defined(BOOST_NO_STRINGSTREAM)
        std::ostrstream strm;
        strm << "2AC1A572DB6944B0A65C38C4140AF2F4" 
             << std::hex
             << GetCurrentProcessId() 
             << &flag 
             << std::ends;
        unfreezer unfreeze(strm);
#   if defined (BOOST_NO_ANSI_APIS)
        USES_CONVERSION;
        HANDLE mutex = CreateMutexW(NULL, FALSE, A2CW(strm.str()));
#   else
        HANDLE mutex = CreateMutexA(NULL, FALSE, strm.str());
#   endif
#else
#   if defined (BOOST_NO_ANSI_APIS)
        std::wostringstream strm;
        strm << L"2AC1A572DB6944B0A65C38C4140AF2F4" 
             << std::hex
             << GetCurrentProcessId() 
             << &flag;
        HANDLE mutex = CreateMutexW(NULL, FALSE, strm.str().c_str());
#   else
        std::ostringstream strm;
        strm << "2AC1A572DB6944B0A65C38C4140AF2F4" 
             << std::hex
             << GetCurrentProcessId() 
             << &flag;
        HANDLE mutex = CreateMutexA(NULL, FALSE, strm.str().c_str());
#   endif
#endif
        assert(mutex != NULL);

        int res = 0;
        res = WaitForSingleObject(mutex, INFINITE);
        assert(res == WAIT_OBJECT_0);

        if (compare_exchange(&flag, 1, 1) == 0)
        {
            try
            {
                func();
            }
            catch (...)
            {
                res = ReleaseMutex(mutex);
                assert(res);
                res = CloseHandle(mutex);
                assert(res);
                throw;
            }
            InterlockedExchange(&flag, 1);
        }

        res = ReleaseMutex(mutex);
        assert(res);
        res = CloseHandle(mutex);
        assert(res);
    }
#elif defined(BOOST_HAS_PTHREADS)
    pthread_once(&once, &key_init);
    pthread_setspecific(key, &func);
    pthread_once(&flag, do_once);
#elif defined(BOOST_HAS_MPTASKS)
    if(flag == false)
    {
        // all we do here is make a remote call to blue, as blue is not
        // reentrant.
        std::pair<void (*)(), once_flag *> sData(func, &flag);
        MPRemoteCall(remote_call_proxy, &sData, kMPOwningProcessRemoteContext);
        assert(flag == true);
    }
#endif
}
Exemplo n.º 18
0
void ParsePacket()
{
    try
    {
        bool locked = false;
        while (!disconnect)
        {
            Sleep(1);

            if (locked || packetQueueIn.empty())
                continue;
            else
                locked = true;

            WorldPacket data = packetQueueIn.front();
            packetItr itr = packetQueueIn.begin();
            packetQueueIn.erase(itr);

            uint32 msgCode = data.getMsgCode();

            switch (msgCode)
            {
                case MSG_CONNECTION:
                {
                    string msg;
                    data >> msg;

                    cout << "[System]: Chanllenge OK: " << msg << endl;
                    challengeOK = true;
                    break;
                }
                case SMSG_AUTH_CHALLENGE:
                {
                    if (challengeOK)
                    {
                        WorldPacket data(CMSG_AUTH_SESSION);
                        data << username;
                        data << password;

                        SendPacket(data);
                    }
                    else
                        cout << "[System]: Client not prepared!" << endl;
                    break;
                }
                case SMSG_AUTH_RESPONSE:
                {
                    string msg;

                    data >> authed;
                    data >> msg;

                    cout << "[System]: " << msg << endl;

                    WorldPacket sData;

                    if (!authed)
                    {
                        cin >> username >> password;

                        sData.Initialize(CMSG_AUTH_SESSION);
                        sData << username;
                        sData << password;

                        SendPacket(sData);
                    }
                    else
                    {
                        sData.Initialize(CMSG_ENUM_CHARACTERS);
                        sData << uint8(0);
                        SendPacket(sData);
                    }
                    break;
                }
                case SMSG_HELLO:
                {
                    uint32 onLinePlayer;
                    string msg;

                    data >> accountID;
                    data >> onLinePlayer;
                    data >> msg;

                    cout << "[System]: " << "AccountID: " << accountID << ", Name: " << player.name << ", Online Players: " << onLinePlayer << "\n[System]: " << msg << endl;

                    break;
                }
                case SMSG_ENUM_CHARACTERS:
                {
                    data >> player.name
                         >> player.guid
                         >> player.id
                         >> player.level
                         >> player.race
                         >> player.classs
                         >> player.health
                         >> player.mana
                         >> player.speed;

                    uint32 id;
                    while (true)
                    {
                        cout << "[System]: Choose your character: " << player.id << endl;
                        cin >> id;

                        if (id == player.id)
                            break;

                        cout << "[System]: You don't have that character!" << endl;
                    }

                    playerMap[player.id] = player.name;

                    loggedIn = true;

                    WorldPacket sData(CMSG_PLAYER_LOGIN);
                    sData << player.id;

                    SendPacket(sData);

                    break;
                }
                case SMSG_PLAYER_LOGIN:
                {
                    uint32 id;
                    string name;
                    string msg;

                    data >> id;
                    data >> name;
                    data >> msg;

                    if (id != accountID)
                    {
                        cout << "[System]: " << msg << ", ID: " << id << ", Name: " << name << endl;
                        playerMap[id] = name;
                    }
                    break;
                }
                case SMSG_PLAYER_INFO:
                {
                    PlayerInfo *info = new PlayerInfo();

                    data >> info->name
                         >> info->guid
                         >> info->id
                         >> info->level
                         >> info->race
                         >> info->classs
                         >> info->health
                         >> info->mana
                         >> info->speed;

                    cout << "Player:[Name:" << info->name << ", GUID:" << info->guid << ", ID:" << info->id << ", LV:" << uint32(info->level)
                         << ", R:" << uint32(info->race) << ", C:" << uint32(info->classs) << ", HP:" << info->health << ", MP:" << info->mana << ", S:" << info->speed << "]" << endl;

                    if (playerMap[info->id] == "")
                        playerMap[info->id] = info->name;

                    SAFE_DELETE(info);

                    break;
                }
                case SMSG_CHATMESSAGE:
                {
                    int32  sender;
                    string msg;
                    data >> sender;
                    data >> msg;

                    if (sender < 0)
                        cout << "[System]: " << msg << endl;
                    else
                    {
                        if (playerMap[sender] == "")
                        {
                            WorldPacket sData(CMSG_PLAYER_INFO);
                            sData << sender;
                            SendPacket(sData);
                            break;
                        }

                        if (sender == player.id)
                            SetInputPos(inputPosX, inputPosY);

                        cout << "[" << playerMap[sender] << "]: " << msg << endl;
                    }
                    break;
                }
                case SMSG_PLAYER_LOGOUT:
                {
                    uint32 id = data.ReadUInt32();
                    if (playerMap[id] != "")
                        cout << "[System]: Player [" << playerMap[id] << "] Logged out!" << endl;

                    break;
                }
                default:
                    cout << "[System]: Get UnHandled MsgCode: " << msgCode << endl;
            }

            GetInputPos(&inputPosX, &inputPosY);
            locked = false;
        }