- Switched to new RsAccounts interface.

- Reworked ServerPage to support HiddenNode configuration.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-initdev@7028 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2014-01-18 02:35:06 +00:00
parent 39db508ce7
commit bbe3ee8d2f
13 changed files with 329 additions and 52 deletions

View file

@ -72,12 +72,12 @@ void GenCertDialog::init()
std::list<std::string>::iterator it;
bool foundGPGKeys = false;
if (!mOnlyGenerateIdentity) {
if (RsInit::GetPGPLogins(pgpIds)) {
if (RsAccounts::GetPGPLogins(pgpIds)) {
for(it = pgpIds.begin(); it != pgpIds.end(); it++)
{
QVariant userData(QString::fromStdString(*it));
std::string name, email;
RsInit::GetPGPLoginDetails(*it, name, email);
RsAccounts::GetPGPLoginDetails(*it, name, email);
std::cerr << "Adding PGPUser: " << name << " id: " << *it << std::endl;
QString gid = QString::fromStdString(*it).right(8) ;
ui.genPGPuser->addItem(QString::fromUtf8(name.c_str()) + " <" + QString::fromUtf8(email.c_str()) + "> (" + gid + ")", userData);
@ -187,7 +187,7 @@ void GenCertDialog::exportIdentity()
QVariant data = ui.genPGPuser->itemData(ui.genPGPuser->currentIndex());
std::string gpg_id = data.toString().toStdString() ;
if(RsInit::exportIdentity(fname.toStdString(),gpg_id))
if(RsAccounts::ExportIdentity(fname.toStdString(),gpg_id))
QMessageBox::information(this,tr("Identity saved"),tr("Your identity was successfully saved\nIt is encrypted\n\nYou can now copy it to another computer\nand use the import button to load it")) ;
else
QMessageBox::information(this,tr("Identity not saved"),tr("Your identity was not saved. An error occurred.")) ;
@ -203,7 +203,7 @@ void GenCertDialog::importIdentity()
std::string gpg_id ;
std::string err_string ;
if(!RsInit::importIdentity(fname.toStdString(),gpg_id,err_string))
if(!RsAccounts::ImportIdentity(fname.toStdString(),gpg_id,err_string))
{
QMessageBox::information(this,tr("Identity not loaded"),tr("Your identity was not loaded properly:")+" \n "+QString::fromStdString(err_string)) ;
return ;
@ -212,7 +212,7 @@ void GenCertDialog::importIdentity()
{
std::string name,email ;
RsInit::GetPGPLoginDetails(gpg_id, name, email);
RsAccounts::GetPGPLoginDetails(gpg_id, name, email);
std::cerr << "Adding PGPUser: " << name << " id: " << gpg_id << std::endl;
QMessageBox::information(this,tr("New identity imported"),tr("Your identity was imported successfully:")+" \n"+"\nName :"+QString::fromStdString(name)+"\nemail: " + QString::fromStdString(email)+"\nKey ID: "+QString::fromStdString(gpg_id)+"\n\n"+tr("You can use it now to create a new location.")) ;
@ -226,6 +226,7 @@ void GenCertDialog::genPerson()
/* Check the data from the GUI. */
std::string genLoc = ui.location_input->text().toUtf8().constData();
std::string PGPId;
bool isHiddenLoc = false;
if (ui.hidden_checkbox->isChecked())
{
@ -240,6 +241,7 @@ void GenCertDialog::genPerson()
QMessageBox::Ok);
return;
}
isHiddenLoc = true;
}
if (!genNewGPGKey) {
@ -297,7 +299,7 @@ void GenCertDialog::genPerson()
while(QAbstractEventDispatcher::instance()->processEvents(QEventLoop::AllEvents)) ;
std::string email_str = "" ;
RsInit::GeneratePGPCertificate(ui.name_input->text().toUtf8().constData(), email_str.c_str(), ui.password_input->text().toUtf8().constData(), PGPId, err_string);
RsAccounts::GeneratePGPCertificate(ui.name_input->text().toUtf8().constData(), email_str.c_str(), ui.password_input->text().toUtf8().constData(), PGPId, err_string);
setCursor(Qt::ArrowCursor) ;
}
@ -305,19 +307,19 @@ void GenCertDialog::genPerson()
//generate a random ssl password
std::string sslPasswd = RSRandom::random_alphaNumericString(RsInit::getSslPwdLen()) ;
/* Initialise the PGP user first */
RsInit::SelectGPGAccount(PGPId);
/* GenerateSSLCertificate - selects the PGP Account */
//RsInit::SelectGPGAccount(PGPId);
std::string sslId;
std::cerr << "GenCertDialog::genPerson() Generating SSL cert with gpg id : " << PGPId << std::endl;
std::string err;
bool okGen = RsInit::GenerateSSLCertificate(PGPId, "", genLoc, "", sslPasswd, sslId, err);
bool okGen = RsAccounts::GenerateSSLCertificate(PGPId, "", genLoc, "", isHiddenLoc, sslPasswd, sslId, err);
if (okGen)
{
/* complete the process */
RsInit::LoadPassword(sslId, sslPasswd);
if (Rshare::loadCertificate(sslId, false, PGPId)) {
RsInit::LoadPassword(sslPasswd);
if (Rshare::loadCertificate(sslId, false)) {
accept();
}
}