diff options
author | George Hazan <ghazan@miranda.im> | 2017-03-10 21:46:59 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-03-10 21:47:09 +0300 |
commit | b9a3a98d6f2695a36ca27fa2d88e99fedd72cc98 (patch) | |
tree | beea931b224074701afadd5072db524d1b179219 /src | |
parent | bdbb894df1353ba2f5e8eb61a59acf901fd652e5 (diff) |
Group chats:
- GC_CONTROL_MSG left us forever;
- tons of old/unused/useless slack simply wiped out;
- new function: CSrmmBaseDialog::ClearLog
Diffstat (limited to 'src')
-rw-r--r-- | src/core/stdmsg/src/chat_window.cpp | 88 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgdialog.cpp | 14 | ||||
-rw-r--r-- | src/mir_app/src/chat.h | 7 | ||||
-rw-r--r-- | src/mir_app/src/chat_manager.cpp | 143 | ||||
-rw-r--r-- | src/mir_app/src/chat_svc.cpp | 52 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/srmm_base.cpp | 16 |
8 files changed, 112 insertions, 210 deletions
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index 5e98c0f0f6..53123a88da 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -931,7 +931,16 @@ void CChatRoomDlg::OnInitDialog() void CChatRoomDlg::OnDestroy() { NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSING); + SaveWindowPosition(true); + if (!g_Settings.bTabsEnable) { + if (db_get_b(0, CHAT_MODULE, "SavePosition", 0)) { + db_set_dw(m_hContact, CHAT_MODULE, "roomx", m_si->iX); + db_set_dw(m_hContact, CHAT_MODULE, "roomy", m_si->iY); + db_set_dw(m_hContact, CHAT_MODULE, "roomwidth", m_si->iWidth); + db_set_dw(m_hContact, CHAT_MODULE, "roomheight", m_si->iHeight); + } + } WindowList_Remove(pci->hWindowList, m_hwnd); @@ -1388,7 +1397,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) } else Log_StreamInEvent(m_si->pLogEnd, TRUE); } - else SendMessage(m_hwnd, GC_CONTROL_MSG, WINDOW_CLEARLOG, 0); + else ClearLog(); break; case GC_REDRAWLOG2: @@ -1401,7 +1410,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (m_si->pLogEnd) Log_StreamInEvent(m_si->pLog, FALSE); else - SendMessage(m_hwnd, GC_CONTROL_MSG, WINDOW_CLEARLOG, 0); + ClearLog(); break; case WM_CTLCOLORLISTBOX: @@ -1484,71 +1493,6 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) } break; - case GC_CONTROL_MSG: - switch (wParam) { - case SESSION_OFFLINE: - SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0); - SendMessage(m_si->pDlg->GetHwnd(), GC_UPDATENICKLIST, 0, 0); - return TRUE; - - case SESSION_ONLINE: - SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0); - return TRUE; - - case WINDOW_HIDDEN: - SendMessage(m_hwnd, GC_CLOSEWINDOW, 0, 0); - return TRUE; - - case WINDOW_CLEARLOG: - SetDlgItemText(m_hwnd, IDC_LOG, L""); - return TRUE; - - case SESSION_TERMINATE: - if (!g_Settings.bTabsEnable) { - SaveWindowPosition(true); - if (db_get_b(0, CHAT_MODULE, "SavePosition", 0)) { - db_set_dw(m_hContact, CHAT_MODULE, "roomx", m_si->iX); - db_set_dw(m_hContact, CHAT_MODULE, "roomy", m_si->iY); - db_set_dw(m_hContact, CHAT_MODULE, "roomwidth", m_si->iWidth); - db_set_dw(m_hContact, CHAT_MODULE, "roomheight", m_si->iHeight); - } - } - - if (pcli->pfnGetEvent(m_hContact, 0)) - pcli->pfnRemoveEvent(m_hContact, GC_FAKE_EVENT); - m_si->wState &= ~STATE_TALK; - db_set_w(m_hContact, m_si->pszModule, "ApparentMode", 0); - SendMessage(m_hwnd, GC_CLOSEWINDOW, 0, 0); - return TRUE; - - case WINDOW_MINIMIZE: - ShowWindow(m_hwnd, SW_MINIMIZE); - goto LABEL_SHOWWINDOW; - - case WINDOW_MAXIMIZE: - ShowWindow(m_hwnd, SW_MAXIMIZE); - goto LABEL_SHOWWINDOW; - - case SESSION_INITDONE: - if (db_get_b(0, CHAT_MODULE, "PopupOnJoin", 0) != 0) - return TRUE; - // fall through - case WINDOW_VISIBLE: - if (IsIconic(m_hwnd)) - ShowWindow(m_hwnd, SW_NORMAL); - -LABEL_SHOWWINDOW: - SendMessage(m_hwnd, WM_SIZE, 0, 0); - SendMessage(m_hwnd, GC_REDRAWLOG, 0, 0); - SendMessage(m_hwnd, GC_UPDATENICKLIST, 0, 0); - SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0); - ShowWindow(m_hwnd, SW_SHOW); - SendMessage(m_hwnd, WM_SIZE, 0, 0); - SetForegroundWindow(m_hwnd); - return TRUE; - } - break; - case GC_CLOSEWINDOW: if (g_Settings.bTabsEnable) SendMessage(GetParent(m_hwndParent), GC_REMOVETAB, 0, (LPARAM)this); @@ -1620,7 +1564,7 @@ LABEL_SHOWWINDOW: if (uMsg != WM_ACTIVATE) SetFocus(m_message.GetHwnd()); - pci->SetActiveSession(m_si->ptszID, m_si->pszModule); + pci->SetActiveSession(m_si); if (KillTimer(m_hwnd, TIMERID_FLASHWND)) FlashWindow(m_hwnd, FALSE); @@ -1682,7 +1626,7 @@ LABEL_SHOWWINDOW: case ID_CLEARLOG: s = pci->SM_FindSession(m_si->ptszID, m_si->pszModule); if (s) { - SetDlgItemText(m_hwnd, IDC_LOG, L""); + ClearLog(); pci->LM_RemoveAll(&s->pLog, &s->pLogEnd); s->iEventCount = 0; s->LastTime = 0; @@ -1739,12 +1683,6 @@ LABEL_SHOWWINDOW: break; case WM_COMMAND: - if (HIWORD(wParam) == BN_CLICKED) - if (LOWORD(wParam) >= MIN_CBUTTONID && LOWORD(wParam) <= MAX_CBUTTONID) { - Srmm_ClickToolbarIcon(m_hContact, LOWORD(wParam), GetDlgItem(m_hwnd, LOWORD(wParam)), 0); - break; - } - switch (LOWORD(wParam)) { case IDC_MESSAGE: EnableWindow(m_btnOk.GetHwnd(), GetRichTextLength(m_message.GetHwnd()) != 0); diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 345107d711..3ded6a16c7 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -697,7 +697,7 @@ void CSrmmWindow::OnOptionsApplied(bool bUpdateAvatar) pf2.wEffects = PFE_RTLPARA;
pf2.dwMask = PFM_RTLPARA;
- m_log.SetText(L"");
+ ClearLog();
m_log.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
pf2.wEffects = 0;
m_log.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
@@ -1274,16 +1274,6 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) break;
case WM_COMMAND:
- if (!lParam && Clist_MenuProcessCommand(LOWORD(wParam), MPCF_CONTACTMENU, m_hContact))
- break;
-
- // custom button handling
- if (HIWORD(wParam) == BN_CLICKED)
- if (LOWORD(wParam) >= MIN_CBUTTONID && LOWORD(wParam) <= MAX_CBUTTONID) {
- Srmm_ClickToolbarIcon(m_hContact, LOWORD(wParam), GetDlgItem(m_hwnd, LOWORD(wParam)), 0);
- break;
- }
-
switch (LOWORD(wParam)) {
case IDOK:
if (IsWindowEnabled(GetDlgItem(m_hwnd, IDOK))) {
@@ -1427,7 +1417,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) SendMessage(pLink->nmhdr.hwndFrom, EM_EXSETSEL, 0, (LPARAM)&all);
break;
case IDM_CLEAR:
- m_log.SetText(L"");
+ ClearLog();
m_hDbEventFirst = NULL;
break;
}
diff --git a/src/mir_app/src/chat.h b/src/mir_app/src/chat.h index d081407ac6..dee0182b12 100644 --- a/src/mir_app/src/chat.h +++ b/src/mir_app/src/chat.h @@ -58,12 +58,11 @@ char* SM_GetUsers(SESSION_INFO *si); BOOL SM_GiveStatus(const wchar_t *pszID, const char *pszModule, const wchar_t *pszUID, const wchar_t *pszStatus);
BOOL SM_MoveUser(const wchar_t *pszID, const char *pszModule, const wchar_t *pszUID);
void SM_RemoveAll(void);
-int SM_RemoveSession(const wchar_t *pszID, const char *pszModule, BOOL removeContact);
+int SM_RemoveSession(const wchar_t *pszID, const char *pszModule, bool removeContact);
BOOL SM_RemoveUser(const wchar_t *pszID, const char *pszModule, const wchar_t *pszUID);
-LRESULT SM_SendMessage(const wchar_t *pszID, const char *pszModule, UINT msg, WPARAM wParam, LPARAM lParam);
BOOL SM_SetContactStatus(const wchar_t *pszID, const char *pszModule, const wchar_t *pszUID, WORD wStatus);
-BOOL SM_SetOffline(const wchar_t *pszID, const char *pszModule);
-BOOL SM_SetStatus(const wchar_t *pszID, const char *pszModule, int wStatus);
+BOOL SM_SetOffline(SESSION_INFO *si);
+BOOL SM_SetStatus(SESSION_INFO *si, int wStatus);
BOOL SM_TakeStatus(const wchar_t *pszID, const char *pszModule, const wchar_t *pszUID, const wchar_t *pszStatus);
SESSION_INFO* SM_FindSession(const wchar_t *pszID, const char *pszModule);
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp index 2fa68a3f90..0f9024d306 100644 --- a/src/mir_app/src/chat_manager.cpp +++ b/src/mir_app/src/chat_manager.cpp @@ -42,7 +42,7 @@ CHAT_MANAGER chatApi; MODULEINFO *m_ModList = 0;
-static void SetActiveSessionEx(SESSION_INFO *si)
+static void SetActiveSession(SESSION_INFO *si)
{
if (si) {
replaceStrW(chatApi.szActiveWndID, si->ptszID);
@@ -50,13 +50,6 @@ static void SetActiveSessionEx(SESSION_INFO *si) }
}
-static void SetActiveSession(const wchar_t *pszID, const char *pszModule)
-{
- SESSION_INFO *si = SM_FindSession(pszID, pszModule);
- if (si)
- SetActiveSessionEx(si);
-}
-
static SESSION_INFO* GetActiveSession(void)
{
SESSION_INFO *si = SM_FindSession(chatApi.szActiveWndID, chatApi.szActiveWndModule);
@@ -72,8 +65,21 @@ static SESSION_INFO* GetActiveSession(void) // Keeps track of all sessions and its windows
//---------------------------------------------------
-static void SM_FreeSession(SESSION_INFO *si)
+static void SM_FreeSession(SESSION_INFO *si, bool bRemoveContact = false)
{
+ if (cli.pfnGetEvent(si->hContact, 0))
+ cli.pfnRemoveEvent(si->hContact, GC_FAKE_EVENT);
+ si->wState &= ~STATE_TALK;
+ db_set_w(si->hContact, si->pszModule, "ApparentMode", 0);
+
+ if (si->pDlg)
+ SendMessage(si->pDlg->GetHwnd(), GC_CLOSEWINDOW, 0, 1);
+
+ DoEventHook(si, GC_SESSION_TERMINATE, nullptr, nullptr, (INT_PTR)si->pItemData);
+
+ if (si->hContact && bRemoveContact)
+ db_delete_contact(si->hContact);
+
// contact may have been deleted here already, since function may be called after deleting
// contact so the handle may be invalid, therefore db_get_b shall return 0
if (si->hContact && db_get_b(si->hContact, si->pszModule, "ChatRoom", 0) != 0) {
@@ -106,32 +112,28 @@ static void SM_FreeSession(SESSION_INFO *si) mir_free(si);
}
-int SM_RemoveSession(const wchar_t *pszID, const char *pszModule, BOOL removeContact)
+int SM_RemoveSession(const wchar_t *pszID, const char *pszModule, bool removeContact)
{
- if (!pszModule)
+ if (pszModule == nullptr)
return FALSE;
- for (int i = g_arSessions.getCount() - 1; i >= 0; i--) {
- SESSION_INFO *si = g_arSessions[i];
- // match
- if ((!pszID && si->iType != GCW_SERVER || !mir_wstrcmpi(si->ptszID, pszID)) && !mir_strcmpi(si->pszModule, pszModule)) {
- if (si->pDlg)
- SendMessage(si->pDlg->GetHwnd(), GC_CONTROL_MSG, SESSION_TERMINATE, 0);
- DoEventHook(si, GC_SESSION_TERMINATE, nullptr, nullptr, (INT_PTR)si->pItemData);
+ if (pszID != nullptr) {
+ SESSION_INFO *si = SM_FindSession(pszID, pszModule);
+ if (si == nullptr)
+ return FALSE;
- // contact may have been deleted here already, since function may be called after deleting
- // contact so the handle may be invalid, therefore db_get_b shall return 0
- if (si->hContact && removeContact)
- db_delete_contact(si->hContact);
+ SM_FreeSession(si, removeContact);
+ return TRUE;
+ }
- SM_FreeSession(si);
+ for (int i = g_arSessions.getCount() - 1; i >= 0; i--) {
+ SESSION_INFO *si = g_arSessions[i];
+ if (si->iType != GCW_SERVER && !mir_strcmpi(si->pszModule, pszModule)) {
+ SM_FreeSession(si, removeContact);
g_arSessions.remove(i);
-
- if (pszID)
- return 1;
}
}
- return FALSE;
+ return TRUE;
}
SESSION_INFO* SM_FindSession(const wchar_t *pszID, const char *pszModule)
@@ -147,26 +149,18 @@ SESSION_INFO* SM_FindSession(const wchar_t *pszID, const char *pszModule) return g_arSessions.find(&tmp);
}
-BOOL SM_SetOffline(const wchar_t *pszID, const char *pszModule)
+BOOL SM_SetOffline(SESSION_INFO *si)
{
- if (!pszModule)
+ if (si == nullptr)
return FALSE;
- for (int i = 0; i < g_arSessions.getCount(); i++) {
- SESSION_INFO *si = g_arSessions[i];
- if ((pszID && mir_wstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
- continue;
-
- chatApi.UM_RemoveAll(&si->pUsers);
- si->pMe = nullptr;
- si->nUsersInNicklist = 0;
- if (si->iType != GCW_SERVER)
- si->bInitDone = false;
- if (chatApi.OnOfflineSession)
- chatApi.OnOfflineSession(si);
- if (pszID)
- return TRUE;
- }
+ chatApi.UM_RemoveAll(&si->pUsers);
+ si->pMe = nullptr;
+ si->nUsersInNicklist = 0;
+ if (si->iType != GCW_SERVER)
+ si->bInitDone = false;
+ if (chatApi.OnOfflineSession)
+ chatApi.OnOfflineSession(si);
return TRUE;
}
@@ -308,27 +302,6 @@ BOOL SM_TakeStatus(const wchar_t *pszID, const char *pszModule, const wchar_t *p return TRUE;
}
-LRESULT SM_SendMessage(const wchar_t *pszID, const char *pszModule, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- if (pszModule == nullptr)
- return 0;
-
- for (int i = 0; i < g_arSessions.getCount(); i++) {
- SESSION_INFO *si = g_arSessions[i];
- if ((pszID && mir_wstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
- continue;
-
- if (si->pDlg) {
- LRESULT res = SendMessage(si->pDlg->GetHwnd(), msg, wParam, lParam);
- if (pszID)
- return res;
- }
- if (pszID)
- return 0;
- }
- return 0;
-}
-
static BOOL SM_BroadcastMessage(const char *pszModule, UINT msg, WPARAM wParam, LPARAM lParam, BOOL bAsync)
{
for (int i = 0; i < g_arSessions.getCount(); i++) {
@@ -346,30 +319,19 @@ static BOOL SM_BroadcastMessage(const char *pszModule, UINT msg, WPARAM wParam, return TRUE;
}
-BOOL SM_SetStatus(const wchar_t *pszID, const char *pszModule, int wStatus)
+BOOL SM_SetStatus(SESSION_INFO *si, int wStatus)
{
- if (!pszModule)
- return FALSE;
-
- for (int i = 0; i < g_arSessions.getCount(); i++) {
- SESSION_INFO *si = g_arSessions[i];
- if ((pszID && mir_wstrcmpi(si->ptszID, pszID)) || mir_strcmpi(si->pszModule, pszModule))
- continue;
+ si->wStatus = wStatus;
+ if (si->hContact) {
+ if (si->iType != GCW_SERVER && wStatus != ID_STATUS_OFFLINE)
+ db_unset(si->hContact, "CList", "Hidden");
- si->wStatus = wStatus;
- if (si->hContact) {
- if (si->iType != GCW_SERVER && wStatus != ID_STATUS_OFFLINE)
- db_unset(si->hContact, "CList", "Hidden");
-
- db_set_w(si->hContact, si->pszModule, "Status", (WORD)wStatus);
- }
+ db_set_w(si->hContact, si->pszModule, "Status", (WORD)wStatus);
+ }
- if (chatApi.OnSetStatus)
- chatApi.OnSetStatus(si, wStatus);
+ if (chatApi.OnSetStatus)
+ chatApi.OnSetStatus(si, wStatus);
- if (pszID)
- return TRUE;
- }
return TRUE;
}
@@ -400,15 +362,9 @@ BOOL SM_ChangeNick(const wchar_t *pszID, const char *pszModule, GCEVENT *gce) void SM_RemoveAll(void)
{
- for (int i = 0; i < g_arSessions.getCount(); i++) {
- SESSION_INFO *si = g_arSessions[i];
-
- if (si->pDlg)
- SendMessage(si->pDlg->GetHwnd(), GC_CONTROL_MSG, SESSION_TERMINATE, 0);
- DoEventHook(si, GC_SESSION_TERMINATE, nullptr, nullptr, (INT_PTR)si->pItemData);
+ for (int i = 0; i < g_arSessions.getCount(); i++)
+ SM_FreeSession(g_arSessions[i], false);
- SM_FreeSession(si);
- }
g_arSessions.destroy();
}
@@ -1088,7 +1044,6 @@ MIR_APP_DLL(CHAT_MANAGER*) Chat_GetInterface(CHAT_MANAGER_INITDATA *pInit, int _ g_iChatLang = _hLangpack;
chatApi.SetActiveSession = SetActiveSession;
- chatApi.SetActiveSessionEx = SetActiveSessionEx;
chatApi.GetActiveSession = GetActiveSession;
chatApi.SM_FindSession = SM_FindSession;
chatApi.SM_GetStatusIcon = SM_GetStatusIcon;
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp index 0446d8979d..8bfb9d684d 100644 --- a/src/mir_app/src/chat_svc.cpp +++ b/src/mir_app/src/chat_svc.cpp @@ -275,50 +275,52 @@ static INT_PTR __stdcall stubRoomControl(void *param) ChatConrolParam *p = (ChatConrolParam*)param;
mir_cslock lck(csChat);
+ SESSION_INFO *si = chatApi.SM_FindSession(p->wszId, p->szModule);
+ if (si == nullptr)
+ return GC_EVENT_ERROR;
+
switch (p->command) {
case WINDOW_HIDDEN:
- if (SESSION_INFO *si = chatApi.SM_FindSession(p->wszId, p->szModule)) {
- SetInitDone(si);
- chatApi.SetActiveSession(si->ptszID, si->pszModule);
- }
- return 0;
+ SetInitDone(si);
+ chatApi.SetActiveSession(si);
+ if (si->pDlg)
+ ::SendMessage(si->pDlg->GetHwnd(), GC_CLOSEWINDOW, 0, 0);
+ break;
- case WINDOW_MINIMIZE:
- case WINDOW_MAXIMIZE:
case WINDOW_VISIBLE:
case SESSION_INITDONE:
- if (SESSION_INFO *si = chatApi.SM_FindSession(p->wszId, p->szModule)) {
- SetInitDone(si);
- if (p->command != SESSION_INITDONE || db_get_b(0, CHAT_MODULE, "PopupOnJoin", 0) == 0)
- chatApi.ShowRoom(si);
- return 0;
- }
+ SetInitDone(si);
+ if (p->command != SESSION_INITDONE || db_get_b(0, CHAT_MODULE, "PopupOnJoin", 0) == 0)
+ chatApi.ShowRoom(si);
break;
case SESSION_OFFLINE:
- SM_SetOffline(p->wszId, p->szModule);
- // fall through
+ SM_SetOffline(si);
+ SM_SetStatus(si, ID_STATUS_OFFLINE);
+ if (si->pDlg) {
+ ::SendMessage(si->pDlg->GetHwnd(), GC_UPDATESTATUSBAR, 0, 0);
+ ::SendMessage(si->pDlg->GetHwnd(), GC_UPDATENICKLIST, 0, 0);
+ }
+ break;
case SESSION_ONLINE:
- SM_SetStatus(p->wszId, p->szModule, p->command == SESSION_ONLINE ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE);
+ SM_SetStatus(si, ID_STATUS_ONLINE);
+ if (si->pDlg)
+ ::SendMessage(si->pDlg->GetHwnd(), GC_UPDATESTATUSBAR, 0, 0);
break;
- case SESSION_TERMINATE:
- return SM_RemoveSession(p->wszId, p->szModule, false);
-
case WINDOW_CLEARLOG:
- if (SESSION_INFO *si = chatApi.SM_FindSession(p->wszId, p->szModule)) {
- chatApi.LM_RemoveAll(&si->pLog, &si->pLogEnd);
- si->iEventCount = 0;
- si->LastTime = 0;
- }
+ chatApi.LM_RemoveAll(&si->pLog, &si->pLogEnd);
+ si->iEventCount = 0;
+ si->LastTime = 0;
+ if (si->pDlg)
+ si->pDlg->ClearLog();
break;
default:
return GC_EVENT_ERROR;
}
- SM_SendMessage(p->wszId, p->szModule, GC_CONTROL_MSG, p->command, 0);
return 0;
}
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index c2562b7c58..1628ca17a9 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -411,3 +411,4 @@ ProtoGetAvatarMimeType @401 Srmm_LogStreamCallback @412
Srmm_MessageStreamCallback @413
?DoEventHook@CSrmmBaseDialog@@IAEXHPBUUSERINFO@@PB_WH@Z @414 NONAME
+?ClearLog@CSrmmBaseDialog@@QAEXXZ @415 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 8c86e46402..ad9ab48e67 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -411,3 +411,4 @@ ProtoGetAvatarMimeType @401 Srmm_LogStreamCallback @412
Srmm_MessageStreamCallback @413
?DoEventHook@CSrmmBaseDialog@@IEAAXHPEBUUSERINFO@@PEB_W_J@Z @414 NONAME
+?ClearLog@CSrmmBaseDialog@@QEAAXXZ @415 NONAME
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp index 03aa63c405..1f017289b4 100644 --- a/src/mir_app/src/srmm_base.cpp +++ b/src/mir_app/src/srmm_base.cpp @@ -58,6 +58,16 @@ CSrmmBaseDialog::CSrmmBaseDialog(HINSTANCE hInst, int idDialog, SESSION_INFO *si INT_PTR CSrmmBaseDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { + case WM_COMMAND: + if (!lParam && Clist_MenuProcessCommand(LOWORD(wParam), MPCF_CONTACTMENU, m_hContact)) + return 0; + + if (wParam >= MIN_CBUTTONID && wParam <= MAX_CBUTTONID) { + Srmm_ClickToolbarIcon(m_hContact, wParam, GetDlgItem(m_hwnd, wParam), 0); + return 0; + } + break; + case WM_NOTIFY: if (m_pLog != nullptr) { LPNMHDR hdr = (LPNMHDR)lParam; @@ -128,6 +138,12 @@ INT_PTR CSrmmBaseDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) return CDlgBase::DlgProc(msg, wParam, lParam); } +void CSrmmBaseDialog::ClearLog() +{ + if (m_pLog != nullptr) + m_pLog->SetText(L""); +} + void CSrmmBaseDialog::DoEventHook(int iType, const USERINFO *pUser, const wchar_t *pszText, INT_PTR dwItem) { GCDEST gcd = {}; |