diff options
-rw-r--r-- | plugins/Scriver/src/chat/window.cpp | 50 | ||||
-rw-r--r-- | plugins/Scriver/src/infobar.cpp | 16 | ||||
-rw-r--r-- | plugins/Scriver/src/msgdialog.cpp | 534 | ||||
-rw-r--r-- | plugins/Scriver/src/msglog.cpp | 57 | ||||
-rw-r--r-- | plugins/Scriver/src/msgs.cpp | 9 | ||||
-rw-r--r-- | plugins/Scriver/src/msgs.h | 52 | ||||
-rw-r--r-- | plugins/Scriver/src/utils.cpp | 2 | ||||
-rw-r--r-- | plugins/Scriver/src/version.h | 2 |
8 files changed, 360 insertions, 362 deletions
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index bb980fc252..4ad3cf571f 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -855,8 +855,8 @@ class CChatRoomDlg : public CSrmmBaseDialog void MessageDialogResize(int w, int h)
{
bool bNick = m_si->iType != GCW_SERVER && m_si->bNicklistEnabled;
- bool bToolbar = SendMessage(GetParent(m_hwnd), CM_GETTOOLBARSTATUS, 0, 0) != 0;
- int hSplitterMinTop = TOOLBAR_HEIGHT + m_si->minLogBoxHeight, hSplitterMinBottom = m_si->minEditBoxHeight;
+ bool bToolbar = SendMessage(m_hwndParent, CM_GETTOOLBARSTATUS, 0, 0) != 0;
+ int hSplitterMinTop = TOOLBAR_HEIGHT + m_si->m_minLogBoxHeight, hSplitterMinBottom = m_si->m_minEditBoxHeight;
int toolbarHeight = bToolbar ? TOOLBAR_HEIGHT : 0;
m_si->iSplitterY = m_si->desiredInputAreaHeight + SPLITTER_HEIGHT + 3;
@@ -886,7 +886,7 @@ class CChatRoomDlg : public CSrmmBaseDialog HDWP hdwp = BeginDeferWindowPos(5);
int toolbarTopY = bToolbar ? h - m_si->iSplitterY - toolbarHeight : h - m_si->iSplitterY;
- int logBottom = (m_si->hwndIeview != NULL) ? toolbarTopY / 2 : toolbarTopY;
+ int logBottom = (m_si->m_hwndIeview != NULL) ? toolbarTopY / 2 : toolbarTopY;
hdwp = DeferWindowPos(hdwp, GetDlgItem(m_hwnd, IDC_LOG), 0, 1, 0, bNick ? w - m_si->iSplitterX - 1 : w - 2, logBottom, SWP_NOZORDER);
hdwp = DeferWindowPos(hdwp, GetDlgItem(m_hwnd, IDC_CHAT_LIST), 0, w - m_si->iSplitterX + 2, 0, m_si->iSplitterX - 3, toolbarTopY, SWP_NOZORDER);
@@ -897,12 +897,12 @@ class CChatRoomDlg : public CSrmmBaseDialog SetButtonsPos(m_hwnd, bToolbar);
- if (m_si->hwndIeview != NULL) {
+ if (m_si->m_hwndIeview != NULL) {
IEVIEWWINDOW ieWindow;
ieWindow.cbSize = sizeof(IEVIEWWINDOW);
ieWindow.iType = IEW_SETPOS;
ieWindow.parent = m_hwnd;
- ieWindow.hwnd = m_si->hwndIeview;
+ ieWindow.hwnd = m_si->m_hwndIeview;
ieWindow.x = 0;
ieWindow.y = logBottom + 1;
ieWindow.cx = bNick ? w - m_si->iSplitterX : w;
@@ -949,8 +949,8 @@ public: RECT minEditInit;
GetWindowRect(m_message.GetHwnd(), &minEditInit);
- m_si->minEditBoxHeight = minEditInit.bottom - minEditInit.top;
- m_si->minLogBoxHeight = m_si->minEditBoxHeight;
+ m_si->m_minEditBoxHeight = minEditInit.bottom - minEditInit.top;
+ m_si->m_minLogBoxHeight = m_si->m_minEditBoxHeight;
m_message.SendMsg(EM_SUBCLASSED, 0, 0);
m_message.SendMsg(EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_CHANGE | ENM_REQUESTRESIZE);
@@ -970,11 +970,11 @@ public: ieWindow.cy = 300;
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
- m_si->hwndIeview = ieWindow.hwnd;
+ m_si->m_hwndIeview = ieWindow.hwnd;
IEVIEWEVENT iee = { sizeof(iee) };
iee.iType = IEE_CLEAR_LOG;
- iee.hwnd = m_si->hwndIeview;
+ iee.hwnd = m_si->m_hwndIeview;
iee.hContact = m_si->hContact;
iee.pszProto = m_si->pszModule;
CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&iee);
@@ -986,7 +986,7 @@ public: SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0);
SendMessage(m_hwnd, DM_UPDATETITLEBAR, 0, 0);
- SendMessage(GetParent(m_hwnd), CM_ADDCHILD, (WPARAM)m_hwnd, m_si->hContact);
+ SendMessage(m_hwndParent, CM_ADDCHILD, (WPARAM)m_hwnd, m_si->hContact);
PostMessage(m_hwnd, GC_UPDATENICKLIST, 0, 0);
NotifyLocalWinEvent(m_si->hContact, m_hwnd, MSG_WINDOW_EVT_OPEN);
}
@@ -998,12 +998,12 @@ public: m_si->hWnd = NULL;
SetWindowLongPtr(m_hwnd, GWLP_USERDATA, 0);
- SendMessage(GetParent(m_hwnd), CM_REMOVECHILD, 0, (LPARAM)m_hwnd);
- if (m_si->hwndIeview != NULL) {
+ SendMessage(m_hwndParent, CM_REMOVECHILD, 0, (LPARAM)m_hwnd);
+ if (m_si->m_hwndIeview != NULL) {
IEVIEWWINDOW ieWindow;
ieWindow.cbSize = sizeof(IEVIEWWINDOW);
ieWindow.iType = IEW_DESTROY;
- ieWindow.hwnd = m_si->hwndIeview;
+ ieWindow.hwnd = m_si->m_hwndIeview;
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
}
@@ -1091,7 +1091,7 @@ public: }
tbd.iFlags = TBDF_TEXT | TBDF_ICON;
tbd.pszText = szTemp;
- SendMessage(GetParent(m_hwnd), CM_UPDATETITLEBAR, (WPARAM)&tbd, (LPARAM)m_hwnd);
+ SendMessage(m_hwndParent, CM_UPDATETITLEBAR, (WPARAM)&tbd, (LPARAM)m_hwnd);
SendMessage(m_hwnd, DM_UPDATETABCONTROL, 0, 0);
break;
@@ -1106,12 +1106,12 @@ public: sbd.iFlags = SBDF_TEXT | SBDF_ICON;
sbd.hIcon = hIcon;
sbd.pszText = szTemp;
- SendMessage(GetParent(m_hwnd), CM_UPDATESTATUSBAR, (WPARAM)&sbd, (LPARAM)m_hwnd);
+ SendMessage(m_hwndParent, CM_UPDATESTATUSBAR, (WPARAM)&sbd, (LPARAM)m_hwnd);
sbd.iItem = 1;
sbd.hIcon = NULL;
sbd.pszText = L"";
- SendMessage(GetParent(m_hwnd), CM_UPDATESTATUSBAR, (WPARAM)&sbd, (LPARAM)m_hwnd);
+ SendMessage(m_hwndParent, CM_UPDATESTATUSBAR, (WPARAM)&sbd, (LPARAM)m_hwnd);
StatusIconData sid = { sizeof(sid) };
sid.szModule = SRMMMOD;
@@ -1178,7 +1178,7 @@ public: case DM_UPDATETABCONTROL:
tcd.iFlags = TCDF_TEXT;
tcd.pszText = m_si->ptszName;
- SendMessage(GetParent(m_hwnd), CM_UPDATETABCONTROL, (WPARAM)&tcd, (LPARAM)m_hwnd);
+ SendMessage(m_hwndParent, CM_UPDATETABCONTROL, (WPARAM)&tcd, (LPARAM)m_hwnd);
// fall through
case GC_FIXTABICONS:
@@ -1192,21 +1192,21 @@ public: tcd.iFlags = TCDF_ICON;
tcd.hIcon = hIcon;
- SendMessage(GetParent(m_hwnd), CM_UPDATETABCONTROL, (WPARAM)&tcd, (LPARAM)m_hwnd);
+ SendMessage(m_hwndParent, CM_UPDATETABCONTROL, (WPARAM)&tcd, (LPARAM)m_hwnd);
break;
case GC_SETMESSAGEHIGHLIGHT:
m_si->wState |= GC_EVENT_HIGHLIGHT;
SendMessage(m_si->hWnd, GC_FIXTABICONS, 0, 0);
SendMessage(m_hwnd, DM_UPDATETITLEBAR, 0, 0);
- if (g_Settings.bFlashWindowHighlight && GetActiveWindow() != m_hwnd && GetForegroundWindow() != GetParent(m_hwnd))
+ if (g_Settings.bFlashWindowHighlight && GetActiveWindow() != m_hwnd && GetForegroundWindow() != m_hwndParent)
SendMessage(GetParent(m_si->hWnd), CM_STARTFLASHING, 0, 0);
break;
case GC_SETTABHIGHLIGHT:
SendMessage(m_si->hWnd, GC_FIXTABICONS, 0, 0);
SendMessage(m_hwnd, DM_UPDATETITLEBAR, 0, 0);
- if (g_Settings.bFlashWindow && GetActiveWindow() != GetParent(m_hwnd) && GetForegroundWindow() != GetParent(m_hwnd))
+ if (g_Settings.bFlashWindow && GetActiveWindow() != m_hwndParent && GetForegroundWindow() != m_hwndParent)
SendMessage(GetParent(m_si->hWnd), CM_STARTFLASHING, 0, 0);
break;
@@ -1755,7 +1755,7 @@ public: if (mmi->ptMinTrackSize.x < 350)
mmi->ptMinTrackSize.x = 350;
- mmi->ptMinTrackSize.y = m_si->minLogBoxHeight + TOOLBAR_HEIGHT + m_si->minEditBoxHeight + 5;
+ mmi->ptMinTrackSize.y = m_si->m_minLogBoxHeight + TOOLBAR_HEIGHT + m_si->m_minEditBoxHeight + 5;
}
break;
@@ -1763,11 +1763,11 @@ public: if (LOWORD(lParam) < 30)
PostMessage(m_hwnd, GC_SCROLLTOBOTTOM, 0, 0);
else
- SendMessage(GetParent(m_hwnd), WM_SYSCOMMAND, SC_MINIMIZE, 0);
+ SendMessage(m_hwndParent, WM_SYSCOMMAND, SC_MINIMIZE, 0);
break;
case WM_LBUTTONDOWN:
- SendMessage(GetParent(m_hwnd), WM_LBUTTONDOWN, wParam, lParam);
+ SendMessage(m_hwndParent, WM_LBUTTONDOWN, wParam, lParam);
return TRUE;
case DM_GETCONTEXTMENU:
@@ -1775,7 +1775,7 @@ public: return TRUE;
case WM_CONTEXTMENU:
- if (GetParent(m_hwnd) == (HWND)wParam) {
+ if (m_hwndParent == (HWND)wParam) {
HMENU hMenu = Menu_BuildContactMenu(m_si->hContact);
GetCursorPos(&pt);
TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, m_hwnd, NULL);
@@ -1804,7 +1804,7 @@ void ShowRoom(SESSION_INFO *si) pDlg->SetParent(hParent);
pDlg->Show();
- si->parent = (ParentWindowData*)GetWindowLongPtr(hParent, GWLP_USERDATA);
+ si->m_pParent = (ParentWindowData*)GetWindowLongPtr(hParent, GWLP_USERDATA);
si->hWnd = pDlg->GetHwnd();
}
SendMessage(si->hWnd, DM_UPDATETABCONTROL, -1, (LPARAM)si);
diff --git a/plugins/Scriver/src/infobar.cpp b/plugins/Scriver/src/infobar.cpp index be0d288d39..02cb0a07e5 100644 --- a/plugins/Scriver/src/infobar.cpp +++ b/plugins/Scriver/src/infobar.cpp @@ -68,9 +68,9 @@ void SetupInfobar(InfobarWindowData* idat) static HICON GetExtraStatusIcon(InfobarWindowData* idat)
{
- BYTE bXStatus = db_get_b(idat->mwd->m_hContact, idat->mwd->szProto, "XStatusId", 0);
+ BYTE bXStatus = db_get_b(idat->mwd->m_hContact, idat->mwd->m_szProto, "XStatusId", 0);
if (bXStatus > 0)
- return (HICON)CallProtoService(idat->mwd->szProto, PS_GETCUSTOMSTATUSICON, bXStatus, 0);
+ return (HICON)CallProtoService(idat->mwd->m_szProto, PS_GETCUSTOMSTATUSICON, bXStatus, 0);
return NULL;
}
@@ -80,8 +80,8 @@ void RefreshInfobar(InfobarWindowData* idat) HWND hwnd = idat->hWnd;
CSrmmWindow *dat = idat->mwd;
ptrW szContactStatusMsg(db_get_wsa(dat->m_hContact, "CList", "StatusMsg"));
- ptrW szXStatusName(db_get_wsa(idat->mwd->m_hContact, idat->mwd->szProto, "XStatusName"));
- ptrW szXStatusMsg(db_get_wsa(idat->mwd->m_hContact, idat->mwd->szProto, "XStatusMsg"));
+ ptrW szXStatusName(db_get_wsa(idat->mwd->m_hContact, idat->mwd->m_szProto, "XStatusName"));
+ ptrW szXStatusMsg(db_get_wsa(idat->mwd->m_hContact, idat->mwd->m_szProto, "XStatusMsg"));
HICON hIcon = GetExtraStatusIcon(idat);
wchar_t szText[2048];
SETTEXTEX st;
@@ -137,9 +137,9 @@ static INT_PTR CALLBACK InfobarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA GetClientRect(hwnd, &rc);
dlgWidth = rc.right - rc.left;
dlgHeight = rc.bottom - rc.top;
- if (idat->mwd->avatarPic && (g_dat.flags&SMF_AVATAR)) {
+ if (idat->mwd->m_hbmpAvatarPic && (g_dat.flags & SMF_AVATAR)) {
BITMAP bminfo;
- GetObject(idat->mwd->avatarPic, sizeof(bminfo), &bminfo);
+ GetObject(idat->mwd->m_hbmpAvatarPic, sizeof(bminfo), &bminfo);
if (bminfo.bmWidth != 0 && bminfo.bmHeight != 0) {
avatarHeight = dlgHeight - 2;
avatarWidth = bminfo.bmWidth * avatarHeight / bminfo.bmHeight;
@@ -219,9 +219,9 @@ static INT_PTR CALLBACK InfobarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA rect.right = itemWidth - 1;
rect.bottom = itemHeight - 1;
FillRect(hdcMem, &rect, g_dat.hInfobarBrush);
- if (idat->mwd->avatarPic && (g_dat.flags&SMF_AVATAR)) {
+ if (idat->mwd->m_hbmpAvatarPic && (g_dat.flags & SMF_AVATAR)) {
BITMAP bminfo;
- GetObject(idat->mwd->avatarPic, sizeof(bminfo), &bminfo);
+ GetObject(idat->mwd->m_hbmpAvatarPic, sizeof(bminfo), &bminfo);
if (bminfo.bmWidth != 0 && bminfo.bmHeight != 0) {
int avatarHeight = itemHeight;
int avatarWidth = bminfo.bmWidth * avatarHeight / bminfo.bmHeight;
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 5d28d0412c..b1cc7efbba 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -33,7 +33,7 @@ extern HANDLE hHookWinEvt; static wchar_t* GetIEViewSelection(CSrmmWindow *dat)
{
IEVIEWEVENT evt = { sizeof(evt) };
- evt.hwnd = dat->hwndIeview;
+ evt.hwnd = dat->m_hwndIeview;
evt.hContact = dat->m_hContact;
evt.iType = IEE_GET_SELECTION;
return mir_wstrdup((wchar_t*)CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&evt));
@@ -162,13 +162,13 @@ static void AddToFileList(wchar_t ***pppFiles, int *totalCount, const wchar_t* s void CSrmmWindow::SetDialogToType()
{
- BOOL showToolbar = SendMessage(GetParent(m_hwnd), CM_GETTOOLBARSTATUS, 0, 0);
- ParentWindowData *pdat = parent;
+ BOOL showToolbar = SendMessage(m_hwndParent, CM_GETTOOLBARSTATUS, 0, 0);
+ ParentWindowData *pdat = m_pParent;
if (pdat->flags2 & SMF2_SHOWINFOBAR)
- ShowWindow(infobarData->hWnd, SW_SHOW);
+ ShowWindow(m_pInfobarData->hWnd, SW_SHOW);
else
- ShowWindow(infobarData->hWnd, SW_HIDE);
+ ShowWindow(m_pInfobarData->hWnd, SW_HIDE);
CustomButtonData *cbd;
for (int i = 0; cbd = Srmm_GetNthButton(i); i++) {
@@ -186,62 +186,62 @@ void CSrmmWindow::SetDialogToType() }
ShowWindow(m_message.GetHwnd(), SW_SHOW);
- if (hwndIeview != NULL)
+ if (m_hwndIeview != NULL)
ShowWindow(m_log.GetHwnd(), SW_HIDE);
else
ShowWindow(m_log.GetHwnd(), SW_SHOW);
ShowWindow(GetDlgItem(m_hwnd, IDC_SPLITTERY), SW_SHOW);
UpdateReadChars();
- EnableWindow(GetDlgItem(m_hwnd, IDOK), GetRichTextLength(GetDlgItem(m_hwnd, IDC_MESSAGE), 1200, FALSE) ? TRUE : FALSE);
+ EnableWindow(GetDlgItem(m_hwnd, IDOK), GetRichTextLength(m_message.GetHwnd(), 1200, FALSE) ? TRUE : FALSE);
SendMessage(m_hwnd, DM_CLISTSETTINGSCHANGED, 0, 0);
SendMessage(m_hwnd, WM_SIZE, 0, 0);
}
void CSrmmWindow::SetStatusIcon()
{
- if (szProto == NULL)
+ if (m_szProto == nullptr)
return;
MCONTACT hContact = db_mc_getSrmmSub(m_hContact);
- if (hContact == NULL)
- hContact = hContact;
+ if (hContact == 0)
+ hContact = m_hContact;
char *szProto = GetContactProto(hContact);
- statusIcon = Skin_LoadProtoIcon(szProto, wStatus, false);
- statusIconBig = Skin_LoadProtoIcon(szProto, wStatus, true);
+ m_hStatusIcon = Skin_LoadProtoIcon(szProto, m_wStatus, false);
+ m_hStatusIconBig = Skin_LoadProtoIcon(szProto, m_wStatus, true);
- if (statusIconOverlay != NULL)
- DestroyIcon(statusIconOverlay);
+ if (m_hStatusIconOverlay != NULL)
+ DestroyIcon(m_hStatusIconOverlay);
- int index = ImageList_ReplaceIcon(g_dat.hHelperIconList, 0, statusIcon);
- statusIconOverlay = ImageList_GetIcon(g_dat.hHelperIconList, index, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1));
+ int index = ImageList_ReplaceIcon(g_dat.hHelperIconList, 0, m_hStatusIcon);
+ m_hStatusIconOverlay = ImageList_GetIcon(g_dat.hHelperIconList, index, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1));
}
void CSrmmWindow::GetTitlebarIcon(TitleBarData *tbd)
{
- if (showTyping && (g_dat.flags2 & SMF2_SHOWTYPINGWIN))
+ if (m_bShowTyping && (g_dat.flags2 & SMF2_SHOWTYPINGWIN))
tbd->hIconNot = tbd->hIcon = GetCachedIcon("scriver_TYPING");
- else if (showUnread && (GetActiveWindow() != m_hwndParent || GetForegroundWindow() != m_hwndParent)) {
- tbd->hIcon = (g_dat.flags & SMF_STATUSICON) ? statusIcon : g_dat.hMsgIcon;
+ else if (m_iShowUnread && (GetActiveWindow() != m_hwndParent || GetForegroundWindow() != m_hwndParent)) {
+ tbd->hIcon = (g_dat.flags & SMF_STATUSICON) ? m_hStatusIcon : g_dat.hMsgIcon;
tbd->hIconNot = (g_dat.flags & SMF_STATUSICON) ? g_dat.hMsgIcon : GetCachedIcon("scriver_OVERLAY");
}
else {
- tbd->hIcon = (g_dat.flags & SMF_STATUSICON) ? statusIcon : g_dat.hMsgIcon;
+ tbd->hIcon = (g_dat.flags & SMF_STATUSICON) ? m_hStatusIcon : g_dat.hMsgIcon;
tbd->hIconNot = NULL;
}
- tbd->hIconBig = (g_dat.flags & SMF_STATUSICON) ? statusIconBig : g_dat.hMsgIconBig;
+ tbd->hIconBig = (g_dat.flags & SMF_STATUSICON) ? m_hStatusIconBig : g_dat.hMsgIconBig;
}
HICON CSrmmWindow::GetTabIcon()
{
- if (showTyping)
+ if (m_bShowTyping)
return GetCachedIcon("scriver_TYPING");
- if (showUnread != 0)
- return statusIconOverlay;
+ if (m_iShowUnread != 0)
+ return m_hStatusIconOverlay;
- return statusIcon;
+ return m_hStatusIcon;
}
static LRESULT CALLBACK LogEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -441,13 +441,13 @@ static void SubclassLogEdit(HWND hwnd) void CSrmmWindow::MessageDialogResize(int w, int h)
{
- if (!infobarData)
+ if (!m_pInfobarData)
return;
- ParentWindowData *pdat = parent;
+ ParentWindowData *pdat = m_pParent;
bool bToolbar = (pdat->flags2 & SMF2_SHOWTOOLBAR) != 0;
- int hSplitterPos = splitterPos, toolbarHeight = (bToolbar) ? toolbarSize.cy : 0;
- int hSplitterMinTop = toolbarHeight + minLogBoxHeight, hSplitterMinBottom = minEditBoxHeight;
+ int hSplitterPos = m_iSplitterPos, toolbarHeight = (bToolbar) ? m_toolbarSize.cy : 0;
+ int hSplitterMinTop = toolbarHeight + m_minLogBoxHeight, hSplitterMinBottom = m_minEditBoxHeight;
int infobarInnerHeight = INFO_BAR_INNER_HEIGHT;
int infobarHeight = INFO_BAR_HEIGHT;
int avatarWidth = 0, avatarHeight = 0;
@@ -459,7 +459,7 @@ void CSrmmWindow::MessageDialogResize(int w, int h) infobarHeight = 0;
infobarInnerHeight = 0;
}
- hSplitterPos = desiredInputAreaHeight + SPLITTER_HEIGHT + 3;
+ hSplitterPos = m_iDesiredInputAreaHeight + SPLITTER_HEIGHT + 3;
if (hSplitterPos > (h - toolbarHeight - infobarHeight + SPLITTER_HEIGHT + 1) / 2)
hSplitterPos = (h - toolbarHeight - infobarHeight + SPLITTER_HEIGHT + 1) / 2;
@@ -474,7 +474,7 @@ void CSrmmWindow::MessageDialogResize(int w, int h) hSplitterPos = hSplitterMinBottom;
if (!(pdat->flags2 & SMF2_SHOWINFOBAR)) {
- if (avatarPic && (g_dat.flags & SMF_AVATAR)) {
+ if (m_hbmpAvatarPic && (g_dat.flags & SMF_AVATAR)) {
avatarWidth = BOTTOM_RIGHT_AVATAR_HEIGHT;
avatarHeight = toolbarHeight + hSplitterPos - 2;
if (avatarHeight < BOTTOM_RIGHT_AVATAR_HEIGHT) {
@@ -487,34 +487,34 @@ void CSrmmWindow::MessageDialogResize(int w, int h) if (avatarWidth > BOTTOM_RIGHT_AVATAR_HEIGHT && avatarWidth > w / 4)
avatarWidth = w / 4;
- if ((toolbarWidth - avatarWidth - 2) < toolbarSize.cx)
- avatarWidth = toolbarWidth - toolbarSize.cx - 2;
+ if ((toolbarWidth - avatarWidth - 2) < m_toolbarSize.cx)
+ avatarWidth = toolbarWidth - m_toolbarSize.cx - 2;
toolbarWidth -= avatarWidth + 2;
messageEditWidth -= avatarWidth + 1;
}
}
- splitterPos = hSplitterPos;
+ m_iSplitterPos = hSplitterPos;
logY = infobarInnerHeight;
logH = h - hSplitterPos - toolbarHeight - infobarInnerHeight;
HDWP hdwp = BeginDeferWindowPos(5);
- hdwp = DeferWindowPos(hdwp, infobarData->hWnd, 0, 1, 0, w - 2, infobarInnerHeight - 2, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, m_pInfobarData->hWnd, 0, 1, 0, w - 2, infobarInnerHeight - 2, SWP_NOZORDER);
hdwp = DeferWindowPos(hdwp, m_log.GetHwnd(), 0, 1, logY, w - 2, logH, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(m_hwnd, IDC_MESSAGE), 0, 1, h - hSplitterPos + SPLITTER_HEIGHT, messageEditWidth, hSplitterPos - SPLITTER_HEIGHT - 1, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, m_message.GetHwnd(), 0, 1, h - hSplitterPos + SPLITTER_HEIGHT, messageEditWidth, hSplitterPos - SPLITTER_HEIGHT - 1, SWP_NOZORDER);
hdwp = DeferWindowPos(hdwp, GetDlgItem(m_hwnd, IDC_AVATAR), 0, w - avatarWidth - 1, h - (avatarHeight + avatarWidth) / 2 - 1, avatarWidth, avatarWidth, SWP_NOZORDER);
hdwp = DeferWindowPos(hdwp, GetDlgItem(m_hwnd, IDC_SPLITTERY), 0, 0, h - hSplitterPos - 1, toolbarWidth, SPLITTER_HEIGHT, SWP_NOZORDER);
EndDeferWindowPos(hdwp);
SetButtonsPos(m_hwnd, bToolbar);
- if (hwndIeview != NULL) {
+ if (m_hwndIeview != NULL) {
IEVIEWWINDOW ieWindow = { sizeof(ieWindow) };
ieWindow.iType = IEW_SETPOS;
ieWindow.parent = m_hwnd;
- ieWindow.hwnd = hwndIeview;
+ ieWindow.hwnd = m_hwndIeview;
ieWindow.x = 0;
ieWindow.y = logY;
ieWindow.cx = w;
@@ -525,16 +525,16 @@ void CSrmmWindow::MessageDialogResize(int w, int h) RedrawWindow(m_message.GetHwnd(), NULL, NULL, RDW_INVALIDATE);
- RefreshInfobar(infobarData);
+ RefreshInfobar(m_pInfobarData);
RedrawWindow(GetDlgItem(m_hwnd, IDC_AVATAR), NULL, NULL, RDW_INVALIDATE);
}
void CSrmmWindow::UpdateReadChars()
{
- if (parent->hwndActive == m_hwnd) {
+ if (m_pParent->hwndActive == m_hwnd) {
wchar_t szText[256];
- int len = GetRichTextLength(GetDlgItem(m_hwnd, IDC_MESSAGE), 1200, FALSE);
+ int len = GetRichTextLength(m_message.GetHwnd(), 1200, FALSE);
StatusBarData sbd;
sbd.iItem = 1;
@@ -549,24 +549,21 @@ void CSrmmWindow::UpdateReadChars() void CSrmmWindow::ShowAvatar()
{
INT_PTR res = CallService(MS_AV_GETAVATARBITMAP, m_hContact, 0);
- ace = res != CALLSERVICE_NOTFOUND ? (AVATARCACHEENTRY*)res : NULL;
- avatarPic = (ace != NULL && (ace->dwFlags & AVS_HIDEONCLIST) == 0) ? ace->hbmPic : NULL;
+ m_ace = res != CALLSERVICE_NOTFOUND ? (AVATARCACHEENTRY*)res : NULL;
+ m_hbmpAvatarPic = (m_ace != NULL && (m_ace->dwFlags & AVS_HIDEONCLIST) == 0) ? m_ace->hbmPic : NULL;
SendMessage(m_hwnd, WM_SIZE, 0, 0);
- RefreshInfobar(infobarData);
+ RefreshInfobar(m_pInfobarData);
RedrawWindow(GetDlgItem(m_hwnd, IDC_AVATAR), NULL, NULL, RDW_INVALIDATE);
}
bool CSrmmWindow::IsTypingNotificationSupported()
{
- if (!m_hContact)
+ if (!m_hContact || !m_szProto)
return false;
- if (!szProto)
- return false;
-
- DWORD typeCaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0);
+ DWORD typeCaps = CallProtoService(m_szProto, PS_GETCAPS, PFLAGNUM_4, 0);
if (!(typeCaps & PF4_SUPPORTTYPING))
return false;
return true;
@@ -577,15 +574,15 @@ bool CSrmmWindow::IsTypingNotificationEnabled() if (!db_get_b(m_hContact, SRMMMOD, SRMSGSET_TYPING, db_get_b(NULL, SRMMMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)))
return FALSE;
- DWORD protoStatus = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
+ DWORD protoStatus = CallProtoService(m_szProto, PS_GETSTATUS, 0, 0);
if (protoStatus < ID_STATUS_ONLINE)
return FALSE;
- DWORD protoCaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0);
- if (protoCaps & PF1_VISLIST && db_get_w(m_hContact, szProto, "ApparentMode", 0) == ID_STATUS_OFFLINE)
+ DWORD protoCaps = CallProtoService(m_szProto, PS_GETCAPS, PFLAGNUM_1, 0);
+ if (protoCaps & PF1_VISLIST && db_get_w(m_hContact, m_szProto, "ApparentMode", 0) == ID_STATUS_OFFLINE)
return FALSE;
- if (protoCaps & PF1_INVISLIST && protoStatus == ID_STATUS_INVISIBLE && db_get_w(m_hContact, szProto, "ApparentMode", 0) != ID_STATUS_ONLINE)
+ if (protoCaps & PF1_INVISLIST && protoStatus == ID_STATUS_INVISIBLE && db_get_w(m_hContact, m_szProto, "ApparentMode", 0) != ID_STATUS_ONLINE)
return FALSE;
if (db_get_b(m_hContact, "CList", "NotOnList", 0)
@@ -608,8 +605,8 @@ void CSrmmWindow::NotifyTyping(int mode) return;
// End user check
- nTypeMode = mode;
- CallService(MS_PROTO_SELFISTYPING, m_hContact, nTypeMode);
+ m_nTypeMode = mode;
+ CallService(MS_PROTO_SELFISTYPING, m_hContact, m_nTypeMode);
}
static INT_PTR CALLBACK ConfirmSendAllDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM)
@@ -664,46 +661,42 @@ CSrmmWindow::CSrmmWindow(MCONTACT hContact, bool bIncoming, const char *szInitia void CSrmmWindow::OnInitDialog()
{
- int len = 0;
-
SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LONG_PTR)this);
WindowList_Add(pci->hWindowList, m_hwnd, m_hContact);
NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPENING);
- parent = (ParentWindowData *)GetWindowLongPtr(m_hwndParent, GWLP_USERDATA);
- szProto = GetContactProto(m_hContact);
+ m_pParent = (ParentWindowData *)GetWindowLongPtr(m_hwndParent, GWLP_USERDATA);
+ m_szProto = GetContactProto(m_hContact);
- if (m_hContact && szProto != NULL)
- wStatus = db_get_w(m_hContact, szProto, "Status", ID_STATUS_OFFLINE);
+ if (m_hContact && m_szProto != nullptr)
+ m_wStatus = db_get_w(m_hContact, m_szProto, "Status", ID_STATUS_OFFLINE);
else
- wStatus = ID_STATUS_OFFLINE;
+ m_wStatus = ID_STATUS_OFFLINE;
- nTypeMode = PROTOTYPE_SELFTYPING_OFF;
+ m_nTypeMode = PROTOTYPE_SELFTYPING_OFF;
SetTimer(m_hwnd, TIMERID_TYPE, 1000, NULL);
- lastEventType = -1;
- lastEventTime = time(NULL);
- startTime = time(NULL);
+ m_lastEventType = -1;
+ m_lastEventTime = time(NULL);
+ m_startTime = time(NULL);
- if (db_get_b(m_hContact, SRMMMOD, "UseRTL", (BYTE)0))
- flags |= SMF_RTL;
-
- flags |= g_dat.ieviewInstalled ? g_dat.flags & SMF_USEIEVIEW : 0;
+ m_bUseRtl = db_get_b(m_hContact, SRMMMOD, "UseRTL", 0) != 0;
+ m_bUseIEView = g_dat.ieviewInstalled ? (g_dat.flags & SMF_USEIEVIEW) != 0 : false;
PARAFORMAT2 pf2;
memset(&pf2, 0, sizeof(pf2));
pf2.cbSize = sizeof(pf2);
pf2.dwMask = PFM_RTLPARA;
- if (!(flags & SMF_RTL)) {
+ if (!m_bUseRtl) {
pf2.wEffects = 0;
- SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_MESSAGE), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_MESSAGE), GWL_EXSTYLE) & ~(WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR));
+ SetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE) & ~(WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR));
}
else {
pf2.wEffects = PFE_RTLPARA;
- SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_MESSAGE), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_MESSAGE), GWL_EXSTYLE) | WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR);
+ SetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE) | WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR);
}
- SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
+ m_message.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
/* Workaround to make Richedit display RTL messages correctly */
memset(&pf2, 0, sizeof(pf2));
pf2.cbSize = sizeof(pf2);
@@ -711,60 +704,61 @@ void CSrmmWindow::OnInitDialog() pf2.wEffects = PFE_RTLPARA;
pf2.dxStartIndent = 30;
pf2.dxRightIndent = 30;
- SendDlgItemMessage(m_hwnd, IDC_LOG, EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
+ m_log.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
pf2.dwMask = PFM_RTLPARA;
pf2.wEffects = 0;
- SendDlgItemMessage(m_hwnd, IDC_LOG, EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
- if (flags & SMF_RTL)
+ m_log.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
+ if (m_bUseRtl)
SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LOG), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LOG), GWL_EXSTYLE) | WS_EX_LEFTSCROLLBAR);
else
SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LOG), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LOG), GWL_EXSTYLE) & ~WS_EX_LEFTSCROLLBAR);
RECT minEditInit;
- GetWindowRect(GetDlgItem(m_hwnd, IDC_MESSAGE), &minEditInit);
- minEditBoxHeight = minEditInit.bottom - minEditInit.top;
- minLogBoxHeight = minEditBoxHeight;
- toolbarSize.cy = TOOLBAR_HEIGHT;
- toolbarSize.cx = 0;
- if (splitterPos == -1)
- splitterPos = minEditBoxHeight;
+ GetWindowRect(m_message.GetHwnd(), &minEditInit);
+ m_minEditBoxHeight = minEditInit.bottom - minEditInit.top;
+ m_minLogBoxHeight = m_minEditBoxHeight;
+ m_toolbarSize.cy = TOOLBAR_HEIGHT;
+ m_toolbarSize.cx = 0;
+ if (m_iSplitterPos == -1)
+ m_iSplitterPos = m_minEditBoxHeight;
if (m_wszInitialText) {
- SetDlgItemText(m_hwnd, IDC_MESSAGE, m_wszInitialText);
+ m_message.SetText(m_wszInitialText);
mir_free(m_wszInitialText);
}
else if (g_dat.flags & SMF_SAVEDRAFTS) {
+ int len = 0;
ptrW ptszSavedMsg(db_get_wsa(m_hContact, "SRMM", "SavedMsg"));
if (ptszSavedMsg)
- len = SetRichText(GetDlgItem(m_hwnd, IDC_MESSAGE), ptszSavedMsg);
- PostMessage(GetDlgItem(m_hwnd, IDC_MESSAGE), EM_SETSEL, len, len);
+ len = SetRichText(m_message.GetHwnd(), ptszSavedMsg);
+ PostMessage(m_message.GetHwnd(), EM_SETSEL, len, len);
}
Srmm_CreateToolbarIcons(m_hwnd, BBBF_ISIMBUTTON);
SendMessage(m_hwnd, DM_CHANGEICONS, 0, 0);
- SendDlgItemMessage(m_hwnd, IDC_LOG, EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback);
- SendDlgItemMessage(m_hwnd, IDC_LOG, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_LINK | ENM_KEYEVENTS);
- SendDlgItemMessage(m_hwnd, IDC_LOG, EM_SETEDITSTYLE, SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR);
- SendDlgItemMessage(m_hwnd, IDC_LOG, EM_SETLANGOPTIONS, 0, (LPARAM)SendDlgItemMessage(m_hwnd, IDC_LOG, EM_GETLANGOPTIONS, 0, 0) & ~(IMF_AUTOKEYBOARD | IMF_AUTOFONTSIZEADJUST));
- SendDlgItemMessage(m_hwnd, IDC_LOG, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(0, 0));
- SendDlgItemMessage(m_hwnd, IDC_LOG, EM_AUTOURLDETECT, TRUE, 0);
-
- SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SETLANGOPTIONS, 0, (LPARAM)SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD);
- SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback2);
- SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_CHANGE | ENM_REQUESTRESIZE);
- if (m_hContact && szProto) {
- int nMax = CallProtoService(szProto, PS_GETCAPS, PFLAG_MAXLENOFMESSAGE, m_hContact);
+ m_log.SendMsg(EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback);
+ m_log.SendMsg(EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_LINK | ENM_KEYEVENTS);
+ m_log.SendMsg(EM_SETEDITSTYLE, SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR);
+ m_log.SendMsg(EM_SETLANGOPTIONS, 0, (LPARAM)m_log.SendMsg(EM_GETLANGOPTIONS, 0, 0) & ~(IMF_AUTOKEYBOARD | IMF_AUTOFONTSIZEADJUST));
+ m_log.SendMsg(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(0, 0));
+ m_log.SendMsg(EM_AUTOURLDETECT, TRUE, 0);
+
+ m_message.SendMsg(EM_SETLANGOPTIONS, 0, (LPARAM)m_message.SendMsg(EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD);
+ m_message.SendMsg(EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback2);
+ m_message.SendMsg(EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_CHANGE | ENM_REQUESTRESIZE);
+ if (m_hContact && m_szProto) {
+ int nMax = CallProtoService(m_szProto, PS_GETCAPS, PFLAG_MAXLENOFMESSAGE, m_hContact);
if (nMax)
- SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_LIMITTEXT, nMax, 0);
+ m_message.SendMsg(EM_LIMITTEXT, nMax, 0);
}
// get around a lame bug in the Windows template resource code where richedits are limited to 0x7FFF
- SendDlgItemMessage(m_hwnd, IDC_LOG, EM_LIMITTEXT, sizeof(wchar_t) * 0x7FFFFFFF, 0);
+ m_log.SendMsg(EM_LIMITTEXT, sizeof(wchar_t) * 0x7FFFFFFF, 0);
SubclassLogEdit(GetDlgItem(m_hwnd, IDC_LOG));
- SubclassMessageEdit(GetDlgItem(m_hwnd, IDC_MESSAGE));
- infobarData = CreateInfobar(m_hwnd, this);
- if (flags & SMF_USEIEVIEW) {
+ SubclassMessageEdit(m_message.GetHwnd());
+ m_pInfobarData = CreateInfobar(m_hwnd, this);
+ if (m_bUseIEView) {
IEVIEWWINDOW ieWindow = { sizeof(IEVIEWWINDOW) };
ieWindow.iType = IEW_CREATE;
ieWindow.dwMode = IEWM_SCRIVER;
@@ -772,19 +766,19 @@ void CSrmmWindow::OnInitDialog() ieWindow.cx = 200;
ieWindow.cy = 300;
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
- hwndIeview = ieWindow.hwnd;
- if (hwndIeview == NULL)
- flags ^= SMF_USEIEVIEW;
+ m_hwndIeview = ieWindow.hwnd;
+ if (m_hwndIeview == NULL)
+ m_bUseIEView = false;
}
bool notifyUnread = false;
if (m_hContact) {
int historyMode = db_get_b(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY);
// This finds the first message to display, it works like shit
- hDbEventFirst = db_event_firstUnread(m_hContact);
- if (hDbEventFirst != NULL) {
+ m_hDbEventFirst = db_event_firstUnread(m_hContact);
+ if (m_hDbEventFirst != NULL) {
DBEVENTINFO dbei = {};
- db_event_get(hDbEventFirst, &dbei);
+ db_event_get(m_hDbEventFirst, &dbei);
if (DbEventIsMessageOrCustom(&dbei) && !(dbei.flags & DBEF_READ) && !(dbei.flags & DBEF_SENT))
notifyUnread = true;
}
@@ -794,28 +788,28 @@ void CSrmmWindow::OnInitDialog() switch (historyMode) {
case LOADHISTORY_COUNT:
for (int i = db_get_w(NULL, SRMMMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT); i > 0; i--) {
- if (hDbEventFirst == NULL)
+ if (m_hDbEventFirst == NULL)
hPrevEvent = db_event_last(m_hContact);
else
- hPrevEvent = db_event_prev(m_hContact, hDbEventFirst);
+ hPrevEvent = db_event_prev(m_hContact, m_hDbEventFirst);
if (hPrevEvent == NULL)
break;
dbei.cbBlob = 0;
- hDbEventFirst = hPrevEvent;
- db_event_get(hDbEventFirst, &dbei);
+ m_hDbEventFirst = hPrevEvent;
+ db_event_get(m_hDbEventFirst, &dbei);
if (!DbEventIsShown(dbei))
i++;
}
break;
case LOADHISTORY_TIME:
- if (hDbEventFirst == NULL) {
+ if (m_hDbEventFirst == NULL) {
dbei.timestamp = time(NULL);
hPrevEvent = db_event_last(m_hContact);
}
else {
- db_event_get(hDbEventFirst, &dbei);
- hPrevEvent = db_event_prev(m_hContact, hDbEventFirst);
+ db_event_get(m_hDbEventFirst, &dbei);
+ hPrevEvent = db_event_prev(m_hContact, m_hDbEventFirst);
}
DWORD firstTime = dbei.timestamp - 60 * db_get_w(NULL, SRMMMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME);
for (;;) {
@@ -826,7 +820,7 @@ void CSrmmWindow::OnInitDialog() if (dbei.timestamp < firstTime)
break;
if (DbEventIsShown(dbei))
- hDbEventFirst = hPrevEvent;
+ m_hDbEventFirst = hPrevEvent;
hPrevEvent = db_event_prev(m_hContact, hPrevEvent);
}
break;
@@ -840,24 +834,24 @@ void CSrmmWindow::OnInitDialog() do {
db_event_get(hdbEvent, &dbei);
if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) {
- lastMessage = dbei.timestamp;
+ m_lastMessage = dbei.timestamp;
break;
}
} while ((hdbEvent = db_event_prev(m_hContact, hdbEvent)));
}
SendMessage(m_hwnd, DM_OPTIONSAPPLIED, 0, 0);
- SendMessage(GetParent(m_hwnd), CM_POPUPWINDOW, m_bIncoming, (LPARAM)m_hwnd);
+ SendMessage(m_hwndParent, CM_POPUPWINDOW, m_bIncoming, (LPARAM)m_hwnd);
if (notifyUnread) {
- if (GetForegroundWindow() != m_hwndParent || parent->hwndActive != m_hwnd) {
- showUnread = 1;
+ if (GetForegroundWindow() != m_hwndParent || m_pParent->hwndActive != m_hwnd) {
+ m_iShowUnread = 1;
SendMessage(m_hwnd, DM_UPDATEICON, 0, 0);
SetTimer(m_hwnd, TIMERID_UNREAD, TIMEOUT_UNREAD, NULL);
}
SendMessage(m_hwndParent, CM_STARTFLASHING, 0, 0);
}
- messagesInProgress = ReattachSendQueueItems(m_hwnd, m_hContact);
- if (messagesInProgress > 0)
+ m_iMessagesInProgress = ReattachSendQueueItems(m_hwnd, m_hContact);
+ if (m_iMessagesInProgress > 0)
SendMessage(m_hwnd, DM_SHOWMESSAGESENDING, 0, 0);
NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_OPEN);
@@ -866,17 +860,20 @@ void CSrmmWindow::OnInitDialog() void CSrmmWindow::OnDestroy()
{
NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSING);
- if (nTypeMode == PROTOTYPE_SELFTYPING_ON)
+
+ if (m_nTypeMode == PROTOTYPE_SELFTYPING_ON)
NotifyTyping(PROTOTYPE_SELFTYPING_OFF);
- IcoLib_ReleaseIcon(statusIcon);
- IcoLib_ReleaseIcon(statusIconBig);
- if (statusIconOverlay != NULL) DestroyIcon(statusIconOverlay);
- statusIcon = NULL;
- statusIconOverlay = NULL;
+ IcoLib_ReleaseIcon(m_hStatusIcon); m_hStatusIcon = nullptr;
+ IcoLib_ReleaseIcon(m_hStatusIconBig); m_hStatusIconBig = nullptr;
+ if (m_hStatusIconOverlay != NULL) {
+ DestroyIcon(m_hStatusIconOverlay);
+ m_hStatusIconOverlay = NULL;
+ }
+
ReleaseSendQueueItems(m_hwnd);
if (g_dat.flags & SMF_SAVEDRAFTS) {
- ptrA szText(GetRichTextUtf(GetDlgItem(m_hwnd, IDC_MESSAGE)));
+ ptrA szText(GetRichTextUtf(m_message.GetHwnd()));
if (szText)
db_set_utf(m_hContact, "SRMM", "SavedMsg", szText);
else
@@ -886,21 +883,21 @@ void CSrmmWindow::OnDestroy() tcmdlist_free(cmdList);
WindowList_Remove(pci->hWindowList, m_hwnd);
- HFONT hFont = (HFONT)SendDlgItemMessage(m_hwnd, IDC_MESSAGE, WM_GETFONT, 0, 0);
+ HFONT hFont = (HFONT)m_message.SendMsg(WM_GETFONT, 0, 0);
if (hFont != NULL && hFont != (HFONT)SendDlgItemMessage(m_hwnd, IDOK, WM_GETFONT, 0, 0))
DeleteObject(hFont);
- db_set_b(m_hContact, SRMMMOD, "UseRTL", (BYTE)((flags & SMF_RTL) ? 1 : 0));
+ db_set_b(m_hContact, SRMMMOD, "UseRTL", m_bUseRtl);
if (m_hContact && (g_dat.flags & SMF_DELTEMP))
if (db_get_b(m_hContact, "CList", "NotOnList", 0))
db_delete_contact(m_hContact);
SetWindowLongPtr(m_hwnd, GWLP_USERDATA, 0);
SendMessage(m_hwndParent, CM_REMOVECHILD, 0, (LPARAM)m_hwnd);
- if (hwndIeview != NULL) {
+ if (m_hwndIeview != NULL) {
IEVIEWWINDOW ieWindow = { sizeof(ieWindow) };
ieWindow.iType = IEW_DESTROY;
- ieWindow.hwnd = hwndIeview;
+ ieWindow.hwnd = m_hwndIeview;
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
}
NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSE);
@@ -936,9 +933,9 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) break;
case WM_DROPFILES:
- if (szProto == NULL) break;
- if (!(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0)&PF1_FILESEND)) break;
- if (wStatus == ID_STATUS_OFFLINE) break;
+ if (m_szProto == nullptr) break;
+ if (!(CallProtoService(m_szProto, PS_GETCAPS, PFLAGNUM_1, 0)&PF1_FILESEND)) break;
+ if (m_wStatus == ID_STATUS_OFFLINE) break;
if (m_hContact != NULL) {
wchar_t szFilename[MAX_PATH];
HDROP hDrop = (HDROP)wParam;
@@ -962,13 +959,13 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) {
PROTO_AVATAR_INFORMATION ai = { 0 };
ai.hContact = m_hContact;
- CallProtoService(szProto, PS_GETAVATARINFO, GAIF_FORCE, (LPARAM)&ai);
+ CallProtoService(m_szProto, PS_GETAVATARINFO, GAIF_FORCE, (LPARAM)&ai);
ShowAvatar();
}
break;
case DM_TYPING:
- nTypeSecs = (int)lParam > 0 ? (int)lParam : 0;
+ m_nTypeSecs = (int)lParam > 0 ? (int)lParam : 0;
break;
case DM_CHANGEICONS:
@@ -985,7 +982,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) tcd.iFlags = TCDF_ICON;
tcd.hIcon = GetTabIcon();
SendMessage(m_hwndParent, CM_UPDATETABCONTROL, (WPARAM)&tcd, (LPARAM)m_hwnd);
- SendDlgItemMessage(m_hwnd, IDC_USERMENU, BM_SETIMAGE, IMAGE_ICON, (LPARAM)statusIcon);
+ SendDlgItemMessage(m_hwnd, IDC_USERMENU, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_hStatusIcon);
}
break;
@@ -1003,7 +1000,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) TitleBarData tbd = { 0 };
tbd.iFlags = TBDF_TEXT | TBDF_ICON;
GetTitlebarIcon(&tbd);
- tbd.pszText = GetWindowTitle(m_hContact, szProto);
+ tbd.pszText = GetWindowTitle(m_hContact, m_szProto);
SendMessage(m_hwndParent, CM_UPDATETITLEBAR, (WPARAM)&tbd, (LPARAM)m_hwnd);
mir_free(tbd.pszText);
}
@@ -1011,15 +1008,15 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) case DM_CLISTSETTINGSCHANGED:
if (wParam == m_hContact) {
- if (m_hContact && szProto) {
+ if (m_hContact && m_szProto) {
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam;
char idbuf[128], buf[128];
GetContactUniqueId(this, 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, szProto) && !mir_strcmp(cws->szSetting, "Status"))
- wStatus = cws->value.wVal;
+ 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);
@@ -1031,13 +1028,8 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) break;
case DM_OPTIONSAPPLIED:
- memset(&pf2, 0, sizeof(pf2));
- memset(&cf2, 0, sizeof(cf2));
- LOGFONT lf;
- COLORREF colour;
- flags &= ~SMF_USEIEVIEW;
- flags |= g_dat.ieviewInstalled ? g_dat.flags & SMF_USEIEVIEW : 0;
- if (flags & SMF_USEIEVIEW && hwndIeview == NULL) {
+ m_bUseIEView = g_dat.ieviewInstalled ? (g_dat.flags & SMF_USEIEVIEW) != 0 : false;
+ if (m_bUseIEView && m_hwndIeview == NULL) {
IEVIEWWINDOW ieWindow = { sizeof(ieWindow) };
ieWindow.iType = IEW_CREATE;
ieWindow.dwMode = IEWM_SCRIVER;
@@ -1045,54 +1037,60 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) ieWindow.cx = 200;
ieWindow.cy = 300;
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
- hwndIeview = ieWindow.hwnd;
- if (hwndIeview == NULL)
- flags ^= SMF_USEIEVIEW;
+ m_hwndIeview = ieWindow.hwnd;
+ if (m_hwndIeview == NULL)
+ m_bUseIEView = false;
}
- else if (!(flags & SMF_USEIEVIEW) && hwndIeview != NULL) {
- if (hwndIeview != NULL) {
+ else if (!m_bUseIEView && m_hwndIeview != NULL) {
+ if (m_hwndIeview != NULL) {
IEVIEWWINDOW ieWindow = { sizeof(ieWindow) };
ieWindow.iType = IEW_DESTROY;
- ieWindow.hwnd = hwndIeview;
+ ieWindow.hwnd = m_hwndIeview;
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
}
- hwndIeview = NULL;
+ m_hwndIeview = NULL;
}
SendMessage(m_hwnd, DM_GETAVATAR, 0, 0);
SetDialogToType();
+ {
+ COLORREF colour = db_get_dw(NULL, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR);
+ m_log.SendMsg(EM_SETBKGNDCOLOR, 0, colour);
+ colour = db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
+ m_message.SendMsg(EM_SETBKGNDCOLOR, 0, colour);
+ InvalidateRect(m_message.GetHwnd(), NULL, FALSE);
+
+ LOGFONT lf;
+ LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, &lf, &colour);
+
+ memset(&cf2, 0, sizeof(cf2));
+ cf2.cbSize = sizeof(cf2);
+ cf2.dwMask = CFM_COLOR | CFM_FACE | CFM_CHARSET | CFM_SIZE | CFM_WEIGHT | CFM_BOLD | CFM_ITALIC;
+ cf2.crTextColor = colour;
+ cf2.bCharSet = lf.lfCharSet;
+ wcsncpy(cf2.szFaceName, lf.lfFaceName, LF_FACESIZE);
+ cf2.dwEffects = ((lf.lfWeight >= FW_BOLD) ? CFE_BOLD : 0) | (lf.lfItalic ? CFE_ITALIC : 0);
+ cf2.wWeight = (WORD)lf.lfWeight;
+ cf2.bPitchAndFamily = lf.lfPitchAndFamily;
+ cf2.yHeight = abs(lf.lfHeight) * 1440 / g_dat.logPixelSY;
+ m_message.SendMsg(EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf2);
+ m_message.SendMsg(EM_SETLANGOPTIONS, 0, (LPARAM)m_message.SendMsg(EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD);
+ }
- colour = db_get_dw(NULL, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR);
- SendDlgItemMessage(m_hwnd, IDC_LOG, EM_SETBKGNDCOLOR, 0, colour);
- colour = db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
- SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SETBKGNDCOLOR, 0, colour);
- InvalidateRect(GetDlgItem(m_hwnd, IDC_MESSAGE), NULL, FALSE);
- LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, &lf, &colour);
- cf2.cbSize = sizeof(cf2);
- cf2.dwMask = CFM_COLOR | CFM_FACE | CFM_CHARSET | CFM_SIZE | CFM_WEIGHT | CFM_BOLD | CFM_ITALIC;
- cf2.crTextColor = colour;
- cf2.bCharSet = lf.lfCharSet;
- wcsncpy(cf2.szFaceName, lf.lfFaceName, LF_FACESIZE);
- cf2.dwEffects = ((lf.lfWeight >= FW_BOLD) ? CFE_BOLD : 0) | (lf.lfItalic ? CFE_ITALIC : 0);
- cf2.wWeight = (WORD)lf.lfWeight;
- cf2.bPitchAndFamily = lf.lfPitchAndFamily;
- cf2.yHeight = abs(lf.lfHeight) * 1440 / g_dat.logPixelSY;
- SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf2);
- SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SETLANGOPTIONS, 0, (LPARAM)SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD);
-
+ memset(&pf2, 0, sizeof(pf2));
pf2.cbSize = sizeof(pf2);
pf2.dwMask = PFM_OFFSET;
pf2.dxOffset = (g_dat.flags & SMF_INDENTTEXT) ? g_dat.indentSize * 1440 / g_dat.logPixelSX : 0;
SetDlgItemText(m_hwnd, IDC_LOG, L"");
- SendDlgItemMessage(m_hwnd, IDC_LOG, EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
- SendDlgItemMessage(m_hwnd, IDC_LOG, EM_SETLANGOPTIONS, 0, (LPARAM)SendDlgItemMessage(m_hwnd, IDC_LOG, EM_GETLANGOPTIONS, 0, 0) & ~(IMF_AUTOKEYBOARD | IMF_AUTOFONTSIZEADJUST));
+ m_log.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
+ 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);
SendMessage(m_hwnd, DM_UPDATETABCONTROL, 0, 0);
SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0);
- SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_REQUESTRESIZE, 0, 0);
- SetupInfobar(infobarData);
+ m_message.SendMsg(EM_REQUESTRESIZE, 0, 0);
+ SetupInfobar(m_pInfobarData);
break;
case DM_USERNAMETOCLIP:
@@ -1134,18 +1132,18 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) memset(&pf2, 0, sizeof(pf2));
pf2.cbSize = sizeof(pf2);
pf2.dwMask = PFM_RTLPARA;
- flags ^= SMF_RTL;
- if (flags & SMF_RTL) {
+ m_bUseRtl = !m_bUseRtl;
+ if (m_bUseRtl) {
pf2.wEffects = PFE_RTLPARA;
- SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_MESSAGE), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_MESSAGE), GWL_EXSTYLE) | WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR);
+ SetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE) | WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR);
SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LOG), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LOG), GWL_EXSTYLE) | WS_EX_LEFTSCROLLBAR);
}
else {
pf2.wEffects = 0;
- SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_MESSAGE), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_MESSAGE), GWL_EXSTYLE) &~(WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR));
+ SetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE, GetWindowLongPtr(m_message.GetHwnd(), GWL_EXSTYLE) &~(WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR));
SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LOG), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LOG), GWL_EXSTYLE) &~(WS_EX_LEFTSCROLLBAR));
}
- SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
+ m_message.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
SendMessage(m_hwnd, DM_REMAKELOG, 0, 0);
break;
@@ -1169,9 +1167,9 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) //fall through
case WM_MOUSEACTIVATE:
- if (hDbUnreadEventFirst != NULL) {
- MEVENT hDbEvent = hDbUnreadEventFirst;
- hDbUnreadEventFirst = NULL;
+ if (m_hDbUnreadEventFirst != NULL) {
+ MEVENT hDbEvent = m_hDbUnreadEventFirst;
+ m_hDbUnreadEventFirst = NULL;
while (hDbEvent != NULL) {
DBEVENTINFO dbei = {};
db_event_get(hDbEvent, &dbei);
@@ -1180,8 +1178,8 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) hDbEvent = db_event_next(m_hContact, hDbEvent);
}
}
- if (showUnread) {
- showUnread = 0;
+ if (m_iShowUnread) {
+ m_iShowUnread = 0;
KillTimer(m_hwnd, TIMERID_UNREAD);
SendMessage(m_hwnd, DM_UPDATEICON, 0, 0);
}
@@ -1196,8 +1194,8 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) HWND hLog;
POINT pt;
GetCursorPos(&pt);
- if (hwndIeview != NULL)
- hLog = hwndIeview;
+ if (m_hwndIeview != NULL)
+ hLog = m_hwndIeview;
else
hLog = m_log.GetHwnd();
@@ -1218,14 +1216,14 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) case DM_SETPARENT:
SetParent((HWND)lParam);
- parent = (ParentWindowData *)GetWindowLongPtr(m_hwndParent, GWLP_USERDATA);
+ m_pParent = (ParentWindowData *)GetWindowLongPtr(m_hwndParent, GWLP_USERDATA);
return TRUE;
case WM_GETMINMAXINFO:
{
MINMAXINFO *mmi = (MINMAXINFO *)lParam;
- mmi->ptMinTrackSize.x = toolbarSize.cx + BOTTOM_RIGHT_AVATAR_HEIGHT;
- mmi->ptMinTrackSize.y = minLogBoxHeight + toolbarSize.cy + minEditBoxHeight + max(INFO_BAR_HEIGHT, BOTTOM_RIGHT_AVATAR_HEIGHT - toolbarSize.cy) + 5;
+ mmi->ptMinTrackSize.x = m_toolbarSize.cx + BOTTOM_RIGHT_AVATAR_HEIGHT;
+ mmi->ptMinTrackSize.y = m_minLogBoxHeight + m_toolbarSize.cy + m_minEditBoxHeight + max(INFO_BAR_HEIGHT, BOTTOM_RIGHT_AVATAR_HEIGHT - m_toolbarSize.cy) + 5;
}
return 0;
@@ -1245,15 +1243,15 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) POINT pt = { 0, (int)wParam };
ScreenToClient(m_hwnd, &pt);
- splitterPos = rc.bottom - pt.y;
+ m_iSplitterPos = rc.bottom - pt.y;
SendMessage(m_hwnd, WM_SIZE, 0, 0);
}
break;
case DM_REMAKELOG:
- lastEventType = -1;
+ m_lastEventType = -1;
if (wParam == 0 || wParam == m_hContact)
- StreamInEvents(hDbEventFirst, -1, 0);
+ StreamInEvents(m_hDbEventFirst, -1, 0);
InvalidateRect(GetDlgItem(m_hwnd, IDC_LOG), NULL, FALSE);
break;
@@ -1263,7 +1261,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) break;
case DM_SCROLLLOGTOBOTTOM:
- if (hwndIeview == NULL) {
+ if (m_hwndIeview == NULL) {
if ((GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_LOG), GWL_STYLE) & WS_VSCROLL) == 0)
break;
@@ -1283,7 +1281,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) IEVIEWWINDOW ieWindow;
ieWindow.cbSize = sizeof(IEVIEWWINDOW);
ieWindow.iType = IEW_SCROLLBOTTOM;
- ieWindow.hwnd = hwndIeview;
+ ieWindow.hwnd = m_hwndIeview;
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
}
break;
@@ -1293,30 +1291,30 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) MEVENT hDbEvent = lParam;
DBEVENTINFO dbei = {};
db_event_get(hDbEvent, &dbei);
- if (hDbEventFirst == NULL)
- hDbEventFirst = hDbEvent;
+ if (m_hDbEventFirst == NULL)
+ m_hDbEventFirst = hDbEvent;
if (DbEventIsShown(dbei)) {
if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & (DBEF_SENT))) {
/* store the event when the container is hidden so that clist notifications can be removed */
- if (!IsWindowVisible(GetParent(m_hwnd)) && hDbUnreadEventFirst == NULL)
- hDbUnreadEventFirst = hDbEvent;
- lastMessage = dbei.timestamp;
+ if (!IsWindowVisible(m_hwndParent) && m_hDbUnreadEventFirst == NULL)
+ m_hDbUnreadEventFirst = hDbEvent;
+ m_lastMessage = dbei.timestamp;
SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0);
- if (GetForegroundWindow() == m_hwndParent && parent->hwndActive == m_hwnd)
+ if (GetForegroundWindow() == m_hwndParent && m_pParent->hwndActive == m_hwnd)
SkinPlaySound("RecvMsgActive");
else SkinPlaySound("RecvMsgInactive");
if ((g_dat.flags2 & SMF2_SWITCHTOACTIVE) && (IsIconic(m_hwndParent) || GetActiveWindow() != m_hwndParent) && IsWindowVisible(m_hwndParent))
SendMessage(m_hwndParent, CM_ACTIVATECHILD, 0, (LPARAM)m_hwnd);
if (IsAutoPopup(m_hContact))
- SendMessage(GetParent(m_hwnd), CM_POPUPWINDOW, 1, (LPARAM)m_hwnd);
+ SendMessage(m_hwndParent, CM_POPUPWINDOW, 1, (LPARAM)m_hwnd);
}
- if (hDbEvent != hDbEventFirst && db_event_next(m_hContact, hDbEvent) == NULL)
+ if (hDbEvent != m_hDbEventFirst && db_event_next(m_hContact, hDbEvent) == NULL)
SendMessage(m_hwnd, DM_APPENDTOLOG, WPARAM(hDbEvent), 0);
else
SendMessage(m_hwnd, DM_REMAKELOG, 0, 0);
if (!(dbei.flags & DBEF_SENT) && !DbEventIsCustomForMsgWindow(&dbei)) {
- if (GetActiveWindow() != m_hwndParent || GetForegroundWindow() != m_hwndParent || parent->hwndActive != m_hwnd) {
- showUnread = 1;
+ if (GetActiveWindow() != m_hwndParent || GetForegroundWindow() != m_hwndParent || m_pParent->hwndActive != m_hwnd) {
+ m_iShowUnread = 1;
SendMessage(m_hwnd, DM_UPDATEICON, 0, 0);
SetTimer(m_hwnd, TIMERID_UNREAD, TIMEOUT_UNREAD, NULL);
}
@@ -1327,25 +1325,25 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) break;
case GC_UPDATESTATUSBAR:
- if (parent->hwndActive == m_hwnd) {
+ if (m_pParent->hwndActive == m_hwnd) {
wchar_t szText[256];
StatusBarData sbd = { 0 };
sbd.iFlags = SBDF_TEXT | SBDF_ICON;
- if (messagesInProgress && (g_dat.flags & SMF_SHOWPROGRESS)) {
+ if (m_iMessagesInProgress && (g_dat.flags & SMF_SHOWPROGRESS)) {
sbd.hIcon = GetCachedIcon("scriver_DELIVERING");
sbd.pszText = szText;
- mir_snwprintf(szText, TranslateT("Sending in progress: %d message(s) left..."), messagesInProgress);
+ mir_snwprintf(szText, TranslateT("Sending in progress: %d message(s) left..."), m_iMessagesInProgress);
}
- else if (nTypeSecs) {
+ else if (m_nTypeSecs) {
sbd.hIcon = GetCachedIcon("scriver_TYPING");
sbd.pszText = szText;
mir_snwprintf(szText, TranslateT("%s is typing a message..."), pcli->pfnGetContactDisplayName(m_hContact, 0));
- nTypeSecs--;
+ m_nTypeSecs--;
}
- else if (lastMessage) {
+ else if (m_lastMessage) {
wchar_t date[64], time[64];
- TimeZone_PrintTimeStamp(NULL, lastMessage, L"d", date, _countof(date), 0);
- TimeZone_PrintTimeStamp(NULL, lastMessage, L"t", time, _countof(time), 0);
+ TimeZone_PrintTimeStamp(NULL, m_lastMessage, L"d", date, _countof(date), 0);
+ TimeZone_PrintTimeStamp(NULL, m_lastMessage, L"t", time, _countof(time), 0);
mir_snwprintf(szText, TranslateT("Last message received on %s at %s."), date, time);
sbd.pszText = szText;
}
@@ -1370,40 +1368,40 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) break;
case DM_CLEARLOG:
- if (hwndIeview != NULL) {
+ if (m_hwndIeview != NULL) {
IEVIEWEVENT evt = { sizeof(evt) };
evt.iType = IEE_CLEAR_LOG;
- evt.dwFlags = ((flags & SMF_RTL) ? IEEF_RTL : 0);
- evt.hwnd = hwndIeview;
+ evt.dwFlags = (m_bUseRtl) ? IEEF_RTL : 0;
+ evt.hwnd = m_hwndIeview;
evt.hContact = m_hContact;
- evt.pszProto = szProto;
+ evt.pszProto = m_szProto;
CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&evt);
}
SetDlgItemText(m_hwnd, IDC_LOG, L"");
- hDbEventFirst = NULL;
- lastEventType = -1;
+ m_hDbEventFirst = NULL;
+ m_lastEventType = -1;
break;
case WM_TIMER:
if (wParam == TIMERID_MSGSEND)
ReportSendQueueTimeouts(m_hwnd);
else if (wParam == TIMERID_TYPE) {
- if (nTypeMode == PROTOTYPE_SELFTYPING_ON && GetTickCount() - nLastTyping > TIMEOUT_TYPEOFF)
+ if (m_nTypeMode == PROTOTYPE_SELFTYPING_ON && GetTickCount() - m_nLastTyping > TIMEOUT_TYPEOFF)
NotifyTyping(PROTOTYPE_SELFTYPING_OFF);
- if (showTyping) {
- if (nTypeSecs)
- nTypeSecs--;
+ if (m_bShowTyping) {
+ if (m_nTypeSecs)
+ m_nTypeSecs--;
else {
- showTyping = 0;
+ m_bShowTyping = false;
SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0);
SendMessage(m_hwnd, DM_UPDATEICON, 0, 0);
}
}
else {
- if (nTypeSecs) {
- showTyping = 1;
+ if (m_nTypeSecs) {
+ m_bShowTyping = true;
SendMessage(m_hwnd, GC_UPDATESTATUSBAR, 0, 0);
SendMessage(m_hwnd, DM_UPDATEICON, 0, 0);
}
@@ -1412,9 +1410,9 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) else if (wParam == TIMERID_UNREAD) {
TabControlData tcd;
tcd.iFlags = TCDF_ICON;
- if (!showTyping) {
- showUnread++;
- tcd.hIcon = (showUnread & 1) ? statusIconOverlay : statusIcon;
+ if (!m_bShowTyping) {
+ m_iShowUnread++;
+ tcd.hIcon = (m_iShowUnread & 1) ? m_hStatusIconOverlay : m_hStatusIcon;
SendMessage(m_hwndParent, CM_UPDATETABCONTROL, (WPARAM)&tcd, (LPARAM)m_hwnd);
}
}
@@ -1427,7 +1425,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) MessageSendQueueItem *item = CreateSendQueueItem(m_hwnd);
item->hContact = m_hContact;
- item->proto = mir_strdup(szProto);
+ item->proto = mir_strdup(m_szProto);
item->flags = msi->flags;
item->sendBufferSize = msi->sendBufferSize;
item->sendBuffer = mir_strndup(msi->sendBuffer, msi->sendBufferSize);
@@ -1436,7 +1434,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) break;
case DM_STARTMESSAGESENDING:
- messagesInProgress++;
+ m_iMessagesInProgress++;
case DM_SHOWMESSAGESENDING:
SetTimer(m_hwnd, TIMERID_MSGSEND, 1000, NULL);
if (g_dat.flags & SMF_SHOWPROGRESS)
@@ -1444,12 +1442,12 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) break;
case DM_STOPMESSAGESENDING:
- if (messagesInProgress > 0) {
- messagesInProgress--;
+ if (m_iMessagesInProgress > 0) {
+ m_iMessagesInProgress--;
if (g_dat.flags & SMF_SHOWPROGRESS)
SendMessage(GetHwnd(), GC_UPDATESTATUSBAR, 0, 0);
}
- if (messagesInProgress == 0)
+ if (m_iMessagesInProgress == 0)
KillTimer(m_hwnd, TIMERID_MSGSEND);
break;
@@ -1468,7 +1466,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) switch (wParam) {
case MSGERROR_CANCEL:
RemoveSendQueueItem(item);
- SetFocus(GetDlgItem(m_hwnd, IDC_MESSAGE));
+ SetFocus(m_message.GetHwnd());
break;
case MSGERROR_RETRY:
SendMessage(m_hwnd, DM_STARTMESSAGESENDING, 0, 0);
@@ -1499,9 +1497,9 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) rect.bottom = itemHeight - 1;
FillRect(hdcMem, &rect, GetSysColorBrush(COLOR_BTNFACE));
- if (avatarPic && (g_dat.flags&SMF_AVATAR)) {
+ if (m_hbmpAvatarPic && (g_dat.flags & SMF_AVATAR)) {
BITMAP bminfo;
- GetObject(avatarPic, sizeof(bminfo), &bminfo);
+ GetObject(m_hbmpAvatarPic, sizeof(bminfo), &bminfo);
if (bminfo.bmWidth != 0 && bminfo.bmHeight != 0) {
avatarHeight = itemHeight;
avatarWidth = bminfo.bmWidth * avatarHeight / bminfo.bmHeight;
@@ -1543,12 +1541,12 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) switch (LOWORD(wParam)) {
case IDC_SENDALL:
int result;
- if (sendAllConfirm == 0) {
+ if (m_iSendAllConfirm == 0) {
result = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_CONFIRM_SENDALL), m_hwnd, ConfirmSendAllDlgProc, (LPARAM)m_hwnd);
if (result & 0x10000)
- sendAllConfirm = result;
+ m_iSendAllConfirm = result;
}
- else result = sendAllConfirm;
+ else result = m_iSendAllConfirm;
if (LOWORD(result) != IDYES)
break;
@@ -1562,9 +1560,9 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) memset(&pf2, 0, sizeof(pf2));
pf2.cbSize = sizeof(pf2);
pf2.dwMask = PFM_RTLPARA;
- SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_GETPARAFORMAT, 0, (LPARAM)&pf2);
+ m_message.SendMsg(EM_GETPARAFORMAT, 0, (LPARAM)&pf2);
- int bufSize = GetRichTextLength(GetDlgItem(m_hwnd, IDC_MESSAGE), 1200, TRUE) + 2;
+ int bufSize = GetRichTextLength(m_message.GetHwnd(), 1200, TRUE) + 2;
ptrW ptszUnicode((wchar_t*)mir_alloc(bufSize * sizeof(wchar_t)));
MessageSendQueueItem msi = { 0 };
@@ -1575,7 +1573,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) gt.flags = GT_USECRLF;
gt.cb = bufSize;
gt.codepage = 1200; // Unicode
- SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_GETTEXTEX, (WPARAM)>, ptszUnicode);
+ m_message.SendMsg(EM_GETTEXTEX, (WPARAM)>, ptszUnicode);
if (RTL_Detect(ptszUnicode))
msi.flags |= PREF_RTL;
@@ -1595,7 +1593,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) cmdListCurrent = NULL;
- if (nTypeMode == PROTOTYPE_SELFTYPING_ON)
+ if (m_nTypeMode == PROTOTYPE_SELFTYPING_ON)
NotifyTyping(PROTOTYPE_SELFTYPING_OFF);
SetDlgItemText(m_hwnd, IDC_MESSAGE, L"");
@@ -1634,42 +1632,42 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) break;
case IDC_QUOTE:
- if (hDbEventLast != NULL) {
+ if (m_hDbEventLast != NULL) {
SETTEXTEX st;
st.flags = ST_SELECTION;
st.codepage = 1200;
wchar_t *buffer = NULL;
- if (hwndIeview != NULL)
+ if (m_hwndIeview != NULL)
buffer = GetIEViewSelection(this);
else
buffer = GetRichEditSelection(GetDlgItem(m_hwnd, IDC_LOG));
if (buffer != NULL) {
wchar_t *quotedBuffer = GetQuotedTextW(buffer);
- SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&st, (LPARAM)quotedBuffer);
+ m_message.SendMsg(EM_SETTEXTEX, (WPARAM)&st, (LPARAM)quotedBuffer);
mir_free(quotedBuffer);
mir_free(buffer);
}
else {
DBEVENTINFO dbei = {};
- dbei.cbBlob = db_event_getBlobSize(hDbEventLast);
+ dbei.cbBlob = db_event_getBlobSize(m_hDbEventLast);
if (dbei.cbBlob == 0xFFFFFFFF)
break;
dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob);
- db_event_get(hDbEventLast, &dbei);
+ db_event_get(m_hDbEventLast, &dbei);
if (DbEventIsMessageOrCustom(&dbei)) {
buffer = DbEvent_GetTextW(&dbei, CP_ACP);
if (buffer != NULL) {
wchar_t *quotedBuffer = GetQuotedTextW(buffer);
- SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&st, (LPARAM)quotedBuffer);
+ m_message.SendMsg(EM_SETTEXTEX, (WPARAM)&st, (LPARAM)quotedBuffer);
mir_free(quotedBuffer);
mir_free(buffer);
}
}
mir_free(dbei.pBlob);
}
- SetFocus(GetDlgItem(m_hwnd, IDC_MESSAGE));
+ SetFocus(m_message.GetHwnd());
}
break;
@@ -1686,17 +1684,17 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) case IDC_MESSAGE:
if (HIWORD(wParam) == EN_CHANGE) {
- int len = GetRichTextLength(GetDlgItem(m_hwnd, IDC_MESSAGE), 1200, FALSE);
+ int len = GetRichTextLength(m_message.GetHwnd(), 1200, FALSE);
cmdListCurrent = NULL;
UpdateReadChars();
EnableWindow(GetDlgItem(m_hwnd, IDOK), len != 0);
if (!(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_SHIFT) & 0x8000)) {
- nLastTyping = GetTickCount();
+ m_nLastTyping = GetTickCount();
if (len != 0) {
- if (nTypeMode == PROTOTYPE_SELFTYPING_OFF)
+ if (m_nTypeMode == PROTOTYPE_SELFTYPING_OFF)
NotifyTyping(PROTOTYPE_SELFTYPING_ON);
}
- else if (nTypeMode == PROTOTYPE_SELFTYPING_ON)
+ else if (m_nTypeMode == PROTOTYPE_SELFTYPING_ON)
NotifyTyping(PROTOTYPE_SELFTYPING_OFF);
}
}
@@ -1711,7 +1709,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) switch (pNmhdr->code) {
case EN_MSGFILTER:
{
- int result = InputAreaShortcuts(GetDlgItem(m_hwnd, IDC_MESSAGE), ((MSGFILTER *)lParam)->msg, ((MSGFILTER *)lParam)->wParam, ((MSGFILTER *)lParam)->lParam, this);
+ int result = InputAreaShortcuts(m_message.GetHwnd(), ((MSGFILTER *)lParam)->msg, ((MSGFILTER *)lParam)->wParam, ((MSGFILTER *)lParam)->lParam, this);
if (result != -1) {
SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, TRUE);
return TRUE;
@@ -1721,8 +1719,8 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) switch (((MSGFILTER *)lParam)->msg) {
case WM_CHAR:
if (!(GetKeyState(VK_CONTROL) & 0x8000)) {
- SetFocus(GetDlgItem(m_hwnd, IDC_MESSAGE));
- SendDlgItemMessage(m_hwnd, IDC_MESSAGE, ((MSGFILTER *)lParam)->msg, ((MSGFILTER *)lParam)->wParam, ((MSGFILTER *)lParam)->lParam);
+ SetFocus(m_message.GetHwnd());
+ m_message.SendMsg(((MSGFILTER *)lParam)->msg, ((MSGFILTER *)lParam)->wParam, ((MSGFILTER *)lParam)->lParam);
SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, TRUE);
}
return TRUE;
@@ -1764,8 +1762,8 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) if (height < g_dat.minInputAreaHeight)
height = g_dat.minInputAreaHeight;
- if (desiredInputAreaHeight != height) {
- desiredInputAreaHeight = height;
+ if (m_iDesiredInputAreaHeight != height) {
+ m_iDesiredInputAreaHeight = height;
SendMessage(m_hwnd, WM_SIZE, 0, 0);
PostMessage(m_hwnd, DM_SCROLLLOGTOBOTTOM, 0, 0);
}
@@ -1775,8 +1773,8 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) break;
case WM_CHAR:
- SetFocus(GetDlgItem(m_hwnd, IDC_MESSAGE));
- SendDlgItemMessage(m_hwnd, IDC_MESSAGE, msg, wParam, lParam);
+ SetFocus(m_message.GetHwnd());
+ m_message.SendMsg(msg, wParam, lParam);
break;
}
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index f0b009f737..923122dcbc 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -138,13 +138,13 @@ EventData* getEventFromDB(CSrmmWindow *dat, MCONTACT hContact, MEVENT hDbEvent) evt->dwFlags = (dbei.flags & DBEF_READ ? IEEDF_READ : 0) | (dbei.flags & DBEF_SENT ? IEEDF_SENT : 0) | (dbei.flags & DBEF_RTL ? IEEDF_RTL : 0);
evt->dwFlags |= IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK | IEEDF_UNICODE_TEXT2;
- if (dat->flags & SMF_RTL)
+ if (dat->m_bUseRtl)
evt->dwFlags |= IEEDF_RTL;
evt->time = dbei.timestamp;
evt->pszNick = NULL;
if (evt->dwFlags & IEEDF_SENT)
- evt->pszNickT = Contact_GetInfo(CNF_DISPLAY, NULL, dat->szProto);
+ evt->pszNickT = Contact_GetInfo(CNF_DISPLAY, NULL, dat->m_szProto);
else
evt->pszNickT = mir_wstrdup(pcli->pfnGetContactDisplayName(hContact, 0));
@@ -157,7 +157,7 @@ EventData* getEventFromDB(CSrmmWindow *dat, MCONTACT hContact, MEVENT hDbEvent) }
else evt->pszTextT = DbEvent_GetTextW(&dbei, CP_UTF8);
- if (!(dat->flags & SMF_RTL) && RTL_Detect(evt->pszTextT))
+ if (!dat->m_bUseRtl && RTL_Detect(evt->pszTextT))
evt->dwFlags |= IEEDF_RTL;
mir_free(dbei.pBlob);
@@ -483,14 +483,14 @@ static char* CreateRTFFromEvent(CSrmmWindow *dat, EventData *evt, GlobalMessageD int isGroupBreak = TRUE;
int highlight = 0;
- if ((gdat->flags & SMF_GROUPMESSAGES) && evt->dwFlags == LOWORD(dat->lastEventType) &&
- evt->eventType == EVENTTYPE_MESSAGE && HIWORD(dat->lastEventType) == EVENTTYPE_MESSAGE &&
- (isSameDate(evt->time, dat->lastEventTime)) && ((((int)evt->time < dat->startTime) == (dat->lastEventTime < dat->startTime)) || !(evt->dwFlags & IEEDF_READ))) {
+ if ((gdat->flags & SMF_GROUPMESSAGES) && evt->dwFlags == LOWORD(dat->m_lastEventType) &&
+ evt->eventType == EVENTTYPE_MESSAGE && HIWORD(dat->m_lastEventType) == EVENTTYPE_MESSAGE &&
+ (isSameDate(evt->time, dat->m_lastEventTime)) && ((((int)evt->time < dat->m_startTime) == (dat->m_lastEventTime < dat->m_startTime)) || !(evt->dwFlags & IEEDF_READ))) {
isGroupBreak = FALSE;
}
CMStringA buf;
- if (!streamData->isFirst && !dat->isMixed) {
+ if (!streamData->isFirst && !dat->m_isMixed) {
if (isGroupBreak || gdat->flags & SMF_MARKFOLLOWUPS)
buf.Append("\\par");
else
@@ -498,7 +498,7 @@ static char* CreateRTFFromEvent(CSrmmWindow *dat, EventData *evt, GlobalMessageD }
if (evt->dwFlags & IEEDF_RTL)
- dat->isMixed = 1;
+ dat->m_isMixed = 1;
if (!streamData->isFirst && isGroupBreak && (gdat->flags & SMF_DRAWLINES))
buf.AppendFormat("\\sl-1\\slmult0\\highlight%d\\cf%d\\fs1 \\par\\sl0", fontOptionsListSize + 4, fontOptionsListSize + 4);
@@ -511,14 +511,14 @@ static char* CreateRTFFromEvent(CSrmmWindow *dat, EventData *evt, GlobalMessageD highlight = fontOptionsListSize + 1;
buf.AppendFormat("\\highlight%d\\cf%d", highlight, highlight);
- if (!streamData->isFirst && dat->isMixed) {
+ if (!streamData->isFirst && dat->m_isMixed) {
if (isGroupBreak)
buf.Append("\\sl-1 \\par\\sl0");
else
buf.Append("\\sl-1 \\line\\sl0");
}
streamData->isFirst = FALSE;
- if (dat->isMixed) {
+ if (dat->m_isMixed) {
if (evt->dwFlags & IEEDF_RTL)
buf.Append("\\ltrch\\rtlch");
else
@@ -650,11 +650,11 @@ static char* CreateRTFFromEvent(CSrmmWindow *dat, EventData *evt, GlobalMessageD AppendWithCustomLinks(evt, style, buf);
break;
}
- if (dat->isMixed)
+ if (dat->m_isMixed)
buf.Append("\\par");
- dat->lastEventTime = evt->time;
- dat->lastEventType = MAKELONG(evt->dwFlags, evt->eventType);
+ dat->m_lastEventTime = evt->time;
+ dat->m_lastEventType = MAKELONG(evt->dwFlags, evt->eventType);
return buf.Detach();
}
@@ -738,21 +738,16 @@ void StreamInTestEvents(HWND hEditWnd, GlobalMessageData *gdat) void CSrmmWindow::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend)
{
- FINDTEXTEXA fi;
- EDITSTREAM stream = { 0 };
- LogStreamData streamData = { 0 };
- CHARRANGE oldSel, sel;
-
// IEVIew MOD Begin
- if (hwndIeview != NULL) {
+ if (m_hwndIeview != NULL) {
IEVIEWEVENT evt;
IEVIEWWINDOW ieWindow;
memset(&evt, 0, sizeof(evt));
evt.cbSize = sizeof(evt);
- evt.dwFlags = ((flags & SMF_RTL) ? IEEF_RTL : 0);
- evt.hwnd = hwndIeview;
+ evt.dwFlags = (m_bUseRtl) ? IEEF_RTL : 0;
+ evt.hwnd = m_hwndIeview;
evt.hContact = m_hContact;
- evt.pszProto = szProto;
+ evt.pszProto = m_szProto;
if (!fAppend) {
evt.iType = IEE_CLEAR_LOG;
CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&evt);
@@ -761,30 +756,36 @@ void CSrmmWindow::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend) evt.hDbEventFirst = hDbEventFirst;
evt.count = count;
CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&evt);
- hDbEventLast = evt.hDbEventFirst != NULL ? evt.hDbEventFirst : hDbEventLast;
+ m_hDbEventLast = evt.hDbEventFirst != NULL ? evt.hDbEventFirst : m_hDbEventLast;
memset(&ieWindow, 0, sizeof(ieWindow));
ieWindow.cbSize = sizeof(ieWindow);
ieWindow.iType = IEW_SCROLLBOTTOM;
- ieWindow.hwnd = hwndIeview;
+ ieWindow.hwnd = m_hwndIeview;
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
return;
}
// IEVIew MOD End
+ CHARRANGE oldSel, sel;
m_log.SendMsg(EM_HIDESELECTION, TRUE, 0);
m_log.SendMsg(EM_EXGETSEL, 0, (LPARAM)&oldSel);
+ LogStreamData streamData = {};
streamData.hContact = m_hContact;
streamData.hDbEvent = hDbEventFirst;
- streamData.hDbEventLast = hDbEventLast;
+ streamData.hDbEventLast = m_hDbEventLast;
streamData.dlgDat = this;
streamData.eventsToInsert = count;
streamData.isFirst = fAppend ? GetRichTextLength(m_log.GetHwnd(), CP_ACP, FALSE) == 0 : 1;
streamData.gdat = &g_dat;
+
+ EDITSTREAM stream = {};
stream.pfnCallback = LogStreamInEvents;
stream.dwCookie = (DWORD_PTR)& streamData;
sel.cpMin = 0;
+
+ FINDTEXTEXA fi;
if (fAppend) {
GETTEXTLENGTHEX gtxl = { 0 };
gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMCHARS;
@@ -800,7 +801,7 @@ void CSrmmWindow::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend) sel.cpMax = GetRichTextLength(m_log.GetHwnd(), 1200, FALSE);
m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel);
fi.chrg.cpMin = 0;
- isMixed = 0;
+ m_isMixed = 0;
}
m_log.SendMsg(EM_STREAMIN, fAppend ? SFF_SELECTION | SF_RTF : SFF_SELECTION | SF_RTF, (LPARAM)&stream);
@@ -813,7 +814,7 @@ void CSrmmWindow::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend) smre.hwndRichEditControl = m_log.GetHwnd();
MCONTACT hContact = db_mc_getSrmmSub(m_hContact);
- smre.Protocolname = (hContact != NULL) ? GetContactProto(hContact) : szProto;
+ smre.Protocolname = (hContact != NULL) ? GetContactProto(hContact) : m_szProto;
if (fi.chrg.cpMin > 0) {
sel.cpMin = fi.chrg.cpMin;
@@ -834,7 +835,7 @@ void CSrmmWindow::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend) if (!fAppend)
m_log.SendMsg(WM_SETREDRAW, TRUE, 0);
- hDbEventLast = streamData.hDbEventLast;
+ m_hDbEventLast = streamData.hDbEventLast;
PostMessage(m_hwnd, DM_SCROLLLOGTOBOTTOM, 0, 0);
}
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 5197599dce..579f63e7a0 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -318,22 +318,21 @@ static INT_PTR SetStatusText(WPARAM hContact, LPARAM lParam) return 1;
SESSION_INFO *si = (SESSION_INFO*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if (si == NULL || si->parent == NULL)
+ if (si == NULL || si->m_pParent == NULL)
return 1;
- pdat = si->parent;
+ pdat = si->m_pParent;
}
else {
CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if (dat == NULL || dat->parent == NULL)
+ if (dat == NULL || dat->m_pParent == NULL)
return 1;
- pdat = dat->parent;
+ pdat = dat->m_pParent;
}
SendMessage(pdat->hwndStatus, SB_SETICON, 0, (LPARAM)(st == NULL ? 0 : st->hIcon));
SendMessage(pdat->hwndStatus, SB_SETTEXT, 0, (LPARAM)(st == NULL ? L"" : st->tszText));
-
return 0;
}
diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index 70ee0f9704..a2873ce784 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -94,9 +94,9 @@ struct MessageWindowTabData struct CommonWindowData
{
- ParentWindowData *parent;
- int minLogBoxHeight, minEditBoxHeight;
- HWND hwndIeview;
+ ParentWindowData *m_pParent;
+ int m_minLogBoxHeight, m_minEditBoxHeight;
+ HWND m_hwndIeview;
TCmdList *cmdList, *cmdListCurrent;
};
@@ -105,22 +105,22 @@ class CSrmmWindow : public CSrmmBaseDialog, public MZeroedObject, public CommonW CCtrlEdit m_log, m_message;
wchar_t *m_wszInitialText;
- bool m_bIncoming;
+ bool m_bIncoming, m_bShowTyping;
- MEVENT hDbEventFirst, hDbEventLast, hDbUnreadEventFirst;
- int splitterPos;
- int desiredInputAreaHeight;
- SIZE toolbarSize;
- int windowWasCascaded;
- int nTypeSecs, nTypeMode, nLastTyping;
- int showTyping, showUnread;
- WORD wStatus;
- DWORD lastMessage;
- int messagesInProgress;
- int sendAllConfirm;
- HICON statusIcon, statusIconBig, statusIconOverlay;
-
- InfobarWindowData *infobarData;
+ MEVENT m_hDbEventFirst, m_hDbEventLast, m_hDbUnreadEventFirst;
+ int m_iSplitterPos;
+ int m_iDesiredInputAreaHeight;
+ SIZE m_toolbarSize;
+ int m_iWindowWasCascaded;
+ int m_nTypeSecs, m_nTypeMode, m_nLastTyping;
+ int m_iShowUnread;
+ WORD m_wStatus;
+ DWORD m_lastMessage;
+ int m_iMessagesInProgress;
+ int m_iSendAllConfirm;
+ HICON m_hStatusIcon, m_hStatusIconBig, m_hStatusIconOverlay;
+
+ InfobarWindowData *m_pInfobarData;
HICON GetTabIcon();
void GetTitlebarIcon(struct TitleBarData *tbd);
@@ -137,14 +137,14 @@ class CSrmmWindow : public CSrmmBaseDialog, public MZeroedObject, public CommonW public:
MCONTACT m_hContact;
- char *szProto;
- time_t startTime, lastEventTime;
- int lastEventType;
- int isMixed;
- DWORD flags;
-
- HBITMAP avatarPic;
- AVATARCACHEENTRY *ace;
+ char *m_szProto;
+ time_t m_startTime, m_lastEventTime;
+ int m_lastEventType;
+ int m_isMixed;
+ bool m_bUseRtl, m_bUseIEView;
+
+ HBITMAP m_hbmpAvatarPic;
+ AVATARCACHEENTRY *m_ace;
public:
CSrmmWindow(MCONTACT hContact, bool bIncoming = false, const char *szInitialText = NULL, bool bIsUnicode = false);
diff --git a/plugins/Scriver/src/utils.cpp b/plugins/Scriver/src/utils.cpp index 6f6b20209d..11a012b094 100644 --- a/plugins/Scriver/src/utils.cpp +++ b/plugins/Scriver/src/utils.cpp @@ -387,7 +387,7 @@ void SetSearchEngineIcons(HMENU hMenu, HIMAGELIST hImageList) void GetContactUniqueId(CSrmmWindow *dat, char *buf, int maxlen)
{
- ptrW id(Contact_GetInfo(CNF_UNIQUEID, dat->m_hContact, dat->szProto));
+ ptrW id(Contact_GetInfo(CNF_UNIQUEID, dat->m_hContact, dat->m_szProto));
if (id != NULL)
strncpy_s(buf, maxlen, _T2A(id), _TRUNCATE);
}
diff --git a/plugins/Scriver/src/version.h b/plugins/Scriver/src/version.h index 8da9620ec9..d3a60aa1f5 100644 --- a/plugins/Scriver/src/version.h +++ b/plugins/Scriver/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 3 #define __MINOR_VERSION 0 #define __RELEASE_NUM 1 -#define __BUILD_NUM 1 +#define __BUILD_NUM 2 #include <stdver.h> |