summaryrefslogtreecommitdiff
path: root/protocols/Telegram/src/server.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-02-27 15:58:48 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-02-27 15:58:48 +0300
commit669cb4d3fe1b4d114c072924f6983d229dcb826e (patch)
tree99aa99a0e72c42713564c1409c6e23d018016f07 /protocols/Telegram/src/server.cpp
parent9c71658f815f3e1bea31d897f3c11ce08bb2266e (diff)
TG: code cleaning
Diffstat (limited to 'protocols/Telegram/src/server.cpp')
-rw-r--r--protocols/Telegram/src/server.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp
index e85332970f..7c4b045042 100644
--- a/protocols/Telegram/src/server.cpp
+++ b/protocols/Telegram/src/server.cpp
@@ -309,11 +309,11 @@ void CTelegramProto::OnSendMessage(td::ClientManager::Response &response)
if (!response.object)
return;
- switch(response.object->get_id()) {
+ switch (response.object->get_id()) {
case TD::error::ID:
for (auto &it : m_arOwnMsg)
if (it->hAck == (HANDLE)response.request_id) {
- auto *pError= ((TD::error *)response.object.get());
+ auto *pError = ((TD::error *)response.object.get());
CMStringW wszMsg(FORMAT, TranslateT("Error %d: %s"), pError->code_, TranslateW(Utf2T(pError->message_.c_str())));
ProtoBroadcastAck(it->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, it->hAck, (LPARAM)wszMsg.c_str());
break;
@@ -456,14 +456,14 @@ void CTelegramProto::ProcessChat(TD::updateNewChat *pObj)
auto *pChat = pObj->chat_.get();
std::string szTitle;
- switch(pChat->type_->get_id()) {
+ switch (pChat->type_->get_id()) {
case TD::chatTypePrivate::ID:
case TD::chatTypeSecret::ID:
userId = pChat->id_;
break;
case TD::chatTypeBasicGroup::ID:
- userId = ((TD::chatTypeBasicGroup*)pChat->type_.get())->basic_group_id_;
+ userId = ((TD::chatTypeBasicGroup *)pChat->type_.get())->basic_group_id_;
szTitle = pChat->title_;
break;
@@ -601,7 +601,7 @@ void CTelegramProto::ProcessChatPosition(TD::updateChatPosition *pObj)
if (pList->get_id() == TD::chatListArchive::ID)
wszGroup = TranslateT("Archive");
else if (pList->get_id() == TD::chatListFolder::ID) {
- CMStringA szSetting(FORMAT, "ChatFilter%d", ((TD::chatListFolder*)pList)->chat_folder_id_);
+ CMStringA szSetting(FORMAT, "ChatFilter%d", ((TD::chatListFolder *)pList)->chat_folder_id_);
wszGroup = getMStringW(szSetting);
if (wszGroup.IsEmpty())
return;
@@ -625,7 +625,7 @@ void CTelegramProto::ProcessChatReactions(TD::updateChatAvailableReactions *pObj
debugLogA("Unsupported reactions type: %d", pObj->available_reactions_->get_id());
return;
}
-
+
auto &pReactions = ((TD::chatAvailableReactionsSome *)pObj->available_reactions_.get())->reactions_;
if (auto *pChat = FindChat(pObj->chat_id_)) {
@@ -676,7 +676,7 @@ void CTelegramProto::ProcessConnectionState(TD::updateConnectionState *pObj)
if (pAuthState->get_id() == TD::authorizationStateReady::ID)
OnLoggedIn();
break;
- }
+ }
}
void CTelegramProto::ProcessActiveEmoji(TD::updateActiveEmojiReactions *pObj)
@@ -708,7 +708,7 @@ void CTelegramProto::ProcessDeleteMessage(TD::updateDeleteMessages *pObj)
void CTelegramProto::ProcessGroups(TD::updateChatFolders *pObj)
{
for (auto &grp : pObj->chat_folders_) {
- if (grp->icon_->name_!= "Custom")
+ if (grp->icon_->name_ != "Custom")
continue;
CMStringA szSetting(FORMAT, "ChatFilter%d", grp->id_);
@@ -815,7 +815,7 @@ void CTelegramProto::ProcessMessage(const TD::message *pMessage)
debugLogA("spam from unknown group chat, ignored");
return;
}
-
+
AddUser(pUser->id, false);
Contact::RemoveFromList(pUser->hContact);
}
@@ -834,7 +834,7 @@ void CTelegramProto::ProcessMessage(const TD::message *pMessage)
szReplyId = msg2id(pMessage->chat_id_, pMessage->reply_to_message_id_);
dbei.szReplyId = szReplyId;
}
-
+
if (dbei) {
replaceStr(dbei.pBlob, szText.Detach());
db_event_edit(hOldEvent, &dbei, true);
@@ -1048,10 +1048,8 @@ void CTelegramProto::ProcessUser(TD::updateUser *pObj)
auto storedId = getMStringA(pu->hContact, DBKEY_AVATAR_HASH);
if (remoteId != storedId.c_str()) {
if (!remoteId.empty()) {
- if (pu) {
- pu->szAvatarHash = remoteId.c_str();
- setString(pu->hContact, DBKEY_AVATAR_HASH, remoteId.c_str());
- }
+ pu->szAvatarHash = remoteId.c_str();
+ setString(pu->hContact, DBKEY_AVATAR_HASH, remoteId.c_str());
SendQuery(new TD::downloadFile(pSmall->id_, 5, 0, 0, false));
}
else delSetting(pu->hContact, DBKEY_AVATAR_HASH);