2014-05-30 12:53:19 +04:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 13:23:14 +03:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2018-01-03 13:23:14 +03:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2014-05-30 12:53:19 +04:00
|
|
|
*/
|
2016-03-23 21:43:12 +03:00
|
|
|
#include "mtproto/facade.h"
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2017-03-04 13:23:56 +03:00
|
|
|
#include "storage/localstorage.h"
|
2017-02-24 20:15:41 +03:00
|
|
|
#include "messenger.h"
|
2014-11-22 12:45:04 +03:00
|
|
|
|
2016-03-24 11:57:11 +03:00
|
|
|
namespace MTP {
|
2017-02-24 20:15:41 +03:00
|
|
|
namespace internal {
|
2014-05-30 12:53:19 +04:00
|
|
|
namespace {
|
2016-03-24 11:57:11 +03:00
|
|
|
|
2016-12-05 14:01:08 +03:00
|
|
|
int PauseLevel = 0;
|
2015-10-15 12:18:24 +02:00
|
|
|
|
2016-03-24 11:57:11 +03:00
|
|
|
} // namespace
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2016-03-24 11:57:11 +03:00
|
|
|
bool paused() {
|
2016-12-05 14:01:08 +03:00
|
|
|
return PauseLevel > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void pause() {
|
|
|
|
++PauseLevel;
|
|
|
|
}
|
|
|
|
|
|
|
|
void unpause() {
|
|
|
|
--PauseLevel;
|
2017-02-24 20:15:41 +03:00
|
|
|
if (!PauseLevel) {
|
|
|
|
if (auto instance = MainInstance()) {
|
|
|
|
instance->unpaused();
|
2016-02-29 19:53:26 +03:00
|
|
|
}
|
|
|
|
}
|
2016-03-24 11:57:11 +03:00
|
|
|
}
|
2016-02-23 12:52:18 +03:00
|
|
|
|
2016-03-24 11:57:11 +03:00
|
|
|
} // namespace internal
|
2015-05-14 19:50:04 +03:00
|
|
|
|
2017-02-24 20:15:41 +03:00
|
|
|
Instance *MainInstance() {
|
|
|
|
return Messenger::Instance().mtp();
|
2016-03-24 11:57:11 +03:00
|
|
|
}
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2016-03-24 11:57:11 +03:00
|
|
|
} // namespace MTP
|