summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-03-23 21:52:25 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-03-23 21:52:25 +0300
commit0e4a45eff4dd8ab29f8dd79e419d33a89a808939 (patch)
treed1c82826735c217a46f8d0cec1f87390d6a396f5 /protocols
parenta1284729b31119dc50d95f73e2ffe7fed4a20ac8 (diff)
group chats unserialization
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Telegram/src/groupchat.cpp48
1 files changed, 28 insertions, 20 deletions
diff --git a/protocols/Telegram/src/groupchat.cpp b/protocols/Telegram/src/groupchat.cpp
index c0ea6165e8..5b13fe4fe3 100644
--- a/protocols/Telegram/src/groupchat.cpp
+++ b/protocols/Telegram/src/groupchat.cpp
@@ -28,32 +28,40 @@ void CTelegramProto::InitGroupChat(TG_USER *pUser, const TD::chat *pChat, bool b
if (bUpdateMembers) {
si = Chat_NewSession(GCW_CHATROOM, m_szModuleName, wszId, Utf2T(pChat->title_.c_str()), pUser);
- Chat_AddGroup(si, TranslateT("Creator"));
- Chat_AddGroup(si, TranslateT("Admin"));
- Chat_AddGroup(si, TranslateT("Participant"));
+ if (!si->pStatuses) {
+ Chat_AddGroup(si, TranslateT("Creator"));
+ Chat_AddGroup(si, TranslateT("Admin"));
+ Chat_AddGroup(si, TranslateT("Participant"));
- // push async query to fetch users
- SendQuery(new TD::getBasicGroupFullInfo(pUser->id), &CTelegramProto::StartGroupChat, pUser);
+ // push async query to fetch users
+ SendQuery(new TD::getBasicGroupFullInfo(pUser->id), &CTelegramProto::StartGroupChat, pUser);
+ }
+ else {
+ Chat_Control(si, m_bHideGroupchats ? WINDOW_HIDDEN : SESSION_INITDONE);
+ Chat_Control(si, SESSION_ONLINE);
+ }
}
else {
si = Chat_NewSession(GCW_CHANNEL, m_szModuleName, wszId, Utf2T(pChat->title_.c_str()), pUser);
- Chat_AddGroup(si, TranslateT("SuperAdmin"));
- Chat_AddGroup(si, TranslateT("Visitor"));
+ if (!si->pStatuses) {
+ Chat_AddGroup(si, TranslateT("SuperAdmin"));
+ Chat_AddGroup(si, TranslateT("Visitor"));
- ptrW wszUserId(getWStringA(DBKEY_ID)), wszNick(Contact::GetInfo(CNF_DISPLAY, 0, m_szModuleName));
-
- GCEVENT gce = { si, GC_EVENT_JOIN };
- gce.pszUID.w = wszUserId;
- gce.pszNick.w = wszNick;
- gce.bIsMe = true;
- gce.pszStatus.w = TranslateT("Visitor");
- Chat_Event(&gce);
+ ptrW wszUserId(getWStringA(DBKEY_ID)), wszNick(Contact::GetInfo(CNF_DISPLAY, 0, m_szModuleName));
- gce.bIsMe = false;
- gce.pszUID.w = L"---";
- gce.pszNick.w = TranslateT("Admin");
- gce.pszStatus.w = TranslateT("SuperAdmin");
- Chat_Event(&gce);
+ GCEVENT gce = { si, GC_EVENT_JOIN };
+ gce.pszUID.w = wszUserId;
+ gce.pszNick.w = wszNick;
+ gce.bIsMe = true;
+ gce.pszStatus.w = TranslateT("Visitor");
+ Chat_Event(&gce);
+
+ gce.bIsMe = false;
+ gce.pszUID.w = L"---";
+ gce.pszNick.w = TranslateT("Admin");
+ gce.pszStatus.w = TranslateT("SuperAdmin");
+ Chat_Event(&gce);
+ }
Chat_Control(si, m_bHideGroupchats ? WINDOW_HIDDEN : SESSION_INITDONE);
Chat_Control(si, SESSION_ONLINE);