summaryrefslogtreecommitdiff
path: root/protocols/Telegram/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Telegram/src')
-rw-r--r--protocols/Telegram/src/groupchat.cpp16
-rw-r--r--protocols/Telegram/src/proto.cpp12
-rw-r--r--protocols/Telegram/src/proto.h1
3 files changed, 16 insertions, 13 deletions
diff --git a/protocols/Telegram/src/groupchat.cpp b/protocols/Telegram/src/groupchat.cpp
index 076dd28782..7c2729d776 100644
--- a/protocols/Telegram/src/groupchat.cpp
+++ b/protocols/Telegram/src/groupchat.cpp
@@ -24,10 +24,12 @@ void CTelegramProto::InitGroupChat(TG_USER *pUser, const TD::chat *pChat)
wchar_t wszId[100];
_i64tow(pUser->id, wszId, 10);
+
SESSION_INFO *si;
+ Utf2T wszNick(pChat->title_.c_str());
if (pUser->bLoadMembers) {
- si = Chat_NewSession(GCW_CHATROOM, m_szModuleName, wszId, Utf2T(pChat->title_.c_str()), pUser);
+ si = Chat_NewSession(GCW_CHATROOM, m_szModuleName, wszId, wszNick, pUser);
if (!si->pStatuses) {
Chat_AddGroup(si, TranslateT("Creator"));
Chat_AddGroup(si, TranslateT("Admin"));
@@ -45,23 +47,23 @@ void CTelegramProto::InitGroupChat(TG_USER *pUser, const TD::chat *pChat)
}
}
else {
- si = Chat_NewSession(GCW_CHANNEL, m_szModuleName, wszId, Utf2T(pChat->title_.c_str()), pUser);
+ si = Chat_NewSession(GCW_CHANNEL, m_szModuleName, wszId, wszNick, pUser);
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));
+ ptrW wszMyId(getWStringA(DBKEY_ID)), wszMyNick(Contact::GetInfo(CNF_DISPLAY, 0, m_szModuleName));
GCEVENT gce = { si, GC_EVENT_JOIN };
- gce.pszUID.w = wszUserId;
- gce.pszNick.w = wszNick;
+ gce.pszUID.w = wszMyId;
+ gce.pszNick.w = wszMyNick;
gce.bIsMe = true;
gce.pszStatus.w = TranslateT("Visitor");
Chat_Event(&gce);
gce.bIsMe = false;
- gce.pszUID.w = L"---";
- gce.pszNick.w = TranslateT("Admin");
+ gce.pszUID.w = wszId;
+ gce.pszNick.w = wszNick;
gce.pszStatus.w = TranslateT("SuperAdmin");
Chat_Event(&gce);
}
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp
index 6a82a00347..26cc4e31d9 100644
--- a/protocols/Telegram/src/proto.cpp
+++ b/protocols/Telegram/src/proto.cpp
@@ -128,13 +128,10 @@ void CTelegramProto::OnModulesLoaded()
m_arChats.insert(pUser);
}
- for (auto &cc : AccContacts()) {
- ptrA szPath(getStringA(cc, "AvatarPath"));
- if (szPath) {
- delSetting(cc, "AvatarPath");
- delSetting(cc, DBKEY_AVATAR_HASH);
- }
+ int iCompatLevel = getByte(DBKEY_COMPAT);
+ VARSW cachePath(L"%miranda_userdata%\\ChatCache");
+ for (auto &cc : AccContacts()) {
bool isGroupChat = isChatRoom(cc);
szId = getMStringA(cc, DBKEY_ID);
if (!szId.IsEmpty()) {
@@ -143,8 +140,11 @@ void CTelegramProto::OnModulesLoaded()
m_arUsers.insert(pUser);
if (!isGroupChat)
m_arChats.insert(pUser);
+ else if (iCompatLevel == 0)
+ _wremove(CMStringW(FORMAT, L"%s\\%d.json", cachePath.get(), cc));
}
}
+ setByte(DBKEY_COMPAT, 1);
m_bSmileyAdd = ServiceExists(MS_SMILEYADD_LOADCONTACTSMILEYS);
if (m_bSmileyAdd) {
diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h
index 4963a02cde..f4e1e69f8b 100644
--- a/protocols/Telegram/src/proto.h
+++ b/protocols/Telegram/src/proto.h
@@ -3,6 +3,7 @@
#define STATUS_SWITCH_TIMEOUT 600
#define DBKEY_ID "id"
+#define DBKEY_COMPAT "Compatibility"
#define DBKEY_AVATAR_HASH "AvatarHash"
#define DBKEY_AVATAR_TYPE "AvatarType"