fixed transitioning of msg service config files from global signature format

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3522 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2010-09-21 22:02:35 +00:00
parent f84b6ff501
commit 8b1ffdb5d9
3 changed files with 31 additions and 4 deletions

View File

@ -29,6 +29,7 @@
#include "pqi/authssl.h"
#include "pqi/pqibin.h"
#include "pqi/pqistore.h"
#include "pqi/pqiarchive.h"
#include "pqi/pqinotify.h"
#include <errno.h>
#include <util/rsdiscspace.h>
@ -820,10 +821,32 @@ bool p3Config::getHashAttempt(const std::string& loadHash, std::string& hashstr,
uint32_t stream_flags = BIN_FLAGS_READABLE;
BinInterface *bio = new BinFileInterface(cfg_fname.c_str(), bioflags);
pqistore stream(setupSerialiser(), "CONFIG", bio, stream_flags);
PQInterface *stream = NULL;
std::string tempString, msgConfigFileName;
std::string::reverse_iterator rit = Filename().rbegin();
// get the msgconfig file name
for(int i =0; (i <= 7) && (rit != Filename().rend()); i++)
{
tempString.push_back(*rit);
rit++;
}
rit = tempString.rbegin();
for(; rit !=tempString.rend(); rit++)
msgConfigFileName.push_back(*rit);
if(msgConfigFileName == "msgs.cfg")
stream = new pqiarchive(setupSerialiser(), bio, bioflags);
else
stream = new pqistore(setupSerialiser(), "CONFIG", bio, bioflags);
RsItem *item = NULL;
while(NULL != (item = stream.GetItem()))
while(NULL != (item = stream->GetItem()))
{
#ifdef CONFIG_DEBUG
std::cerr << "p3Config::loadConfiguration() loaded item:";
@ -862,7 +885,8 @@ bool p3Config::getHashAttempt(const std::string& loadHash, std::string& hashstr,
return false;
}
//delete bio;
delete stream;
return true;
}

View File

@ -325,6 +325,9 @@ virtual RsSerialiser *setupSerialiser() = 0;
/**
* saves list of derived object
* @param cleanup this inform you if you need to call saveDone() to unlock/allow
* access to resources pointed to by handles (list) returned by function: thus false, call saveDone after returned list finished with
* and vice versa
* @return list of config items derived object wants to saves
*/
virtual std::list<RsItem *> saveList(bool &cleanup) = 0;

View File

@ -41,7 +41,7 @@
*
*/
class pqiarchive: PQInterface
class pqiarchive: public PQInterface
{
public:
pqiarchive(RsSerialiser *rss, BinInterface *bio_in, int bio_flagsin);