fixed up addign friend from short invite

This commit is contained in:
csoler 2019-06-09 23:49:31 +02:00
parent 4bd5aaa9b2
commit fb52f6717c
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
9 changed files with 90 additions and 44 deletions

View file

@ -922,7 +922,7 @@ void ConnectFriendWizard::accept()
return;
}
if (!mCertificate.empty() && add_key_to_keyring)
if(!peerDetails.skip_signature_validation && !mCertificate.empty() && add_key_to_keyring)
{
RsPgpId pgp_id ;
RsPeerId ssl_id ;
@ -940,28 +940,33 @@ void ConnectFriendWizard::accept()
if(accept_connection && !peerDetails.gpg_id.isNull())
{
std::cerr << "ConclusionPage::validatePage() accepting GPG key for connection." << std::endl;
rsPeers->addFriend(peerDetails.id, peerDetails.gpg_id,serviceFlags()) ;
rsPeers->setServicePermissionFlags(peerDetails.gpg_id,serviceFlags()) ;
if(ui->_addIPToWhiteList_CB_2->isChecked())
{
sockaddr_storage addr ;
if(sockaddr_storage_ipv4_aton(addr,peerDetails.extAddr.c_str()) && sockaddr_storage_isValidNet(addr))
{
std::cerr << "ConclusionPage::adding IP " << sockaddr_storage_tostring(addr) << " to whitelist." << std::endl;
rsBanList->addIpRange(addr,ui->_addIPToWhiteList_ComboBox_2->currentIndex(),RSBANLIST_TYPE_WHITELIST,std::string(tr("Added with certificate from %1").arg(ui->nameEdit->text()).toUtf8().constData()));
}
}
if(peerDetails.skip_signature_validation)
rsPeers->addSslOnlyFriend(peerDetails.id, peerDetails.gpg_id,peerDetails);
else
rsPeers->addFriend(peerDetails.id, peerDetails.gpg_id,serviceFlags()) ;
rsPeers->setServicePermissionFlags(peerDetails.gpg_id,serviceFlags()) ;
if(ui->_addIPToWhiteList_CB_2->isChecked())
{
sockaddr_storage addr ;
if(sockaddr_storage_ipv4_aton(addr,peerDetails.extAddr.c_str()) && sockaddr_storage_isValidNet(addr))
{
std::cerr << "ConclusionPage::adding IP " << sockaddr_storage_tostring(addr) << " to whitelist." << std::endl;
rsBanList->addIpRange(addr,ui->_addIPToWhiteList_ComboBox_2->currentIndex(),RSBANLIST_TYPE_WHITELIST,std::string(tr("Added with certificate from %1").arg(ui->nameEdit->text()).toUtf8().constData()));
}
}
if(sign)
{
std::cerr << "ConclusionPage::validatePage() signing GPG key." << std::endl;
rsPeers->signGPGCertificate(peerDetails.gpg_id); //bye default sign set accept_connection to true;
rsPeers->setServicePermissionFlags(peerDetails.gpg_id,serviceFlags()) ;
}
}
if (!groupId.isEmpty())
rsPeers->assignPeerToGroup(RsNodeGroupId(groupId.toStdString()), peerDetails.gpg_id, true);
if (!groupId.isEmpty())
rsPeers->assignPeerToGroup(RsNodeGroupId(groupId.toStdString()), peerDetails.gpg_id, true);
}
if ((accept_connection) && (!peerDetails.id.isNull()))

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>400</height>
<width>1100</width>
<height>604</height>
</rect>
</property>
<property name="windowTitle">
@ -45,7 +45,7 @@
<item>
<widget class="QRadioButton" name="foffRadioButton">
<property name="text">
<string>&amp;Make friend with selected friends of my friends</string>
<string>Ma&amp;ke friend with selected friends of my friends</string>
</property>
</widget>
</item>
@ -59,7 +59,7 @@
<item>
<widget class="QRadioButton" name="webmailRadioButton">
<property name="text">
<string>&amp;Send an Invitation by Web Mail Providers</string>
<string>Send an In&amp;vitation by Web Mail Providers</string>
</property>
</widget>
</item>
@ -1502,6 +1502,12 @@
</widget>
</widget>
<customwidgets>
<customwidget>
<class>AvatarWidget</class>
<extends>QLabel</extends>
<header>gui/common/AvatarWidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>StyledLabel</class>
<extends>QLabel</extends>
@ -1513,12 +1519,6 @@
<header>gui/common/FriendSelectionWidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>AvatarWidget</class>
<extends>QLabel</extends>
<header>gui/common/AvatarWidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>DropLineEdit</class>
<extends>QLineEdit</extends>
@ -1537,8 +1537,8 @@
</customwidget>
</customwidgets>
<resources>
<include location="../icons.qrc"/>
<include location="../images.qrc"/>
<include location="../icons.qrc"/>
</resources>
<connections/>
</ui>