Added sources to RS link download (now works for copy links from browsable only files). Removed unused optional list of sources from RetroShareLink::process()

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3539 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2010-09-24 21:01:13 +00:00
parent 55a45dacd3
commit b0f0e4c380
6 changed files with 21 additions and 16 deletions

View File

@ -1741,7 +1741,7 @@ void ForumsDialog::anchorClicked (const QUrl& link )
std::cerr << "ForumsDialog::anchorClicked link.scheme() : " << link.scheme().toStdString() << std::endl;
#endif
RetroShareLink::processUrl(link, NULL, RSLINK_PROCESS_NOTIFY_ALL);
RetroShareLink::processUrl(link, RSLINK_PROCESS_NOTIFY_ALL);
}
void ForumsDialog::filterRegExpChanged()

View File

@ -1863,7 +1863,7 @@ void MessagesDialog::anchorClicked (const QUrl& link )
{
std::cerr << "MessagesDialog::anchorClicked link.scheme() : " << link.scheme().toStdString() << std::endl;
RetroShareLink::processUrl(link, NULL, RSLINK_PROCESS_NOTIFY_ALL);
RetroShareLink::processUrl(link, RSLINK_PROCESS_NOTIFY_ALL);
}
bool MessagesDialog::fileSave()

View File

@ -1829,7 +1829,7 @@ void PeersDialog::anchorClicked (const QUrl& link )
std::cerr << "PeersDialog::anchorClicked link.scheme() : " << link.scheme().toStdString() << std::endl;
#endif
RetroShareLink::processUrl(link, NULL, RSLINK_PROCESS_NOTIFY_ALL);
RetroShareLink::processUrl(link, RSLINK_PROCESS_NOTIFY_ALL);
}
void PeersDialog::dropEvent(QDropEvent *event)

View File

@ -239,7 +239,7 @@ bool RetroShareLink::checkHash(const QString& hash)
return true ;
}
bool RetroShareLink::process(std::list<std::string> *psrcIds, int flag)
bool RetroShareLink::process(int flag)
{
if (valid() == false) {
std::cerr << " RetroShareLink::process invalid request" << std::endl;
@ -254,9 +254,15 @@ bool RetroShareLink::process(std::list<std::string> *psrcIds, int flag)
{
std::cerr << " RetroShareLink::process FileRequest : fileName : " << name().toUtf8().constData() << ". fileHash : " << hash().toStdString() << ". fileSize : " << size() << std::endl;
// Get a list of available direct sources, in case the file is browsable only.
std::list<std::string> srcIds;
if (psrcIds) {
srcIds = *psrcIds;
FileInfo finfo ;
rsFiles->FileDetails(hash().toStdString(), RS_FILE_HINTS_REMOTE,finfo) ;
for(std::list<TransferInfo>::const_iterator it(finfo.peers.begin());it!=finfo.peers.end();++it)
{
std::cerr << " adding peerid " << (*it).peerId << std::endl ;
srcIds.push_back((*it).peerId) ;
}
if (rsFiles->FileRequest(name().toUtf8().constData(), hash().toStdString(), size(), "", RS_FILE_HINTS_NETWORK_WIDE, srcIds)) {
@ -340,7 +346,7 @@ bool RetroShareLink::process(std::list<std::string> *psrcIds, int flag)
return false;
}
/*static*/ bool RetroShareLink::processUrl(const QUrl &url, std::list<std::string> *psrcIds, int flag)
/*static*/ bool RetroShareLink::processUrl(const QUrl &url, int flag)
{
if (url.scheme() == "http") {
QDesktopServices::openUrl(url);
@ -359,7 +365,7 @@ bool RetroShareLink::process(std::list<std::string> *psrcIds, int flag)
// RetroShareLink link(url);
//
// if (link.valid()) {
// return link.process(psrcId, flag);
// return link.process(flag);
// }
//
// if (flag & RSLINK_PROCESS_NOTIFY_ERROR) {
@ -502,7 +508,7 @@ bool RSLinkClipboard::empty(RetroShareLink::enumType type /*= RetroShareLink::TY
for (uint32_t i = 0; i < links.size(); i++) {
if (links[i].valid() && (type == RetroShareLink::TYPE_UNKNOWN || links[i].type() == type)) {
if (links[i].process(NULL, flag)) {
if (links[i].process(flag)) {
count++;
}
}

View File

@ -81,8 +81,8 @@ class RetroShareLink
bool operator==(const RetroShareLink& l) const { return _type == l._type && _hash == l._hash ; }
bool process(std::list<std::string> *psrcIds, int flag);
static bool processUrl(const QUrl &url, std::list<std::string> *psrcIds, int flag);
bool process(int flag);
static bool processUrl(const QUrl &url, int flag);
private:
void fromString(const QString &url);

View File

@ -994,8 +994,7 @@ void PopupChatDialog::anchorClicked (const QUrl& link )
#endif
std::list<std::string> srcIds;
srcIds.push_back(dialogId);
RetroShareLink::processUrl(link, &srcIds, RSLINK_PROCESS_NOTIFY_ALL);
RetroShareLink::processUrl(link, RSLINK_PROCESS_NOTIFY_ALL);
}
void PopupChatDialog::dropEvent(QDropEvent *event)