mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-26 07:59:35 -05:00
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:
parent
55a45dacd3
commit
b0f0e4c380
@ -1741,7 +1741,7 @@ void ForumsDialog::anchorClicked (const QUrl& link )
|
|||||||
std::cerr << "ForumsDialog::anchorClicked link.scheme() : " << link.scheme().toStdString() << std::endl;
|
std::cerr << "ForumsDialog::anchorClicked link.scheme() : " << link.scheme().toStdString() << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RetroShareLink::processUrl(link, NULL, RSLINK_PROCESS_NOTIFY_ALL);
|
RetroShareLink::processUrl(link, RSLINK_PROCESS_NOTIFY_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ForumsDialog::filterRegExpChanged()
|
void ForumsDialog::filterRegExpChanged()
|
||||||
|
@ -1863,7 +1863,7 @@ void MessagesDialog::anchorClicked (const QUrl& link )
|
|||||||
{
|
{
|
||||||
std::cerr << "MessagesDialog::anchorClicked link.scheme() : " << link.scheme().toStdString() << std::endl;
|
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()
|
bool MessagesDialog::fileSave()
|
||||||
|
@ -1829,7 +1829,7 @@ void PeersDialog::anchorClicked (const QUrl& link )
|
|||||||
std::cerr << "PeersDialog::anchorClicked link.scheme() : " << link.scheme().toStdString() << std::endl;
|
std::cerr << "PeersDialog::anchorClicked link.scheme() : " << link.scheme().toStdString() << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RetroShareLink::processUrl(link, NULL, RSLINK_PROCESS_NOTIFY_ALL);
|
RetroShareLink::processUrl(link, RSLINK_PROCESS_NOTIFY_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeersDialog::dropEvent(QDropEvent *event)
|
void PeersDialog::dropEvent(QDropEvent *event)
|
||||||
|
@ -239,7 +239,7 @@ bool RetroShareLink::checkHash(const QString& hash)
|
|||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RetroShareLink::process(std::list<std::string> *psrcIds, int flag)
|
bool RetroShareLink::process(int flag)
|
||||||
{
|
{
|
||||||
if (valid() == false) {
|
if (valid() == false) {
|
||||||
std::cerr << " RetroShareLink::process invalid request" << std::endl;
|
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;
|
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;
|
std::list<std::string> srcIds;
|
||||||
if (psrcIds) {
|
FileInfo finfo ;
|
||||||
srcIds = *psrcIds;
|
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)) {
|
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;
|
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") {
|
if (url.scheme() == "http") {
|
||||||
QDesktopServices::openUrl(url);
|
QDesktopServices::openUrl(url);
|
||||||
@ -359,7 +365,7 @@ bool RetroShareLink::process(std::list<std::string> *psrcIds, int flag)
|
|||||||
// RetroShareLink link(url);
|
// RetroShareLink link(url);
|
||||||
//
|
//
|
||||||
// if (link.valid()) {
|
// if (link.valid()) {
|
||||||
// return link.process(psrcId, flag);
|
// return link.process(flag);
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// if (flag & RSLINK_PROCESS_NOTIFY_ERROR) {
|
// 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++) {
|
for (uint32_t i = 0; i < links.size(); i++) {
|
||||||
if (links[i].valid() && (type == RetroShareLink::TYPE_UNKNOWN || links[i].type() == type)) {
|
if (links[i].valid() && (type == RetroShareLink::TYPE_UNKNOWN || links[i].type() == type)) {
|
||||||
if (links[i].process(NULL, flag)) {
|
if (links[i].process(flag)) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,8 +81,8 @@ class RetroShareLink
|
|||||||
|
|
||||||
bool operator==(const RetroShareLink& l) const { return _type == l._type && _hash == l._hash ; }
|
bool operator==(const RetroShareLink& l) const { return _type == l._type && _hash == l._hash ; }
|
||||||
|
|
||||||
bool process(std::list<std::string> *psrcIds, int flag);
|
bool process(int flag);
|
||||||
static bool processUrl(const QUrl &url, std::list<std::string> *psrcIds, int flag);
|
static bool processUrl(const QUrl &url, int flag);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void fromString(const QString &url);
|
void fromString(const QString &url);
|
||||||
|
@ -994,8 +994,7 @@ void PopupChatDialog::anchorClicked (const QUrl& link )
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::list<std::string> srcIds;
|
std::list<std::string> srcIds;
|
||||||
srcIds.push_back(dialogId);
|
RetroShareLink::processUrl(link, RSLINK_PROCESS_NOTIFY_ALL);
|
||||||
RetroShareLink::processUrl(link, &srcIds, RSLINK_PROCESS_NOTIFY_ALL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopupChatDialog::dropEvent(QDropEvent *event)
|
void PopupChatDialog::dropEvent(QDropEvent *event)
|
||||||
|
Loading…
Reference in New Issue
Block a user