added a new per-friend flag to allow to seek for direct transfers. Disabled for existing friendds (should be added manually), enabled by default for new friends

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6406 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2013-06-05 12:57:11 +00:00
parent ef2ebcc1d6
commit 9c69ad0500
6 changed files with 43 additions and 10 deletions

View File

@ -56,6 +56,7 @@
#include "pqi/pqinotify.h"
#include "retroshare/rsiface.h"
#include "retroshare/rspeers.h"
#include "serialiser/rsconfigitems.h"
#include <stdio.h>
@ -293,6 +294,7 @@ void ftController::searchForDirectSources()
if(mSearch->search(it->first, RS_FILE_HINTS_REMOTE | RS_FILE_HINTS_SPEC_ONLY, info))
for(std::list<TransferInfo>::const_iterator pit = info.peers.begin(); pit != info.peers.end(); pit++)
if(rsPeers->servicePermissionFlags_sslid(pit->peerId) & RS_SERVICE_PERM_DIRECT_DL)
if(it->second->mTransfer->addFileSource(pit->peerId)) /* if the sources don't exist already - add in */
setPeerState(it->second->mTransfer, pit->peerId, FT_CNTRL_STANDARD_RATE, mLinkMgr->isOnline( pit->peerId ));
}

View File

@ -72,7 +72,9 @@ const ServicePermissionFlags RS_SERVICE_PERM_NONE ( 0x00000000 ) ;
const ServicePermissionFlags RS_SERVICE_PERM_TURTLE ( 0x00000001 ) ;
const ServicePermissionFlags RS_SERVICE_PERM_DISCOVERY ( 0x00000002 ) ;
const ServicePermissionFlags RS_SERVICE_PERM_DISTRIB ( 0x00000004 ) ;
const ServicePermissionFlags RS_SERVICE_PERM_ALL = RS_SERVICE_PERM_TURTLE | RS_SERVICE_PERM_DISCOVERY | RS_SERVICE_PERM_DISTRIB ;
const ServicePermissionFlags RS_SERVICE_PERM_DIRECT_DL ( 0x00000008 ) ;
const ServicePermissionFlags RS_SERVICE_PERM_ALL = RS_SERVICE_PERM_TURTLE | RS_SERVICE_PERM_DISCOVERY
| RS_SERVICE_PERM_DISTRIB | RS_SERVICE_PERM_DIRECT_DL;
// ...
/* Connect state */

View File

@ -137,6 +137,7 @@ void ConfCertDialog::setServiceFlags()
if(ui._anonymous_routing_CB->isChecked()) flags = flags | RS_SERVICE_PERM_TURTLE ;
if( ui._discovery_CB->isChecked()) flags = flags | RS_SERVICE_PERM_DISCOVERY ;
if( ui._forums_channels_CB->isChecked()) flags = flags | RS_SERVICE_PERM_DISTRIB ;
if( ui._direct_transfer_CB->isChecked()) flags = flags | RS_SERVICE_PERM_DIRECT_DL ;
rsPeers->setServicePermissionFlags(detail.gpg_id,flags) ;
}
@ -175,6 +176,7 @@ void ConfCertDialog::load()
ui._anonymous_routing_CB->setChecked(detail.service_perm_flags & RS_SERVICE_PERM_TURTLE ) ;
ui._discovery_CB->setChecked( detail.service_perm_flags & RS_SERVICE_PERM_DISCOVERY ) ;
ui._forums_channels_CB->setChecked( detail.service_perm_flags & RS_SERVICE_PERM_DISTRIB ) ;
ui._direct_transfer_CB->setChecked( detail.service_perm_flags & RS_SERVICE_PERM_DIRECT_DL ) ;
ui.name->setText(QString::fromUtf8(detail.name.c_str()));
ui.peerid->setText(QString::fromStdString(detail.id));

View File

