diff options
author | George Hazan <ghazan@miranda.im> | 2017-03-11 12:27:21 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-03-11 12:27:21 +0300 |
commit | e02f1e05b363226a48fe9a4b151748a5cbb295d9 (patch) | |
tree | e49e428ab703459d65ef7829187dd17b9af4154c /plugins | |
parent | 432b115c1eaf6f74d7d4d8ac580f5de39c16a533 (diff) |
GC_UPDATETITLE replaced with CSrmmBaseDlg::UpdateTitle
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Scriver/src/chat/window.cpp | 82 | ||||
-rw-r--r-- | plugins/Scriver/src/msgdialog.cpp | 91 | ||||
-rw-r--r-- | plugins/Scriver/src/msgs.h | 2 | ||||
-rw-r--r-- | plugins/Scriver/src/tabs.cpp | 61 | ||||
-rw-r--r-- | plugins/Scriver/src/tabs.h | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat_tools.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat_window.cpp | 131 | ||||
-rw-r--r-- | plugins/TabSRMM/src/container.cpp | 85 | ||||
-rw-r--r-- | plugins/TabSRMM/src/generic_msghandlers.cpp | 105 | ||||
-rw-r--r-- | plugins/TabSRMM/src/globals.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdialog.cpp | 110 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.h | 6 |
13 files changed, 328 insertions, 355 deletions
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index 0db9074563..4b1e6006db 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -971,7 +971,7 @@ void CChatRoomDlg::OnInitDialog() SendMessage(m_hwnd, GC_SETWNDPROPS, 0, 0);
SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0);
- SendMessage(m_hwnd, DM_UPDATETITLEBAR, 0, 0);
+ UpdateTitle();
SendMessage(m_hwndParent, CM_ADDCHILD, (WPARAM)this, 0);
PostMessage(m_hwnd, GC_UPDATENICKLIST, 0, 0);
@@ -1217,6 +1217,44 @@ void CChatRoomDlg::onChange_Message(CCtrlEdit *pEdit) m_btnOk.Enable(GetRichTextLength(pEdit->GetHwnd(), 1200, FALSE) != 0);
}
+void CChatRoomDlg::UpdateTitle()
+{
+ TitleBarData tbd = {};
+ if (g_dat.flags & SMF_STATUSICON) {
+ MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule);
+ tbd.hIcon = (m_si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIcon : mi->hOfflineIcon;
+ tbd.hIconBig = (m_si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIconBig : mi->hOfflineIconBig;
+ }
+ else {
+ tbd.hIcon = GetCachedIcon("chat_window");
+ tbd.hIconBig = g_dat.hIconChatBig;
+ }
+ tbd.hIconNot = (m_si->wState & (GC_EVENT_HIGHLIGHT | STATE_TALK)) ? GetCachedIcon("chat_overlay") : nullptr;
+
+ wchar_t szTemp[512];
+ switch (m_si->iType) {
+ case GCW_CHATROOM:
+ mir_snwprintf(szTemp,
+ (m_si->nUsersInNicklist == 1) ? TranslateT("%s: chat room (%u user)") : TranslateT("%s: chat room (%u users)"),
+ m_si->ptszName, m_si->nUsersInNicklist);
+ break;
+ case GCW_PRIVMESS:
+ mir_snwprintf(szTemp,
+ (m_si->nUsersInNicklist == 1) ? TranslateT("%s: message session") : TranslateT("%s: message session (%u users)"),
+ m_si->ptszName, m_si->nUsersInNicklist);
+ break;
+ case GCW_SERVER:
+ mir_snwprintf(szTemp, L"%s: Server", m_si->ptszName);
+ break;
+ }
+ tbd.iFlags = TBDF_TEXT | TBDF_ICON;
+ tbd.pszText = szTemp;
+ SendMessage(m_hwndParent, CM_UPDATETITLEBAR, (WPARAM)&tbd, (LPARAM)m_hwnd);
+ SendMessage(m_hwnd, DM_UPDATETABCONTROL, 0, 0);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static HMENU hToolbarMenu;
@@ -1224,7 +1262,6 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) POINT pt;
HICON hIcon;
TabControlData tcd;
- TitleBarData tbd;
wchar_t szTemp[512];
switch (uMsg) {
@@ -1245,7 +1282,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) }
SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0);
- SendMessage(m_hwnd, DM_UPDATETITLEBAR, 0, 0);
+ UpdateTitle();
SendMessage(m_hwnd, GC_FIXTABICONS, 0, 0);
m_log.SendMsg(EM_SETBKGNDCOLOR, 0, g_Settings.crLogBackground);
@@ -1281,39 +1318,6 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) SendMessage(m_hwnd, GC_REDRAWLOG2, 0, 0);
break;
- case DM_UPDATETITLEBAR:
- if (g_dat.flags & SMF_STATUSICON) {
- MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule);
- tbd.hIcon = (m_si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIcon : mi->hOfflineIcon;
- tbd.hIconBig = (m_si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIconBig : mi->hOfflineIconBig;
- }
- else {
- tbd.hIcon = GetCachedIcon("chat_window");
- tbd.hIconBig = g_dat.hIconChatBig;
- }
- tbd.hIconNot = (m_si->wState & (GC_EVENT_HIGHLIGHT | STATE_TALK)) ? GetCachedIcon("chat_overlay") : nullptr;
-
- switch (m_si->iType) {
- case GCW_CHATROOM:
- mir_snwprintf(szTemp,
- (m_si->nUsersInNicklist == 1) ? TranslateT("%s: chat room (%u user)") : TranslateT("%s: chat room (%u users)"),
- m_si->ptszName, m_si->nUsersInNicklist);
- break;
- case GCW_PRIVMESS:
- mir_snwprintf(szTemp,
- (m_si->nUsersInNicklist == 1) ? TranslateT("%s: message session") : TranslateT("%s: message session (%u users)"),
- m_si->ptszName, m_si->nUsersInNicklist);
- break;
- case GCW_SERVER:
- mir_snwprintf(szTemp, L"%s: Server", m_si->ptszName);
- break;
- }
- tbd.iFlags = TBDF_TEXT | TBDF_ICON;
- tbd.pszText = szTemp;
- SendMessage(m_hwndParent, CM_UPDATETITLEBAR, (WPARAM)&tbd, (LPARAM)m_hwnd);
- SendMessage(m_hwnd, DM_UPDATETABCONTROL, 0, 0);
- break;
-
case GC_UPDATESTATUSBAR:
{
MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule);
@@ -1417,14 +1421,14 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) case GC_SETMESSAGEHIGHLIGHT:
m_si->wState |= GC_EVENT_HIGHLIGHT;
SendMessage(m_hwnd, GC_FIXTABICONS, 0, 0);
- SendMessage(m_hwnd, DM_UPDATETITLEBAR, 0, 0);
+ UpdateTitle();
if (g_Settings.bFlashWindowHighlight && GetActiveWindow() != m_hwnd && GetForegroundWindow() != m_hwndParent)
SendMessage(m_hwndParent, CM_STARTFLASHING, 0, 0);
break;
case GC_SETTABHIGHLIGHT:
SendMessage(m_hwnd, GC_FIXTABICONS, 0, 0);
- SendMessage(m_hwnd, DM_UPDATETITLEBAR, 0, 0);
+ UpdateTitle();
if (g_Settings.bFlashWindow && GetActiveWindow() != m_hwndParent && GetForegroundWindow() != m_hwndParent)
SendMessage(m_hwndParent, CM_STARTFLASHING, 0, 0);
break;
@@ -1538,7 +1542,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) m_nickList.SendMsg(WM_SETREDRAW, TRUE, 0);
InvalidateRect(m_nickList.GetHwnd(), nullptr, FALSE);
UpdateWindow(m_nickList.GetHwnd());
- SendMessage(m_hwnd, DM_UPDATETITLEBAR, 0, 0);
+ UpdateTitle();
break;
case GC_CHANGEFILTERFLAG:
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index e131d282ca..2326d472d9 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -1061,6 +1061,49 @@ void CSrmmWindow::onChanged_Splitter(CSplitter *pSplitter) m_pParent->iSplitterY = rc.bottom - pSplitter->GetPos();
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static const wchar_t *titleTokenNames[] = { L"%name%", L"%status%", L"%statusmsg%", L"%account%" };
+
+void CSrmmWindow::UpdateTitle()
+{
+ CMStringW wszTitle;
+ ptrW tmplt(db_get_wsa(0, SRMMMOD, SRMSGSET_WINDOWTITLE));
+ if (tmplt != nullptr)
+ wszTitle = tmplt;
+ else if (g_dat.flags & SMF_STATUSICON)
+ wszTitle = L"%name% - ";
+ else
+ wszTitle = L"%name% (%status%) : ";
+
+ if (m_hContact && m_szProto) {
+ wszTitle.Replace(L"%name%", pcli->pfnGetContactDisplayName(m_hContact, 0));
+ wszTitle.Replace(L"%status%", pcli->pfnGetStatusModeDescription(db_get_w(m_hContact, m_szProto, "Status", ID_STATUS_OFFLINE), 0));
+
+ CMStringW tszStatus = ptrW(db_get_wsa(m_hContact, "CList", "StatusMsg"));
+ tszStatus.Replace(L"\r\n", L" ");
+ wszTitle.Replace(L"%statusmsg%", tszStatus);
+
+ char *accModule = Proto_GetBaseAccountName(m_hContact);
+ if (accModule != nullptr) {
+ PROTOACCOUNT *proto = Proto_GetAccount(accModule);
+ if (proto != nullptr)
+ wszTitle.Replace(L"%account%", proto->tszAccountName);
+ }
+ }
+
+ if (tmplt == nullptr)
+ wszTitle.Append(TranslateT("Message session"));
+
+ TitleBarData tbd = {};
+ tbd.iFlags = TBDF_TEXT | TBDF_ICON;
+ GetTitlebarIcon(&tbd);
+ tbd.pszText = wszTitle.GetBuffer();
+ SendMessage(m_hwndParent, CM_UPDATETITLEBAR, (WPARAM)&tbd, (LPARAM)m_hwnd);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
{
PARAFORMAT2 pf2;
@@ -1142,44 +1185,30 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) }
break;
- case DM_UPDATETABCONTROL: {
+ case DM_UPDATETABCONTROL:
TabControlData tcd;
tcd.iFlags = TCDF_TEXT | TCDF_ICON;
tcd.hIcon = GetTabIcon();
tcd.pszText = pcli->pfnGetContactDisplayName(m_hContact, 0);
SendMessage(m_hwndParent, CM_UPDATETABCONTROL, (WPARAM)&tcd, (LPARAM)m_hwnd);
break;
- }
-
- case DM_UPDATETITLEBAR:
- {
- TitleBarData tbd = { 0 };
- tbd.iFlags = TBDF_TEXT | TBDF_ICON;
- GetTitlebarIcon(&tbd);
- tbd.pszText = GetWindowTitle(m_hContact, m_szProto);
- SendMessage(m_hwndParent, CM_UPDATETITLEBAR, (WPARAM)&tbd, (LPARAM)m_hwnd);
- mir_free(tbd.pszText);
- }
- break;
case DM_CLISTSETTINGSCHANGED:
- if (wParam == m_hContact) {
- if (m_hContact && m_szProto) {
- DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam;
- char idbuf[128], buf[128];
- GetContactUniqueId(idbuf, sizeof(idbuf));
- mir_snprintf(buf, Translate("User menu - %s"), idbuf);
- SendDlgItemMessage(m_hwnd, IDC_USERMENU, BUTTONADDTOOLTIP, (WPARAM)buf, 0);
-
- if (cws && !mir_strcmp(cws->szModule, m_szProto) && !mir_strcmp(cws->szSetting, "Status"))
- m_wStatus = cws->value.wVal;
-
- SetStatusIcon();
- SendMessage(m_hwnd, DM_UPDATEICON, 0, 0);
- SendMessage(m_hwnd, DM_UPDATETITLEBAR, 0, 0);
- SendMessage(m_hwnd, DM_UPDATETABCONTROL, 0, 0);
- ShowAvatar();
- }
+ if (wParam == m_hContact && m_hContact && m_szProto) {
+ DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam;
+ char idbuf[128], buf[128];
+ GetContactUniqueId(idbuf, sizeof(idbuf));
+ mir_snprintf(buf, Translate("User menu - %s"), idbuf);
+ SendDlgItemMessage(m_hwnd, IDC_USERMENU, BUTTONADDTOOLTIP, (WPARAM)buf, 0);
+
+ if (cws && !mir_strcmp(cws->szModule, m_szProto) && !mir_strcmp(cws->szSetting, "Status"))
+ m_wStatus = cws->value.wVal;
+
+ SetStatusIcon();
+ SendMessage(m_hwnd, DM_UPDATEICON, 0, 0);
+ UpdateTitle();
+ SendMessage(m_hwnd, DM_UPDATETABCONTROL, 0, 0);
+ ShowAvatar();
}
break;
@@ -1244,7 +1273,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) m_log.SendMsg(EM_SETLANGOPTIONS, 0, (LPARAM)m_log.SendMsg(EM_GETLANGOPTIONS, 0, 0) & ~(IMF_AUTOKEYBOARD | IMF_AUTOFONTSIZEADJUST));
SendMessage(m_hwnd, DM_REMAKELOG, 0, 0);
- SendMessage(m_hwnd, DM_UPDATETITLEBAR, 0, 0);
+ UpdateTitle();
SendMessage(m_hwnd, DM_UPDATETABCONTROL, 0, 0);
SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0);
m_message.SendMsg(EM_REQUESTRESIZE, 0, 0);
diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index 9bde19bcec..873fd5ab90 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -148,6 +148,7 @@ public: virtual void OnInitDialog() override;
virtual void OnDestroy() override;
+ virtual void UpdateTitle() override;
virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
@@ -189,6 +190,7 @@ public: virtual void OnDestroy() override;
virtual INT_PTR DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) override;
+ virtual void UpdateTitle() override;
void onChange_Message(CCtrlEdit*);
diff --git a/plugins/Scriver/src/tabs.cpp b/plugins/Scriver/src/tabs.cpp index 63ece38006..dc77083ee8 100644 --- a/plugins/Scriver/src/tabs.cpp +++ b/plugins/Scriver/src/tabs.cpp @@ -33,65 +33,6 @@ static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM wParam, LPARAM lPar /////////////////////////////////////////////////////////////////////////////////////////
-static const wchar_t *titleTokenNames[] = { L"%name%", L"%status%", L"%statusmsg%", L"%account%" };
-
-wchar_t* GetWindowTitle(MCONTACT hContact, const char *szProto)
-{
- ptrW tmplt;
- const wchar_t* tokens[4] = { 0 };
-
- CMStringW tszTemplate, tszStatus, tszTitle;
- if (hContact && szProto) {
- tokens[0] = pcli->pfnGetContactDisplayName(hContact, 0);
- tokens[1] = pcli->pfnGetStatusModeDescription(db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
-
- tszStatus = ptrW(db_get_wsa(hContact, "CList", "StatusMsg"));
- tszStatus.Replace(L"\r\n", L" ");
- tokens[2] = tszStatus;
-
- char *accModule = Proto_GetBaseAccountName(hContact);
- if (accModule != nullptr) {
- PROTOACCOUNT* proto = Proto_GetAccount(accModule);
- if (proto != nullptr)
- tokens[3] = mir_wstrdup(proto->tszAccountName);
- }
-
- tmplt = db_get_wsa(0, SRMMMOD, SRMSGSET_WINDOWTITLE);
- if (tmplt != nullptr)
- tszTemplate = tmplt;
- else {
- if (g_dat.flags & SMF_STATUSICON)
- tszTemplate = L"%name% - ";
- else
- tszTemplate = L"%name% (%status%) : ";
- }
- }
-
- for (const wchar_t *p = tszTemplate; *p; p++) {
- if (*p == '%') {
- int i;
- for (i = 0; i < _countof(titleTokenNames); i++) {
- size_t tnlen = mir_wstrlen(titleTokenNames[i]);
- if (!wcsncmp(p, titleTokenNames[i], tnlen)) {
- if (tokens[i] != nullptr)
- tszTitle.Append(tokens[i]);
-
- p += tnlen - 1;
- break;
- }
- }
- if (i < _countof(titleTokenNames))
- continue;
- }
- tszTitle.AppendChar(*p);
- }
-
- if (tmplt == nullptr)
- tszTitle.Append(TranslateT("Message session"));
-
- return tszTitle.Detach();
-}
-
static int GetChildCount(ParentWindowData *dat)
{
return TabCtrl_GetItemCount(dat->hwndTabs);
@@ -253,7 +194,7 @@ static void ActivateChild(ParentWindowData *dat, HWND child) dat->hwndActive = child;
SetupStatusBar(dat);
SendMessage(dat->hwndActive, GC_UPDATESTATUSBAR, 0, 0);
- SendMessage(dat->hwndActive, DM_UPDATETITLEBAR, 0, 0);
+ pDlg->UpdateTitle();
SendMessage(dat->hwndActive, WM_SIZE, 0, 0);
ShowWindow(dat->hwndActive, SW_SHOWNOACTIVATE);
SendMessage(dat->hwndActive, DM_SCROLLLOGTOBOTTOM, 0, 0);
diff --git a/plugins/Scriver/src/tabs.h b/plugins/Scriver/src/tabs.h index ca2e643e7c..bafb7c4518 100644 --- a/plugins/Scriver/src/tabs.h +++ b/plugins/Scriver/src/tabs.h @@ -44,7 +44,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define CM_GETTOOLBARSTATUS (WM_USER+0x1A2)
/* child window services */
-#define DM_UPDATETITLEBAR (WM_USER+0x1B0)
#define DM_UPDATETABCONTROL (WM_USER+0x1B2)
#define DM_SETPARENT (WM_USER+0x1B3)
#define DM_ACTIVATE (WM_USER+0x1B6)
@@ -85,7 +84,6 @@ struct TabControlData HICON hIcon;
};
-wchar_t* GetWindowTitle(MCONTACT hContact, const char *szProto);
HWND GetParentWindow(MCONTACT hContact, BOOL bChat);
void NotifyLocalWinEvent(MCONTACT hContact, HWND hwnd, unsigned int type);
diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp index 75d08d6aa3..d316bbd744 100644 --- a/plugins/TabSRMM/src/chat_tools.cpp +++ b/plugins/TabSRMM/src/chat_tools.cpp @@ -257,7 +257,7 @@ void DoFlashAndSoundWorker(FLASH_PARAMS *p) TabCtrl_SetCurSel(hwndTab, iItem);
ShowWindow(dat->m_pContainer->hwndActive, SW_HIDE);
dat->m_pContainer->hwndActive = si->pDlg->GetHwnd();
- SendMessage(dat->m_pContainer->hwnd, DM_UPDATETITLE, dat->m_hContact, 0);
+ dat->m_pContainer->UpdateTitle(dat->m_hContact);
dat->m_pContainer->dwFlags |= CNT_DEFERREDTABSELECT;
}
}
diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp index 8022bdb1a5..219613964d 100644 --- a/plugins/TabSRMM/src/chat_window.cpp +++ b/plugins/TabSRMM/src/chat_window.cpp @@ -197,7 +197,8 @@ void CChatRoomDlg::UpdateWindowState(UINT msg) if (pcli->pfnGetEvent(m_si->hContact, 0)) pcli->pfnRemoveEvent(m_si->hContact, GC_FAKE_EVENT); - SendMessage(m_hwnd, GC_UPDATETITLE, 0, 1); + UpdateTitle(); + m_hTabIcon = m_hTabStatusIcon; m_dwTickLastEvent = 0; m_dwFlags &= ~MWF_DIVIDERSET; if (KillTimer(m_hwnd, TIMERID_FLASHWND) || m_iFlashIcon) { @@ -1651,7 +1652,8 @@ void CChatRoomDlg::OnInitDialog() SendMessage(m_hwnd, GC_SETWNDPROPS, 0, 0); SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0); - SendMessage(m_hwnd, GC_UPDATETITLE, 0, 1); + UpdateTitle(); + m_hTabIcon = m_hTabStatusIcon; RECT rc; SendMessage(m_pContainer->hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rc); @@ -1781,7 +1783,7 @@ void CChatRoomDlg::onClick_Filter(CCtrlButton *pButton) return; } SendMessage(m_hwnd, GC_REDRAWLOG, 0, 0); - SendMessage(m_hwnd, GC_UPDATETITLE, 0, 0); + UpdateTitle(); db_set_b(m_si->hContact, CHAT_MODULE, "FilterEnabled", m_bFilterEnabled); } @@ -1946,6 +1948,66 @@ void CChatRoomDlg::onDblClick_List(CCtrlListBox*) else DoEventHook(GC_USER_PRIVMESS, ui, nullptr, 0); } +///////////////////////////////////////////////////////////////////////////////////////// + +void CChatRoomDlg::UpdateTitle() +{ + m_wStatus = m_si->wStatus; + + const wchar_t *szNick = m_cache->getNick(); + if (mir_wstrlen(szNick) > 0) { + if (M.GetByte("cuttitle", 0)) + CutContactName(szNick, m_wszTitle, _countof(m_wszTitle)); + else + wcsncpy_s(m_wszTitle, szNick, _TRUNCATE); + } + + wchar_t szTemp[100]; + HICON hIcon = 0; + + switch (m_si->iType) { + case GCW_CHATROOM: + hIcon = Skin_LoadProtoIcon(m_si->pszModule, (m_wStatus <= ID_STATUS_OFFLINE) ? ID_STATUS_OFFLINE : m_wStatus); + mir_snwprintf(szTemp, + (m_si->nUsersInNicklist == 1) ? TranslateT("%s: chat room (%u user%s)") : TranslateT("%s: chat room (%u users%s)"), + szNick, m_si->nUsersInNicklist, m_bFilterEnabled ? TranslateT(", event filter active") : L""); + break; + case GCW_PRIVMESS: + hIcon = Skin_LoadProtoIcon(m_si->pszModule, (m_wStatus <= ID_STATUS_OFFLINE) ? ID_STATUS_OFFLINE : m_wStatus); + if (m_si->nUsersInNicklist == 1) + mir_snwprintf(szTemp, TranslateT("%s: message session"), szNick); + else + mir_snwprintf(szTemp, TranslateT("%s: message session (%u users)"), szNick, m_si->nUsersInNicklist); + break; + case GCW_SERVER: + mir_snwprintf(szTemp, L"%s: Server", szNick); + hIcon = LoadIconEx("window"); + break; + } + + if (m_pWnd) { + m_pWnd->updateTitle(m_wszTitle); + m_pWnd->updateIcon(hIcon); + } + m_hTabStatusIcon = hIcon; + + if (m_cache->getStatus() != m_cache->getOldStatus()) { + wcsncpy_s(m_wszStatus, pcli->pfnGetStatusModeDescription(m_wStatus, 0), _TRUNCATE); + + TCITEM item = {}; + item.mask = TCIF_TEXT; + item.pszText = m_wszTitle; + TabCtrl_SetItem(m_hwndParent, m_iTabID, &item); + } + SetWindowText(m_hwnd, szTemp); + if (m_pContainer->hwndActive == m_hwnd) { + m_pContainer->UpdateTitle(0, this); + SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0); + } +} + +///////////////////////////////////////////////////////////////////////////////////////// + INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) { if (m_si == nullptr && (uMsg == WM_ACTIVATE || uMsg == WM_SETFOCUS)) @@ -1996,66 +2058,6 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) SendMessage(m_hwnd, GC_REDRAWLOG2, 0, 0); break; - case DM_UPDATETITLE: - case GC_UPDATETITLE: - m_wStatus = m_si->wStatus; - { - const wchar_t *szNick = m_cache->getNick(); - if (mir_wstrlen(szNick) > 0) { - if (M.GetByte("cuttitle", 0)) - CutContactName(szNick, m_wszTitle, _countof(m_wszTitle)); - else - wcsncpy_s(m_wszTitle, szNick, _TRUNCATE); - } - - wchar_t szTemp[100]; - HICON hIcon = 0; - - switch (m_si->iType) { - case GCW_CHATROOM: - hIcon = Skin_LoadProtoIcon(m_si->pszModule, (m_wStatus <= ID_STATUS_OFFLINE) ? ID_STATUS_OFFLINE : m_wStatus); - mir_snwprintf(szTemp, - (m_si->nUsersInNicklist == 1) ? TranslateT("%s: chat room (%u user%s)") : TranslateT("%s: chat room (%u users%s)"), - szNick, m_si->nUsersInNicklist, m_bFilterEnabled ? TranslateT(", event filter active") : L""); - break; - case GCW_PRIVMESS: - hIcon = Skin_LoadProtoIcon(m_si->pszModule, (m_wStatus <= ID_STATUS_OFFLINE) ? ID_STATUS_OFFLINE : m_wStatus); - if (m_si->nUsersInNicklist == 1) - mir_snwprintf(szTemp, TranslateT("%s: message session"), szNick); - else - mir_snwprintf(szTemp, TranslateT("%s: message session (%u users)"), szNick, m_si->nUsersInNicklist); - break; - case GCW_SERVER: - mir_snwprintf(szTemp, L"%s: Server", szNick); - hIcon = LoadIconEx("window"); - break; - } - - if (m_pWnd) { - m_pWnd->updateTitle(m_wszTitle); - m_pWnd->updateIcon(hIcon); - } - m_hTabStatusIcon = hIcon; - - if (lParam) - m_hTabIcon = m_hTabStatusIcon; - - if (m_cache->getStatus() != m_cache->getOldStatus()) { - wcsncpy_s(m_wszStatus, pcli->pfnGetStatusModeDescription(m_wStatus, 0), _TRUNCATE); - - TCITEM item = {}; - item.mask = TCIF_TEXT; - item.pszText = m_wszTitle; - TabCtrl_SetItem(m_hwndParent, m_iTabID, &item); - } - SetWindowText(m_hwnd, szTemp); - if (m_pContainer->hwndActive == m_hwnd) { - SendMessage(m_pContainer->hwnd, DM_UPDATETITLE, (WPARAM)m_hwnd, 1); - SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0); - } - } - break; - case GC_UPDATESTATUSBAR: if (m_pContainer->hwndActive != m_hwnd || m_pContainer->hwndStatus == 0 || CMimAPI::m_shutDown || m_wszStatusBar[0]) break; @@ -2342,7 +2344,8 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) int i = m_list.SendMsg(LB_GETTOPINDEX, 0, 0); m_list.SendMsg(LB_SETCOUNT, m_si->nUsersInNicklist, 0); m_list.SendMsg(LB_SETTOPINDEX, i, 0); - SendMessage(m_hwnd, GC_UPDATETITLE, 0, 0); + UpdateTitle(); + m_hTabIcon = m_hTabStatusIcon; } break; diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index fcbd5be40f..4f33d16414 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -41,6 +41,45 @@ static TContainerData* TSAPI RemoveContainerFromList(TContainerData*); static bool fForceOverlayIcons = false;
+void TContainerData::UpdateTitle(MCONTACT hContact, CTabBaseDlg *pDlg)
+{
+ if (pDlg) { // lParam != 0 means sent by a chat window
+ wchar_t szText[512];
+ GetWindowText(pDlg->GetHwnd(), szText, _countof(szText));
+ szText[_countof(szText) - 1] = 0;
+ SetWindowText(hwnd, szText);
+ SendMessage(hwnd, DM_SETICON, (WPARAM)pDlg, (LPARAM)(pDlg->m_hTabIcon != pDlg->m_hTabStatusIcon ? pDlg->m_hTabIcon : pDlg->m_hTabStatusIcon));
+ return;
+ }
+
+ CTabBaseDlg *dat = nullptr;
+ if (hContact == 0) { // no hContact given - obtain the hContact for the active tab
+ if (hwndActive && IsWindow(hwndActive))
+ SendMessage(hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
+ else
+ return;
+ dat = (CTabBaseDlg*)GetWindowLongPtr(hwndActive, GWLP_USERDATA);
+ }
+ else {
+ HWND hwnd = M.FindWindow(hContact);
+ if (hwnd == nullptr) {
+ SESSION_INFO *si = SM_FindSessionByHCONTACT(hContact);
+ if (si) {
+ si->pDlg->UpdateTitle();
+ return;
+ }
+ }
+ if (hwnd && hContact)
+ dat = (CTabBaseDlg*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ }
+ if (dat) {
+ SendMessage(hwnd, DM_SETICON, (WPARAM)dat, (LPARAM)(dat->m_hXStatusIcon ? dat->m_hXStatusIcon : dat->m_hTabStatusIcon));
+ CMStringW szTitle;
+ if (Utils::FormatTitleBar(dat, settings->szTitleFormat, szTitle))
+ SetWindowText(hwnd, szTitle);
+ }
+}
+
// Windows Vista+
// extend the glassy area to get aero look for the status bar, tab bar, info panel
// and outer margins.
@@ -1183,48 +1222,6 @@ panel_found: }
return 0;
- case DM_UPDATETITLE:
- hContact = 0;
- dat = nullptr;
-
- if (lParam) { // lParam != 0 means sent by a chat window
- wchar_t szText[512];
- dat = (CTabBaseDlg*)GetWindowLongPtr((HWND)wParam, GWLP_USERDATA);
- GetWindowText((HWND)wParam, szText, _countof(szText));
- szText[_countof(szText) - 1] = 0;
- SetWindowText(hwndDlg, szText);
- if (dat)
- SendMessage(hwndDlg, DM_SETICON, (WPARAM)dat, (LPARAM)(dat->m_hTabIcon != dat->m_hTabStatusIcon ? dat->m_hTabIcon : dat->m_hTabStatusIcon));
- return 0;
- }
- if (wParam == 0) { // no hContact given - obtain the hContact for the active tab
- if (pContainer->hwndActive && IsWindow(pContainer->hwndActive))
- SendMessage(pContainer->hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
- else
- break;
- dat = (CTabBaseDlg*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
- }
- else {
- HWND hwnd = M.FindWindow(wParam);
- if (hwnd == 0) {
- SESSION_INFO *si = SM_FindSessionByHCONTACT(wParam);
- if (si) {
- SendMessage(si->pDlg->GetHwnd(), GC_UPDATETITLE, 0, 0);
- return 0;
- }
- }
- hContact = wParam;
- if (hwnd && hContact)
- dat = (CTabBaseDlg*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- }
- if (dat) {
- SendMessage(hwndDlg, DM_SETICON, (WPARAM)dat, (LPARAM)(dat->m_hXStatusIcon ? dat->m_hXStatusIcon : dat->m_hTabStatusIcon));
- CMStringW szTitle;
- if (Utils::FormatTitleBar(dat, pContainer->settings->szTitleFormat, szTitle))
- SetWindowText(hwndDlg, szTitle);
- }
- return 0;
-
case WM_TIMER:
if (wParam == TIMERID_HEARTBEAT) {
if (GetForegroundWindow() != hwndDlg && (pContainer->settings->autoCloseSeconds > 0) && !pContainer->fHidden) {
@@ -1392,7 +1389,7 @@ panel_found: hContact = 0;
SendMessage(pContainer->hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
if (hContact)
- SendMessage(hwndDlg, DM_UPDATETITLE, hContact, 0);
+ pContainer->UpdateTitle(hContact);
}
}
memset(&item, 0, sizeof(item));
@@ -1619,7 +1616,7 @@ panel_found: hContact = 0;
SendMessage(pContainer->hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
if (hContact)
- SendMessage(hwndDlg, DM_UPDATETITLE, hContact, 0);
+ pContainer->UpdateTitle(hContact);
}
SendMessage(hwndDlg, WM_SIZE, 0, 1);
BroadCastContainer(pContainer, DM_CONFIGURETOOLBAR, 0, 1);
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 88cc78091c..40bcd17ce3 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -1080,9 +1080,9 @@ void CTabBaseDlg::DM_Typing(bool fForceOff) HandleIconFeedback(this, (HICON)-1); CTabBaseDlg *dat_active = (CTabBaseDlg*)GetWindowLongPtr(m_pContainer->hwndActive, GWLP_USERDATA); if (dat_active && !dat_active->isChat()) - SendMessage(hwndContainer, DM_UPDATETITLE, 0, 0); + m_pContainer->UpdateTitle(0); else - SendMessage(hwndContainer, DM_UPDATETITLE, (WPARAM)m_pContainer->hwndActive, 1); + m_pContainer->UpdateTitle(0, dat_active); if (!(m_pContainer->dwFlags & CNT_NOFLASH) && PluginConfig.m_FlashOnMTN) ReflashContainer(m_pContainer); } @@ -1302,7 +1302,7 @@ void CTabBaseDlg::DM_EventAdded(WPARAM hContact, LPARAM lParam) TabCtrl_SetCurSel(m_hwndParent, iItem); ShowWindow(m_pContainer->hwndActive, SW_HIDE); m_pContainer->hwndActive = m_hwnd; - SendMessage(m_pContainer->hwnd, DM_UPDATETITLE, m_hContact, 0); + m_pContainer->UpdateTitle(m_hContact); m_pContainer->dwFlags |= CNT_DEFERREDTABSELECT; } } @@ -1365,105 +1365,6 @@ void CTabBaseDlg::DM_HandleAutoSizeRequest(REQRESIZE* rr) DM_ScrollToBottom(1, 0); } -void CTabBaseDlg::DM_UpdateTitle(WPARAM, LPARAM lParam) -{ - DWORD dwOldIdle = m_idle; - const char *szActProto = 0; - - m_wszStatus[0] = 0; - - if (m_iTabID == -1) - return; - - TCITEM item = {}; - - wchar_t newtitle[128]; - if (m_hContact) { - const wchar_t *szNick = m_cache->getNick(); - - if (m_szProto) { - szActProto = m_cache->getProto(); - - bool bHasName = (m_cache->getUIN()[0] != 0); - m_idle = m_cache->getIdleTS(); - m_dwFlagsEx = m_idle ? m_dwFlagsEx | MWF_SHOW_ISIDLE : m_dwFlagsEx & ~MWF_SHOW_ISIDLE; - - m_wStatus = m_cache->getStatus(); - wcsncpy_s(m_wszStatus, pcli->pfnGetStatusModeDescription(m_szProto == nullptr ? ID_STATUS_OFFLINE : m_wStatus, 0), _TRUNCATE); - - if (lParam != 0) { - wchar_t newcontactname[128]; newcontactname[0] = 0; - if (PluginConfig.m_bCutContactNameOnTabs) - CutContactName(szNick, newcontactname, _countof(newcontactname)); - else - wcsncpy_s(newcontactname, szNick, _TRUNCATE); - - Utils::DoubleAmpersands(newcontactname, _countof(newcontactname)); - - if (newcontactname[0] != 0) { - if (PluginConfig.m_bStatusOnTabs) - mir_snwprintf(newtitle, L"%s (%s)", newcontactname, m_wszStatus); - else - wcsncpy_s(newtitle, newcontactname, _TRUNCATE); - } - else wcsncpy_s(newtitle, L"Forward", _TRUNCATE); - - item.mask |= TCIF_TEXT; - } - SendMessage(m_hwnd, DM_UPDATEWINICON, 0, 0); - - wchar_t fulluin[256]; - if (m_bIsMeta) - mir_snwprintf(fulluin, - TranslateT("UID: %s (SHIFT click -> copy to clipboard)\nClick for user's details\nRight click for metacontact control\nClick dropdown to add or remove user from your favorites."), - bHasName ? m_cache->getUIN() : TranslateT("No UID")); - else - mir_snwprintf(fulluin, - TranslateT("UID: %s (SHIFT click -> copy to clipboard)\nClick for user's details\nClick dropdown to change this contact's favorite status."), - bHasName ? m_cache->getUIN() : TranslateT("No UID")); - - SendDlgItemMessage(m_hwnd, IDC_NAME, BUTTONADDTOOLTIP, (WPARAM)fulluin, BATF_UNICODE); - } - } - else wcsncpy_s(newtitle, L"Message Session", _TRUNCATE); - - if (m_idle != dwOldIdle || lParam != 0) { - if (item.mask & TCIF_TEXT) { - item.pszText = m_wszTitle; - wcsncpy_s(m_wszTitle, newtitle, _TRUNCATE); - if (m_pWnd) - m_pWnd->updateTitle(m_cache->getNick()); - } - if (m_iTabID >= 0) { - TabCtrl_SetItem(m_hwndParent, m_iTabID, &item); - if (m_pContainer->dwFlags & CNT_SIDEBAR) - m_pContainer->SideBar->updateSession(this); - } - if (m_pContainer->hwndActive == m_hwnd && lParam) - SendMessage(m_pContainer->hwnd, DM_UPDATETITLE, m_hContact, 0); - - UpdateTrayMenuState(this, TRUE); - if (m_cache->isFavorite()) - AddContactToFavorites(m_hContact, m_cache->getNick(), szActProto, m_wszStatus, m_wStatus, - Skin_LoadProtoIcon(m_cache->getProto(), m_cache->getStatus()), 0, PluginConfig.g_hMenuFavorites); - - if (m_cache->isRecent()) - AddContactToFavorites(m_hContact, m_cache->getNick(), szActProto, m_wszStatus, m_wStatus, - Skin_LoadProtoIcon(m_cache->getProto(), m_cache->getStatus()), 0, PluginConfig.g_hMenuRecent); - - m_pPanel.Invalidate(); - if (m_pWnd) - m_pWnd->Invalidate(); - } - - // care about MetaContacts and update the statusbar icon with the currently "most online" contact... - if (m_bIsMeta) { - PostMessage(m_hwnd, DM_OWNNICKCHANGED, 0, 0); - if (m_pContainer->dwFlags & CNT_UINSTATUSBAR) - DM_UpdateLastMessage(); - } -} - ///////////////////////////////////////////////////////////////////////////////////////// // status icon stuff (by sje, used for indicating encryption status in the status bar // this is now part of the message window api diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index f7be82207b..3634081ff7 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -405,7 +405,7 @@ int CGlobals::DBSettingChanged(WPARAM hContact, LPARAM lParam) if (!strcmp(setting, "MirVer"))
PostMessage(hwnd, DM_CLIENTCHANGED, 0, 0);
if (fChanged || fExtendedStatusChange)
- PostMessage(hwnd, DM_UPDATETITLE, 0, 1);
+ c->getDat()->UpdateTitle();
if (fExtendedStatusChange)
PostMessage(hwnd, DM_UPDATESTATUSMSG, 0, 0);
if (fChanged) {
@@ -449,7 +449,7 @@ int CGlobals::MetaContactEvent(WPARAM hContact, LPARAM) c->updateMeta();
CTabBaseDlg *pDlg = c->getDat();
if (pDlg) {
- ::PostMessage(pDlg->GetHwnd(), DM_UPDATETITLE, 0, 1);
+ pDlg->UpdateTitle();
::PostMessage(pDlg->GetHwnd(), DM_UPDATEPICLAYOUT, 0, 0);
InvalidateRect(pDlg->GetHwnd(), 0, TRUE); // force redraw
}
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index dde75b1e75..9968b46906 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -310,7 +310,7 @@ void CSrmmWindow::MsgWindowUpdateState(UINT msg) }
m_pContainer->hIconTaskbarOverlay = 0;
- SendMessage(m_pContainer->hwnd, DM_UPDATETITLE, m_hContact, 0);
+ m_pContainer->UpdateTitle(m_hContact);
UpdateStatusBar();
m_dwLastActivity = GetTickCount();
@@ -420,7 +420,7 @@ void TSAPI SetDialogToType(HWND hwndDlg) Utils::showDlgControl(hwndDlg, IDC_MULTISPLITTER, (dat->m_sendMode & SMODE_MULTIPLE) ? SW_SHOW : SW_HIDE);
dat->EnableSendButton(GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE)) != 0);
- SendMessage(hwndDlg, DM_UPDATETITLE, 0, 1);
+ dat->UpdateTitle();
SendMessage(hwndDlg, WM_SIZE, 0, 0);
Utils::enableDlgControl(hwndDlg, IDC_CONTACTPIC, false);
@@ -1207,7 +1207,7 @@ void CSrmmWindow::OnInitDialog() m_pContainer->hwndActive = m_hwnd;
m_pContainer->dwFlags |= CNT_DEFERREDCONFIGURE;
}
- PostMessage(m_pContainer->hwnd, DM_UPDATETITLE, m_hContact, 0);
+ m_pContainer->UpdateTitle(m_hContact);
DM_RecalcPictureSize();
m_dwLastActivity = GetTickCount() - 1000;
@@ -1335,6 +1335,106 @@ void CSrmmWindow::ReplayQueue() TranslateT("Auto scrolling is disabled (press F12 to enable it)"));
}
+void CSrmmWindow::UpdateTitle()
+{
+ DWORD dwOldIdle = m_idle;
+ const char *szActProto = 0;
+
+ m_wszStatus[0] = 0;
+
+ if (m_iTabID == -1)
+ return;
+
+ TCITEM item = {};
+
+ bool bChanged = false;
+ wchar_t newtitle[128];
+ if (m_hContact) {
+ if (m_szProto) {
+ szActProto = m_cache->getProto();
+
+ bool bHasName = (m_cache->getUIN()[0] != 0);
+ m_idle = m_cache->getIdleTS();
+ m_dwFlagsEx = m_idle ? m_dwFlagsEx | MWF_SHOW_ISIDLE : m_dwFlagsEx & ~MWF_SHOW_ISIDLE;
+
+ m_wStatus = m_cache->getStatus();
+ wcsncpy_s(m_wszStatus, pcli->pfnGetStatusModeDescription(m_szProto == nullptr ? ID_STATUS_OFFLINE : m_wStatus, 0), _TRUNCATE);
+
+ wchar_t newcontactname[128]; newcontactname[0] = 0;
+ if (PluginConfig.m_bCutContactNameOnTabs)
+ CutContactName(m_cache->getNick(), newcontactname, _countof(newcontactname));
+ else
+ wcsncpy_s(newcontactname, m_cache->getNick(), _TRUNCATE);
+
+ Utils::DoubleAmpersands(newcontactname, _countof(newcontactname));
+
+ if (newcontactname[0] != 0) {
+ if (PluginConfig.m_bStatusOnTabs)
+ mir_snwprintf(newtitle, L"%s (%s)", newcontactname, m_wszStatus);
+ else
+ wcsncpy_s(newtitle, newcontactname, _TRUNCATE);
+ }
+ else wcsncpy_s(newtitle, L"Forward", _TRUNCATE);
+
+ if (mir_wstrcmp(newtitle, m_wszTitle)) {
+ bChanged = true;
+ item.mask |= TCIF_TEXT;
+ }
+
+ SendMessage(m_hwnd, DM_UPDATEWINICON, 0, 0);
+
+ wchar_t fulluin[256];
+ if (m_bIsMeta)
+ mir_snwprintf(fulluin,
+ TranslateT("UID: %s (SHIFT click -> copy to clipboard)\nClick for user's details\nRight click for metacontact control\nClick dropdown to add or remove user from your favorites."),
+ bHasName ? m_cache->getUIN() : TranslateT("No UID"));
+ else
+ mir_snwprintf(fulluin,
+ TranslateT("UID: %s (SHIFT click -> copy to clipboard)\nClick for user's details\nClick dropdown to change this contact's favorite status."),
+ bHasName ? m_cache->getUIN() : TranslateT("No UID"));
+
+ SendDlgItemMessage(m_hwnd, IDC_NAME, BUTTONADDTOOLTIP, (WPARAM)fulluin, BATF_UNICODE);
+ }
+ }
+ else wcsncpy_s(newtitle, L"Message Session", _TRUNCATE);
+
+ if (m_idle != dwOldIdle || bChanged) {
+ if (bChanged) {
+ item.pszText = m_wszTitle;
+ wcsncpy_s(m_wszTitle, newtitle, _TRUNCATE);
+ if (m_pWnd)
+ m_pWnd->updateTitle(m_cache->getNick());
+ }
+ if (m_iTabID >= 0) {
+ TabCtrl_SetItem(m_hwndParent, m_iTabID, &item);
+ if (m_pContainer->dwFlags & CNT_SIDEBAR)
+ m_pContainer->SideBar->updateSession(this);
+ }
+ if (m_pContainer->hwndActive == m_hwnd && bChanged)
+ m_pContainer->UpdateTitle(m_hContact);
+
+ UpdateTrayMenuState(this, TRUE);
+ if (m_cache->isFavorite())
+ AddContactToFavorites(m_hContact, m_cache->getNick(), szActProto, m_wszStatus, m_wStatus,
+ Skin_LoadProtoIcon(m_cache->getProto(), m_cache->getStatus()), 0, PluginConfig.g_hMenuFavorites);
+
+ if (m_cache->isRecent())
+ AddContactToFavorites(m_hContact, m_cache->getNick(), szActProto, m_wszStatus, m_wStatus,
+ Skin_LoadProtoIcon(m_cache->getProto(), m_cache->getStatus()), 0, PluginConfig.g_hMenuRecent);
+
+ m_pPanel.Invalidate();
+ if (m_pWnd)
+ m_pWnd->Invalidate();
+ }
+
+ // care about MetaContacts and update the statusbar icon with the currently "most online" contact...
+ if (m_bIsMeta) {
+ PostMessage(m_hwnd, DM_OWNNICKCHANGED, 0, 0);
+ if (m_pContainer->dwFlags & CNT_UINSTATUSBAR)
+ DM_UpdateLastMessage();
+ }
+}
+
void CSrmmWindow::onClick_Ok(CCtrlButton*)
{
if (m_bEditNotesActive) {
@@ -2412,10 +2512,6 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) DM_OptionsApplied(wParam, lParam);
return 0;
- case DM_UPDATETITLE:
- DM_UpdateTitle(wParam, lParam);
- return 0;
-
case DM_UPDATESTATUSMSG:
m_pPanel.Invalidate();
return 0;
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index d2b5330478..9049314a48 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -602,7 +602,7 @@ int TSAPI ActivateExistingTab(TContainerData *pContainer, HWND hwndChild) SendMessage(pContainer->hwnd, WM_NOTIFY, 0, (LPARAM)&nmhdr); // just select the tab and let WM_NOTIFY do the rest
}
if (!dat->isChat())
- SendMessage(pContainer->hwnd, DM_UPDATETITLE, dat->m_hContact, 0);
+ pContainer->UpdateTitle(dat->m_hContact);
if (IsIconic(pContainer->hwnd)) {
SendMessage(pContainer->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
SetForegroundWindow(pContainer->hwnd);
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 1b7699b447..a2777ce4aa 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -224,6 +224,8 @@ struct TContainerData CTaskbarInteract* TaskBar;
CMenuBar *MenuBar;
CSideBar *SideBar;
+
+ void UpdateTitle(MCONTACT, class CTabBaseDlg* = nullptr);
};
struct SESSION_INFO;
@@ -241,7 +243,6 @@ protected: bool DM_GenericHotkeysCheck(MSG *message);
int DM_SplitterGlobalEvent(WPARAM wParam, LPARAM lParam);
void DM_UpdateLastMessage() const;
- void DM_UpdateTitle(WPARAM wParam, LPARAM lParam);
void DetermineMinHeight();
void FindFirstEvent();
@@ -454,6 +455,7 @@ public: virtual void OnDestroy() override;
virtual int Resizer(UTILRESIZECONTROL *urc) override;
+ virtual void UpdateTitle() override;
virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
@@ -494,6 +496,7 @@ public: virtual void OnDestroy() override;
virtual int Resizer(UTILRESIZECONTROL *urc) override;
+ virtual void UpdateTitle() override;
virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
@@ -662,7 +665,6 @@ struct TIconDescW #define DM_SETINFOPANEL (TM_USER+13)
#define DM_OPTIONSAPPLIED (TM_USER+14)
#define DM_SPLITTERMOVED (TM_USER+15)
-#define DM_UPDATETITLE (TM_USER+16)
#define DM_SPLITSENDACK (TM_USER+19)
#define DM_TYPING (TM_USER+20)
#define DM_UPDATEWINICON (TM_USER+21)
|