1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 14:16:32 +02:00

On blacklisted redirect, emit correct final URL

This commit is contained in:
Uwe L. Korn
2013-07-24 10:38:06 +02:00
parent 15564cec5c
commit d755415704
4 changed files with 7 additions and 4 deletions

View File

@@ -107,6 +107,7 @@ NetworkReply::networkLoadFinished()
if ( m_blacklistedHosts.contains( redir.toUrl().host() ) ) if ( m_blacklistedHosts.contains( redir.toUrl().host() ) )
{ {
tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Reached blacklisted host, not redirecting anymore."; tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Reached blacklisted host, not redirecting anymore.";
emit finished( redir.toUrl() );
emit finished(); emit finished();
} }
else else
@@ -116,5 +117,6 @@ NetworkReply::networkLoadFinished()
} }
} }
else else
emit finished( m_url );
emit finished(); emit finished();
} }

View File

@@ -42,6 +42,7 @@ signals:
void redirected(); void redirected();
void finished(); void finished();
void finished( const QUrl& finalUrl );
void error( QNetworkReply::NetworkError error ); void error( QNetworkReply::NetworkError error );
private slots: private slots:

View File

@@ -86,7 +86,7 @@ ShortenedLinkParser::lookupUrl( const QString& url )
reply->blacklistHostFromRedirection( "www.deezer.com" ); reply->blacklistHostFromRedirection( "www.deezer.com" );
reply->blacklistHostFromRedirection( "deezer.com" ); reply->blacklistHostFromRedirection( "deezer.com" );
connect( reply, SIGNAL( finished() ), SLOT( lookupFinished() ) ); connect( reply, SIGNAL( finished( QUrl ) ), SLOT( lookupFinished( QUrl ) ) );
m_queries.insert( reply ); m_queries.insert( reply );
@@ -98,7 +98,7 @@ ShortenedLinkParser::lookupUrl( const QString& url )
void void
ShortenedLinkParser::lookupFinished() ShortenedLinkParser::lookupFinished( const QUrl& url )
{ {
NetworkReply* r = qobject_cast< NetworkReply* >( sender() ); NetworkReply* r = qobject_cast< NetworkReply* >( sender() );
Q_ASSERT( r ); Q_ASSERT( r );
@@ -109,7 +109,7 @@ ShortenedLinkParser::lookupFinished()
#endif #endif
tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Got an un-shortened url:" << r->reply()->url().toString(); tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Got an un-shortened url:" << r->reply()->url().toString();
m_links << r->reply()->url().toString(); m_links << url.toString();
m_queries.remove( r ); m_queries.remove( r );
r->deleteLater(); r->deleteLater();

View File

@@ -55,7 +55,7 @@ public:
static bool handlesUrl( const QString& url ); static bool handlesUrl( const QString& url );
public slots: public slots:
void lookupFinished(); void lookupFinished( const QUrl& url );
signals: signals:
void urls( const QStringList& urls ); void urls( const QStringList& urls );