2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-01 06:55:58 +00:00

New way for subscribe/notify async about any events.

Two classes base::Observable<Event> and base::Subscriber were added.
base::Observable<Event> can notify about Event-s, while any
base::Subscriber can subscribe and then async receive them.
This commit is contained in:
John Preston
2016-08-18 21:27:43 +02:00
parent 90678d411f
commit ea955635ac
10 changed files with 416 additions and 11 deletions

View File

@@ -33,6 +33,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "autoupdater.h"
#include "core/observer.h"
#include "observer_peer.h"
#include "core/observer.h"
namespace {
void mtpStateChanged(int32 dc, int32 state) {
@@ -922,6 +923,10 @@ void AppClass::call_handleDelayedPeerUpdates() {
Notify::peerUpdatedSendDelayed();
}
void AppClass::call_handleObservables() {
base::HandleObservables();
}
void AppClass::killDownloadSessions() {
uint64 ms = getms(), left = MTPAckSendWaiting + MTPKillFileSessionTimeout;
for (QMap<int32, uint64>::iterator i = killDownloadSessionTimes.begin(); i != killDownloadSessionTimes.end(); ) {