summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_chat.h1
-rw-r--r--include/m_chat_int.h1
-rw-r--r--protocols/Telegram/src/groupchat.cpp6
-rw-r--r--protocols/Telegram/src/server.cpp6
-rw-r--r--src/mir_app/src/chat_svc.cpp10
-rw-r--r--src/mir_app/src/srmm_base.cpp7
6 files changed, 26 insertions, 5 deletions
diff --git a/include/m_chat.h b/include/m_chat.h
index 2ac337e3cd..49a636f220 100644
--- a/include/m_chat.h
+++ b/include/m_chat.h
@@ -166,6 +166,7 @@ MIR_APP_DLL(int) Chat_Register(const GCREGISTER*);
// A hContact will be added for the session, but it will default to being hidden (on the CList)
#define GCW_PRIVMESS 3 // NOT SUPPORTED YET! the session is a 1 to 1 session, but with additional
// support for adding more users etc. ex "MSN session".
+#define GCW_CHANNEL 4 // same as GCW_CHATROOM, but without user list/nick list
MIR_APP_DLL(struct SESSION_INFO*) Chat_NewSession(
int iType, // Use one of the GCW_* flags above to set the type of session
diff --git a/include/m_chat_int.h b/include/m_chat_int.h
index 94939f412c..6aa2bee8a6 100644
--- a/include/m_chat_int.h
+++ b/include/m_chat_int.h
@@ -141,6 +141,7 @@ struct MIR_APP_EXPORT GCSessionInfoBase : public MZeroedObject, public MNonCopya
bool bInitDone;
bool bHasToolTip;
+ bool bHasNicklist;
bool bTrimmed;
bool bHistoryInit;
diff --git a/protocols/Telegram/src/groupchat.cpp b/protocols/Telegram/src/groupchat.cpp
index fdcb45faa7..0aa21fb752 100644
--- a/protocols/Telegram/src/groupchat.cpp
+++ b/protocols/Telegram/src/groupchat.cpp
@@ -24,9 +24,10 @@ void CTelegramProto::InitGroupChat(TG_USER *pUser, const TD::chat *pChat, bool b
wchar_t wszId[100];
_i64tow(pUser->id, wszId, 10);
- auto *si = pUser->m_si = Chat_NewSession(GCW_CHATROOM, m_szModuleName, wszId, Utf2T(pChat->title_.c_str()), pUser);
+ SESSION_INFO *si;
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"));
@@ -35,6 +36,7 @@ void CTelegramProto::InitGroupChat(TG_USER *pUser, const TD::chat *pChat, bool b
SendQuery(new TD::getBasicGroupFullInfo(pUser->id), &CTelegramProto::StartGroupChat, pUser);
}
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"));
@@ -56,6 +58,8 @@ void CTelegramProto::InitGroupChat(TG_USER *pUser, const TD::chat *pChat, bool b
Chat_Control(si, m_bHideGroupchats ? WINDOW_HIDDEN : SESSION_INITDONE);
Chat_Control(si, SESSION_ONLINE);
}
+
+ pUser->m_si = si;
}
void CTelegramProto::StartGroupChat(td::ClientManager::Response &response, void *pUserData)
diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp
index f4dfd60353..4517c8cca3 100644
--- a/protocols/Telegram/src/server.cpp
+++ b/protocols/Telegram/src/server.cpp
@@ -281,7 +281,11 @@ void CTelegramProto::ProcessChat(TD::updateNewChat *pObj)
break;
case TD::chatTypeSupergroup::ID:
- chatId = ((TD::chatTypeSupergroup*)pChat->type_.get())->supergroup_id_;
+ {
+ auto *pSuperGroup = (TD::chatTypeSupergroup *)pChat->type_.get();
+ chatId = pSuperGroup->supergroup_id_;
+ bIsBasicGroup = !pSuperGroup->is_channel_;
+ }
break;
default:
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index 47ad6d4954..8c72074600 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -241,10 +241,18 @@ MIR_APP_DLL(SESSION_INFO*) Chat_NewSession(
si->pItemData = pItemData;
if (iType != GCW_SERVER)
si->wStatus = ID_STATUS_ONLINE;
- si->iType = iType;
si->ptszName = mir_wstrdup(ptszName);
si->currentHovered = -1;
+ if (iType == GCW_CHANNEL) {
+ si->iType = GCW_CHATROOM;
+ si->bHasNicklist = false;
+ }
+ else {
+ si->bHasNicklist = true;
+ si->iType = iType;
+ }
+
wchar_t szTemp[256];
if (si->iType == GCW_SERVER)
mir_snwprintf(szTemp, L"Server: %s", si->ptszName);
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp
index 10bb17736a..eab87c6e78 100644
--- a/src/mir_app/src/srmm_base.cpp
+++ b/src/mir_app/src/srmm_base.cpp
@@ -501,8 +501,11 @@ bool CSrmmBaseDialog::OnInitDialog()
::DragAcceptFiles(m_message.GetHwnd(), TRUE);
if (isChat()) {
- SetWindowLongPtr(m_nickList.GetHwnd(), GWLP_USERDATA, LPARAM(this));
- mir_subclassWindow(m_nickList.GetHwnd(), stubNicklistProc);
+ if (m_si->bHasNicklist) {
+ SetWindowLongPtr(m_nickList.GetHwnd(), GWLP_USERDATA, LPARAM(this));
+ mir_subclassWindow(m_nickList.GetHwnd(), stubNicklistProc);
+ }
+ else m_bNicklistEnabled = false;
}
// three buttons below are initiated inside this call, so button creation must precede subclassing