diff options
author | George Hazan <ghazan@miranda.im> | 2022-12-26 19:12:00 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-12-26 19:12:00 +0300 |
commit | 016f5b27df751bc8a605aeb9c97c844892458eeb (patch) | |
tree | 8d446c73e4d4585d11ae9a942f0c18d255d81eca | |
parent | dee83d7a89c021f63b746681d11ab72381bdc472 (diff) |
fixes #3285 (Telegram: не создаётся группа) + перенос папок в подгруппы
-rw-r--r-- | protocols/Telegram/src/mt_proto.cpp | 5 | ||||
-rw-r--r-- | protocols/Telegram/src/mt_proto.h | 1 | ||||
-rw-r--r-- | protocols/Telegram/src/server.cpp | 9 |
3 files changed, 11 insertions, 4 deletions
diff --git a/protocols/Telegram/src/mt_proto.cpp b/protocols/Telegram/src/mt_proto.cpp index 998e84c733..eeed67745c 100644 --- a/protocols/Telegram/src/mt_proto.cpp +++ b/protocols/Telegram/src/mt_proto.cpp @@ -34,6 +34,11 @@ CMTProto::CMTProto(const char* protoName, const wchar_t* userName) : HookProtoEvent(ME_OPT_INITIALISE, &CMTProto::OnOptionsInit); + // default contacts group + if (m_wszDefaultGroup == NULL) + m_wszDefaultGroup = mir_wstrdup(L"WhatsApp"); + m_iBaseGroup = Clist_GroupCreate(0, m_wszDefaultGroup); + // Create standard network connection NETLIBUSER nlu = {}; nlu.flags = NUF_UNICODE; diff --git a/protocols/Telegram/src/mt_proto.h b/protocols/Telegram/src/mt_proto.h index 22b4fd2654..75f6869ad5 100644 --- a/protocols/Telegram/src/mt_proto.h +++ b/protocols/Telegram/src/mt_proto.h @@ -128,6 +128,7 @@ class CMTProto : public PROTO<CMTProto> // Users int64_t m_iOwnId; + MGROUP m_iBaseGroup; OBJLIST<TG_USER> m_arUsers; TG_USER* FindUser(uint64_t id); diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp index 50c6aa7084..9c1cf79d45 100644 --- a/protocols/Telegram/src/server.cpp +++ b/protocols/Telegram/src/server.cpp @@ -201,15 +201,16 @@ void CMTProto::ProcessGroups(TD::updateChatFilters *pObj) CMStringW wszOldValue(getMStringW(szSetting)); Utf2T wszNewValue(grp->title_.c_str()); if (wszOldValue.IsEmpty()) { - Clist_GroupCreate(0, wszNewValue); + Clist_GroupCreate(m_iBaseGroup, wszNewValue); setWString(szSetting, wszNewValue); } else if (wszOldValue != wszNewValue) { - MGROUP oldGroup = Clist_GroupExists(wszNewValue); + CMStringW wszFullGroup(FORMAT, L"%s\\%s", (wchar_t*)m_wszDefaultGroup, wszNewValue); + MGROUP oldGroup = Clist_GroupExists(wszFullGroup); if (!oldGroup) - Clist_GroupCreate(0, wszNewValue); + Clist_GroupCreate(m_iBaseGroup, wszFullGroup); else - Clist_GroupRename(oldGroup, wszNewValue); + Clist_GroupRename(oldGroup, wszFullGroup); setWString(szSetting, wszNewValue); } } |