diff --git a/src/config/configfile.cpp b/src/config/configfile.cpp index 25543123..be98a318 100644 --- a/src/config/configfile.cpp +++ b/src/config/configfile.cpp @@ -48,7 +48,7 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly) myQtToolsInterface = CreateQtToolsWrapper(); // !!!! Revisionsnummer der Configdefaults !!!!! - configRev = 57; + configRev = 58; //standard defaults logOnOffDefault = "1"; @@ -57,7 +57,7 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly) #ifdef _WIN32 const char *appDataPath = getenv("AppData"); if (appDataPath && appDataPath[0] != 0) { - configFileName = appDataPath; + configFileName = appDataPath; } else { const int MaxPathSize = 1024; @@ -101,8 +101,8 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly) mkdir(logDir.c_str()); mkdir(dataDir.c_str()); mkdir(cacheDir.c_str()); - - + + #else //define app-dir const char *homePath = getenv("HOME"); @@ -124,7 +124,7 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly) mkdir(dataDir.c_str(), MODUS); mkdir(cacheDir.c_str(), MODUS); } - + #endif ostringstream tempIntToString; @@ -141,9 +141,9 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly) configList.push_back(ConfigInfo("ShowFlipCardsAnimation", CONFIG_TYPE_INT, "1")); configList.push_back(ConfigInfo("ShowBlindButtons", CONFIG_TYPE_INT, "1")); configList.push_back(ConfigInfo("ShowCardsChanceMonitor", CONFIG_TYPE_INT, "1")); - configList.push_back(ConfigInfo("AntiPeekMode", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("AlternateFKeysUserActionMode", CONFIG_TYPE_INT, "0")); - configList.push_back(ConfigInfo("EnableBetInputFocusSwitch", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("AntiPeekMode", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("AlternateFKeysUserActionMode", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("EnableBetInputFocusSwitch", CONFIG_TYPE_INT, "0")); configList.push_back(ConfigInfo("FlipsideTux", CONFIG_TYPE_INT, "1")); configList.push_back(ConfigInfo("FlipsideOwn", CONFIG_TYPE_INT, "0")); configList.push_back(ConfigInfo("FlipsideOwnFile", CONFIG_TYPE_STRING, "")); @@ -189,6 +189,10 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly) configList.push_back(ConfigInfo("ServerUseIpv6", CONFIG_TYPE_INT, "0")); configList.push_back(ConfigInfo("ServerUseSctp", CONFIG_TYPE_INT, "0")); configList.push_back(ConfigInfo("ServerPort", CONFIG_TYPE_INT, "7234")); + configList.push_back(ConfigInfo("ServerUsePutAvatars", CONFIG_TYPE_INT, "0")); + configList.push_back(ConfigInfo("ServerPutAvatarsAddress", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("ServerPutAvatarsUser", CONFIG_TYPE_STRING, "")); + configList.push_back(ConfigInfo("ServerPutAvatarsPassword", CONFIG_TYPE_STRING, "")); configList.push_back(ConfigInfo("InternetServerConfigMode", CONFIG_TYPE_INT, "0")); configList.push_back(ConfigInfo("InternetServerListAddress", CONFIG_TYPE_STRING, "pokerth.net/serverlist.xml.z")); configList.push_back(ConfigInfo("InternetServerAddress", CONFIG_TYPE_STRING, "pokerth.6dns.org")); @@ -232,7 +236,7 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly) configList.push_back(ConfigInfo("LogStoreDuration", CONFIG_TYPE_INT, "2")); configList.push_back(ConfigInfo("LogInterval", CONFIG_TYPE_INT, "0")); configList.push_back(ConfigInfo("UserDataDir", CONFIG_TYPE_STRING, dataDir)); - configList.push_back(ConfigInfo("CacheDir", CONFIG_TYPE_STRING, cacheDir)); + configList.push_back(ConfigInfo("CacheDir", CONFIG_TYPE_STRING, cacheDir)); configList.push_back(ConfigInfo("CLA_NoWriteAccess", CONFIG_TYPE_INT, "0")); configList.push_back(ConfigInfo("DisableBackToLobbyWarning", CONFIG_TYPE_INT, "0")); configList.push_back(ConfigInfo("DlgGameLobbyGameListSortingSection", CONFIG_TYPE_INT, "2")); @@ -246,34 +250,34 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly) if(!noWriteAccess) { configFileName += "config.xml"; - + //Prüfen ob Configfile existiert --> sonst anlegen - TiXmlDocument doc(configFileName); - if(!doc.LoadFile()){ + TiXmlDocument doc(configFileName); + if(!doc.LoadFile()){ myConfigState = NONEXISTING; - updateConfig(myConfigState); + updateConfig(myConfigState); } - else { + else { //Check if config revision and AppDataDir is ok. Otherwise --> update() int tempRevision = 0; string tempAppDataPath (""); - - TiXmlHandle docHandle( &doc ); + + TiXmlHandle docHandle( &doc ); TiXmlElement* confRevision = docHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).FirstChild( "ConfigRevision" ).ToElement(); if ( confRevision ) { confRevision->QueryIntAttribute("value", &tempRevision ); } TiXmlElement* confAppDataPath = docHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).FirstChild( "AppDataDir" ).ToElement(); - if ( confAppDataPath ) { + if ( confAppDataPath ) { const char *tmpStr = confAppDataPath->Attribute("value"); if (tmpStr) tempAppDataPath = tmpStr; } - if (tempRevision < configRev || tempAppDataPath != myQtToolsInterface->getDataPathStdString(myArgv0) ) { /*löschen()*/ + if (tempRevision < configRev || tempAppDataPath != myQtToolsInterface->getDataPathStdString(myArgv0) ) { /*löschen()*/ myConfigState = OLD; updateConfig(myConfigState) ; } } - - + + fillBuffer(); } } @@ -283,7 +287,7 @@ ConfigFile::~ConfigFile() { delete myQtToolsInterface; myQtToolsInterface = 0; - + } @@ -295,15 +299,15 @@ void ConfigFile::fillBuffer() { string tempString1(""); string tempString2(""); - TiXmlDocument doc(configFileName); - + TiXmlDocument doc(configFileName); + if(doc.LoadFile()) { - TiXmlHandle docHandle( &doc ); + TiXmlHandle docHandle( &doc ); + + for (i=0; iAttribute("value"); @@ -312,25 +316,25 @@ void ConfigFile::fillBuffer() { const char *tmpStr2 = conf->Attribute("type"); if (tmpStr2) { - tempString2 = tmpStr2; + tempString2 = tmpStr2; if(tempString2 == "list") { - + list tempStringList2; TiXmlElement* confList = docHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).FirstChild( configList[i].name ).FirstChild().ToElement(); - + for( ; confList; confList=confList->NextSiblingElement()) { tempStringList2.push_back(confList->Attribute("value")); } - + configBufferList[i].defaultListValue = tempStringList2; } } - - - } + + + } else { LOG_ERROR("Could not find the root element in the config file!"); } - + // cout << configBufferList[i].name << " " << configBufferList[i].defaultValue << endl; } } @@ -342,31 +346,31 @@ void ConfigFile::writeBuffer() const { //write buffer to disc if enabled if(!noWriteAccess) { - TiXmlDocument doc; - TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "UTF-8", ""); - doc.LinkEndChild( decl ); - - TiXmlElement * root = new TiXmlElement( "PokerTH" ); - doc.LinkEndChild( root ); - + TiXmlDocument doc; + TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "UTF-8", ""); + doc.LinkEndChild( decl ); + + TiXmlElement * root = new TiXmlElement( "PokerTH" ); + doc.LinkEndChild( root ); + TiXmlElement * config; - config = new TiXmlElement( "Configuration" ); - root->LinkEndChild( config ); - + config = new TiXmlElement( "Configuration" ); + root->LinkEndChild( config ); + size_t i; - + for (i=0; iLinkEndChild( tmpElement ); tmpElement->SetAttribute("value", configBufferList[i].defaultValue); - + if(configBufferList[i].type == CONFIG_TYPE_INT_LIST) { tmpElement->SetAttribute("type", "list"); list tempList = configBufferList[i].defaultListValue; list::iterator it; for(it = tempList.begin(); it != tempList.end(); it++) { - + TiXmlElement *tmpSubElement = new TiXmlElement(configBufferList[i].defaultValue); tmpElement->LinkEndChild( tmpSubElement ); tmpSubElement->SetAttribute("value", *it); @@ -374,7 +378,7 @@ void ConfigFile::writeBuffer() const { } } - + doc.SaveFile( configFileName ); } } @@ -384,20 +388,20 @@ void ConfigFile::updateConfig(ConfigState myConfigState) { boost::recursive_mutex::scoped_lock lock(m_configMutex); size_t i; - + if(myConfigState == NONEXISTING) { - + //Create a new ConfigFile! - TiXmlDocument doc; - TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "UTF-8", ""); - doc.LinkEndChild( decl ); - - TiXmlElement * root = new TiXmlElement( "PokerTH" ); - doc.LinkEndChild( root ); - + TiXmlDocument doc; + TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "UTF-8", ""); + doc.LinkEndChild( decl ); + + TiXmlElement * root = new TiXmlElement( "PokerTH" ); + doc.LinkEndChild( root ); + TiXmlElement * config; - config = new TiXmlElement( "Configuration" ); - root->LinkEndChild( config ); + config = new TiXmlElement( "Configuration" ); + root->LinkEndChild( config ); for (i=0; i tempList = configList[i].defaultListValue; list::iterator it; for(it = tempList.begin(); it != tempList.end(); it++) { - + TiXmlElement *tmpSubElement = new TiXmlElement(configList[i].defaultValue); tmpElement->LinkEndChild( tmpSubElement ); tmpSubElement->SetAttribute("value", *it); @@ -418,84 +422,84 @@ void ConfigFile::updateConfig(ConfigState myConfigState) { } } - + doc.SaveFile( configFileName ); } if(myConfigState == OLD) { - - TiXmlDocument oldDoc(configFileName); - + + TiXmlDocument oldDoc(configFileName); + //load the old one if(oldDoc.LoadFile()) { - - string tempString1(""); - string tempString2(""); - - TiXmlDocument newDoc; - - //Create the new one - TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "UTF-8", ""); - newDoc.LinkEndChild( decl ); - - TiXmlElement * root = new TiXmlElement( "PokerTH" ); - newDoc.LinkEndChild( root ); - - TiXmlElement * config; - config = new TiXmlElement( "Configuration" ); - root->LinkEndChild( config ); - //change configRev and AppDataPath - TiXmlElement * confElement0 = new TiXmlElement( "ConfigRevision" ); + string tempString1(""); + string tempString2(""); + + TiXmlDocument newDoc; + + //Create the new one + TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "UTF-8", ""); + newDoc.LinkEndChild( decl ); + + TiXmlElement * root = new TiXmlElement( "PokerTH" ); + newDoc.LinkEndChild( root ); + + TiXmlElement * config; + config = new TiXmlElement( "Configuration" ); + root->LinkEndChild( config ); + + //change configRev and AppDataPath + TiXmlElement * confElement0 = new TiXmlElement( "ConfigRevision" ); config->LinkEndChild( confElement0 ); confElement0->SetAttribute("value", configRev); - TiXmlElement * confElement1 = new TiXmlElement( "AppDataDir" ); + TiXmlElement * confElement1 = new TiXmlElement( "AppDataDir" ); config->LinkEndChild( confElement1 ); confElement1->SetAttribute("value", myQtToolsInterface->getDataPathStdString(myArgv0)); - TiXmlHandle oldDocHandle( &oldDoc ); + TiXmlHandle oldDocHandle( &oldDoc ); - for (i=0; i take over the saved values - + if(configList[i].name != "ConfigRevision" && configList[i].name != "AppDataDir") { // dont update ConfigRevision and AppDataDir becaus it was already set ^ - + TiXmlElement *tmpElement = new TiXmlElement(configList[i].name); config->LinkEndChild( tmpElement ); - + const char *tmpStr1 = oldConf->Attribute("value"); if (tmpStr1) tempString1 = tmpStr1; tmpElement->SetAttribute("value", tempString1); - + //for lists copy elements const char *tmpStr2 = oldConf->Attribute("type"); if (tmpStr2) { - tempString2 = tmpStr2; + tempString2 = tmpStr2; if(tempString2 == "list") { - + list tempStringList2; - + TiXmlElement* oldConfList = oldDocHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).FirstChild( configList[i].name ).FirstChild().ToElement(); - + for( ; oldConfList; oldConfList=oldConfList->NextSiblingElement()) { tempStringList2.push_back(oldConfList->Attribute("value")); } - + tmpElement->SetAttribute("type", "list"); list tempList = tempStringList2; list::iterator it; for(it = tempList.begin(); it != tempList.end(); it++) { - + TiXmlElement *tmpSubElement = new TiXmlElement(tempString1); tmpElement->LinkEndChild( tmpSubElement ); tmpSubElement->SetAttribute("value", *it); @@ -509,26 +513,26 @@ void ConfigFile::updateConfig(ConfigState myConfigState) { TiXmlElement *tmpElement = new TiXmlElement(configList[i].name); config->LinkEndChild( tmpElement ); tmpElement->SetAttribute("value", myQtToolsInterface->stringToUtf8(configList[i].defaultValue)); - + if(configList[i].type == CONFIG_TYPE_INT_LIST) { - + tmpElement->SetAttribute("type", "list"); list tempList = configList[i].defaultListValue; list::iterator it; for(it = tempList.begin(); it != tempList.end(); it++) { - + TiXmlElement *tmpSubElement = new TiXmlElement(configList[i].defaultValue); tmpElement->LinkEndChild( tmpSubElement ); tmpSubElement->SetAttribute("value", *it); } } } - } + } newDoc.SaveFile( configFileName ); } else { LOG_ERROR("Cannot update config file: Unable to load configuration."); } - + } } @@ -539,10 +543,10 @@ string ConfigFile::readConfigString(string varName) const size_t i; string tempString(""); - for (i=0; i> tempInt; - + return tempInt; } @@ -579,19 +583,19 @@ list ConfigFile::readConfigIntList(string varName) const list tempStringList; list tempIntList; - for (i=0; i::iterator it; for(it = tempStringList.begin(); it != tempStringList.end(); it++) { - + isst.str(*it); isst >> tempInt; tempIntList.push_back(tempInt); @@ -611,11 +615,11 @@ void ConfigFile::writeConfigInt(string varName, int varCont) string tempString; ostringstream intToString; - for (i=0; i varCont) ostringstream intToString; list stringList; - for (i=0; i::iterator it; for(it = varCont.begin(); it != varCont.end(); it++) { - - intToString << (*it); + + intToString << (*it); stringList.push_back(intToString.str()); intToString.str(""); intToString.clear(); } - - configBufferList[i].defaultListValue = stringList; + + configBufferList[i].defaultListValue = stringList; } } } @@ -653,7 +657,7 @@ void ConfigFile::writeConfigString(string varName, string varCont) boost::recursive_mutex::scoped_lock lock(m_configMutex); size_t i; - for (i=0; i m_uploader; }; diff --git a/src/core/common/avatarmanager.cpp b/src/core/common/avatarmanager.cpp index 48f73e56..369c1bad 100644 --- a/src/core/common/avatarmanager.cpp +++ b/src/core/common/avatarmanager.cpp @@ -53,7 +53,10 @@ struct AvatarFileState ifstream inputStream; }; -AvatarManager::AvatarManager() +AvatarManager::AvatarManager(bool useExternalServer, const std::string &externalServerAddress, + const string &externalServerUser, const string &externalServerPassword) +: m_useExternalServer(useExternalServer), m_externalServerAddress(externalServerAddress), + m_externalServerUser(externalServerUser), m_externalServerPassword(externalServerPassword) { m_uploader.reset(new UploaderThread()); } @@ -65,7 +68,7 @@ AvatarManager::~AvatarManager() } bool -AvatarManager::Init(const std::string &dataDir, const std::string &cacheDir) +AvatarManager::Init(const string &dataDir, const string &cacheDir) { bool retVal = true; bool tmpRet; @@ -324,7 +327,7 @@ AvatarManager::HasAvatar(const MD5Buf &md5buf) const } bool -AvatarManager::StoreAvatarInCache(const MD5Buf &md5buf, AvatarFileType avatarFileType, const unsigned char *data, unsigned size) +AvatarManager::StoreAvatarInCache(const MD5Buf &md5buf, AvatarFileType avatarFileType, const unsigned char *data, unsigned size, bool upload) { bool retVal = false; string cacheDir; @@ -361,7 +364,11 @@ AvatarManager::StoreAvatarInCache(const MD5Buf &md5buf, AvatarFileType avatarFil if (!o.fail()) { o.write((const char *)data, size); - //m_uploader->QueueUpload(fileName, size); + if (upload && m_useExternalServer) + { + m_uploader->QueueUpload(m_externalServerAddress, m_externalServerUser, m_externalServerPassword, fileName, size); + } + { boost::mutex::scoped_lock lock(m_cachedAvatarsMutex); m_cachedAvatars.insert(AvatarMap::value_type(md5buf, fileName)); diff --git a/src/net/common/clientthread.cpp b/src/net/common/clientthread.cpp index 664607ad..79b1f559 100644 --- a/src/net/common/clientthread.cpp +++ b/src/net/common/clientthread.cpp @@ -230,7 +230,7 @@ ClientThread::SendResetTimeout() { boost::shared_ptr reset(new NetPacketResetTimeout); boost::mutex::scoped_lock lock(m_outPacketListMutex); - m_outPacketList.push_back(reset); + m_outPacketList.push_back(reset); } void @@ -565,7 +565,7 @@ ClientThread::CompleteTempAvatarData(unsigned playerId) LOG_ERROR("Client received invalid player id!"); else { - if (!GetAvatarManager().StoreAvatarInCache(tmpPlayerInfo.avatar, tmpAvatar->fileType, &tmpAvatar->fileData[0], avatarSize)) + if (!GetAvatarManager().StoreAvatarInCache(tmpPlayerInfo.avatar, tmpAvatar->fileType, &tmpAvatar->fileData[0], avatarSize, false)) LOG_ERROR("Failed to store avatar in cache directory."); // Update player info, but never re-request avatar. diff --git a/src/net/common/downloadhelper.cpp b/src/net/common/downloadhelper.cpp index 55d241b3..2840fa3d 100644 --- a/src/net/common/downloadhelper.cpp +++ b/src/net/common/downloadhelper.cpp @@ -37,7 +37,7 @@ DownloadHelper::~DownloadHelper() } void -DownloadHelper::InternalInit(const string &/*url*/, const string &targetFileName, const string &/*user*/, const string &/*password*/) +DownloadHelper::InternalInit(const string &/*url*/, const string &targetFileName, const string &/*user*/, const string &/*password*/, int /*filesize*/) { // Open target file for writing. GetData()->targetFile = fopen(targetFileName.c_str(), "wb"); diff --git a/src/net/common/serverlobbythread.cpp b/src/net/common/serverlobbythread.cpp index 47c0f762..183a50f9 100644 --- a/src/net/common/serverlobbythread.cpp +++ b/src/net/common/serverlobbythread.cpp @@ -611,7 +611,7 @@ ServerLobbyThread::HandleNetPacketAvatarEnd(SessionWrapper session, const NetPac unsigned avatarSize = (unsigned)tmpAvatar->fileData.size(); if (avatarSize == tmpAvatar->reportedSize) { - if (!GetAvatarManager().StoreAvatarInCache(avatarMD5, tmpAvatar->fileType, &tmpAvatar->fileData[0], avatarSize)) + if (!GetAvatarManager().StoreAvatarInCache(avatarMD5, tmpAvatar->fileType, &tmpAvatar->fileData[0], avatarSize, true)) { session.playerData->SetAvatarMD5(MD5Buf()); LOG_ERROR("Failed to store avatar in cache directory."); diff --git a/src/net/common/transferhelper.cpp b/src/net/common/transferhelper.cpp index 5b8e6ebd..9ff9fc9a 100644 --- a/src/net/common/transferhelper.cpp +++ b/src/net/common/transferhelper.cpp @@ -42,7 +42,7 @@ TransferHelper::~TransferHelper() } void -TransferHelper::Init(const string &url, const string &targetFileName, const string &user, const string &password) +TransferHelper::Init(const string &url, const string &targetFileName, const string &user, const string &password, int filesize) { // Initialise curl. m_data->curlHandle = curl_easy_init(); @@ -57,7 +57,7 @@ TransferHelper::Init(const string &url, const string &targetFileName, const stri if (curl_easy_setopt(m_data->curlHandle, CURLOPT_URL, m_data->curlUrl.c_str()) != CURLE_OK) throw NetException(__FILE__, __LINE__, ERR_SOCK_TRANSFER_INVALID_URL, 0); - InternalInit(url, targetFileName, user, password); + InternalInit(url, targetFileName, user, password, filesize); // Use the multi interface for better abort handling. if (curl_multi_add_handle(m_data->curlMultiHandle, m_data->curlHandle) != CURLM_OK) @@ -156,4 +156,5 @@ boost::shared_ptr TransferHelper::GetData() { return m_data; -} \ No newline at end of file +} + diff --git a/src/net/common/uploaderthread.cpp b/src/net/common/uploaderthread.cpp index 5f313266..ed70d5a4 100644 --- a/src/net/common/uploaderthread.cpp +++ b/src/net/common/uploaderthread.cpp @@ -40,10 +40,10 @@ UploaderThread::~UploaderThread() } void -UploaderThread::QueueUpload(const std::string &filename, int filesize) +UploaderThread::QueueUpload(const string &url, const string &user, const string &pwd, const string &filename, int filesize) { boost::mutex::scoped_lock lock(m_uploadQueueMutex); - m_uploadQueue.push(UploadData(filename, filesize)); + m_uploadQueue.push(UploadData(url, user, pwd, filename, filesize)); } void diff --git a/src/net/common/uploadhelper.cpp b/src/net/common/uploadhelper.cpp index bc32350c..f032a8b8 100644 --- a/src/net/common/uploadhelper.cpp +++ b/src/net/common/uploadhelper.cpp @@ -46,14 +46,8 @@ UploadHelper::~UploadHelper() } void -UploadHelper::InternalInit(const string &/*url*/, const string &targetFileName, const string &user, const string &password) +UploadHelper::InternalInit(const string &/*url*/, const string &targetFileName, const string &user, const string &password, int filesize) { - int filesize = 0; - struct stat filestat; - - if (stat(targetFileName.c_str(), &filestat) == 0) /* success */ - filesize = filestat.st_size; - // Open target file for writing. // Open target file for writing. GetData()->targetFile = fopen(targetFileName.c_str(), "rb"); @@ -68,5 +62,7 @@ UploadHelper::InternalInit(const string &/*url*/, const string &targetFileName, curl_easy_setopt(GetData()->curlHandle, CURLOPT_USERPWD, GetData()->userCredentials.c_str()); curl_easy_setopt(GetData()->curlHandle, CURLOPT_UPLOAD, 1L); curl_easy_setopt(GetData()->curlHandle, CURLOPT_PUT, 1L); + curl_easy_setopt(GetData()->curlHandle, CURLOPT_SSL_VERIFYPEER, 0L); + curl_easy_setopt(GetData()->curlHandle, CURLOPT_SSL_VERIFYHOST, 0L); } diff --git a/src/net/downloadhelper.h b/src/net/downloadhelper.h index cb0eae5c..cd954ed0 100644 --- a/src/net/downloadhelper.h +++ b/src/net/downloadhelper.h @@ -32,7 +32,7 @@ public: protected: virtual void InternalInit(const std::string &url, const std::string &targetFileName, - const std::string &user, const std::string &password); + const std::string &user, const std::string &password, int filesize); }; #endif diff --git a/src/net/transferhelper.h b/src/net/transferhelper.h index 32dbedc8..b4f20b07 100644 --- a/src/net/transferhelper.h +++ b/src/net/transferhelper.h @@ -36,7 +36,7 @@ public: // Set the parameters. Does not do any error checking. // Throws an exception on failure. void Init(const std::string &url, const std::string &targetFileName, - const std::string &user = "", const std::string &password = ""); + const std::string &user = "", const std::string &password = "", int filesize = 0); // Returns true when done, false should call again. // Throws an exception on error. @@ -49,7 +49,7 @@ protected: boost::shared_ptr GetData(); virtual void InternalInit(const std::string &url, const std::string &targetFileName, - const std::string &user, const std::string &password) = 0; + const std::string &user, const std::string &password, int filesize) = 0; private: diff --git a/src/net/uploaderthread.h b/src/net/uploaderthread.h index 6d7a32b6..c0808c40 100644 --- a/src/net/uploaderthread.h +++ b/src/net/uploaderthread.h @@ -36,14 +36,18 @@ public: UploaderThread(); virtual ~UploaderThread(); - void QueueUpload(const std::string &filename, int filesize); + void QueueUpload(const std::string &url, const std::string &user, const std::string &pwd, const std::string &filename, int filesize); protected: struct UploadData { UploadData() : filesize(0) {} - UploadData(const std::string &f, int s) : filename(f), filesize(s) {} + UploadData(const std::string &a, const std::string &u, const std::string &p, const std::string &f, int s) + : address(a), user(u), pwd(p), filename(f), filesize(s) {} + std::string address; + std::string user; + std::string pwd; std::string filename; int filesize; }; diff --git a/src/net/uploadhelper.h b/src/net/uploadhelper.h index 8bc080ca..d82a0936 100644 --- a/src/net/uploadhelper.h +++ b/src/net/uploadhelper.h @@ -32,7 +32,7 @@ public: protected: virtual void InternalInit(const std::string &url, const std::string &targetFileName, - const std::string &user, const std::string &password); + const std::string &user, const std::string &password, int filesize); }; #endif diff --git a/src/session.cpp b/src/session.cpp index 762e9b29..3fcf0998 100755 --- a/src/session.cpp +++ b/src/session.cpp @@ -59,7 +59,12 @@ Session::~Session() bool Session::init() { - myAvatarManager.reset(new AvatarManager); + myAvatarManager.reset(new AvatarManager( + myConfig->readConfigInt("ServerUsePutAvatars") == 1, + myConfig->readConfigString("ServerPutAvatarsAddress"), + myConfig->readConfigString("ServerPutAvatarsUser"), + myConfig->readConfigString("ServerPutAvatarsPassword") + )); bool retVal = myAvatarManager->Init( myQtToolsInterface->stringFromUtf8(myConfig->readConfigString("AppDataDir")), myQtToolsInterface->stringFromUtf8(myConfig->readConfigString("CacheDir"))); @@ -90,7 +95,7 @@ void Session::startLocalGame(const GameData &gameData, const StartData &startDat PlayerDataList playerDataList; for(int i = 0; i < startData.numberOfPlayers; i++) { - //Namen und Avatarpfad abfragen + //Namen und Avatarpfad abfragen ostringstream myName; if (i==0) { myName << "MyName"; } else { myName << "Opponent" << i << "Name"; }