@ -60,7 +60,7 @@
<item row="0" column="0">
<widget class="QTabWidget" name="stabWidget">
<property name="currentIndex">
<number>0</number>
<number>3</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="icon">
@ -800,7 +800,7 @@ Some services (Discovery, anonymous routing) can be switched off globally, which
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="_anonymous_routing_CB">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Disabling anonymous routing will suppress all sending/retrieval of tunnel and anonymous search requests from/to this user. This user will not be able to transfer anonymously through you.&lt;/p&gt;&lt;p&gt;For a global switch, go to the server configuration panel.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;justify&quot;&gt;Disabling anonymous routing will suppress all sending/retrieval of tunnel and anonymous search requests from/to this user. This user will not be able to transfer anonymously through you.&lt;/p&gt;&lt;p align=&quot;justify&quot;&gt;For a global switch, go to the server configuration panel.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Anonymous routing</string>
@ -810,7 +810,7 @@ Some services (Discovery, anonymous routing) can be switched off globally, which
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="_discovery_CB">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Disabling discovery removes the sending of public keys of your own friends to this user. Discovery information from this friend will be dropped as well.&lt;/p&gt;&lt;p&gt;For a global switch, go to the server configuration panel.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;justify&quot;&gt;Disabling discovery removes the sending of public keys of your own friends to this user. Discovery information from this friend will be dropped as well.&lt;/p&gt;&lt;p align=&quot;justify&quot;&gt;For a global switch, go to the server configuration panel.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Discovery</string>
@ -820,14 +820,14 @@ Some services (Discovery, anonymous routing) can be switched off globally, which
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="_forums_channels_CB">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Disabling this means that forums and channels posts will not be passed from you to this friend, and items coming from this friend will be dropped.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;justify&quot;&gt;Disabling this means that forums and channels posts will not be passed from you to this friend, and items coming from this friend will be dropped.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Forums/Channels</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="_chat_CB">
<property name="enabled">
<bool>false</bool>
@ -840,7 +840,7 @@ Some services (Discovery, anonymous routing) can be switched off globally, which
</property>
</widget>
</item>
<item row="6" column="0" colspan="3">
<item row="7" column="0" colspan="3">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -853,6 +853,16 @@ Some services (Discovery, anonymous routing) can be switched off globally, which
</property>
</spacer>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="_direct_transfer_CB">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;justify&quot;&gt;Retroshare always periodically your friend lists for browsable files matching your transfers, to establish a direct transfer. In this case, your friend knows you're downloading the file.&lt;/p&gt;&lt;p align=&quot;justify&quot;&gt;To prevent this behavior for this friend only, uncheck this box. You can still perform a direct transfer if you explicitly ask for it, by e.g. downloading from your friend's file list. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Use as direct source, when available</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>

View File

@ -243,6 +243,7 @@ void ConnectFriendWizard::initializePage(int id)
ui->_anonymous_routing_CB_2->setChecked(peerDetails.service_perm_flags & RS_SERVICE_PERM_TURTLE) ;
ui->_discovery_CB_2 ->setChecked(peerDetails.service_perm_flags & RS_SERVICE_PERM_DISCOVERY) ;
ui->_forums_channels_CB_2 ->setChecked(peerDetails.service_perm_flags & RS_SERVICE_PERM_DISTRIB) ;
ui->_direct_transfer_CB_2 ->setChecked(peerDetails.service_perm_flags & RS_SERVICE_PERM_DIRECT_DL) ;
//set the radio button to sign the GPG key
if (peerDetails.accept_connection && !peerDetails.ownsign) {
@ -520,10 +521,12 @@ ServicePermissionFlags ConnectFriendWizard::serviceFlags() const
if(ui->_anonymous_routing_CB->isChecked()) flags |= RS_SERVICE_PERM_TURTLE ;
if( ui->_discovery_CB->isChecked()) flags |= RS_SERVICE_PERM_DISCOVERY ;
if( ui->_forums_channels_CB->isChecked()) flags |= RS_SERVICE_PERM_DISTRIB ;
if( ui->_direct_transfer_CB->isChecked()) flags |= RS_SERVICE_PERM_DIRECT_DL ;
} else if (hasVisitedPage(Page_Conclusion)) {
if(ui->_anonymous_routing_CB_2->isChecked()) flags |= RS_SERVICE_PERM_TURTLE ;
if( ui->_discovery_CB_2->isChecked()) flags |= RS_SERVICE_PERM_DISCOVERY ;
if( ui->_forums_channels_CB_2->isChecked()) flags |= RS_SERVICE_PERM_DISTRIB ;
if( ui->_direct_transfer_CB_2->isChecked()) flags |= RS_SERVICE_PERM_DIRECT_DL ;
}
return flags ;
}

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>603</width>
<height>474</height>
<height>624</height>
</rect>
</property>
<property name="windowTitle">
@ -701,6 +701,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="_direct_transfer_CB">
<property name="text">
<string>Use as direct source, when available</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -919,6 +926,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="_direct_transfer_CB_2">
<property name="text">
<string>Direct source</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">