Fix offline mode bugs

This commit is contained in:
Petr Mrázek
2013-12-08 22:06:04 +01:00
parent 9410dd042e
commit b0dbd4f4af
12 changed files with 83 additions and 40 deletions

View File

@ -97,6 +97,10 @@ public: /* manipulation */
*/
std::shared_ptr<Task> login(QString password = QString());
void downgrade()
{
m_online = false;
}
public: /* queries */
const QString &username() const
{

View File

@ -78,7 +78,9 @@ void YggdrasilTask::processReply()
{
setStatus(getStateMessage(STATE_PROCESSING_RESPONSE));
if (m_netReply->error() == QNetworkReply::OperationCanceledError)
// any network errors lead to offline mode right now
if (m_netReply->error() >= QNetworkReply::ConnectionRefusedError &&
m_netReply->error() <= QNetworkReply::UnknownNetworkError)
{
// WARNING/FIXME: the value here is used in MojangAccount to detect the cancel/timeout
emitFailed("Yggdrasil task cancelled.");