void Window::notifySchedule(History *history, MsgId msgId) { if (App::quiting() || !history->currentNotification()) return; bool haveSetting = (history->peer->notify != UnknownNotifySettings); if (haveSetting) { if (history->peer->notify != EmptyNotifySettings && history->peer->notify->mute > unixtime()) { history->clearNotifications(); return; } } else { App::wnd()->getNotifySetting(MTP_inputNotifyPeer(history->peer->input)); } uint64 ms = getms(true) + NotifyWaitTimeout; notifyWhenAlerts[history].insert(ms, NullType()); if (cDesktopNotify()) { NotifyWhenMaps::iterator i = notifyWhenMaps.find(history); if (i == notifyWhenMaps.end()) { i = notifyWhenMaps.insert(history, NotifyWhenMap()); } if (i.value().constFind(msgId) == i.value().cend()) { i.value().insert(msgId, ms); } NotifyWaiters *addTo = haveSetting ? ¬ifyWaiters : ¬ifySettingWaiters; if (addTo->constFind(history) == addTo->cend()) { addTo->insert(history, NotifyWaiter(msgId, ms)); } } if (haveSetting) { if (!notifyWaitTimer.isActive()) { notifyWaitTimer.start(NotifyWaitTimeout); } } }
namespace LucED { class NullType {}; const NullType Null = NullType(); inline bool operator==(const void* lhs, const NullType& rhs) { return lhs == NULL; } inline bool operator==(const NullType& lhs, const void* rhs) { return rhs == NULL; } inline bool operator!=(const void* lhs, const NullType& rhs) { return lhs != NULL; } inline bool operator!=(const NullType& lhs, const void* rhs) { return rhs != NULL; } } // namespace LucED