summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Scriver/src/chat/window.cpp45
-rw-r--r--plugins/Scriver/src/msgdialog.cpp16
-rw-r--r--plugins/Scriver/src/msgs.h19
-rw-r--r--plugins/Scriver/src/utils.cpp4
-rw-r--r--plugins/Scriver/src/utils.h1
-rw-r--r--plugins/TabSRMM/src/chat/log.cpp2
-rw-r--r--plugins/TabSRMM/src/chat/window.cpp21
-rw-r--r--plugins/TabSRMM/src/infopanel.cpp4
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp33
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.cpp51
-rw-r--r--plugins/TabSRMM/src/msgs.cpp4
-rw-r--r--plugins/TabSRMM/src/msgs.h12
-rw-r--r--plugins/TabSRMM/src/tabctrl.cpp2
-rw-r--r--plugins/TabSRMM/src/taskbar.cpp103
-rw-r--r--plugins/TabSRMM/src/taskbar.h8
15 files changed, 170 insertions, 155 deletions
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp
index 982cbd02cf..3655e3c4b7 100644
--- a/plugins/Scriver/src/chat/window.cpp
+++ b/plugins/Scriver/src/chat/window.cpp
@@ -895,7 +895,7 @@ class CChatRoomDlg : public CSrmmBaseDialog
hdwp = DeferWindowPos(hdwp, GetDlgItem(m_hwnd, IDC_MESSAGE), 0, 1, h - m_si->iSplitterY + SPLITTER_HEIGHT, w - 2, m_si->iSplitterY - SPLITTER_HEIGHT - 1, SWP_NOZORDER);
EndDeferWindowPos(hdwp);
- SetButtonsPos(m_hwnd, m_si->hContact, bToolbar);
+ SetButtonsPos(m_hwnd, m_hContact, bToolbar);
if (m_si->m_hwndIeview != NULL) {
IEVIEWWINDOW ieWindow;
@@ -926,11 +926,12 @@ public:
m_pLog = &m_log;
m_pEntry = &m_message;
m_autoClose = 0;
+ m_hContact = si->hContact;
}
virtual void OnInitDialog() override
{
- NotifyLocalWinEvent(m_si->hContact, m_hwnd, MSG_WINDOW_EVT_OPENING);
+ NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPENING);
SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LONG_PTR)m_si);
@@ -975,7 +976,7 @@ public:
IEVIEWEVENT iee = { sizeof(iee) };
iee.iType = IEE_CLEAR_LOG;
iee.hwnd = m_si->m_hwndIeview;
- iee.hContact = m_si->hContact;
+ iee.hContact = m_hContact;
iee.pszProto = m_si->pszModule;
CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&iee);
}
@@ -986,14 +987,14 @@ public:
SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0);
SendMessage(m_hwnd, DM_UPDATETITLEBAR, 0, 0);
- SendMessage(m_hwndParent, CM_ADDCHILD, (WPARAM)m_hwnd, m_si->hContact);
+ SendMessage(m_hwndParent, CM_ADDCHILD, (WPARAM)m_hwnd, m_hContact);
PostMessage(m_hwnd, GC_UPDATENICKLIST, 0, 0);
- NotifyLocalWinEvent(m_si->hContact, m_hwnd, MSG_WINDOW_EVT_OPEN);
+ NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPEN);
}
virtual void OnDestroy() override
{
- NotifyLocalWinEvent(m_si->hContact, m_hwnd, MSG_WINDOW_EVT_CLOSING);
+ NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSING);
m_si->hWnd = NULL;
SetWindowLongPtr(m_hwnd, GWLP_USERDATA, 0);
@@ -1007,7 +1008,7 @@ public:
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
}
- NotifyLocalWinEvent(m_si->hContact, m_hwnd, MSG_WINDOW_EVT_CLOSE);
+ NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSE);
}
virtual INT_PTR DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) override
@@ -1115,7 +1116,7 @@ public:
StatusIconData sid = { sizeof(sid) };
sid.szModule = SRMMMOD;
- Srmm_ModifyIcon(m_si->hContact, &sid);
+ Srmm_ModifyIcon(m_hContact, &sid);
}
break;
@@ -1213,14 +1214,14 @@ public:
case DM_ACTIVATE:
if (m_si->wState & STATE_TALK) {
m_si->wState &= ~STATE_TALK;
- db_set_w(m_si->hContact, m_si->pszModule, "ApparentMode", 0);
+ db_set_w(m_hContact, m_si->pszModule, "ApparentMode", 0);
}
if (m_si->wState & GC_EVENT_HIGHLIGHT) {
m_si->wState &= ~GC_EVENT_HIGHLIGHT;
- if (pcli->pfnGetEvent(m_si->hContact, 0))
- pcli->pfnRemoveEvent(m_si->hContact, GC_FAKE_EVENT);
+ if (pcli->pfnGetEvent(m_hContact, 0))
+ pcli->pfnRemoveEvent(m_hContact, GC_FAKE_EVENT);
}
SendMessage(m_hwnd, GC_FIXTABICONS, 0, 0);
@@ -1342,10 +1343,10 @@ public:
return TRUE;
case SESSION_TERMINATE:
- if (pcli->pfnGetEvent(m_si->hContact, 0))
- pcli->pfnRemoveEvent(m_si->hContact, GC_FAKE_EVENT);
+ if (pcli->pfnGetEvent(m_hContact, 0))
+ pcli->pfnRemoveEvent(m_hContact, GC_FAKE_EVENT);
m_si->wState &= ~STATE_TALK;
- db_set_w(m_si->hContact, m_si->pszModule, "ApparentMode", 0);
+ db_set_w(m_hContact, m_si->pszModule, "ApparentMode", 0);
SendMessage(m_hwnd, GC_CLOSEWINDOW, 0, 0);
return TRUE;
@@ -1461,10 +1462,10 @@ public:
pci->SetActiveSession(m_si->ptszID, m_si->pszModule);
- if (db_get_w(m_si->hContact, m_si->pszModule, "ApparentMode", 0) != 0)
- db_set_w(m_si->hContact, m_si->pszModule, "ApparentMode", 0);
- if (pcli->pfnGetEvent(m_si->hContact, 0))
- pcli->pfnRemoveEvent(m_si->hContact, GC_FAKE_EVENT);
+ if (db_get_w(m_hContact, m_si->pszModule, "ApparentMode", 0) != 0)
+ db_set_w(m_hContact, m_si->pszModule, "ApparentMode", 0);
+ if (pcli->pfnGetEvent(m_hContact, 0))
+ pcli->pfnRemoveEvent(m_hContact, GC_FAKE_EVENT);
break;
case WM_NOTIFY:
@@ -1518,12 +1519,12 @@ public:
break;
case WM_COMMAND:
- if (!lParam && Clist_MenuProcessCommand(LOWORD(wParam), MPCF_CONTACTMENU, m_si->hContact))
+ if (!lParam && Clist_MenuProcessCommand(LOWORD(wParam), MPCF_CONTACTMENU, m_hContact))
break;
if (HIWORD(wParam) == BN_CLICKED)
if (LOWORD(wParam) >= MIN_CBUTTONID && LOWORD(wParam) <= MAX_CBUTTONID) {
- Srmm_ClickToolbarIcon(m_si->hContact, LOWORD(wParam), GetDlgItem(m_hwnd, LOWORD(wParam)), 0);
+ Srmm_ClickToolbarIcon(m_hContact, LOWORD(wParam), GetDlgItem(m_hwnd, LOWORD(wParam)), 0);
break;
}
@@ -1771,12 +1772,12 @@ public:
return TRUE;
case DM_GETCONTEXTMENU:
- SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, (LPARAM)Menu_BuildContactMenu(m_si->hContact));
+ SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, (LPARAM)Menu_BuildContactMenu(m_hContact));
return TRUE;
case WM_CONTEXTMENU:
if (m_hwndParent == (HWND)wParam) {
- HMENU hMenu = Menu_BuildContactMenu(m_si->hContact);
+ HMENU hMenu = Menu_BuildContactMenu(m_hContact);
GetCursorPos(&pt);
TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, m_hwnd, NULL);
DestroyMenu(hMenu);
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp
index 0d6440c9eb..0b8fb28a86 100644
--- a/plugins/Scriver/src/msgdialog.cpp
+++ b/plugins/Scriver/src/msgdialog.cpp
@@ -30,11 +30,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern HCURSOR hCurSplitNS, hCurSplitWE, hCurHyperlinkHand, hDragCursor;
extern HANDLE hHookWinEvt;
-static wchar_t* GetIEViewSelection(CSrmmWindow *dat)
+wchar_t* CSrmmWindow::GetIEViewSelection()
{
IEVIEWEVENT evt = { sizeof(evt) };
- evt.hwnd = dat->m_hwndIeview;
- evt.hContact = dat->m_hContact;
+ evt.hwnd = m_hwndIeview;
+ evt.hContact = m_hContact;
evt.iType = IEE_GET_SELECTION;
return mir_wstrdup((wchar_t*)CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&evt));
}
@@ -636,11 +636,11 @@ CSrmmWindow::CSrmmWindow(MCONTACT hContact, bool bIncoming, const char *szInitia
: CSrmmBaseDialog(g_hInst, IDD_MSG),
m_log(this, IDC_LOG),
m_message(this, IDC_MESSAGE),
- m_bIncoming(bIncoming),
- m_hContact(hContact)
+ m_bIncoming(bIncoming)
{
m_pLog = &m_log;
m_pEntry = &m_message;
+ m_hContact = hContact;
m_hwndParent = GetParentWindow(hContact, FALSE);
m_wszInitialText = (bIsUnicode) ? mir_wstrdup((wchar_t*)szInitialText) : mir_a2u(szInitialText);
@@ -998,7 +998,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
if (m_hContact && m_szProto) {
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam;
char idbuf[128], buf[128];
- GetContactUniqueId(this, idbuf, sizeof(idbuf));
+ GetContactUniqueId(idbuf, sizeof(idbuf));
mir_snprintf(buf, Translate("User menu - %s"), idbuf);
SendDlgItemMessage(m_hwnd, IDC_USERMENU, BUTTONADDTOOLTIP, (WPARAM)buf, 0);
@@ -1083,7 +1083,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
case DM_USERNAMETOCLIP:
if (m_hContact) {
char buf[128];
- GetContactUniqueId(this, buf, sizeof(buf));
+ GetContactUniqueId(buf, sizeof(buf));
if (!OpenClipboard(m_hwnd) || !mir_strlen(buf))
break;
@@ -1626,7 +1626,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
wchar_t *buffer = NULL;
if (m_hwndIeview != NULL)
- buffer = GetIEViewSelection(this);
+ buffer = GetIEViewSelection();
else
buffer = GetRichEditSelection(GetDlgItem(m_hwnd, IDC_LOG));
diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h
index a2873ce784..3374631830 100644
--- a/plugins/Scriver/src/msgs.h
+++ b/plugins/Scriver/src/msgs.h
@@ -122,21 +122,22 @@ class CSrmmWindow : public CSrmmBaseDialog, public MZeroedObject, public CommonW
InfobarWindowData *m_pInfobarData;
- HICON GetTabIcon();
- void GetTitlebarIcon(struct TitleBarData *tbd);
- void MessageDialogResize(int w, int h);
- void ShowAvatar();
- void SetDialogToType();
- void SetStatusIcon();
- void StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend);
- void UpdateReadChars();
+ void GetContactUniqueId(char *buf, int maxlen);
+ wchar_t* GetIEViewSelection();
+ HICON GetTabIcon();
+ void GetTitlebarIcon(struct TitleBarData *tbd);
+ void MessageDialogResize(int w, int h);
+ void ShowAvatar();
+ void SetDialogToType();
+ void SetStatusIcon();
+ void StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend);
+ void UpdateReadChars();
bool IsTypingNotificationEnabled();
bool IsTypingNotificationSupported();
void NotifyTyping(int mode);
public:
- MCONTACT m_hContact;
char *m_szProto;
time_t m_startTime, m_lastEventTime;
int m_lastEventType;
diff --git a/plugins/Scriver/src/utils.cpp b/plugins/Scriver/src/utils.cpp
index a615d5dd5b..c68c1518f6 100644
--- a/plugins/Scriver/src/utils.cpp
+++ b/plugins/Scriver/src/utils.cpp
@@ -385,9 +385,9 @@ void SetSearchEngineIcons(HMENU hMenu, HIMAGELIST hImageList)
}
}
-void GetContactUniqueId(CSrmmWindow *dat, char *buf, int maxlen)
+void CSrmmWindow::GetContactUniqueId(char *buf, int maxlen)
{
- ptrW id(Contact_GetInfo(CNF_UNIQUEID, dat->m_hContact, dat->m_szProto));
+ ptrW id(Contact_GetInfo(CNF_UNIQUEID, m_hContact, m_szProto));
if (id != NULL)
strncpy_s(buf, maxlen, _T2A(id), _TRUNCATE);
}
diff --git a/plugins/Scriver/src/utils.h b/plugins/Scriver/src/utils.h
index 051de4800d..bf01163431 100644
--- a/plugins/Scriver/src/utils.h
+++ b/plugins/Scriver/src/utils.h
@@ -48,7 +48,6 @@ void AppendToBuffer(char *&buffer, size_t &cbBufferEnd, size_t &cbBufferAlloced,
int MeasureMenuItem(WPARAM wParam, LPARAM lParam);
int DrawMenuItem(WPARAM wParam, LPARAM lParam);
void SetSearchEngineIcons(HMENU hMenu, HIMAGELIST hImageList);
-void GetContactUniqueId(class CSrmmWindow *dat, char *buf, int maxlen);
HWND CreateToolTip(HWND hwndParent, LPTSTR ptszText, LPTSTR ptszTitle, RECT *rect);
void SetToolTipText(HWND hwndParent, HWND hwndTT, LPTSTR ptszText, LPTSTR ptszTitle);
void SetToolTipRect(HWND hwndParent, HWND hwndTT, RECT* rect);
diff --git a/plugins/TabSRMM/src/chat/log.cpp b/plugins/TabSRMM/src/chat/log.cpp
index 16ee04bc07..5981eb3557 100644
--- a/plugins/TabSRMM/src/chat/log.cpp
+++ b/plugins/TabSRMM/src/chat/log.cpp
@@ -857,7 +857,7 @@ static DWORD CALLBACK Log_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG
return 0;
}
-void CChatRoomDlg::StreamInEvents(LOGINFO* lin, SESSION_INFO *si, bool bRedraw)
+void CChatRoomDlg::StreamInEvents(LOGINFO *lin, SESSION_INFO *si, bool bRedraw)
{
CHARRANGE oldsel, sel, newsel;
POINT point = { 0 };
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp
index 17c40a43a6..89b5c71d12 100644
--- a/plugins/TabSRMM/src/chat/window.cpp
+++ b/plugins/TabSRMM/src/chat/window.cpp
@@ -1542,6 +1542,27 @@ CChatRoomDlg::CChatRoomDlg(TNewWindowData *pData)
m_Panel = new CInfoPanel(this);
}
+CThumbBase* CChatRoomDlg::CreateThumb(CProxyWindow *pProxy) const
+{
+ return new CThumbMUC(pProxy, si);
+}
+
+void CChatRoomDlg::ClearLog()
+{
+ SESSION_INFO *s = pci->SM_FindSession(si->ptszID, si->pszModule);
+ if (s) {
+ m_log.SetText(L"");
+ pci->LM_RemoveAll(&s->pLog, &s->pLogEnd);
+ s->iEventCount = 0;
+ s->LastTime = 0;
+ si->iEventCount = 0;
+ si->LastTime = 0;
+ si->pLog = s->pLog;
+ si->pLogEnd = s->pLogEnd;
+ PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
+ }
+}
+
void CChatRoomDlg::OnInitDialog()
{
SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LONG_PTR)this);
diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp
index bba1ddffdd..a24101d889 100644
--- a/plugins/TabSRMM/src/infopanel.cpp
+++ b/plugins/TabSRMM/src/infopanel.cpp
@@ -598,8 +598,8 @@ void CInfoPanel::RenderIPStatus(const HDC hdc, RECT& rcItem)
void CInfoPanel::Chat_RenderIPNickname(const HDC hdc, RECT& rcItem)
{
- SESSION_INFO *si = reinterpret_cast<SESSION_INFO*>(m_dat->si);
- if (si == 0)
+ SESSION_INFO *si = m_dat->si;
+ if (si == nullptr)
return;
::SetBkMode(hdc, TRANSPARENT);
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index d899201b24..acaa4fe9a8 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -80,7 +80,7 @@ static void _clrMsgFilter(LPARAM lParam)
// @param hwndFrom src window handle
// @param pt mouse pointer position
-static void ShowPopupMenu(CSrmmWindow *dat, int idFrom, HWND hwndFrom, POINT pt)
+static void ShowPopupMenu(CTabBaseDlg *dat, int idFrom, HWND hwndFrom, POINT pt)
{
CHARRANGE sel, all = { 0, -1 };
HWND hwndDlg = dat->GetHwnd();
@@ -915,9 +915,8 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
dat->m_dynaSplitter = dat->m_savedDynaSplit;
dat->DM_RecalcPictureSize();
if (dat->m_bType == SESSIONTYPE_CHAT) {
- SESSION_INFO *si = dat->si;
- si->iSplitterY = dat->m_savedSplitY;
- dat->m_splitterY = si->iSplitterY + DPISCALEY_S(22);
+ dat->si->iSplitterY = dat->m_savedSplitY;
+ dat->m_splitterY = dat->si->iSplitterY + DPISCALEY_S(22);
}
dat->UpdateToolbarBG();
SendMessage(hwndParent, WM_SIZE, 0, 0);
@@ -944,6 +943,32 @@ CSrmmWindow::CSrmmWindow(TNewWindowData *pNewData)
m_Panel = new CInfoPanel(this);
}
+void CSrmmWindow::ClearLog()
+{
+ if (m_hwndIEView || m_hwndHPP) {
+ IEVIEWEVENT event;
+ event.cbSize = sizeof(IEVIEWEVENT);
+ event.iType = IEE_CLEAR_LOG;
+ event.dwFlags = (m_dwFlags & MWF_LOG_RTL) ? IEEF_RTL : 0;
+ event.hContact = m_hContact;
+ if (m_hwndIEView) {
+ event.hwnd = m_hwndIEView;
+ CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&event);
+ }
+ else {
+ event.hwnd = m_hwndHPP;
+ CallService(MS_HPP_EG_EVENT, 0, (LPARAM)&event);
+ }
+ }
+ m_log.SetText(L"");
+ m_hDbEventFirst = 0;
+}
+
+CThumbBase* CSrmmWindow::CreateThumb(CProxyWindow *pProxy) const
+{
+ return new CThumbIM(pProxy);
+}
+
void CSrmmWindow::OnInitDialog()
{
m_pContainer = newData->pContainer;
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp
index df8a2536e2..40224c9339 100644
--- a/plugins/TabSRMM/src/msgdlgutils.cpp
+++ b/plugins/TabSRMM/src/msgdlgutils.cpp
@@ -325,12 +325,10 @@ int CTabBaseDlg::MsgWindowMenuHandler(int selection, int menuId)
db_unset(m_hContact, SRMSGMOD_T, "tabindex");
break;
case ID_TABMENU_LEAVECHATROOM:
- if (m_bType == SESSIONTYPE_CHAT) {
- if (si != NULL && m_hContact != NULL) {
- char *szProto = GetContactProto(m_hContact);
- if (szProto)
- CallProtoService(szProto, PS_LEAVECHAT, m_hContact, 0);
- }
+ if (m_bType == SESSIONTYPE_CHAT && m_hContact != NULL) {
+ char *szProto = GetContactProto(m_hContact);
+ if (szProto)
+ CallProtoService(szProto, PS_LEAVECHAT, m_hContact, 0);
}
return 1;
@@ -1705,47 +1703,6 @@ void CTabBaseDlg::KbdState(bool &isShift, bool &isControl, bool &isAlt)
}
/////////////////////////////////////////////////////////////////////////////////////////
-// clear the message log
-// code needs to distuingish between IM and MUC sessions.
-
-void CTabBaseDlg::ClearLog()
-{
- if (m_bType == SESSIONTYPE_IM) {
- if (m_hwndIEView || m_hwndHPP) {
- IEVIEWEVENT event;
- event.cbSize = sizeof(IEVIEWEVENT);
- event.iType = IEE_CLEAR_LOG;
- event.dwFlags = (m_dwFlags & MWF_LOG_RTL) ? IEEF_RTL : 0;
- event.hContact = m_hContact;
- if (m_hwndIEView) {
- event.hwnd = m_hwndIEView;
- CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&event);
- }
- else {
- event.hwnd = m_hwndHPP;
- CallService(MS_HPP_EG_EVENT, 0, (LPARAM)&event);
- }
- }
- m_log.SetText(L"");
- m_hDbEventFirst = 0;
- }
- else if (m_bType == SESSIONTYPE_CHAT && si) {
- SESSION_INFO *s = pci->SM_FindSession(si->ptszID, si->pszModule);
- if (s) {
- m_log.SetText(L"");
- pci->LM_RemoveAll(&s->pLog, &s->pLogEnd);
- s->iEventCount = 0;
- s->LastTime = 0;
- si->iEventCount = 0;
- si->LastTime = 0;
- si->pLog = s->pLog;
- si->pLogEnd = s->pLogEnd;
- PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
- }
- }
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
// calculate the minimum required client height for the given message
// window layout
//
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp
index 29597c7215..12d28e1498 100644
--- a/plugins/TabSRMM/src/msgs.cpp
+++ b/plugins/TabSRMM/src/msgs.cpp
@@ -123,11 +123,11 @@ CTabBaseDlg::CTabBaseDlg(TNewWindowData *pData, int iResource)
m_message(this, IDC_MESSAGE),
newData(pData),
- m_pContainer(pData->pContainer),
- m_hContact(pData->hContact)
+ m_pContainer(pData->pContainer)
{
m_pLog = &m_log;
m_pEntry = &m_message;
+ m_hContact = pData->hContact;
m_autoClose = 0;
m_forceResizable = true;
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h
index 26648a98ad..ef7d394969 100644
--- a/plugins/TabSRMM/src/msgs.h
+++ b/plugins/TabSRMM/src/msgs.h
@@ -135,6 +135,7 @@ class CMenuBar;
class CInfoPanel;
class CSideBar;
class CProxyWindow;
+class CThumbBase;
struct CContactCache;
@@ -274,7 +275,6 @@ public:
BYTE m_bType;
DWORD m_dwFlags;
DWORD m_dwFlagsEx;
- MCONTACT m_hContact;
char *m_szProto;
wchar_t m_wszMyNickname[130];
wchar_t m_wszStatusBar[100];
@@ -375,6 +375,9 @@ public:
public:
CTabBaseDlg(TNewWindowData*, int);
+ virtual CThumbBase* CreateThumb(CProxyWindow*) const = 0;
+ virtual void ClearLog() = 0;
+
HWND DM_CreateClist();
void DM_EventAdded(WPARAM wParam, LPARAM lParam);
void DM_InitRichEdit();
@@ -408,7 +411,6 @@ public:
void AdjustBottomAvatarDisplay();
void CalcDynamicAvatarSize(BITMAP *bminfo);
void CheckStatusIconClick(POINT pt, const RECT &rc, int gap, int code);
- void ClearLog();
BOOL DoRtfToTags(CMStringW &pszText, int iNumColors, COLORREF *pColors) const;
void DrawStatusIcons(HDC hDC, const RECT &rc, int gap);
void EnableSendButton(bool bMode) const;
@@ -445,6 +447,9 @@ public:
class CSrmmWindow : public CTabBaseDlg, public MZeroedObject
{
+ virtual CThumbBase* CreateThumb(CProxyWindow *pProxy) const override;
+ virtual void ClearLog() override;
+
void DM_OptionsApplied(WPARAM wParam, LPARAM lParam);
void MsgWindowUpdateState(UINT msg);
@@ -468,6 +473,9 @@ class CChatRoomDlg : public CTabBaseDlg, public MZeroedObject
{
bool m_bWasDeleted;
+ virtual CThumbBase* CreateThumb(CProxyWindow *pProxy) const override;
+ virtual void ClearLog() override;
+
public:
CChatRoomDlg(TNewWindowData*);
diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp
index b82a1016dd..ec39dfb404 100644
--- a/plugins/TabSRMM/src/tabctrl.cpp
+++ b/plugins/TabSRMM/src/tabctrl.cpp
@@ -182,7 +182,7 @@ static void DrawItem(TabControlData *tabdat, HDC dc, RECT *rcItem, int nHint, in
else if (dat->m_bCanFlashTab)
hIcon = dat->m_iFlashIcon;
else {
- if (dat->si && dat->m_iFlashIcon) {
+ if (dat->m_bType == SESSIONTYPE_CHAT && dat->m_iFlashIcon) {
hIcon = dat->m_iFlashIcon;
int sizeY;
diff --git a/plugins/TabSRMM/src/taskbar.cpp b/plugins/TabSRMM/src/taskbar.cpp
index aa0be96110..16a3c67145 100644
--- a/plugins/TabSRMM/src/taskbar.cpp
+++ b/plugins/TabSRMM/src/taskbar.cpp
@@ -293,10 +293,7 @@ void CProxyWindow::sendThumb(LONG width, LONG height)
if (0 == m_thumb) {
m_width = width;
m_height = height;
- if (m_dat->m_bType == SESSIONTYPE_IM)
- m_thumb = new CThumbIM(this);
- else
- m_thumb = new CThumbMUC(this);
+ m_thumb = m_dat->CreateThumb(this);
}
else if (width != m_width || height != m_height || !m_thumb->isValid()) {
m_width = width;
@@ -834,7 +831,9 @@ void CThumbIM::renderContent()
* @param _p our owner (CProxyWindow object)
* @return
*/
-CThumbMUC::CThumbMUC(const CProxyWindow* _p) : CThumbBase(_p)
+CThumbMUC::CThumbMUC(const CProxyWindow* _p, SESSION_INFO *_si)
+ : CThumbBase(_p),
+ si(_si)
{
renderContent();
setValid(true);
@@ -855,61 +854,63 @@ void CThumbMUC::update()
*/
void CThumbMUC::renderContent()
{
- if (m_dat->si) {
- const MODULEINFO* mi = pci->MM_FindModule(m_dat->si->pszModule);
- wchar_t szTemp[250];
- const wchar_t* szStatusMsg = 0;
+ if (si == nullptr)
+ return;
- if (mi) {
- if (m_dat->m_dwUnread) {
- mir_snwprintf(szTemp, TranslateT("%d unread"), m_dat->m_dwUnread);
- CSkin::RenderText(m_hdc, m_dat->m_hTheme, szTemp, &m_rcIcon, m_dtFlags | DT_SINGLELINE | DT_RIGHT, 10, 0, true);
- m_rcIcon.top += m_sz.cy;
+ const MODULEINFO *mi = pci->MM_FindModule(si->pszModule);
+ if (mi) {
+ wchar_t szTemp[250];
+ if (m_dat->m_dwUnread) {
+ mir_snwprintf(szTemp, TranslateT("%d unread"), m_dat->m_dwUnread);
+ CSkin::RenderText(m_hdc, m_dat->m_hTheme, szTemp, &m_rcIcon, m_dtFlags | DT_SINGLELINE | DT_RIGHT, 10, 0, true);
+ m_rcIcon.top += m_sz.cy;
+ }
+ if (si->iType != GCW_SERVER) {
+ wchar_t* _p = NULL;
+ if (si->ptszStatusbarText)
+ _p = wcschr(si->ptszStatusbarText, ']');
+ if (_p) {
+ _p++;
+ wchar_t _t = *_p;
+ *_p = 0;
+ mir_snwprintf(szTemp, TranslateT("Chat room %s"), si->ptszStatusbarText);
+ *_p = _t;
}
- if (m_dat->si->iType != GCW_SERVER) {
- wchar_t* _p = NULL;
- if (m_dat->si->ptszStatusbarText)
- _p = wcschr(m_dat->si->ptszStatusbarText, ']');
- if (_p) {
- _p++;
- wchar_t _t = *_p;
- *_p = 0;
- mir_snwprintf(szTemp, TranslateT("Chat room %s"), m_dat->si->ptszStatusbarText);
- *_p = _t;
- }
- else
- mir_snwprintf(szTemp, TranslateT("Chat room %s"), L"");
- CSkin::RenderText(m_hdc, m_dat->m_hTheme, szTemp, &m_rcIcon, m_dtFlags | DT_SINGLELINE | DT_RIGHT, 10, 0, true);
+ else
+ mir_snwprintf(szTemp, TranslateT("Chat room %s"), L"");
+ CSkin::RenderText(m_hdc, m_dat->m_hTheme, szTemp, &m_rcIcon, m_dtFlags | DT_SINGLELINE | DT_RIGHT, 10, 0, true);
+ m_rcIcon.top += m_sz.cy;
+ mir_snwprintf(szTemp, TranslateT("%d user(s)"), si->nUsersInNicklist);
+ CSkin::RenderText(m_hdc, m_dat->m_hTheme, szTemp, &m_rcIcon, m_dtFlags | DT_SINGLELINE | DT_RIGHT, 10, 0, true);
+ }
+ else {
+ mir_snwprintf(szTemp, TranslateT("Server window"));
+ CSkin::RenderText(m_hdc, m_dat->m_hTheme, szTemp, &m_rcIcon, m_dtFlags | DT_SINGLELINE | DT_RIGHT, 10, 0, true);
+ if (mi->tszIdleMsg[0] && mir_wstrlen(mi->tszIdleMsg) > 2) {
m_rcIcon.top += m_sz.cy;
- mir_snwprintf(szTemp, TranslateT("%d user(s)"), m_dat->si->nUsersInNicklist);
- CSkin::RenderText(m_hdc, m_dat->m_hTheme, szTemp, &m_rcIcon, m_dtFlags | DT_SINGLELINE | DT_RIGHT, 10, 0, true);
- }
- else {
- mir_snwprintf(szTemp, TranslateT("Server window"));
- CSkin::RenderText(m_hdc, m_dat->m_hTheme, szTemp, &m_rcIcon, m_dtFlags | DT_SINGLELINE | DT_RIGHT, 10, 0, true);
- if (mi->tszIdleMsg[0] && mir_wstrlen(mi->tszIdleMsg) > 2) {
- m_rcIcon.top += m_sz.cy;
- CSkin::RenderText(m_hdc, m_dat->m_hTheme, &mi->tszIdleMsg[2], &m_rcIcon, m_dtFlags | DT_SINGLELINE | DT_RIGHT, 10, 0, true);
- }
+ CSkin::RenderText(m_hdc, m_dat->m_hTheme, &mi->tszIdleMsg[2], &m_rcIcon, m_dtFlags | DT_SINGLELINE | DT_RIGHT, 10, 0, true);
}
}
+ }
- if ((m_rcBottom.bottom - m_rcBottom.top) < 2 * m_sz.cy)
- m_dtFlags |= DT_SINGLELINE;
-
- m_rcBottom.bottom -= ((m_rcBottom.bottom - m_rcBottom.top) % m_sz.cy); // adjust to a multiple of line height
+ if ((m_rcBottom.bottom - m_rcBottom.top) < 2 * m_sz.cy)
+ m_dtFlags |= DT_SINGLELINE;
- if (m_dat->si->iType != GCW_SERVER) {
- if (0 == (szStatusMsg = m_dat->si->ptszTopic))
- szStatusMsg = TranslateT("no topic set.");
- }
- else if (mi) {
- mir_snwprintf(szTemp, TranslateT("%s on %s%s"), m_dat->m_wszMyNickname, mi->ptszModDispName, L"");
- szStatusMsg = szTemp;
- }
+ m_rcBottom.bottom -= ((m_rcBottom.bottom - m_rcBottom.top) % m_sz.cy); // adjust to a multiple of line height
- CSkin::RenderText(m_hdc, m_dat->m_hTheme, szStatusMsg, &m_rcBottom, DT_WORD_ELLIPSIS | DT_END_ELLIPSIS | m_dtFlags, 10, 0, true);
+ const wchar_t *szStatusMsg = 0;
+ if (si->iType != GCW_SERVER) {
+ if (0 == (szStatusMsg = si->ptszTopic))
+ szStatusMsg = TranslateT("no topic set.");
+ }
+ else if (mi) {
+ wchar_t szTemp[250];
+ mir_snwprintf(szTemp, TranslateT("%s on %s%s"), m_dat->m_wszMyNickname, mi->ptszModDispName, L"");
+ szStatusMsg = szTemp;
}
+
+ CSkin::RenderText(m_hdc, m_dat->m_hTheme, szStatusMsg, &m_rcBottom, DT_WORD_ELLIPSIS | DT_END_ELLIPSIS | m_dtFlags, 10, 0, true);
+
/*
* finalize it
* do NOT delete the bitmap, the dwm will need the handle
diff --git a/plugins/TabSRMM/src/taskbar.h b/plugins/TabSRMM/src/taskbar.h
index d8ca7ec962..8c7c3e4719 100644
--- a/plugins/TabSRMM/src/taskbar.h
+++ b/plugins/TabSRMM/src/taskbar.h
@@ -80,18 +80,20 @@ public:
void update();
private:
- void renderContent();
+ virtual void renderContent() override;
};
class CThumbMUC : public CThumbBase
{
+ SESSION_INFO *si;
+
public:
- CThumbMUC(const CProxyWindow* pWnd);
+ CThumbMUC(const CProxyWindow* pWnd, SESSION_INFO*);
virtual ~CThumbMUC() {};
void update();
private:
- void renderContent();
+ virtual void renderContent() override;
};
class CProxyWindow