/
lmaxyz
/
telegraf
Обзор
Документация
Войти
/
lmaxyz
/
telegraf
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
src/tdlib/tdlibstate.cpp
89 строк
3 KB
mbarashkov
Закомментирован код связанный с flood_wait, т.к. он не вызывается
06 июл 2025, 14:06
06 июл 2025, 14:06
2e7ae02
Код
Авторство
О чём код?
#include "tdlibstate.h" #include <td/telegram/td_json_client.h> TDLibState* TDLibState::instance; namespace { const char STATUS[] = "status"; const char MY_ID_OPTION[] = "my_id"; const char ME_URL_PREFIX[] = "t_me_url"; } TDLibState::TDLibState(TDLibDataRepository* tdLibDataRepository, QObject *parent) : QObject(parent), //floodWait(false), joinChatRequested(false), loggingOut(false), activeChatSearchName(""), networkType(TDLibConstants::NetworkType::None), tdLibClientId(td_create_client_id()), tdLibDataRepository(tdLibDataRepository), authorizationState(TDLibConstants::AuthorizationState::Closed) { TDLibState::instance = this; } TDLibConstants::UserPrivacySettingRule TDLibState::getUserPrivacySettingRule(const TDLibConstants::UserPrivacySetting setting) const { return userPrivacySettingRules.value(setting, TDLibConstants::UserPrivacySettingRule::RuleAllowAll); } void TDLibState::setUserPrivacySettingRule(const TDLibConstants::UserPrivacySetting setting, const TDLibConstants::UserPrivacySettingRule rule) { userPrivacySettingRules.insert(setting, rule); } void TDLibState::setMyUserIdAndInformation(const qlonglong userId, const QVariantMap &userInformation) { if(myUserId != userId) { emit myUserIdChanged(userId); } myUserId = userId; myUserInformation = userInformation; } void TDLibState::setMyUserInformationStatus(const QVariantMap &userStatusInformation) { myUserInformation.insert(STATUS, userStatusInformation); } void TDLibState::setAuthorizationStateAndData(const TDLibConstants::AuthorizationState authorizationState, const QVariantMap &authorizationStateData) { this->authorizationState = authorizationState; this->authorizationStateData = authorizationStateData; emit authorizationStateChanged(authorizationState, authorizationStateData); } void TDLibState::setConnectionState(TDLibConstants::ConnectionState connectionState) { this->connectionState = connectionState; emit connectionStateChanged(connectionState); } void TDLibState::updateOption(const QString &optionName, const QVariant &optionValue) { if(optionName != MY_ID_OPTION && optionName != ME_URL_PREFIX) { return; } options.insert(optionName, optionValue); if (optionName == MY_ID_OPTION) { const qlonglong ownUserId = optionValue.toLongLong(); setMyUserIdAndInformation(ownUserId, tdLibDataRepository->getUserById(ownUserId)); } } void TDLibState::updateMyUser(const QVariantMap &updatedUserInformation) { setMyUserIdAndInformation(myUserId, updatedUserInformation); emit myUserUpdated(updatedUserInformation); } QString TDLibState::getUrlPrefix() const { return options.value(ME_URL_PREFIX).toString(); } bool TDLibState::getJoinChatRequested() const { return joinChatRequested; } void TDLibState::registerJoinChat() { joinChatRequested = false; }