@ -180,20 +180,19 @@ void DNSUpdater::ipUpdateFinished(const DownloadResult &result)
void DNSUpdater : : processIPUpdateReply ( const QString & reply )
void DNSUpdater : : processIPUpdateReply ( const QString & reply )
{
{
Logger * const logger = Logger : : instance ( ) ;
qDebug ( ) < < Q_FUNC_INFO < < reply ;
qDebug ( ) < < Q_FUNC_INFO < < reply ;
const QString code = reply . split ( u ' ' ) . first ( ) ;
const QString code = reply . split ( u ' ' ) . first ( ) ;
qDebug ( ) < < Q_FUNC_INFO < < " Code: " < < code ;
qDebug ( ) < < Q_FUNC_INFO < < " Code: " < < code ;
if ( ( code = = u " good " ) | | ( code = = u " nochg " ) )
if ( ( code = = u " good " ) | | ( code = = u " nochg " ) )
{
{
logger - > addMessage ( tr ( " Your dynamic DNS was successfully updated. " ) , Log : : INFO ) ;
LogMsg ( tr ( " Your dynamic DNS was successfully updated. " ) , Log : : INFO ) ;
return ;
return ;
}
}
if ( ( code = = u " 911 " ) | | ( code = = u " dnserr " ) )
if ( ( code = = u " 911 " ) | | ( code = = u " dnserr " ) )
{
{
logger - > addMessage ( tr ( " Dynamic DNS error: The service is temporarily unavailable, it will be retried in 30 minutes. " ) , Log : : CRITICAL ) ;
LogMsg ( tr ( " Dynamic DNS error: The service is temporarily unavailable, it will be retried in 30 minutes. " ) , Log : : CRITICAL ) ;
m_lastIP . clear ( ) ;
m_lastIP . clear ( ) ;
// It will retry in 30 minutes because the timer was not stopped
// It will retry in 30 minutes because the timer was not stopped
return ;
return ;
@ -204,21 +203,21 @@ void DNSUpdater::processIPUpdateReply(const QString &reply)
m_lastIP . clear ( ) ;
m_lastIP . clear ( ) ;
if ( code = = u " nohost " )
if ( code = = u " nohost " )
{
{
logger - > addMessage ( tr ( " Dynamic DNS error: hostname supplied does not exist under specified account. " ) , Log : : CRITICAL ) ;
LogMsg ( tr ( " Dynamic DNS error: hostname supplied does not exist under specified account. " ) , Log : : CRITICAL ) ;
m_state = INVALID_CREDS ;
m_state = INVALID_CREDS ;
return ;
return ;
}
}
if ( code = = u " badauth " )
if ( code = = u " badauth " )
{
{
logger - > addMessage ( tr ( " Dynamic DNS error: Invalid username/password. " ) , Log : : CRITICAL ) ;
LogMsg ( tr ( " Dynamic DNS error: Invalid username/password. " ) , Log : : CRITICAL ) ;
m_state = INVALID_CREDS ;
m_state = INVALID_CREDS ;
return ;
return ;
}
}
if ( code = = u " badagent " )
if ( code = = u " badagent " )
{
{
logger - > addMessage ( tr ( " Dynamic DNS error: qBittorrent was blacklisted by the service, please submit a bug report at http://bugs.qbittorrent.org. " ) ,
LogMsg ( tr ( " Dynamic DNS error: qBittorrent was blacklisted by the service, please submit a bug report at http://bugs.qbittorrent.org. " ) ,
Log : : CRITICAL ) ;
Log : : CRITICAL ) ;
m_state = FATAL ;
m_state = FATAL ;
return ;
return ;
@ -226,7 +225,7 @@ void DNSUpdater::processIPUpdateReply(const QString &reply)
if ( code = = u " !donator " )
if ( code = = u " !donator " )
{
{
logger - > addMessage ( tr ( " Dynamic DNS error: %1 was returned by the service, please submit a bug report at http://bugs.qbittorrent.org. " ) . arg ( u " !donator " _qs ) ,
LogMsg ( tr ( " Dynamic DNS error: %1 was returned by the service, please submit a bug report at http://bugs.qbittorrent.org. " ) . arg ( u " !donator " _qs ) ,
Log : : CRITICAL ) ;
Log : : CRITICAL ) ;
m_state = FATAL ;
m_state = FATAL ;
return ;
return ;
@ -234,7 +233,7 @@ void DNSUpdater::processIPUpdateReply(const QString &reply)
if ( code = = u " abuse " )
if ( code = = u " abuse " )
{
{
logger - > addMessage ( tr ( " Dynamic DNS error: Your username was blocked due to abuse. " ) , Log : : CRITICAL ) ;
LogMsg ( tr ( " Dynamic DNS error: Your username was blocked due to abuse. " ) , Log : : CRITICAL ) ;
m_state = FATAL ;
m_state = FATAL ;
}
}
}
}
@ -243,7 +242,6 @@ void DNSUpdater::updateCredentials()
{
{
if ( m_state = = FATAL ) return ;
if ( m_state = = FATAL ) return ;
Preferences * const pref = Preferences : : instance ( ) ;
Preferences * const pref = Preferences : : instance ( ) ;
Logger * const logger = Logger : : instance ( ) ;
bool change = false ;
bool change = false ;
// Get DNS service information
// Get DNS service information
if ( m_service ! = pref - > getDynDNSService ( ) )
if ( m_service ! = pref - > getDynDNSService ( ) )
@ -257,7 +255,7 @@ void DNSUpdater::updateCredentials()
const QRegularExpressionMatch domainRegexMatch = QRegularExpression ( u " ^(?:(?! \\ d|-)[a-zA-Z0-9 \\ -]{1,63} \\ .)+[a-zA-Z]{2,}$ " _qs ) . match ( m_domain ) ;
const QRegularExpressionMatch domainRegexMatch = QRegularExpression ( u " ^(?:(?! \\ d|-)[a-zA-Z0-9 \\ -]{1,63} \\ .)+[a-zA-Z]{2,}$ " _qs ) . match ( m_domain ) ;
if ( ! domainRegexMatch . hasMatch ( ) )
if ( ! domainRegexMatch . hasMatch ( ) )
{
{
logger - > addMessage ( tr ( " Dynamic DNS error: supplied domain name is invalid. " ) , Log : : CRITICAL ) ;
LogMsg ( tr ( " Dynamic DNS error: supplied domain name is invalid. " ) , Log : : CRITICAL ) ;
m_lastIP . clear ( ) ;
m_lastIP . clear ( ) ;
m_ipCheckTimer . stop ( ) ;
m_ipCheckTimer . stop ( ) ;
m_state = INVALID_CREDS ;
m_state = INVALID_CREDS ;
@ -270,7 +268,7 @@ void DNSUpdater::updateCredentials()
m_username = pref - > getDynDNSUsername ( ) ;
m_username = pref - > getDynDNSUsername ( ) ;
if ( m_username . length ( ) < 4 )
if ( m_username . length ( ) < 4 )
{
{
logger - > addMessage ( tr ( " Dynamic DNS error: supplied username is too short. " ) , Log : : CRITICAL ) ;
LogMsg ( tr ( " Dynamic DNS error: supplied username is too short. " ) , Log : : CRITICAL ) ;
m_lastIP . clear ( ) ;
m_lastIP . clear ( ) ;
m_ipCheckTimer . stop ( ) ;
m_ipCheckTimer . stop ( ) ;
m_state = INVALID_CREDS ;
m_state = INVALID_CREDS ;
@ -283,7 +281,7 @@ void DNSUpdater::updateCredentials()
m_password = pref - > getDynDNSPassword ( ) ;
m_password = pref - > getDynDNSPassword ( ) ;
if ( m_password . length ( ) < 4 )
if ( m_password . length ( ) < 4 )
{
{
logger - > addMessage ( tr ( " Dynamic DNS error: supplied password is too short. " ) , Log : : CRITICAL ) ;
LogMsg ( tr ( " Dynamic DNS error: supplied password is too short. " ) , Log : : CRITICAL ) ;
m_lastIP . clear ( ) ;
m_lastIP . clear ( ) ;
m_ipCheckTimer . stop ( ) ;
m_ipCheckTimer . stop ( ) ;
m_state = INVALID_CREDS ;
m_state = INVALID_CREDS ;