summaryrefslogtreecommitdiff
path: root/plugins/Scriver/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Scriver/src')
-rw-r--r--plugins/Scriver/src/Version.h4
-rw-r--r--plugins/Scriver/src/chat/chat.h4
-rw-r--r--plugins/Scriver/src/chat/main.cpp2
-rw-r--r--plugins/Scriver/src/chat/window.cpp364
-rw-r--r--plugins/Scriver/src/infobar.cpp202
-rw-r--r--plugins/Scriver/src/input.cpp2
-rw-r--r--plugins/Scriver/src/msgdialog.cpp267
-rw-r--r--plugins/Scriver/src/msglog.cpp32
-rw-r--r--plugins/Scriver/src/msgs.cpp43
-rw-r--r--plugins/Scriver/src/msgs.h7
-rw-r--r--plugins/Scriver/src/msgtimedout.cpp3
-rw-r--r--plugins/Scriver/src/utils.cpp2
12 files changed, 458 insertions, 474 deletions
diff --git a/plugins/Scriver/src/Version.h b/plugins/Scriver/src/Version.h
index 11c7493910..513ee3ea39 100644
--- a/plugins/Scriver/src/Version.h
+++ b/plugins/Scriver/src/Version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 2
-#define __MINOR_VERSION 11
+#define __MINOR_VERSION 12
#define __RELEASE_NUM 1
-#define __BUILD_NUM 3
+#define __BUILD_NUM 1
#include <stdver.h>
diff --git a/plugins/Scriver/src/chat/chat.h b/plugins/Scriver/src/chat/chat.h
index e3bde037eb..0c382107ea 100644
--- a/plugins/Scriver/src/chat/chat.h
+++ b/plugins/Scriver/src/chat/chat.h
@@ -59,12 +59,10 @@ struct LOGSTREAMDATA : public GCLogStreamDataBase
BOOL isFirst;
};
-struct SESSION_INFO : public GCSessionInfoBase
+struct SESSION_INFO : public GCSessionInfoBase, public CommonWindowData
{
TCHAR szSearch[255];
int desiredInputAreaHeight;
-
- CommonWindowData windowData;
};
struct GlobalLogSettings : public GlobalLogSettingsBase
diff --git a/plugins/Scriver/src/chat/main.cpp b/plugins/Scriver/src/chat/main.cpp
index 0efe6a8526..2d121c4806 100644
--- a/plugins/Scriver/src/chat/main.cpp
+++ b/plugins/Scriver/src/chat/main.cpp
@@ -55,7 +55,7 @@ static void OnAddLog(SESSION_INFO *si, int isOk)
static void OnCreateSession(SESSION_INFO *si, MODULEINFO*)
{
- si->windowData.flags = CWDF_RTF_INPUT;
+ si->flags = CWDF_RTF_INPUT;
}
static void OnDblClickSession(SESSION_INFO *si)
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp
index 2b74246618..d034d768e4 100644
--- a/plugins/Scriver/src/chat/window.cpp
+++ b/plugins/Scriver/src/chat/window.cpp
@@ -38,23 +38,22 @@ static ToolbarButton toolbarButtons[] = {
struct MESSAGESUBDATA
{
time_t lastEnterTime;
- TCHAR* szSearchQuery;
- TCHAR* szSearchResult;
+ TCHAR *szSearchQuery;
+ TCHAR *szSearchResult;
SESSION_INFO *lastSession;
};
static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
+ RECT rc;
+
switch (msg) {
case WM_NCHITTEST:
return HTCLIENT;
case WM_SETCURSOR:
- {
- RECT rc;
- GetClientRect(hwnd, &rc);
- SetCursor(rc.right > rc.bottom ? hCurSplitNS : hCurSplitWE);
- }
+ GetClientRect(hwnd, &rc);
+ SetCursor(rc.right > rc.bottom ? hCurSplitNS : hCurSplitWE);
return TRUE;
case WM_LBUTTONDOWN:
@@ -63,7 +62,6 @@ static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
case WM_MOUSEMOVE:
if (GetCapture() == hwnd) {
- RECT rc;
GetClientRect(hwnd, &rc);
SendMessage(GetParent(hwnd), GC_SPLITTERMOVED, rc.right > rc.bottom ? (short)HIWORD(GetMessagePos()) + rc.bottom / 2 : (short)LOWORD(GetMessagePos()) + rc.right / 2, (LPARAM)hwnd);
}
@@ -139,7 +137,7 @@ static void MessageDialogResize(HWND hwndDlg, SESSION_INFO *si, int w, int h)
BOOL bNick = si->iType != GCW_SERVER && si->bNicklistEnabled;
BOOL bToolbar = SendMessage(GetParent(hwndDlg), CM_GETTOOLBARSTATUS, 0, 0);
int buttonVisibility = bToolbar ? g_dat.chatBbuttonVisibility : 0;
- int hSplitterMinTop = TOOLBAR_HEIGHT + si->windowData.minLogBoxHeight, hSplitterMinBottom = si->windowData.minEditBoxHeight;
+ int hSplitterMinTop = TOOLBAR_HEIGHT + si->minLogBoxHeight, hSplitterMinBottom = si->minEditBoxHeight;
int toolbarHeight = bToolbar ? IsToolbarVisible(SIZEOF(toolbarButtons), g_dat.chatBbuttonVisibility) ? TOOLBAR_HEIGHT : TOOLBAR_HEIGHT / 3 : 0;
si->iSplitterY = si->desiredInputAreaHeight + SPLITTER_HEIGHT + 3;
@@ -170,7 +168,7 @@ static void MessageDialogResize(HWND hwndDlg, SESSION_INFO *si, int w, int h)
HDWP hdwp = BeginDeferWindowPos(20);
toolbarTopY = bToolbar ? h - si->iSplitterY - toolbarHeight : h - si->iSplitterY;
- if (si->windowData.hwndLog != NULL)
+ if (si->hwndLog != NULL)
logBottom = toolbarTopY / 2;
else
logBottom = toolbarTopY;
@@ -182,18 +180,12 @@ static void MessageDialogResize(HWND hwndDlg, SESSION_INFO *si, int w, int h)
hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), 0, 1, h - si->iSplitterY + SPLITTER_HEIGHT, w - 2, si->iSplitterY - SPLITTER_HEIGHT - 1, SWP_NOZORDER);
hdwp = ResizeToolbar(hwndDlg, hdwp, w, toolbarTopY + 1, toolbarHeight - 1, SIZEOF(toolbarButtons), toolbarButtons, buttonVisibility);
EndDeferWindowPos(hdwp);
- if (si->windowData.hwndLog != NULL) {
- RECT rect;
- POINT pt;
+ if (si->hwndLog != NULL) {
IEVIEWWINDOW ieWindow;
- GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_LOG), &rect);
- pt.x = 0;
- pt.y = rect.top;
- ScreenToClient(GetDlgItem(hwndDlg, IDC_CHAT_LOG), &pt);
ieWindow.cbSize = sizeof(IEVIEWWINDOW);
ieWindow.iType = IEW_SETPOS;
ieWindow.parent = hwndDlg;
- ieWindow.hwnd = si->windowData.hwndLog;
+ ieWindow.hwnd = si->hwndLog;
ieWindow.x = 0;
ieWindow.y = logBottom + 1;
ieWindow.cx = bNick ? w - si->iSplitterX : w;
@@ -301,11 +293,10 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
BOOL isCtrl = GetKeyState(VK_CONTROL) & 0x8000;
BOOL isAlt = GetKeyState(VK_MENU) & 0x8000;
- SESSION_INFO *Parentsi = (SESSION_INFO*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
+ SESSION_INFO *si = (SESSION_INFO*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
MESSAGESUBDATA *dat = (MESSAGESUBDATA *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- CommonWindowData *windowData = &Parentsi->windowData;
- int result = InputAreaShortcuts(hwnd, msg, wParam, lParam, windowData);
+ int result = InputAreaShortcuts(hwnd, msg, wParam, lParam, si);
if (result != -1)
return result;
@@ -360,7 +351,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
if (wParam == VK_TAB && !isCtrl && !isShift) { //tab-autocomplete
SendMessage(hwnd, WM_SETREDRAW, FALSE, 0);
- TabAutoComplete(hwnd, dat, Parentsi);
+ TabAutoComplete(hwnd, dat, si);
SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE);
return 0;
@@ -457,7 +448,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
case WM_CONTEXTMENU:
- InputAreaContextMenu(hwnd, wParam, lParam, Parentsi->hContact);
+ InputAreaContextMenu(hwnd, wParam, lParam, si->hContact);
return TRUE;
case WM_KEYUP:
@@ -476,13 +467,13 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
cf.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_BACKCOLOR | CFM_COLOR;
SendMessage(hwnd, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- if (pci->MM_FindModule(Parentsi->pszModule) && pci->MM_FindModule(Parentsi->pszModule)->bColor) {
- int index = pci->GetColorIndex(Parentsi->pszModule, cf.crTextColor);
+ if (pci->MM_FindModule(si->pszModule) && pci->MM_FindModule(si->pszModule)->bColor) {
+ int index = pci->GetColorIndex(si->pszModule, cf.crTextColor);
u = IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_COLOR);
if (index >= 0) {
- Parentsi->bFGSet = TRUE;
- Parentsi->iFG = index;
+ si->bFGSet = TRUE;
+ si->iFG = index;
}
if (u == BST_UNCHECKED && cf.crTextColor != cr)
@@ -491,14 +482,14 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
CheckDlgButton(GetParent(hwnd), IDC_CHAT_COLOR, BST_UNCHECKED);
}
- if (pci->MM_FindModule(Parentsi->pszModule) && pci->MM_FindModule(Parentsi->pszModule)->bBkgColor) {
- int index = pci->GetColorIndex(Parentsi->pszModule, cf.crBackColor);
+ if (pci->MM_FindModule(si->pszModule) && pci->MM_FindModule(si->pszModule)->bBkgColor) {
+ int index = pci->GetColorIndex(si->pszModule, cf.crBackColor);
COLORREF crB = db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
u = IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_BKGCOLOR);
if (index >= 0) {
- Parentsi->bBGSet = TRUE;
- Parentsi->iBG = index;
+ si->bBGSet = TRUE;
+ si->iBG = index;
}
if (u == BST_UNCHECKED && cf.crBackColor != crB)
CheckDlgButton(GetParent(hwnd), IDC_CHAT_BKGCOLOR, BST_CHECKED);
@@ -506,7 +497,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
CheckDlgButton(GetParent(hwnd), IDC_CHAT_BKGCOLOR, BST_UNCHECKED);
}
- if (pci->MM_FindModule(Parentsi->pszModule) && pci->MM_FindModule(Parentsi->pszModule)->bBold) {
+ if (pci->MM_FindModule(si->pszModule) && pci->MM_FindModule(si->pszModule)->bBold) {
u = IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_BOLD);
u2 = cf.dwEffects;
u2 &= CFE_BOLD;
@@ -516,7 +507,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
CheckDlgButton(GetParent(hwnd), IDC_CHAT_BOLD, BST_UNCHECKED);
}
- if (pci->MM_FindModule(Parentsi->pszModule) && pci->MM_FindModule(Parentsi->pszModule)->bItalics) {
+ if (pci->MM_FindModule(si->pszModule) && pci->MM_FindModule(si->pszModule)->bItalics) {
u = IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_ITALICS);
u2 = cf.dwEffects;
u2 &= CFE_ITALIC;
@@ -526,7 +517,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
CheckDlgButton(GetParent(hwnd), IDC_CHAT_ITALICS, BST_UNCHECKED);
}
- if (pci->MM_FindModule(Parentsi->pszModule) && pci->MM_FindModule(Parentsi->pszModule)->bUnderline) {
+ if (pci->MM_FindModule(si->pszModule) && pci->MM_FindModule(si->pszModule)->bUnderline) {
u = IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_UNDERLINE);
u2 = cf.dwEffects;
u2 &= CFE_UNDERLINE;
@@ -603,7 +594,7 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
if (iFlags & GC_EVENT_ADDSTATUS)
iFlags |= GC_EVENT_REMOVESTATUS;
- SendMessage(si->hWnd, GC_CHANGEFILTERFLAG, 0, (LPARAM)iFlags);
+ SendMessage(si->hWnd, GC_CHANGEFILTERFLAG, 0, iFlags);
if (si->bFilterEnabled)
SendMessage(si->hWnd, GC_REDRAWLOG, 0, 0);
PostMessage(hwndDlg, WM_CLOSE, 0, 0);
@@ -615,7 +606,7 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
break;
}
- return(FALSE);
+ return FALSE;
}
static LRESULT CALLBACK ButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -626,9 +617,9 @@ static LRESULT CALLBACK ButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, L
if (GetDlgItem(GetParent(hwnd), IDC_CHAT_FILTER) == hwnd)
SendMessage(GetParent(hwnd), GC_SHOWFILTERMENU, 0, 0);
if (GetDlgItem(GetParent(hwnd), IDC_CHAT_COLOR) == hwnd)
- SendMessage(GetParent(hwnd), GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_CHAT_COLOR);
+ SendMessage(GetParent(hwnd), GC_SHOWCOLORCHOOSER, 0, IDC_CHAT_COLOR);
if (GetDlgItem(GetParent(hwnd), IDC_CHAT_BKGCOLOR) == hwnd)
- SendMessage(GetParent(hwnd), GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_CHAT_BKGCOLOR);
+ SendMessage(GetParent(hwnd), GC_SHOWCOLORCHOOSER, 0, IDC_CHAT_BKGCOLOR);
}
break;
}
@@ -640,38 +631,39 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
{
static BOOL inMenu = FALSE;
SESSION_INFO *si = (SESSION_INFO*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
- int result = InputAreaShortcuts(hwnd, msg, wParam, lParam, &si->windowData);
+ int result = InputAreaShortcuts(hwnd, msg, wParam, lParam, si);
if (result != -1)
return result;
+ CHARRANGE sel;
+
switch (msg) {
case WM_MEASUREITEM:
MeasureMenuItem(wParam, lParam);
return TRUE;
+
case WM_DRAWITEM:
return DrawMenuItem(wParam, lParam);
+
case WM_SETCURSOR:
if (inMenu) {
SetCursor(LoadCursor(NULL, IDC_ARROW));
return TRUE;
}
break;
+
case WM_LBUTTONUP:
- {
- CHARRANGE sel;
- SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
- if (sel.cpMin != sel.cpMax) {
- SendMessage(hwnd, WM_COPY, 0, 0);
- sel.cpMin = sel.cpMax;
- SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&sel);
- }
- SetFocus(GetDlgItem(GetParent(hwnd), IDC_CHAT_MESSAGE));
+ SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
+ if (sel.cpMin != sel.cpMax) {
+ SendMessage(hwnd, WM_COPY, 0, 0);
+ sel.cpMin = sel.cpMax;
+ SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&sel);
}
+ SetFocus(GetDlgItem(GetParent(hwnd), IDC_CHAT_MESSAGE));
break;
case WM_ACTIVATE:
if (LOWORD(wParam) == WA_INACTIVE) {
- CHARRANGE sel;
SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
if (sel.cpMin != sel.cpMax) {
sel.cpMin = sel.cpMax;
@@ -681,25 +673,25 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
break;
case WM_CONTEXTMENU:
+ POINT pt;
+ POINTL ptl;
+ SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
+ if (lParam == 0xFFFFFFFF) {
+ SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM)&pt, (LPARAM)sel.cpMax);
+ ClientToScreen(hwnd, &pt);
+ }
+ else {
+ pt.x = (short)LOWORD(lParam);
+ pt.y = (short)HIWORD(lParam);
+ }
+ ptl.x = (LONG)pt.x;
+ ptl.y = (LONG)pt.y;
+ ScreenToClient(hwnd, (LPPOINT)&ptl);
{
- CHARRANGE sel, all = { 0, -1 };
- POINT pt;
- POINTL ptl;
-
- SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
- if (lParam == 0xFFFFFFFF) {
- SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM)&pt, (LPARAM)sel.cpMax);
- ClientToScreen(hwnd, &pt);
- }
- else {
- pt.x = (short)LOWORD(lParam);
- pt.y = (short)HIWORD(lParam);
- }
- ptl.x = (LONG)pt.x;
- ptl.y = (LONG)pt.y;
- ScreenToClient(hwnd, (LPPOINT)&ptl);
- TCHAR *pszWord = GetRichTextWord(hwnd, &ptl);
+ ptrT pszWord(GetRichTextWord(hwnd, &ptl));
inMenu = TRUE;
+
+ CHARRANGE all = { 0, -1 };
HMENU hMenu = NULL;
UINT uID = CreateGCMenu(hwnd, &hMenu, 1, pt, si, NULL, pszWord);
inMenu = FALSE;
@@ -740,11 +732,10 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
default:
PostMessage(GetParent(hwnd), WM_MOUSEACTIVATE, 0, 0);
- pci->DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_LOGMENU, NULL, NULL, (LPARAM)uID);
+ pci->DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_LOGMENU, NULL, NULL, uID);
break;
}
DestroyGCMenu(&hMenu, 5);
- mir_free(pszWord);
}
break;
@@ -824,7 +815,7 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, SESSION_INFO * p
static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
SESSION_INFO *si = (SESSION_INFO*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
- int result = InputAreaShortcuts(hwnd, msg, wParam, lParam, &si->windowData);
+ int result = InputAreaShortcuts(hwnd, msg, wParam, lParam, si);
if (result != -1)
return result;
@@ -898,6 +889,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
item = (DWORD)(-1);
else
item &= 0xFFFF;
+
USERINFO *ui = pci->SM_GetUserFromIndex(si->ptszID, si->pszModule, (int)item);
if (ui) {
HMENU hMenu = 0;
@@ -919,7 +911,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
default:
- pci->DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui->pszUID, NULL, (LPARAM)uID);
+ pci->DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui->pszUID, NULL, uID);
break;
}
DestroyGCMenu(&hMenu, 1);
@@ -982,10 +974,8 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
_tcscat(si->szSearch, szNew);
}
if (si->szSearch[0]) {
- /*
- * iterate over the (sorted) list of nicknames and search for the
- * string we have
- */
+ // iterate over the (sorted) list of nicknames and search for the
+ // string we have
int iItems = SendMessage(hwnd, LB_GETCOUNT, 0, 0);
for (int i = 0; i < iItems; i++) {
USERINFO *ui = pci->UM_FindUserFromIndex(si->pUsers, i);
@@ -1008,8 +998,9 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
POINT pt = { LOWORD(lParam), HIWORD(lParam) };
RECT clientRect;
GetClientRect(hwnd, &clientRect);
- BOOL bInClient = PtInRect(&clientRect, pt);
+
// Mouse capturing/releasing
+ BOOL bInClient = PtInRect(&clientRect, pt);
if (bInClient && GetCapture() != hwnd)
SetCapture(hwnd);
else if (!bInClient)
@@ -1058,6 +1049,11 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
{
static HMENU hToolbarMenu;
RECT rc;
+ POINT pt;
+ HICON hIcon;
+ TabControlData tcd;
+ TitleBarData tbd;
+ TCHAR szTemp[512];
SESSION_INFO *si = (SESSION_INFO *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (!si && uMsg != WM_INITDIALOG)
@@ -1086,15 +1082,15 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
RECT minEditInit;
GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), &minEditInit);
- si->windowData.minEditBoxHeight = minEditInit.bottom - minEditInit.top;
- si->windowData.minLogBoxHeight = si->windowData.minEditBoxHeight;
+ si->minEditBoxHeight = minEditInit.bottom - minEditInit.top;
+ si->minLogBoxHeight = si->minEditBoxHeight;
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SUBCLASSED, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_AUTOURLDETECT, 1, 0);
int mask = (int)SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_GETEVENTMASK, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETEVENTMASK, 0, mask | ENM_LINK | ENM_MOUSEEVENTS);
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_CHANGE | ENM_REQUESTRESIZE);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_LIMITTEXT, (WPARAM)sizeof(TCHAR)* 0x7FFFFFFF, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_LIMITTEXT, sizeof(TCHAR) * 0x7FFFFFFF, 0);
SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback);
if (db_get_b(NULL, CHAT_MODULE, "UseIEView", 0)) {
@@ -1106,13 +1102,13 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
ieWindow.cy = 300;
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
- si->windowData.hwndLog = ieWindow.hwnd;
+ si->hwndLog = ieWindow.hwnd;
IEVIEWEVENT iee = { sizeof(iee) };
iee.iType = IEE_CLEAR_LOG;
- iee.hwnd = si->windowData.hwndLog;
+ iee.hwnd = si->hwndLog;
iee.hContact = si->hContact;
- iee.codepage = si->windowData.codePage;
+ iee.codepage = si->codePage;
iee.pszProto = si->pszModule;
CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&iee);
}
@@ -1125,7 +1121,7 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0);
- SendMessage(GetParent(hwndDlg), CM_ADDCHILD, (WPARAM)hwndDlg, (LPARAM)psi->hContact);
+ SendMessage(GetParent(hwndDlg), CM_ADDCHILD, (WPARAM)hwndDlg, psi->hContact);
PostMessage(hwndDlg, GC_UPDATENICKLIST, 0, 0);
NotifyLocalWinEvent(psi->hContact, hwndDlg, MSG_WINDOW_EVT_OPEN);
}
@@ -1153,7 +1149,7 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
cf.crBackColor = db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETBKGNDCOLOR, 0, db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR));
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, WM_SETFONT, (WPARAM)g_Settings.MessageBoxFont, MAKELPARAM(TRUE, 0));
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, (WPARAM)SCF_ALL, (LPARAM)&cf);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
// nicklist
int ih = GetTextPixelSize(_T("AQG_glo'"), g_Settings.UserListFont, FALSE);
@@ -1164,7 +1160,7 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
if (db_get_b(NULL, CHAT_MODULE, "ShowContactStatus", 0))
font = font > 16 ? font : 16;
- SendDlgItemMessage(hwndDlg, IDC_CHAT_LIST, LB_SETITEMHEIGHT, 0, (LPARAM)height > font ? height : font);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_LIST, LB_SETITEMHEIGHT, 0, height > font ? height : font);
InvalidateRect(GetDlgItem(hwndDlg, IDC_CHAT_LIST), NULL, TRUE);
}
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_REQUESTRESIZE, 0, 0);
@@ -1173,47 +1169,42 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
break;
case DM_UPDATETITLEBAR:
- {
- TitleBarData tbd = { 0 };
- TCHAR szTemp[100];
- if (g_dat.flags & SMF_STATUSICON) {
- MODULEINFO *mi = pci->MM_FindModule(si->pszModule);
- tbd.hIcon = (si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIcon : mi->hOfflineIcon;
- tbd.hIconBig = (si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIconBig : mi->hOfflineIconBig;
- }
- else {
- tbd.hIcon = GetCachedIcon("chat_window");
- tbd.hIconBig = g_dat.hIconChatBig;
- }
- tbd.hIconNot = (si->wState & (GC_EVENT_HIGHLIGHT | STATE_TALK)) ? GetCachedIcon("chat_overlay") : NULL;
+ if (g_dat.flags & SMF_STATUSICON) {
+ MODULEINFO *mi = pci->MM_FindModule(si->pszModule);
+ tbd.hIcon = (si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIcon : mi->hOfflineIcon;
+ tbd.hIconBig = (si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIconBig : mi->hOfflineIconBig;
+ }
+ else {
+ tbd.hIcon = GetCachedIcon("chat_window");
+ tbd.hIconBig = g_dat.hIconChatBig;
+ }
+ tbd.hIconNot = (si->wState & (GC_EVENT_HIGHLIGHT | STATE_TALK)) ? GetCachedIcon("chat_overlay") : NULL;
- switch (si->iType) {
- case GCW_CHATROOM:
- mir_sntprintf(szTemp, SIZEOF(szTemp),
- (si->nUsersInNicklist == 1) ? TranslateT("%s: Chat Room (%u user)") : TranslateT("%s: Chat Room (%u users)"),
- si->ptszName, si->nUsersInNicklist);
- break;
- case GCW_PRIVMESS:
- mir_sntprintf(szTemp, SIZEOF(szTemp),
- (si->nUsersInNicklist == 1) ? TranslateT("%s: Message Session") : TranslateT("%s: Message Session (%u users)"),
- si->ptszName, si->nUsersInNicklist);
- break;
- case GCW_SERVER:
- mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s: Server"), si->ptszName);
- break;
- }
- tbd.iFlags = TBDF_TEXT | TBDF_ICON;
- tbd.pszText = szTemp;
- SendMessage(GetParent(hwndDlg), CM_UPDATETITLEBAR, (WPARAM)&tbd, (LPARAM)hwndDlg);
- SendMessage(hwndDlg, DM_UPDATETABCONTROL, 0, 0);
+ switch (si->iType) {
+ case GCW_CHATROOM:
+ mir_sntprintf(szTemp, SIZEOF(szTemp),
+ (si->nUsersInNicklist == 1) ? TranslateT("%s: Chat Room (%u user)") : TranslateT("%s: Chat Room (%u users)"),
+ si->ptszName, si->nUsersInNicklist);
+ break;
+ case GCW_PRIVMESS:
+ mir_sntprintf(szTemp, SIZEOF(szTemp),
+ (si->nUsersInNicklist == 1) ? TranslateT("%s: Message Session") : TranslateT("%s: Message Session (%u users)"),
+ si->ptszName, si->nUsersInNicklist);
+ break;
+ case GCW_SERVER:
+ mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s: Server"), si->ptszName);
+ break;
}
+ tbd.iFlags = TBDF_TEXT | TBDF_ICON;
+ tbd.pszText = szTemp;
+ SendMessage(GetParent(hwndDlg), CM_UPDATETITLEBAR, (WPARAM)&tbd, (LPARAM)hwndDlg);
+ SendMessage(hwndDlg, DM_UPDATETABCONTROL, 0, 0);
break;
case DM_UPDATESTATUSBAR:
{
MODULEINFO *mi = pci->MM_FindModule(si->pszModule);
- TCHAR szTemp[512];
- HICON hIcon = si->wStatus == ID_STATUS_ONLINE ? mi->hOnlineIcon : mi->hOfflineIcon;
+ hIcon = si->wStatus == ID_STATUS_ONLINE ? mi->hOnlineIcon : mi->hOfflineIcon;
mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s : %s"), mi->ptszModDispName, si->ptszStatusbarText ? si->ptszStatusbarText : _T(""));
StatusBarData sbd;
@@ -1235,11 +1226,11 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
break;
case DM_GETCODEPAGE:
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, si->windowData.codePage);
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, si->codePage);
return TRUE;
case DM_SETCODEPAGE:
- si->windowData.codePage = (int)lParam;
+ si->codePage = (int)lParam;
SendMessage(hwndDlg, GC_REDRAWLOG2, 0, 0);
break;
@@ -1312,28 +1303,23 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
break;
case DM_UPDATETABCONTROL:
- {
- TabControlData tcd;
- tcd.iFlags = TCDF_TEXT;
- tcd.pszText = si->ptszName;
- SendMessage(GetParent(hwndDlg), CM_UPDATETABCONTROL, (WPARAM)&tcd, (LPARAM)hwndDlg);
- }
- case GC_FIXTABICONS:
- {
- HICON hIcon;
- if (!(si->wState & GC_EVENT_HIGHLIGHT)) {
- if (si->wState & STATE_TALK)
- hIcon = (si->wStatus == ID_STATUS_ONLINE) ? pci->MM_FindModule(si->pszModule)->hOnlineTalkIcon : pci->MM_FindModule(si->pszModule)->hOfflineTalkIcon;
- else
- hIcon = (si->wStatus == ID_STATUS_ONLINE) ? pci->MM_FindModule(si->pszModule)->hOnlineIcon : pci->MM_FindModule(si->pszModule)->hOfflineIcon;
- }
- else hIcon = g_dat.hMsgIcon;
+ tcd.iFlags = TCDF_TEXT;
+ tcd.pszText = si->ptszName;
+ SendMessage(GetParent(hwndDlg), CM_UPDATETABCONTROL, (WPARAM)&tcd, (LPARAM)hwndDlg);
+ // fall through
- TabControlData tcd;
- tcd.iFlags = TCDF_ICON;
- tcd.hIcon = hIcon;
- SendMessage(GetParent(hwndDlg), CM_UPDATETABCONTROL, (WPARAM)&tcd, (LPARAM)hwndDlg);
+ case GC_FIXTABICONS:
+ if (!(si->wState & GC_EVENT_HIGHLIGHT)) {
+ if (si->wState & STATE_TALK)
+ hIcon = (si->wStatus == ID_STATUS_ONLINE) ? pci->MM_FindModule(si->pszModule)->hOnlineTalkIcon : pci->MM_FindModule(si->pszModule)->hOfflineTalkIcon;
+ else
+ hIcon = (si->wStatus == ID_STATUS_ONLINE) ? pci->MM_FindModule(si->pszModule)->hOnlineIcon : pci->MM_FindModule(si->pszModule)->hOfflineIcon;
}
+ else hIcon = g_dat.hMsgIcon;
+
+ tcd.iFlags = TCDF_ICON;
+ tcd.hIcon = hIcon;
+ SendMessage(GetParent(hwndDlg), CM_UPDATETABCONTROL, (WPARAM)&tcd, (LPARAM)hwndDlg);
break;
case GC_SETMESSAGEHIGHLIGHT:
@@ -1360,13 +1346,13 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
if (si->wState & GC_EVENT_HIGHLIGHT) {
si->wState &= ~GC_EVENT_HIGHLIGHT;
- if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0))
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)GC_FAKE_EVENT);
+ if (CallService(MS_CLIST_GETEVENT, si->hContact, 0))
+ CallService(MS_CLIST_REMOVEEVENT, si->hContact, (LPARAM)GC_FAKE_EVENT);
}
SendMessage(hwndDlg, GC_FIXTABICONS, 0, 0);
if (!si->hWnd) {
- ShowRoom(si, (WPARAM)WINDOW_VISIBLE, TRUE);
+ ShowRoom(si, WINDOW_VISIBLE, TRUE);
SendMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
}
break;
@@ -1414,7 +1400,6 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
height++;
int offset = (height == 10) ? 0 : height / 2 - 5;
- HICON hIcon = pci->SM_GetStatusIcon(si, ui);
HFONT hFont = (ui->iStatusEx == 0) ? g_Settings.UserListFont : g_Settings.UserListHeadingsFont;
HFONT hOldFont = (HFONT)SelectObject(dis->hDC, hFont);
SetBkMode(dis->hDC, TRANSPARENT);
@@ -1425,15 +1410,15 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
FillRect(dis->hDC, &dis->rcItem, pci->hListBkgBrush);
if (g_Settings.bShowContactStatus && g_Settings.bContactStatusFirst && ui->ContactStatus) {
- HICON hIcon = LoadSkinnedProtoIcon(si->pszModule, ui->ContactStatus);
+ hIcon = LoadSkinnedProtoIcon(si->pszModule, ui->ContactStatus);
DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, NULL, DI_NORMAL);
Skin_ReleaseIcon(hIcon);
x_offset += 18;
}
- DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset, hIcon, 10, 10, 0, NULL, DI_NORMAL);
+ DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset, pci->SM_GetStatusIcon(si, ui), 10, 10, 0, NULL, DI_NORMAL);
x_offset += 12;
if (g_Settings.bShowContactStatus && !g_Settings.bContactStatusFirst && ui->ContactStatus) {
- HICON hIcon = LoadSkinnedProtoIcon(si->pszModule, ui->ContactStatus);
+ hIcon = LoadSkinnedProtoIcon(si->pszModule, ui->ContactStatus);
DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, NULL, DI_NORMAL);
Skin_ReleaseIcon(hIcon);
x_offset += 18;
@@ -1488,8 +1473,8 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
return TRUE;
case SESSION_TERMINATE:
- if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0))
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)GC_FAKE_EVENT);
+ if (CallService(MS_CLIST_GETEVENT, si->hContact, 0))
+ CallService(MS_CLIST_REMOVEEVENT, si->hContact, (LPARAM)GC_FAKE_EVENT);
si->wState &= ~STATE_TALK;
db_set_w(si->hContact, si->pszModule, "ApparentMode", 0);
SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
@@ -1524,7 +1509,6 @@ LABEL_SHOWWINDOW:
case GC_SPLITTERMOVED:
if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_CHAT_SPLITTERX)) {
- POINT pt;
GetClientRect(hwndDlg, &rc);
pt.x = wParam; pt.y = 0;
ScreenToClient(hwndDlg, &pt);
@@ -1537,7 +1521,6 @@ LABEL_SHOWWINDOW:
g_Settings.iSplitterX = si->iSplitterX;
}
else if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_CHAT_SPLITTERY)) {
- POINT pt;
GetClientRect(hwndDlg, &rc);
pt.x = 0; pt.y = wParam;
ScreenToClient(hwndDlg, &pt);
@@ -1549,8 +1532,8 @@ LABEL_SHOWWINDOW:
case GC_FIREHOOK:
if (lParam) {
- GCHOOK *gch = (GCHOOK *)lParam;
- NotifyEventHooks(pci->hSendEvent, 0, (WPARAM)gch);
+ NotifyEventHooks(pci->hSendEvent, 0, lParam);
+ GCHOOK *gch = (GCHOOK*)lParam;
if (gch->pDest) {
mir_free((void*)gch->pDest->ptszID);
mir_free((void*)gch->pDest->pszModule);
@@ -1610,8 +1593,8 @@ LABEL_SHOWWINDOW:
if (db_get_w(si->hContact, si->pszModule, "ApparentMode", 0) != 0)
db_set_w(si->hContact, si->pszModule, "ApparentMode", 0);
- if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0))
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)GC_FAKE_EVENT);
+ if (CallService(MS_CLIST_GETEVENT, si->hContact, 0))
+ CallService(MS_CLIST_REMOVEEVENT, si->hContact, (LPARAM)GC_FAKE_EVENT);
break;
case WM_NOTIFY:
@@ -1680,7 +1663,7 @@ LABEL_SHOWWINDOW:
break;
case WM_COMMAND:
- if (!lParam && CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)si->hContact))
+ if (!lParam && CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), si->hContact))
break;
switch (LOWORD(wParam)) {
@@ -1721,13 +1704,13 @@ LABEL_SHOWWINDOW:
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDOK))) {
char *pszRtf = GetRichTextRTF(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
- TCmdList *cmdListNew = tcmdlist_last(si->windowData.cmdList);
+ TCmdList *cmdListNew = tcmdlist_last(si->cmdList);
while (cmdListNew != NULL && cmdListNew->temporary) {
- si->windowData.cmdList = tcmdlist_remove(si->windowData.cmdList, cmdListNew);
- cmdListNew = tcmdlist_last(si->windowData.cmdList);
+ si->cmdList = tcmdlist_remove(si->cmdList, cmdListNew);
+ cmdListNew = tcmdlist_last(si->cmdList);
}
- si->windowData.cmdList = tcmdlist_append(si->windowData.cmdList, pszRtf, 20, FALSE);
+ si->cmdList = tcmdlist_append(si->cmdList, pszRtf, 20, FALSE);
TCHAR *ptszText = DoRtfToTags(pszRtf, si);
rtrimt(ptszText);
@@ -1761,8 +1744,8 @@ LABEL_SHOWWINDOW:
case IDC_CHAT_MESSAGE:
if (HIWORD(wParam) == EN_CHANGE) {
- si->windowData.cmdListCurrent = NULL;
- EnableWindow(GetDlgItem(hwndDlg, IDOK), GetRichTextLength(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), si->windowData.codePage, FALSE) != 0);
+ si->cmdListCurrent = NULL;
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), GetRichTextLength(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), si->codePage, FALSE) != 0);
}
break;
@@ -1776,7 +1759,6 @@ LABEL_SHOWWINDOW:
smaddInfo.targetMessage = EM_REPLACESEL;
smaddInfo.targetWParam = TRUE;
smaddInfo.Protocolname = si->pszModule;
- //smaddInfo.Direction = 3;
smaddInfo.Direction = 0;
smaddInfo.xPosition = rc.left;
smaddInfo.yPosition = rc.bottom;
@@ -1820,7 +1802,7 @@ LABEL_SHOWWINDOW:
if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_BKGCOLOR)) {
if (db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) == 0)
- SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_CHAT_BKGCOLOR);
+ SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, IDC_CHAT_BKGCOLOR);
else if (si->bBGSet) {
cf.dwMask = CFM_BACKCOLOR;
cf.crBackColor = pInfo->crColors[si->iBG];
@@ -1853,7 +1835,7 @@ LABEL_SHOWWINDOW:
if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_COLOR)) {
if (db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) == 0)
- SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_CHAT_COLOR);
+ SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, IDC_CHAT_COLOR);
else if (si->bFGSet) {
cf.dwMask = CFM_COLOR;
cf.crTextColor = pInfo->crColors[si->iFG];
@@ -1921,7 +1903,7 @@ LABEL_SHOWWINDOW:
if (mmi->ptMinTrackSize.x < 350)
mmi->ptMinTrackSize.x = 350;
- mmi->ptMinTrackSize.y = si->windowData.minLogBoxHeight + TOOLBAR_HEIGHT + si->windowData.minEditBoxHeight + 5;
+ mmi->ptMinTrackSize.y = si->minLogBoxHeight + TOOLBAR_HEIGHT + si->minEditBoxHeight + 5;
}
break;
@@ -1937,44 +1919,39 @@ LABEL_SHOWWINDOW:
return TRUE;
case WM_RBUTTONUP:
+ hToolbarMenu = CreatePopupMenu();
+ for (int i = 0; i < SIZEOF(toolbarButtons); i++) {
+ MENUITEMINFO mii = { sizeof(mii) };
+ mii.fMask = MIIM_ID | MIIM_STRING | MIIM_STATE | MIIM_DATA | MIIM_BITMAP;
+ mii.fType = MFT_STRING;
+ mii.fState = (g_dat.chatBbuttonVisibility & (1 << i)) ? MFS_CHECKED : MFS_UNCHECKED;
+ mii.wID = i + 1;
+ mii.dwItemData = (ULONG_PTR)g_dat.hChatButtonIconList;
+ mii.hbmpItem = HBMMENU_CALLBACK;
+ mii.dwTypeData = TranslateTS((toolbarButtons[i].name));
+ InsertMenuItem(hToolbarMenu, i, TRUE, &mii);
+ }
+
+ pt.x = (short)LOWORD(GetMessagePos());
+ pt.y = (short)HIWORD(GetMessagePos());
{
- hToolbarMenu = CreatePopupMenu();
- for (int i = 0; i < SIZEOF(toolbarButtons); i++) {
- MENUITEMINFO mii = { sizeof(mii) };
- mii.fMask = MIIM_ID | MIIM_STRING | MIIM_STATE | MIIM_DATA | MIIM_BITMAP;
- mii.fType = MFT_STRING;
- mii.fState = (g_dat.chatBbuttonVisibility & (1 << i)) ? MFS_CHECKED : MFS_UNCHECKED;
- mii.wID = i + 1;
- mii.dwItemData = (ULONG_PTR)g_dat.hChatButtonIconList;
- mii.hbmpItem = HBMMENU_CALLBACK;
- mii.dwTypeData = TranslateTS((toolbarButtons[i].name));
- InsertMenuItem(hToolbarMenu, i, TRUE, &mii);
- }
-
- POINT pt;
- pt.x = (short)LOWORD(GetMessagePos());
- pt.y = (short)HIWORD(GetMessagePos());
int res = TrackPopupMenu(hToolbarMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
if (res > 0) {
g_dat.chatBbuttonVisibility ^= (1 << (res - 1));
db_set_dw(NULL, SRMMMOD, SRMSGSET_CHATBUTTONVISIBILITY, g_dat.chatBbuttonVisibility);
pci->SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
}
- DestroyMenu(hToolbarMenu);
}
+ DestroyMenu(hToolbarMenu);
return TRUE;
case DM_GETCONTEXTMENU:
- {
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)si->hContact, 0);
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LONG_PTR)hMenu);
- }
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, CallService(MS_CLIST_MENUBUILDCONTACT, si->hContact, 0));
return TRUE;
case WM_CONTEXTMENU:
if (GetParent(hwndDlg) == (HWND)wParam) {
- POINT pt;
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)si->hContact, 0);
+ HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, si->hContact, 0);
GetCursorPos(&pt);
TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hwndDlg, NULL);
DestroyMenu(hMenu);
@@ -1995,11 +1972,11 @@ LABEL_SHOWWINDOW:
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
SendMessage(GetParent(hwndDlg), CM_REMOVECHILD, 0, (LPARAM)hwndDlg);
- if (si->windowData.hwndLog != NULL) {
+ if (si->hwndLog != NULL) {
IEVIEWWINDOW ieWindow;
ieWindow.cbSize = sizeof(IEVIEWWINDOW);
ieWindow.iType = IEW_DESTROY;
- ieWindow.hwnd = si->windowData.hwndLog;
+ ieWindow.hwnd = si->hwndLog;
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
}
@@ -2014,11 +1991,10 @@ void ShowRoom(SESSION_INFO *si, WPARAM, BOOL)
if (si == NULL)
return;
- si->windowData.hContact = si->hContact;
-
- //Do we need to create a window?
+ // Do we need to create a window?
if (si->hWnd == NULL) {
HWND hParent = GetParentWindow(si->hContact, TRUE);
+ si->parent = (ParentWindowData*)GetWindowLongPtr(hParent, GWLP_USERDATA);
si->hWnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CHANNEL), hParent, RoomWndProc, (LPARAM)si);
}
SendMessage(si->hWnd, DM_UPDATETABCONTROL, -1, (LPARAM)si);
diff --git a/plugins/Scriver/src/infobar.cpp b/plugins/Scriver/src/infobar.cpp
index c2e53271c8..e096a01886 100644
--- a/plugins/Scriver/src/infobar.cpp
+++ b/plugins/Scriver/src/infobar.cpp
@@ -23,44 +23,45 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "commonheaders.h"
-void SetupInfobar(InfobarWindowData* idat) {
+void SetupInfobar(InfobarWindowData* idat)
+{
HWND hwnd = idat->hWnd;
- CHARFORMAT2 cf2;
+ CHARFORMAT2 cf2;
memset(&cf2, 0, sizeof(cf2));
- LOGFONT lf;
- DWORD colour = db_get_dw(NULL, SRMMMOD, SRMSGSET_INFOBARBKGCOLOUR, SRMSGDEFSET_INFOBARBKGCOLOUR);
- SendDlgItemMessage(hwnd, IDC_INFOBAR_NAME, EM_SETBKGNDCOLOR, 0, colour);
- SendDlgItemMessage(hwnd, IDC_INFOBAR_STATUS, EM_SETBKGNDCOLOR, 0, colour);
- LoadMsgDlgFont(MSGFONTID_INFOBAR_NAME, &lf, &colour);
- cf2.dwMask = CFM_COLOR | CFM_FACE | CFM_CHARSET | CFM_SIZE | CFM_WEIGHT | CFM_BOLD | CFM_ITALIC;
- cf2.cbSize = sizeof(cf2);
- cf2.crTextColor = colour;
- cf2.bCharSet = lf.lfCharSet;
- _tcsncpy(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;
+ LOGFONT lf;
+ DWORD colour = db_get_dw(NULL, SRMMMOD, SRMSGSET_INFOBARBKGCOLOUR, SRMSGDEFSET_INFOBARBKGCOLOUR);
+ SendDlgItemMessage(hwnd, IDC_INFOBAR_NAME, EM_SETBKGNDCOLOR, 0, colour);
+ SendDlgItemMessage(hwnd, IDC_INFOBAR_STATUS, EM_SETBKGNDCOLOR, 0, colour);
+ LoadMsgDlgFont(MSGFONTID_INFOBAR_NAME, &lf, &colour);
+ cf2.dwMask = CFM_COLOR | CFM_FACE | CFM_CHARSET | CFM_SIZE | CFM_WEIGHT | CFM_BOLD | CFM_ITALIC;
+ cf2.cbSize = sizeof(cf2);
+ cf2.crTextColor = colour;
+ cf2.bCharSet = lf.lfCharSet;
+ _tcsncpy(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;
- SendDlgItemMessageA(hwnd, IDC_INFOBAR_NAME, EM_SETCHARFORMAT, 0, (LPARAM)&cf2);
+ SendDlgItemMessageA(hwnd, IDC_INFOBAR_NAME, EM_SETCHARFORMAT, 0, (LPARAM)&cf2);
- LoadMsgDlgFont(MSGFONTID_INFOBAR_STATUS, &lf, &colour);
- cf2.dwMask = CFM_COLOR | CFM_FACE | CFM_CHARSET | CFM_SIZE | CFM_WEIGHT | CFM_BOLD | CFM_ITALIC;
- cf2.cbSize = sizeof(cf2);
- cf2.crTextColor = colour;
- cf2.bCharSet = lf.lfCharSet;
- _tcsncpy(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;
- SendDlgItemMessageA(hwnd, IDC_INFOBAR_STATUS, EM_SETCHARFORMAT, 0, (LPARAM)&cf2);
+ LoadMsgDlgFont(MSGFONTID_INFOBAR_STATUS, &lf, &colour);
+ cf2.dwMask = CFM_COLOR | CFM_FACE | CFM_CHARSET | CFM_SIZE | CFM_WEIGHT | CFM_BOLD | CFM_ITALIC;
+ cf2.cbSize = sizeof(cf2);
+ cf2.crTextColor = colour;
+ cf2.bCharSet = lf.lfCharSet;
+ _tcsncpy(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;
+ SendDlgItemMessageA(hwnd, IDC_INFOBAR_STATUS, EM_SETCHARFORMAT, 0, (LPARAM)&cf2);
- RefreshInfobar(idat);
+ RefreshInfobar(idat);
}
static HICON GetExtraStatusIcon(InfobarWindowData* idat)
{
- BYTE bXStatus = db_get_b(idat->mwd->windowData.hContact, idat->mwd->szProto, "XStatusId", 0);
+ BYTE bXStatus = db_get_b(idat->mwd->hContact, idat->mwd->szProto, "XStatusId", 0);
if (bXStatus > 0)
return (HICON) CallProtoService(idat->mwd->szProto, PS_GETCUSTOMSTATUSICON, bXStatus, 0);
@@ -71,10 +72,10 @@ void RefreshInfobar(InfobarWindowData* idat)
{
HWND hwnd = idat->hWnd;
SrmmWindowData *dat = idat->mwd;
- TCHAR *szContactName = GetNickname(dat->windowData.hContact, dat->szProto);
- TCHAR *szContactStatusMsg = db_get_tsa(dat->windowData.hContact, "CList", "StatusMsg");
- TCHAR *szXStatusName = db_get_tsa(idat->mwd->windowData.hContact, idat->mwd->szProto, "XStatusName");
- TCHAR *szXStatusMsg = db_get_tsa(idat->mwd->windowData.hContact, idat->mwd->szProto, "XStatusMsg");
+ TCHAR *szContactName = GetNickname(dat->hContact, dat->szProto);
+ TCHAR *szContactStatusMsg = db_get_tsa(dat->hContact, "CList", "StatusMsg");
+ TCHAR *szXStatusName = db_get_tsa(idat->mwd->hContact, idat->mwd->szProto, "XStatusName");
+ TCHAR *szXStatusMsg = db_get_tsa(idat->mwd->hContact, idat->mwd->szProto, "XStatusMsg");
HICON hIcon = GetExtraStatusIcon(idat);
TCHAR szText[2048];
SETTEXTEX st;
@@ -84,8 +85,8 @@ void RefreshInfobar(InfobarWindowData* idat)
_tcsncpy_s(szText, TranslateTS(szXStatusName), _TRUNCATE);
st.flags = ST_DEFAULT;
st.codepage = 1200;
- SendDlgItemMessage(hwnd, IDC_INFOBAR_NAME, EM_SETTEXTEX, (WPARAM) &st, (LPARAM)szContactName);
- SendDlgItemMessage(hwnd, IDC_INFOBAR_STATUS, EM_SETTEXTEX, (WPARAM) &st, (LPARAM)szContactStatusMsg);
+ SendDlgItemMessage(hwnd, IDC_INFOBAR_NAME, EM_SETTEXTEX, (WPARAM)&st, (LPARAM)szContactName);
+ SendDlgItemMessage(hwnd, IDC_INFOBAR_STATUS, EM_SETTEXTEX, (WPARAM)&st, (LPARAM)szContactStatusMsg);
hIcon = (HICON)SendDlgItemMessage(hwnd, IDC_XSTATUSICON, STM_SETICON, (WPARAM)hIcon, 0);
if (hIcon) {
DestroyIcon(hIcon);
@@ -104,62 +105,63 @@ void RefreshInfobar(InfobarWindowData* idat)
static INT_PTR CALLBACK InfobarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static BOOL bWasCopy;
- InfobarWindowData* idat = (InfobarWindowData *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if (!idat && msg!=WM_INITDIALOG) return FALSE;
+ InfobarWindowData* idat = (InfobarWindowData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ if (!idat && msg != WM_INITDIALOG)
+ return FALSE;
+
switch (msg) {
case WM_INITDIALOG:
+ bWasCopy = FALSE;
+ idat = (InfobarWindowData*)lParam;
+ idat->hWnd = hwnd;
{
- RECT rect = {0};
- bWasCopy = FALSE;
- idat = (InfobarWindowData *) lParam;
- idat->hWnd = hwnd;
+ RECT rect = { 0 };
idat->hXStatusTip = CreateToolTip(hwnd, NULL, NULL, &rect);
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)idat);
- SendDlgItemMessage(hwnd, IDC_INFOBAR_NAME, EM_AUTOURLDETECT, (WPARAM) TRUE, 0);
+ SendDlgItemMessage(hwnd, IDC_INFOBAR_NAME, EM_AUTOURLDETECT, TRUE, 0);
SendDlgItemMessage(hwnd, IDC_INFOBAR_NAME, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_LINK | ENM_KEYEVENTS);
- SendDlgItemMessage(hwnd, IDC_INFOBAR_STATUS, EM_AUTOURLDETECT, (WPARAM) TRUE, 0);
+ SendDlgItemMessage(hwnd, IDC_INFOBAR_STATUS, EM_AUTOURLDETECT, TRUE, 0);
SendDlgItemMessage(hwnd, IDC_INFOBAR_STATUS, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_LINK | ENM_KEYEVENTS);
SetupInfobar(idat);
}
return TRUE;
case WM_SIZE:
- {
- if (wParam==SIZE_RESTORED || wParam==SIZE_MAXIMIZED) {
- HDWP hdwp;
- RECT rc;
- int dlgWidth, dlgHeight;
- int avatarWidth = 0;
- int avatarHeight = 0;
- GetClientRect(hwnd, &rc);
- dlgWidth = rc.right - rc.left;
- dlgHeight = rc.bottom - rc.top;
- if (idat->mwd->avatarPic && (g_dat.flags&SMF_AVATAR)) {
- BITMAP bminfo;
- GetObject(idat->mwd->avatarPic, sizeof(bminfo), &bminfo);
- if ( bminfo.bmWidth != 0 && bminfo.bmHeight != 0 ) {
- avatarHeight = dlgHeight - 2;
- avatarWidth = bminfo.bmWidth * avatarHeight / bminfo.bmHeight;
- if (avatarWidth > dlgHeight) {
- avatarWidth = dlgHeight - 2;
- avatarHeight = bminfo.bmHeight * avatarWidth / bminfo.bmWidth;
- }
+ if (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED) {
+ int dlgWidth, dlgHeight;
+ int avatarWidth = 0;
+ int avatarHeight = 0;
+
+ RECT rc;
+ GetClientRect(hwnd, &rc);
+ dlgWidth = rc.right - rc.left;
+ dlgHeight = rc.bottom - rc.top;
+ if (idat->mwd->avatarPic && (g_dat.flags&SMF_AVATAR)) {
+ BITMAP bminfo;
+ GetObject(idat->mwd->avatarPic, sizeof(bminfo), &bminfo);
+ if (bminfo.bmWidth != 0 && bminfo.bmHeight != 0) {
+ avatarHeight = dlgHeight - 2;
+ avatarWidth = bminfo.bmWidth * avatarHeight / bminfo.bmHeight;
+ if (avatarWidth > dlgHeight) {
+ avatarWidth = dlgHeight - 2;
+ avatarHeight = bminfo.bmHeight * avatarWidth / bminfo.bmWidth;
}
}
- hdwp = BeginDeferWindowPos(4);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwnd, IDC_INFOBAR_NAME), 0, 16, 0, dlgWidth - avatarWidth - 2 - 32, dlgHeight/2, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwnd, IDC_INFOBAR_STATUS), 0, 16, dlgHeight/2, dlgWidth - avatarWidth - 2 - 32, dlgHeight/2, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwnd, IDC_AVATAR), 0, dlgWidth - avatarWidth - 2, (dlgHeight - avatarHeight) / 2, avatarWidth, (dlgHeight + avatarHeight - 2) / 2, SWP_NOZORDER);
- hdwp = DeferWindowPos(hdwp, GetDlgItem(hwnd, IDC_XSTATUSICON), 0, dlgWidth - avatarWidth - 2 - 16, dlgHeight/4 - 8, 16, 16, SWP_NOZORDER);
- rc.left = dlgWidth - avatarWidth - 2 - 16;
- rc.top = dlgHeight/4 - 8;
- rc.bottom = rc.top + 20;
- rc.right = rc.left + 16;
- SetToolTipRect(hwnd, idat->hXStatusTip, &rc);
- EndDeferWindowPos(hdwp);
}
- return TRUE;
+ HDWP hdwp = BeginDeferWindowPos(4);
+ hdwp = DeferWindowPos(hdwp, GetDlgItem(hwnd, IDC_INFOBAR_NAME), 0, 16, 0, dlgWidth - avatarWidth - 2 - 32, dlgHeight / 2, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, GetDlgItem(hwnd, IDC_INFOBAR_STATUS), 0, 16, dlgHeight / 2, dlgWidth - avatarWidth - 2 - 32, dlgHeight / 2, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, GetDlgItem(hwnd, IDC_AVATAR), 0, dlgWidth - avatarWidth - 2, (dlgHeight - avatarHeight) / 2, avatarWidth, (dlgHeight + avatarHeight - 2) / 2, SWP_NOZORDER);
+ hdwp = DeferWindowPos(hdwp, GetDlgItem(hwnd, IDC_XSTATUSICON), 0, dlgWidth - avatarWidth - 2 - 16, dlgHeight / 4 - 8, 16, 16, SWP_NOZORDER);
+ rc.left = dlgWidth - avatarWidth - 2 - 16;
+ rc.top = dlgHeight / 4 - 8;
+ rc.bottom = rc.top + 20;
+ rc.right = rc.left + 16;
+ SetToolTipRect(hwnd, idat->hXStatusTip, &rc);
+ EndDeferWindowPos(hdwp);
}
+ return TRUE;
+
case WM_CTLCOLORDLG:
case WM_CTLCOLORSTATIC:
return (INT_PTR)g_dat.hInfobarBrush;
@@ -176,32 +178,32 @@ static INT_PTR CALLBACK InfobarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
case IDC_INFOBAR_STATUS:
switch (pNmhdr->code) {
case EN_MSGFILTER:
- switch (((MSGFILTER *) lParam)->msg) {
+ switch (((MSGFILTER*)lParam)->msg) {
case WM_CHAR:
- SendMessage(GetParent(hwnd), ((MSGFILTER *) lParam)->msg, ((MSGFILTER *) lParam)->wParam, ((MSGFILTER *) lParam)->lParam);
+ SendMessage(GetParent(hwnd), ((MSGFILTER *)lParam)->msg, ((MSGFILTER *)lParam)->wParam, ((MSGFILTER *)lParam)->lParam);
SetWindowLongPtr(hwnd, DWLP_MSGRESULT, TRUE);
return TRUE;
+
case WM_LBUTTONUP:
- {
- CHARRANGE sel;
- SendDlgItemMessage(hwnd, pNmhdr->idFrom, EM_EXGETSEL, 0, (LPARAM)&sel);
- bWasCopy = FALSE;
- if (sel.cpMin != sel.cpMax) {
- SendDlgItemMessage(hwnd, pNmhdr->idFrom, WM_COPY, 0, 0);
- sel.cpMin = sel.cpMax ;
- SendDlgItemMessage(hwnd, pNmhdr->idFrom, EM_EXSETSEL, 0, (LPARAM)&sel);
- bWasCopy = TRUE;
- }
- SetFocus(GetParent(hwnd));
+ CHARRANGE sel;
+ SendDlgItemMessage(hwnd, pNmhdr->idFrom, EM_EXGETSEL, 0, (LPARAM)&sel);
+ bWasCopy = FALSE;
+ if (sel.cpMin != sel.cpMax) {
+ SendDlgItemMessage(hwnd, pNmhdr->idFrom, WM_COPY, 0, 0);
+ sel.cpMin = sel.cpMax;
+ SendDlgItemMessage(hwnd, pNmhdr->idFrom, EM_EXSETSEL, 0, (LPARAM)&sel);
+ bWasCopy = TRUE;
}
+ SetFocus(GetParent(hwnd));
}
break;
+
case EN_LINK:
- switch (((ENLINK *) lParam)->msg) {
+ switch (((ENLINK*)lParam)->msg) {
case WM_RBUTTONDOWN:
case WM_LBUTTONUP:
if (!bWasCopy) {
- if (HandleLinkClick(g_hInst, hwnd, GetDlgItem(GetParent(hwnd), IDC_MESSAGE),(ENLINK*)lParam)) {
+ if (HandleLinkClick(g_hInst, hwnd, GetDlgItem(GetParent(hwnd), IDC_MESSAGE), (ENLINK*)lParam)) {
SetWindowLongPtr(hwnd, DWLP_MSGRESULT, TRUE);
return TRUE;
}
@@ -212,8 +214,8 @@ static INT_PTR CALLBACK InfobarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
}
break;
}
- break;
}
+ break;
case WM_DRAWITEM:
{
@@ -224,7 +226,7 @@ static INT_PTR CALLBACK InfobarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
int itemWidth = dis->rcItem.right - dis->rcItem.left + 1;
int itemHeight = dis->rcItem.bottom - dis->rcItem.top + 1;
HBITMAP hbmMem = CreateCompatibleBitmap(dis->hDC, itemWidth, itemHeight);
- hbmMem = (HBITMAP) SelectObject(hdcMem, hbmMem);
+ hbmMem = (HBITMAP)SelectObject(hdcMem, hbmMem);
rect.top = 0;
rect.left = 0;
rect.right = itemWidth - 1;
@@ -242,7 +244,7 @@ static INT_PTR CALLBACK InfobarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
}
AVATARDRAWREQUEST adr = { sizeof(adr) };
- adr.hContact = idat->mwd->windowData.hContact;
+ adr.hContact = idat->mwd->hContact;
adr.hTargetDC = hdcMem;
adr.rcDraw.right = avatarWidth - 1;
adr.rcDraw.bottom = avatarHeight - 1;
@@ -251,25 +253,29 @@ static INT_PTR CALLBACK InfobarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
}
}
BitBlt(dis->hDC, 0, 0, itemWidth, itemHeight, hdcMem, 0, 0, SRCCOPY);
- hbmMem = (HBITMAP) SelectObject(hdcMem, hbmMem);
+ hbmMem = (HBITMAP)SelectObject(hdcMem, hbmMem);
DeleteObject(hbmMem);
DeleteDC(hdcMem);
return TRUE;
}
- return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
}
+ return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
+
case WM_LBUTTONDOWN:
SendMessage(idat->mwd->hwnd, WM_LBUTTONDOWN, wParam, lParam);
return TRUE;
+
case WM_RBUTTONUP:
{
+ HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, idat->mwd->hContact, 0);
+
POINT pt;
- HMENU hMenu = (HMENU) CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM) idat->mwd->windowData.hContact, 0);
GetCursorPos(&pt);
TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, GetParent(hwnd), NULL);
DestroyMenu(hMenu);
}
break;
+
case WM_DESTROY:
if (idat->hXStatusTip != NULL) {
DestroyWindow(idat->hXStatusTip);
@@ -280,9 +286,9 @@ static INT_PTR CALLBACK InfobarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
return FALSE;
}
-InfobarWindowData *CreateInfobar(HWND hParent, SrmmWindowData *dat)
+InfobarWindowData* CreateInfobar(HWND hParent, SrmmWindowData *dat)
{
- InfobarWindowData *idat = (InfobarWindowData *) mir_alloc(sizeof(InfobarWindowData));
+ InfobarWindowData *idat = (InfobarWindowData*)mir_alloc(sizeof(InfobarWindowData));
idat->mwd = dat;
idat->hWnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_INFOBAR), hParent, InfobarWndProc, (LPARAM)idat);
RichUtil_SubClass(idat->hWnd);
diff --git a/plugins/Scriver/src/input.cpp b/plugins/Scriver/src/input.cpp
index b0febe51b2..92005d849a 100644
--- a/plugins/Scriver/src/input.cpp
+++ b/plugins/Scriver/src/input.cpp
@@ -55,7 +55,7 @@ void InputAreaContextMenu(HWND hwnd, WPARAM, LPARAM lParam, MCONTACT hContact)
EnableMenuItem(hSubMenu, IDM_PASTE, MF_BYCOMMAND | MF_GRAYED);
}
if (lParam == 0xFFFFFFFF) {
- SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM)& pt, (LPARAM)sel.cpMax);
+ SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM)&pt, (LPARAM)sel.cpMax);
ClientToScreen(hwnd, &pt);
}
else {
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp
index 256b10e7f4..6ee4faa2ac 100644
--- a/plugins/Scriver/src/msgdialog.cpp
+++ b/plugins/Scriver/src/msgdialog.cpp
@@ -48,9 +48,9 @@ static ToolbarButton toolbarButtons[] = {
static TCHAR* GetIEViewSelection(SrmmWindowData *dat)
{
IEVIEWEVENT evt = { sizeof(evt) };
- evt.codepage = dat->windowData.codePage;
- evt.hwnd = dat->windowData.hwndLog;
- evt.hContact = dat->windowData.hContact;
+ evt.codepage = dat->codePage;
+ evt.hwnd = dat->hwndLog;
+ evt.hContact = dat->hContact;
evt.iType = IEE_GET_SELECTION;
return mir_tstrdup((TCHAR*)CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&evt));
}
@@ -210,9 +210,9 @@ static void SetDialogToType(HWND hwndDlg)
else
ShowWindow(dat->infobarData->hWnd, SW_HIDE);
- if (dat->windowData.hContact) {
+ if (dat->hContact) {
ShowToolbarControls(hwndDlg, SIZEOF(toolbarButtons), toolbarButtons, g_dat.buttonVisibility, showToolbar ? SW_SHOW : SW_HIDE);
- if (!db_get_b(dat->windowData.hContact, "CList", "NotOnList", 0))
+ if (!db_get_b(dat->hContact, "CList", "NotOnList", 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE);
if (!g_dat.smileyAddInstalled)
@@ -221,14 +221,14 @@ static void SetDialogToType(HWND hwndDlg)
else ShowToolbarControls(hwndDlg, SIZEOF(toolbarButtons), toolbarButtons, g_dat.buttonVisibility, SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_MESSAGE), SW_SHOW);
- if (dat->windowData.hwndLog != NULL)
+ if (dat->hwndLog != NULL)
ShowWindow(GetDlgItem(hwndDlg, IDC_LOG), SW_HIDE);
else
ShowWindow(GetDlgItem(hwndDlg, IDC_LOG), SW_SHOW);
ShowWindow(GetDlgItem(hwndDlg, IDC_SPLITTER), SW_SHOW);
UpdateReadChars(hwndDlg, dat);
- EnableWindow(GetDlgItem(hwndDlg, IDOK), GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE), dat->windowData.codePage, FALSE) ? TRUE : FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE), dat->codePage, FALSE) ? TRUE : FALSE);
SendMessage(hwndDlg, DM_CLISTSETTINGSCHANGED, 0, 0);
SendMessage(hwndDlg, WM_SIZE, 0, 0);
}
@@ -238,9 +238,9 @@ void SetStatusIcon(SrmmWindowData *dat)
if (dat->szProto == NULL)
return;
- MCONTACT hContact = db_mc_getSrmmSub(dat->windowData.hContact);
+ MCONTACT hContact = db_mc_getSrmmSub(dat->hContact);
if (hContact == NULL)
- hContact = dat->windowData.hContact;
+ hContact = dat->hContact;
char *szProto = GetContactProto(hContact);
Skin_ReleaseIcon(dat->statusIcon);
@@ -381,9 +381,8 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar
{
MsgEditSubclassData *dat = (MsgEditSubclassData*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
SrmmWindowData *pdat = (SrmmWindowData*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
- CommonWindowData *windowData = &pdat->windowData;
- int result = InputAreaShortcuts(hwnd, msg, wParam, lParam, windowData);
+ int result = InputAreaShortcuts(hwnd, msg, wParam, lParam, pdat);
if (result != -1)
return result;
@@ -460,7 +459,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar
return 0;
case WM_CONTEXTMENU:
- InputAreaContextMenu(hwnd, wParam, lParam, pdat->windowData.hContact);
+ InputAreaContextMenu(hwnd, wParam, lParam, pdat->hContact);
return TRUE;
case WM_DESTROY:
@@ -488,7 +487,7 @@ static void MessageDialogResize(HWND hwndDlg, SrmmWindowData *dat, int w, int h)
{
ParentWindowData *pdat = dat->parent;
int hSplitterPos = dat->splitterPos, toolbarHeight = pdat->flags2&SMF2_SHOWTOOLBAR ? IsToolbarVisible(SIZEOF(toolbarButtons), g_dat.buttonVisibility) ? dat->toolbarSize.cy : dat->toolbarSize.cy / 3 : 0;
- int hSplitterMinTop = toolbarHeight + dat->windowData.minLogBoxHeight, hSplitterMinBottom = dat->windowData.minEditBoxHeight;
+ int hSplitterMinTop = toolbarHeight + dat->minLogBoxHeight, hSplitterMinBottom = dat->minEditBoxHeight;
int infobarInnerHeight = INFO_BAR_INNER_HEIGHT;
int infobarHeight = INFO_BAR_HEIGHT;
int avatarWidth = 0, avatarHeight = 0;
@@ -554,11 +553,11 @@ static void MessageDialogResize(HWND hwndDlg, SrmmWindowData *dat, int w, int h)
hdwp = ResizeToolbar(hwndDlg, hdwp, toolbarWidth, h - hSplitterPos - toolbarHeight + 1, toolbarHeight, SIZEOF(toolbarButtons), toolbarButtons, g_dat.buttonVisibility);
EndDeferWindowPos(hdwp);
- if (dat->windowData.hwndLog != NULL) {
+ if (dat->hwndLog != NULL) {
IEVIEWWINDOW ieWindow = { sizeof(ieWindow) };
ieWindow.iType = IEW_SETPOS;
ieWindow.parent = hwndDlg;
- ieWindow.hwnd = dat->windowData.hwndLog;
+ ieWindow.hwnd = dat->hwndLog;
ieWindow.x = 0;
ieWindow.y = logY;
ieWindow.cx = w;
@@ -578,7 +577,7 @@ static void UpdateReadChars(HWND hwndDlg, SrmmWindowData *dat)
{
if (dat->parent->hwndActive == hwndDlg) {
TCHAR szText[256];
- int len = GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE), dat->windowData.codePage, FALSE);
+ int len = GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE), dat->codePage, FALSE);
StatusBarData sbd;
sbd.iItem = 1;
@@ -592,7 +591,7 @@ static void UpdateReadChars(HWND hwndDlg, SrmmWindowData *dat)
void ShowAvatar(HWND hwndDlg, SrmmWindowData *dat)
{
- INT_PTR res = CallService(MS_AV_GETAVATARBITMAP, dat->windowData.hContact, 0);
+ INT_PTR res = CallService(MS_AV_GETAVATARBITMAP, dat->hContact, 0);
dat->ace = res != CALLSERVICE_NOTFOUND ? (AVATARCACHEENTRY*)res : NULL;
dat->avatarPic = (dat->ace != NULL && (dat->ace->dwFlags & AVS_HIDEONCLIST) == 0) ? dat->ace->hbmPic : NULL;
SendMessage(hwndDlg, WM_SIZE, 0, 0);
@@ -605,7 +604,7 @@ void ShowAvatar(HWND hwndDlg, SrmmWindowData *dat)
static BOOL IsTypingNotificationSupported(SrmmWindowData *dat)
{
DWORD typeCaps;
- if (!dat->windowData.hContact)
+ if (!dat->hContact)
return FALSE;
if (!dat->szProto)
@@ -619,7 +618,7 @@ static BOOL IsTypingNotificationSupported(SrmmWindowData *dat)
static BOOL IsTypingNotificationEnabled(SrmmWindowData *dat)
{
- if (!db_get_b(dat->windowData.hContact, SRMMMOD, SRMSGSET_TYPING, db_get_b(NULL, SRMMMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)))
+ if (!db_get_b(dat->hContact, SRMMMOD, SRMSGSET_TYPING, db_get_b(NULL, SRMMMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)))
return FALSE;
DWORD protoStatus = CallProtoService(dat->szProto, PS_GETSTATUS, 0, 0);
@@ -627,13 +626,13 @@ static BOOL IsTypingNotificationEnabled(SrmmWindowData *dat)
return FALSE;
DWORD protoCaps = CallProtoService(dat->szProto, PS_GETCAPS, PFLAGNUM_1, 0);
- if (protoCaps & PF1_VISLIST && db_get_w(dat->windowData.hContact, dat->szProto, "ApparentMode", 0) == ID_STATUS_OFFLINE)
+ if (protoCaps & PF1_VISLIST && db_get_w(dat->hContact, dat->szProto, "ApparentMode", 0) == ID_STATUS_OFFLINE)
return FALSE;
- if (protoCaps & PF1_INVISLIST && protoStatus == ID_STATUS_INVISIBLE && db_get_w(dat->windowData.hContact, dat->szProto, "ApparentMode", 0) != ID_STATUS_ONLINE)
+ if (protoCaps & PF1_INVISLIST && protoStatus == ID_STATUS_INVISIBLE && db_get_w(dat->hContact, dat->szProto, "ApparentMode", 0) != ID_STATUS_ONLINE)
return FALSE;
- if (db_get_b(dat->windowData.hContact, "CList", "NotOnList", 0)
+ if (db_get_b(dat->hContact, "CList", "NotOnList", 0)
&& !db_get_b(NULL, SRMMMOD, SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN))
return FALSE;
return TRUE;
@@ -654,7 +653,7 @@ static void NotifyTyping(SrmmWindowData *dat, int mode)
// End user check
dat->nTypeMode = mode;
- CallService(MS_PROTO_SELFISTYPING, dat->windowData.hContact, dat->nTypeMode);
+ CallService(MS_PROTO_SELFISTYPING, dat->hContact, dat->nTypeMode);
}
static INT_PTR CALLBACK ConfirmSendAllDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM)
@@ -712,17 +711,17 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
NewMessageWindowLParam *newData = (NewMessageWindowLParam*)lParam;
dat = (SrmmWindowData*)mir_calloc(sizeof(SrmmWindowData));
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
- dat->windowData.hContact = newData->hContact;
- NotifyLocalWinEvent(dat->windowData.hContact, hwndDlg, MSG_WINDOW_EVT_OPENING);
+ dat->hContact = newData->hContact;
+ NotifyLocalWinEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_OPENING);
dat->hwnd = hwndDlg;
dat->hwndParent = GetParent(hwndDlg);
dat->parent = (ParentWindowData *)GetWindowLongPtr(dat->hwndParent, GWLP_USERDATA);
- dat->windowData.hwndLog = NULL;
- dat->szProto = GetContactProto(dat->windowData.hContact);
+ dat->hwndLog = NULL;
+ dat->szProto = GetContactProto(dat->hContact);
dat->avatarPic = 0;
- if (dat->windowData.hContact && dat->szProto != NULL)
- dat->wStatus = db_get_w(dat->windowData.hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
+ if (dat->hContact && dat->szProto != NULL)
+ dat->wStatus = db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
else
dat->wStatus = ID_STATUS_OFFLINE;
dat->hDbEventFirst = NULL;
@@ -741,7 +740,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
dat->lastEventTime = time(NULL);
dat->startTime = time(NULL);
dat->flags = 0;
- if (db_get_b(dat->windowData.hContact, SRMMMOD, "UseRTL", (BYTE)0))
+ if (db_get_b(dat->hContact, SRMMMOD, "UseRTL", (BYTE)0))
dat->flags |= SMF_RTL;
dat->flags |= g_dat.ieviewInstalled ? g_dat.flags & SMF_USEIEVIEW : 0;
@@ -774,16 +773,16 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
else
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LOG), GWL_EXSTYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LOG), GWL_EXSTYLE) & ~WS_EX_LEFTSCROLLBAR);
}
- dat->windowData.codePage = db_get_w(dat->windowData.hContact, SRMMMOD, "CodePage", (WORD)CP_ACP);
+ dat->codePage = db_get_w(dat->hContact, SRMMMOD, "CodePage", (WORD)CP_ACP);
dat->ace = NULL;
GetWindowRect(GetDlgItem(hwndDlg, IDC_MESSAGE), &minEditInit);
- dat->windowData.minEditBoxHeight = minEditInit.bottom - minEditInit.top;
- dat->windowData.minLogBoxHeight = dat->windowData.minEditBoxHeight;
+ dat->minEditBoxHeight = minEditInit.bottom - minEditInit.top;
+ dat->minLogBoxHeight = dat->minEditBoxHeight;
dat->toolbarSize.cy = TOOLBAR_HEIGHT;
dat->toolbarSize.cx = GetToolbarWidth(SIZEOF(toolbarButtons), toolbarButtons);
if (dat->splitterPos == -1)
- dat->splitterPos = dat->windowData.minEditBoxHeight;
- WindowList_Add(g_dat.hMessageWindowList, hwndDlg, dat->windowData.hContact);
+ dat->splitterPos = dat->minEditBoxHeight;
+ WindowList_Add(g_dat.hMessageWindowList, hwndDlg, dat->hContact);
if (newData->szInitialText) {
if (newData->isWchar)
@@ -792,7 +791,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
SetDlgItemTextA(hwndDlg, IDC_MESSAGE, newData->szInitialText);
}
else if (g_dat.flags & SMF_SAVEDRAFTS) {
- TCmdList *draft = tcmdlist_get2(g_dat.draftList, dat->windowData.hContact);
+ TCmdList *draft = tcmdlist_get2(g_dat.draftList, dat->hContact);
if (draft != NULL)
len = SetRichTextEncoded(GetDlgItem(hwndDlg, IDC_MESSAGE), draft->szCmd);
PostMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), EM_SETSEL, len, len);
@@ -823,13 +822,13 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETLANGOPTIONS, 0, (LPARAM)SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD);
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback2);
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_CHANGE | ENM_REQUESTRESIZE);
- if (dat->windowData.hContact && dat->szProto) {
- int nMax = CallProtoService(dat->szProto, PS_GETCAPS, PFLAG_MAXLENOFMESSAGE, dat->windowData.hContact);
+ if (dat->hContact && dat->szProto) {
+ int nMax = CallProtoService(dat->szProto, PS_GETCAPS, PFLAG_MAXLENOFMESSAGE, dat->hContact);
if (nMax)
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_LIMITTEXT, (WPARAM)nMax, 0);
+ SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_LIMITTEXT, nMax, 0);
}
/* get around a lame bug in the Windows template resource code where richedits are limited to 0x7FFF */
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_LIMITTEXT, (WPARAM) sizeof(TCHAR) * 0x7FFFFFFF, 0);
+ SendDlgItemMessage(hwndDlg, IDC_LOG, EM_LIMITTEXT, sizeof(TCHAR) * 0x7FFFFFFF, 0);
SubclassLogEdit(GetDlgItem(hwndDlg, IDC_LOG));
SubclassMessageEdit(GetDlgItem(hwndDlg, IDC_MESSAGE));
dat->infobarData = CreateInfobar(hwndDlg, dat);
@@ -841,16 +840,16 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
ieWindow.cx = 200;
ieWindow.cy = 300;
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
- dat->windowData.hwndLog = ieWindow.hwnd;
- if (dat->windowData.hwndLog == NULL)
+ dat->hwndLog = ieWindow.hwnd;
+ if (dat->hwndLog == NULL)
dat->flags ^= SMF_USEIEVIEW;
}
bool notifyUnread = false;
- if (dat->windowData.hContact) {
+ if (dat->hContact) {
int historyMode = db_get_b(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY);
// This finds the first message to display, it works like shit
- dat->hDbEventFirst = db_event_firstUnread(dat->windowData.hContact);
+ dat->hDbEventFirst = db_event_firstUnread(dat->hContact);
if (dat->hDbEventFirst != NULL) {
DBEVENTINFO dbei = { sizeof(dbei) };
db_event_get(dat->hDbEventFirst, &dbei);
@@ -864,9 +863,9 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
case LOADHISTORY_COUNT:
for (int i = db_get_w(NULL, SRMMMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT); i > 0; i--) {
if (dat->hDbEventFirst == NULL)
- hPrevEvent = db_event_last(dat->windowData.hContact);
+ hPrevEvent = db_event_last(dat->hContact);
else
- hPrevEvent = db_event_prev(dat->windowData.hContact, dat->hDbEventFirst);
+ hPrevEvent = db_event_prev(dat->hContact, dat->hDbEventFirst);
if (hPrevEvent == NULL)
break;
dbei.cbBlob = 0;
@@ -880,11 +879,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
case LOADHISTORY_TIME:
if (dat->hDbEventFirst == NULL) {
dbei.timestamp = time(NULL);
- hPrevEvent = db_event_last(dat->windowData.hContact);
+ hPrevEvent = db_event_last(dat->hContact);
}
else {
db_event_get(dat->hDbEventFirst, &dbei);
- hPrevEvent = db_event_prev(dat->windowData.hContact, dat->hDbEventFirst);
+ hPrevEvent = db_event_prev(dat->hContact, dat->hDbEventFirst);
}
DWORD firstTime = dbei.timestamp - 60 * db_get_w(NULL, SRMMMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME);
for (;;) {
@@ -896,14 +895,14 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
break;
if (DbEventIsShown(dbei))
dat->hDbEventFirst = hPrevEvent;
- hPrevEvent = db_event_prev(dat->windowData.hContact, hPrevEvent);
+ hPrevEvent = db_event_prev(dat->hContact, hPrevEvent);
}
break;
}
}
- SendMessage(dat->hwndParent, CM_ADDCHILD, (WPARAM)hwndDlg, dat->windowData.hContact);
+ SendMessage(dat->hwndParent, CM_ADDCHILD, (WPARAM)hwndDlg, dat->hContact);
{
- HANDLE hdbEvent = db_event_last(dat->windowData.hContact);
+ HANDLE hdbEvent = db_event_last(dat->hContact);
if (hdbEvent) {
DBEVENTINFO dbei = { sizeof(dbei) };
do {
@@ -912,11 +911,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
dat->lastMessage = dbei.timestamp;
break;
}
- } while ((hdbEvent = db_event_prev(dat->windowData.hContact, hdbEvent)));
+ } while ((hdbEvent = db_event_prev(dat->hContact, hdbEvent)));
}
}
SendMessage(hwndDlg, DM_OPTIONSAPPLIED, 0, 0);
- SendMessage(GetParent(hwndDlg), CM_POPUPWINDOW, (WPARAM)(newData->flags & NMWLP_INCOMING), (LPARAM)hwndDlg);
+ SendMessage(GetParent(hwndDlg), CM_POPUPWINDOW, newData->flags & NMWLP_INCOMING, (LPARAM)hwndDlg);
if (notifyUnread) {
if (GetForegroundWindow() != dat->hwndParent || dat->parent->hwndActive != hwndDlg) {
dat->showUnread = 1;
@@ -925,17 +924,17 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
}
SendMessage(dat->hwndParent, CM_STARTFLASHING, 0, 0);
}
- dat->messagesInProgress = ReattachSendQueueItems(hwndDlg, dat->windowData.hContact);
+ dat->messagesInProgress = ReattachSendQueueItems(hwndDlg, dat->hContact);
if (dat->messagesInProgress > 0)
SendMessage(hwndDlg, DM_SHOWMESSAGESENDING, 0, 0);
- NotifyLocalWinEvent(dat->windowData.hContact, hwndDlg, MSG_WINDOW_EVT_OPEN);
+ NotifyLocalWinEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_OPEN);
}
return TRUE;
case DM_GETCONTEXTMENU:
{
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, dat->windowData.hContact, 0);
+ HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, dat->hContact, 0);
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LONG_PTR)hMenu);
}
return TRUE;
@@ -943,7 +942,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
case WM_CONTEXTMENU:
if (dat->hwndParent == (HWND)wParam) {
POINT pt;
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, dat->windowData.hContact, 0);
+ HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, dat->hContact, 0);
GetCursorPos(&pt);
TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hwndDlg, NULL);
DestroyMenu(hMenu);
@@ -983,7 +982,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (dat->szProto == NULL) break;
if (!(CallProtoService(dat->szProto, PS_GETCAPS, PFLAGNUM_1, 0)&PF1_FILESEND)) break;
if (dat->wStatus == ID_STATUS_OFFLINE) break;
- if (dat->windowData.hContact != NULL) {
+ if (dat->hContact != NULL) {
TCHAR szFilename[MAX_PATH];
HDROP hDrop = (HDROP)wParam;
int fileCount = DragQueryFile(hDrop, -1, NULL, 0), totalCount = 0, i;
@@ -992,7 +991,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
DragQueryFile(hDrop, i, szFilename, SIZEOF(szFilename));
AddToFileList(&ppFiles, &totalCount, szFilename);
}
- CallServiceSync(MS_FILE_SENDSPECIFICFILEST, dat->windowData.hContact, (LPARAM)ppFiles);
+ CallServiceSync(MS_FILE_SENDSPECIFICFILEST, dat->hContact, (LPARAM)ppFiles);
for (i = 0; ppFiles[i]; i++) mir_free(ppFiles[i]);
mir_free(ppFiles);
}
@@ -1004,7 +1003,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
case DM_GETAVATAR:
{
- PROTO_AVATAR_INFORMATIONT ai = { sizeof(ai), dat->windowData.hContact };
+ PROTO_AVATAR_INFORMATIONT ai = { sizeof(ai), dat->hContact };
CallProtoService(dat->szProto, PS_GETAVATARINFOT, GAIF_FORCE, (LPARAM)&ai);
ShowAvatar(hwndDlg, dat);
}
@@ -1042,7 +1041,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
TabControlData tcd;
tcd.iFlags = TCDF_TEXT | TCDF_ICON;
tcd.hIcon = GetTabIcon(dat);
- tcd.pszText = GetTabName(dat->windowData.hContact);
+ tcd.pszText = GetTabName(dat->hContact);
SendMessage(dat->hwndParent, CM_UPDATETABCONTROL, (WPARAM)&tcd, (LPARAM)hwndDlg);
mir_free(tcd.pszText);
break;
@@ -1052,15 +1051,15 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
TitleBarData tbd = { 0 };
tbd.iFlags = TBDF_TEXT | TBDF_ICON;
GetTitlebarIcon(dat, &tbd);
- tbd.pszText = GetWindowTitle(dat->windowData.hContact, dat->szProto);
+ tbd.pszText = GetWindowTitle(dat->hContact, dat->szProto);
SendMessage(dat->hwndParent, CM_UPDATETITLEBAR, (WPARAM)&tbd, (LPARAM)hwndDlg);
mir_free(tbd.pszText);
}
break;
case DM_CLISTSETTINGSCHANGED:
- if (wParam == dat->windowData.hContact) {
- if (dat->windowData.hContact && dat->szProto) {
+ if (wParam == dat->hContact) {
+ if (dat->hContact && dat->szProto) {
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam;
char idbuf[128], buf[128];
GetContactUniqueId(dat, idbuf, sizeof(idbuf));
@@ -1086,7 +1085,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
COLORREF colour;
dat->flags &= ~SMF_USEIEVIEW;
dat->flags |= g_dat.ieviewInstalled ? g_dat.flags & SMF_USEIEVIEW : 0;
- if (dat->flags & SMF_USEIEVIEW && dat->windowData.hwndLog == NULL) {
+ if (dat->flags & SMF_USEIEVIEW && dat->hwndLog == NULL) {
IEVIEWWINDOW ieWindow = { sizeof(ieWindow) };
ieWindow.iType = IEW_CREATE;
ieWindow.dwMode = IEWM_SCRIVER;
@@ -1094,18 +1093,18 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
ieWindow.cx = 200;
ieWindow.cy = 300;
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
- dat->windowData.hwndLog = ieWindow.hwnd;
- if (dat->windowData.hwndLog == NULL)
+ dat->hwndLog = ieWindow.hwnd;
+ if (dat->hwndLog == NULL)
dat->flags ^= SMF_USEIEVIEW;
}
- else if (!(dat->flags & SMF_USEIEVIEW) && dat->windowData.hwndLog != NULL) {
- if (dat->windowData.hwndLog != NULL) {
+ else if (!(dat->flags & SMF_USEIEVIEW) && dat->hwndLog != NULL) {
+ if (dat->hwndLog != NULL) {
IEVIEWWINDOW ieWindow = { sizeof(ieWindow) };
ieWindow.iType = IEW_DESTROY;
- ieWindow.hwnd = dat->windowData.hwndLog;
+ ieWindow.hwnd = dat->hwndLog;
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
}
- dat->windowData.hwndLog = NULL;
+ dat->hwndLog = NULL;
}
SendMessage(hwndDlg, DM_GETAVATAR, 0, 0);
@@ -1126,7 +1125,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
cf2.wWeight = (WORD)lf.lfWeight;
cf2.bPitchAndFamily = lf.lfPitchAndFamily;
cf2.yHeight = abs(lf.lfHeight) * 1440 / g_dat.logPixelSY;
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETCHARFORMAT, (WPARAM)SCF_ALL, (LPARAM)&cf2);
+ SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf2);
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETLANGOPTIONS, 0, (LPARAM)SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD);
pf2.cbSize = sizeof(pf2);
@@ -1145,7 +1144,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
break;
case DM_USERNAMETOCLIP:
- if (dat->windowData.hContact) {
+ if (dat->hContact) {
char buf[128];
GetContactUniqueId(dat, buf, sizeof(buf));
if (!OpenClipboard(hwndDlg) || !mir_strlen(buf))
@@ -1166,11 +1165,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
break;
case DM_GETCODEPAGE:
- SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, dat->windowData.codePage);
+ SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, dat->codePage);
return TRUE;
case DM_SETCODEPAGE:
- dat->windowData.codePage = (int)lParam;
+ dat->codePage = (int)lParam;
SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
break;
@@ -1180,11 +1179,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
sid.szModule = SRMMMOD;
sid.dwId = 1;
- BYTE typingNotify = (db_get_b(dat->windowData.hContact, SRMMMOD, SRMSGSET_TYPING,
+ BYTE typingNotify = (db_get_b(dat->hContact, SRMMMOD, SRMSGSET_TYPING,
db_get_b(NULL, SRMMMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)));
- db_set_b(dat->windowData.hContact, SRMMMOD, SRMSGSET_TYPING, (BYTE)!typingNotify);
+ db_set_b(dat->hContact, SRMMMOD, SRMSGSET_TYPING, (BYTE)!typingNotify);
sid.flags = typingNotify ? MBF_DISABLED : 0;
- Srmm_ModifyIcon(dat->windowData.hContact, &sid);
+ Srmm_ModifyIcon(dat->hContact, &sid);
}
break;
@@ -1234,8 +1233,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
DBEVENTINFO dbei = { sizeof(dbei) };
db_event_get(hDbEvent, &dbei);
if (!(dbei.flags & DBEF_SENT) && (DbEventIsMessageOrCustom(&dbei) || dbei.eventType == EVENTTYPE_URL))
- CallService(MS_CLIST_REMOVEEVENT, dat->windowData.hContact, (LPARAM)hDbEvent);
- hDbEvent = db_event_next(dat->windowData.hContact, hDbEvent);
+ CallService(MS_CLIST_REMOVEEVENT, dat->hContact, (LPARAM)hDbEvent);
+ hDbEvent = db_event_next(dat->hContact, hDbEvent);
}
}
if (dat->showUnread) {
@@ -1254,8 +1253,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
HWND hLog;
POINT pt;
GetCursorPos(&pt);
- if (dat->windowData.hwndLog != NULL)
- hLog = dat->windowData.hwndLog;
+ if (dat->hwndLog != NULL)
+ hLog = dat->hwndLog;
else
hLog = GetDlgItem(hwndDlg, IDC_LOG);
@@ -1284,7 +1283,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
{
MINMAXINFO *mmi = (MINMAXINFO *)lParam;
mmi->ptMinTrackSize.x = dat->toolbarSize.cx + BOTTOM_RIGHT_AVATAR_HEIGHT;
- mmi->ptMinTrackSize.y = dat->windowData.minLogBoxHeight + dat->toolbarSize.cy + dat->windowData.minEditBoxHeight + max(INFO_BAR_HEIGHT, BOTTOM_RIGHT_AVATAR_HEIGHT - dat->toolbarSize.cy) + 5;
+ mmi->ptMinTrackSize.y = dat->minLogBoxHeight + dat->toolbarSize.cy + dat->minEditBoxHeight + max(INFO_BAR_HEIGHT, BOTTOM_RIGHT_AVATAR_HEIGHT - dat->toolbarSize.cy) + 5;
}
return 0;
@@ -1311,7 +1310,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
case DM_REMAKELOG:
dat->lastEventType = -1;
- if (wParam == 0 || wParam == dat->windowData.hContact)
+ if (wParam == 0 || wParam == dat->hContact)
StreamInEvents(hwndDlg, dat->hDbEventFirst, -1, 0);
InvalidateRect(GetDlgItem(hwndDlg, IDC_LOG), NULL, FALSE);
@@ -1322,7 +1321,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
break;
case DM_SCROLLLOGTOBOTTOM:
- if (dat->windowData.hwndLog == NULL) {
+ if (dat->hwndLog == NULL) {
if ((GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LOG), GWL_STYLE) & WS_VSCROLL) == 0)
break;
@@ -1342,13 +1341,13 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
IEVIEWWINDOW ieWindow;
ieWindow.cbSize = sizeof(IEVIEWWINDOW);
ieWindow.iType = IEW_SCROLLBOTTOM;
- ieWindow.hwnd = dat->windowData.hwndLog;
+ ieWindow.hwnd = dat->hwndLog;
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
}
break;
case HM_DBEVENTADDED:
- if (wParam == dat->windowData.hContact) {
+ if (wParam == dat->hContact) {
HANDLE hDbEvent = (HANDLE)lParam;
DBEVENTINFO dbei = { sizeof(dbei) };
db_event_get(hDbEvent, &dbei);
@@ -1366,10 +1365,10 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
else SkinPlaySound("RecvMsgInactive");
if ((g_dat.flags2 & SMF2_SWITCHTOACTIVE) && (IsIconic(dat->hwndParent) || GetActiveWindow() != dat->hwndParent) && IsWindowVisible(dat->hwndParent))
SendMessage(dat->hwndParent, CM_ACTIVATECHILD, 0, (LPARAM)hwndDlg);
- if (IsAutoPopup(dat->windowData.hContact))
+ if (IsAutoPopup(dat->hContact))
SendMessage(GetParent(hwndDlg), CM_POPUPWINDOW, 1, (LPARAM)hwndDlg);
}
- if (hDbEvent != dat->hDbEventFirst && db_event_next(dat->windowData.hContact, hDbEvent) == NULL)
+ if (hDbEvent != dat->hDbEventFirst && db_event_next(dat->hContact, hDbEvent) == NULL)
SendMessage(hwndDlg, DM_APPENDTOLOG, WPARAM(hDbEvent), 0);
else
SendMessage(hwndDlg, DM_REMAKELOG, 0, 0);
@@ -1396,7 +1395,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
mir_sntprintf(szText, SIZEOF(szText), TranslateT("Sending in progress: %d message(s) left..."), dat->messagesInProgress);
}
else if (dat->nTypeSecs) {
- TCHAR *szContactName = GetNickname(dat->windowData.hContact, dat->szProto);
+ TCHAR *szContactName = GetNickname(dat->hContact, dat->szProto);
sbd.hIcon = GetCachedIcon("scriver_TYPING");
sbd.pszText = szText;
mir_sntprintf(szText, SIZEOF(szText), TranslateT("%s is typing a message..."), szContactName);
@@ -1418,26 +1417,26 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
StatusIconData sid = { sizeof(sid) };
sid.szModule = SRMMMOD;
sid.flags = MBF_DISABLED;
- Srmm_ModifyIcon(dat->windowData.hContact, &sid);
+ Srmm_ModifyIcon(dat->hContact, &sid);
sid.dwId = 1;
if (IsTypingNotificationSupported(dat) && g_dat.flags2 & SMF2_SHOWTYPINGSWITCH)
- sid.flags = (db_get_b(dat->windowData.hContact, SRMMMOD, SRMSGSET_TYPING,
+ sid.flags = (db_get_b(dat->hContact, SRMMMOD, SRMSGSET_TYPING,
db_get_b(NULL, SRMMMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW))) ? 0 : MBF_DISABLED;
else
sid.flags = MBF_HIDDEN;
- Srmm_ModifyIcon(dat->windowData.hContact, &sid);
+ Srmm_ModifyIcon(dat->hContact, &sid);
}
break;
case DM_CLEARLOG:
- if (dat->windowData.hwndLog != NULL) {
+ if (dat->hwndLog != NULL) {
IEVIEWEVENT evt = { sizeof(evt) };
evt.iType = IEE_CLEAR_LOG;
evt.dwFlags = ((dat->flags & SMF_RTL) ? IEEF_RTL : 0);
- evt.hwnd = dat->windowData.hwndLog;
- evt.hContact = dat->windowData.hContact;
- evt.codepage = dat->windowData.codePage;
+ evt.hwnd = dat->hwndLog;
+ evt.hContact = dat->hContact;
+ evt.codepage = dat->codePage;
evt.pszProto = dat->szProto;
CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&evt);
}
@@ -1486,11 +1485,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (lParam) {
MessageSendQueueItem *msi = (MessageSendQueueItem *)lParam;
MessageSendQueueItem *item = CreateSendQueueItem(hwndDlg);
- item->hContact = dat->windowData.hContact;
+ item->hContact = dat->hContact;
item->proto = mir_strdup(dat->szProto);
item->flags = msi->flags;
- item->codepage = dat->windowData.codePage;
- if (IsUtfSendAvailable(dat->windowData.hContact)) {
+ item->codepage = dat->codePage;
+ if (IsUtfSendAvailable(dat->hContact)) {
char *szMsgUtf = mir_utf8encodeW((TCHAR*)&msi->sendBuffer[strlen(msi->sendBuffer) + 1]);
item->flags &= ~PREF_UNICODE;
if (!szMsgUtf)
@@ -1590,7 +1589,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
}
AVATARDRAWREQUEST adr = { sizeof(adr) };
- adr.hContact = dat->windowData.hContact;
+ adr.hContact = dat->hContact;
adr.hTargetDC = hdcMem;
adr.rcDraw.left = (itemWidth - avatarWidth) / 2;
adr.rcDraw.top = (itemHeight - avatarHeight) / 2;
@@ -1610,7 +1609,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
case WM_COMMAND:
- if (!lParam && CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)dat->windowData.hContact))
+ if (!lParam && CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)dat->hContact))
break;
switch (LOWORD(wParam)) {
@@ -1631,8 +1630,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDOK)))
break;
- if (dat->windowData.hContact != NULL) {
- int ansiBufSize = GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE), dat->windowData.codePage, TRUE) + 1;
+ if (dat->hContact != NULL) {
+ int ansiBufSize = GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE), dat->codePage, TRUE) + 1;
int bufSize = ansiBufSize + GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE), 1200, TRUE) + 2;
memset(&pf2, 0, sizeof(pf2));
@@ -1650,7 +1649,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
GETTEXTEX gt = { 0 };
gt.flags = GT_USECRLF;
gt.cb = ansiBufSize;
- gt.codepage = dat->windowData.codePage;
+ gt.codepage = dat->codePage;
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETTEXTEX, (WPARAM)&gt, (LPARAM)msi.sendBuffer);
gt.cb = bufSize - ansiBufSize;
gt.codepage = 1200;
@@ -1664,17 +1663,17 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
}
/* Store messaging history */
- char *msgText = GetRichTextEncoded(GetDlgItem(hwndDlg, IDC_MESSAGE), dat->windowData.codePage);
- TCmdList *cmdListNew = tcmdlist_last(dat->windowData.cmdList);
+ char *msgText = GetRichTextEncoded(GetDlgItem(hwndDlg, IDC_MESSAGE), dat->codePage);
+ TCmdList *cmdListNew = tcmdlist_last(dat->cmdList);
while (cmdListNew != NULL && cmdListNew->temporary) {
- dat->windowData.cmdList = tcmdlist_remove(dat->windowData.cmdList, cmdListNew);
- cmdListNew = tcmdlist_last(dat->windowData.cmdList);
+ dat->cmdList = tcmdlist_remove(dat->cmdList, cmdListNew);
+ cmdListNew = tcmdlist_last(dat->cmdList);
}
if (msgText != NULL) {
- dat->windowData.cmdList = tcmdlist_append(dat->windowData.cmdList, msgText, 20, FALSE);
+ dat->cmdList = tcmdlist_append(dat->cmdList, msgText, 20, FALSE);
mir_free(msgText);
}
- dat->windowData.cmdListCurrent = NULL;
+ dat->cmdListCurrent = NULL;
if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON)
NotifyTyping(dat, PROTOTYPE_SELFTYPING_OFF);
@@ -1700,7 +1699,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
SendMessage(hwndDlg, DM_USERNAMETOCLIP, 0, 0);
else {
RECT rc;
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)dat->windowData.hContact, 0);
+ HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, dat->hContact, 0);
GetWindowRect(GetDlgItem(hwndDlg, LOWORD(wParam)), &rc);
TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL);
DestroyMenu(hMenu);
@@ -1708,11 +1707,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
break;
case IDC_HISTORY:
- CallService(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM)dat->windowData.hContact, 0);
+ CallService(MS_HISTORY_SHOWCONTACTHISTORY, dat->hContact, 0);
break;
case IDC_DETAILS:
- CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)dat->windowData.hContact, 0);
+ CallService(MS_USERINFO_SHOWDIALOG, dat->hContact, 0);
break;
case IDC_SMILEYS:
@@ -1724,7 +1723,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
smaddInfo.targetMessage = EM_REPLACESEL;
smaddInfo.targetWParam = TRUE;
- MCONTACT hContact = db_mc_getSrmmSub(dat->windowData.hContact);
+ MCONTACT hContact = db_mc_getSrmmSub(dat->hContact);
smaddInfo.Protocolname = (hContact != NULL) ? GetContactProto(hContact) : dat->szProto;
RECT rc;
@@ -1732,7 +1731,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
smaddInfo.Direction = 0;
smaddInfo.xPosition = rc.left;
smaddInfo.yPosition = rc.bottom;
- smaddInfo.hContact = dat->windowData.hContact;
+ smaddInfo.hContact = dat->hContact;
CallService(MS_SMILEYADD_SHOWSELECTION, 0, (LPARAM)&smaddInfo);
}
break;
@@ -1744,7 +1743,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
st.codepage = 1200;
TCHAR *buffer = NULL;
- if (dat->windowData.hwndLog != NULL)
+ if (dat->hwndLog != NULL)
buffer = GetIEViewSelection(dat);
else
buffer = GetRichEditSelection(GetDlgItem(hwndDlg, IDC_LOG));
@@ -1780,18 +1779,18 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
case IDC_ADD:
{
ADDCONTACTSTRUCT acs = { 0 };
- acs.hContact = dat->windowData.hContact;
+ acs.hContact = dat->hContact;
acs.handleType = HANDLE_CONTACT;
acs.szProto = 0;
CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs);
}
- if (!db_get_b(dat->windowData.hContact, "CList", "NotOnList", 0))
+ if (!db_get_b(dat->hContact, "CList", "NotOnList", 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE);
case IDC_MESSAGE:
if (HIWORD(wParam) == EN_CHANGE) {
- int len = GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE), dat->windowData.codePage, FALSE);
- dat->windowData.cmdListCurrent = NULL;
+ int len = GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE), dat->codePage, FALSE);
+ dat->cmdListCurrent = NULL;
UpdateReadChars(hwndDlg, dat);
EnableWindow(GetDlgItem(hwndDlg, IDOK), len != 0);
if (!(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_SHIFT) & 0x8000)) {
@@ -1815,7 +1814,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
switch (pNmhdr->code) {
case EN_MSGFILTER:
{
- int result = InputAreaShortcuts(GetDlgItem(hwndDlg, IDC_MESSAGE), ((MSGFILTER *)lParam)->msg, ((MSGFILTER *)lParam)->wParam, ((MSGFILTER *)lParam)->lParam, &dat->windowData);
+ int result = InputAreaShortcuts(GetDlgItem(hwndDlg, IDC_MESSAGE), ((MSGFILTER *)lParam)->msg, ((MSGFILTER *)lParam)->wParam, ((MSGFILTER *)lParam)->lParam, dat);
if (result != -1) {
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
return TRUE;
@@ -1900,7 +1899,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
break;
case WM_DESTROY:
- NotifyLocalWinEvent(dat->windowData.hContact, hwndDlg, MSG_WINDOW_EVT_CLOSING);
+ NotifyLocalWinEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_CLOSING);
if (dat->nTypeMode == PROTOTYPE_SELFTYPING_ON)
NotifyTyping(dat, PROTOTYPE_SELFTYPING_OFF);
@@ -1911,32 +1910,32 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
dat->statusIconOverlay = NULL;
ReleaseSendQueueItems(hwndDlg);
if (g_dat.flags & SMF_SAVEDRAFTS)
- saveDraftMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), dat->windowData.hContact, dat->windowData.codePage);
+ saveDraftMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), dat->hContact, dat->codePage);
else
- g_dat.draftList = tcmdlist_remove2(g_dat.draftList, dat->windowData.hContact);
+ g_dat.draftList = tcmdlist_remove2(g_dat.draftList, dat->hContact);
- tcmdlist_free(dat->windowData.cmdList);
+ tcmdlist_free(dat->cmdList);
WindowList_Remove(g_dat.hMessageWindowList, hwndDlg);
HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_MESSAGE, WM_GETFONT, 0, 0);
if (hFont != NULL && hFont != (HFONT)SendDlgItemMessage(hwndDlg, IDOK, WM_GETFONT, 0, 0))
DeleteObject(hFont);
- db_set_b(dat->windowData.hContact, SRMMMOD, "UseRTL", (BYTE)((dat->flags & SMF_RTL) ? 1 : 0));
- db_set_w(dat->windowData.hContact, SRMMMOD, "CodePage", (WORD)dat->windowData.codePage);
- if (dat->windowData.hContact && (g_dat.flags & SMF_DELTEMP))
- if (db_get_b(dat->windowData.hContact, "CList", "NotOnList", 0))
- CallService(MS_DB_CONTACT_DELETE, (WPARAM)dat->windowData.hContact, 0);
+ db_set_b(dat->hContact, SRMMMOD, "UseRTL", (BYTE)((dat->flags & SMF_RTL) ? 1 : 0));
+ db_set_w(dat->hContact, SRMMMOD, "CodePage", (WORD)dat->codePage);
+ if (dat->hContact && (g_dat.flags & SMF_DELTEMP))
+ if (db_get_b(dat->hContact, "CList", "NotOnList", 0))
+ CallService(MS_DB_CONTACT_DELETE, dat->hContact, 0);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
SendMessage(dat->hwndParent, CM_REMOVECHILD, 0, (LPARAM)hwndDlg);
- if (dat->windowData.hwndLog != NULL) {
+ if (dat->hwndLog != NULL) {
IEVIEWWINDOW ieWindow = { sizeof(ieWindow) };
ieWindow.iType = IEW_DESTROY;
- ieWindow.hwnd = dat->windowData.hwndLog;
+ ieWindow.hwnd = dat->hwndLog;
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
}
- NotifyLocalWinEvent(dat->windowData.hContact, hwndDlg, MSG_WINDOW_EVT_CLOSE);
+ NotifyLocalWinEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_CLOSE);
mir_free(dat);
break;
}
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp
index 378e0d38fa..4d7631dba9 100644
--- a/plugins/Scriver/src/msglog.cpp
+++ b/plugins/Scriver/src/msglog.cpp
@@ -182,7 +182,7 @@ EventData* getEventFromDB(SrmmWindowData *dat, MCONTACT hContact, HANDLE hDbEven
evt->time = dbei.timestamp;
evt->pszNick = NULL;
- evt->codePage = dat->windowData.codePage;
+ evt->codePage = dat->codePage;
if (evt->dwFlags & IEEDF_SENT)
evt->pszNickT = GetNickname(NULL, dat->szProto);
@@ -196,7 +196,7 @@ EventData* getEventFromDB(SrmmWindowData *dat, MCONTACT hContact, HANDLE hDbEven
if (*descr != 0)
evt->pszText2T = DbGetEventStringT(&dbei, descr);
}
- else evt->pszTextT = DbGetEventTextT(&dbei, dat->windowData.codePage);
+ else evt->pszTextT = DbGetEventTextT(&dbei, dat->codePage);
if (!(dat->flags & SMF_RTL) && RTL_Detect(evt->pszTextT))
evt->dwFlags |= IEEDF_RTL;
@@ -798,7 +798,9 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG
void StreamInTestEvents(HWND hEditWnd, GlobalMessageData *gdat)
{
- SrmmWindowData dat = { 0 };
+ SrmmWindowData dat;
+ memset(&dat, 0, sizeof(dat));
+
LogStreamData streamData = { 0 };
streamData.isFirst = TRUE;
streamData.events = GetTestEvents();
@@ -821,15 +823,15 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend)
CHARRANGE oldSel, sel;
// IEVIew MOD Begin
- if (dat->windowData.hwndLog != NULL) {
+ if (dat->hwndLog != NULL) {
IEVIEWEVENT evt;
IEVIEWWINDOW ieWindow;
memset(&evt, 0, sizeof(evt));
evt.cbSize = sizeof(evt);
evt.dwFlags = ((dat->flags & SMF_RTL) ? IEEF_RTL : 0);
- evt.hwnd = dat->windowData.hwndLog;
- evt.hContact = dat->windowData.hContact;
- evt.codepage = dat->windowData.codePage;
+ evt.hwnd = dat->hwndLog;
+ evt.hContact = dat->hContact;
+ evt.codepage = dat->codePage;
evt.pszProto = dat->szProto;
if (!fAppend) {
evt.iType = IEE_CLEAR_LOG;
@@ -844,7 +846,7 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend)
memset(&ieWindow, 0, sizeof(ieWindow));
ieWindow.cbSize = sizeof(ieWindow);
ieWindow.iType = IEW_SCROLLBOTTOM;
- ieWindow.hwnd = dat->windowData.hwndLog;
+ ieWindow.hwnd = dat->hwndLog;
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
return;
}
@@ -852,12 +854,12 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend)
// IEVIew MOD End
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_HIDESELECTION, TRUE, 0);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXGETSEL, 0, (LPARAM)&oldSel);
- streamData.hContact = dat->windowData.hContact;
+ streamData.hContact = dat->hContact;
streamData.hDbEvent = hDbEventFirst;
streamData.hDbEventLast = dat->hDbEventLast;
streamData.dlgDat = dat;
streamData.eventsToInsert = count;
- streamData.isFirst = fAppend ? GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), dat->windowData.codePage, FALSE) == 0 : 1;
+ streamData.isFirst = fAppend ? GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), dat->codePage, FALSE) == 0 : 1;
streamData.gdat = &g_dat;
stream.pfnCallback = LogStreamInEvents;
stream.dwCookie = (DWORD_PTR)& streamData;
@@ -867,14 +869,14 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend)
gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMCHARS;
gtxl.codepage = 1200;
fi.chrg.cpMin = SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETTEXTLENGTHEX, (WPARAM)&gtxl, 0);
- sel.cpMin = sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), dat->windowData.codePage, FALSE);
+ sel.cpMin = sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), dat->codePage, FALSE);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXSETSEL, 0, (LPARAM)&sel);
}
else {
SendDlgItemMessage(hwndDlg, IDC_LOG, WM_SETREDRAW, FALSE, 0);
SetDlgItemText(hwndDlg, IDC_LOG, _T(""));
sel.cpMin = 0;
- sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), dat->windowData.codePage, FALSE);
+ sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), dat->codePage, FALSE);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXSETSEL, 0, (LPARAM)&sel);
fi.chrg.cpMin = 0;
dat->isMixed = 0;
@@ -888,7 +890,7 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend)
smre.cbSize = sizeof(SMADD_RICHEDIT3);
smre.hwndRichEditControl = GetDlgItem(hwndDlg, IDC_LOG);
- MCONTACT hContact = db_mc_getSrmmSub(dat->windowData.hContact);
+ MCONTACT hContact = db_mc_getSrmmSub(dat->hContact);
smre.Protocolname = (hContact != NULL) ? GetContactProto(hContact) : dat->szProto;
if (fi.chrg.cpMin > 0) {
@@ -899,12 +901,12 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend)
else smre.rangeToReplace = NULL;
smre.disableRedraw = TRUE;
- smre.hContact = dat->windowData.hContact;
+ smre.hContact = dat->hContact;
smre.flags = 0;
CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM)&smre);
}
- int len = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), dat->windowData.codePage, FALSE);
+ int len = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), dat->codePage, FALSE);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETSEL, len - 1, len - 1);
if (!fAppend)
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp
index 9d762aaf57..335446a8b4 100644
--- a/plugins/Scriver/src/msgs.cpp
+++ b/plugins/Scriver/src/msgs.cpp
@@ -188,7 +188,7 @@ static INT_PTR TypingMessageCommand(WPARAM, LPARAM lParam)
{
CLISTEVENT *cle = (CLISTEVENT*)lParam;
if (cle)
- SendMessageCommand((WPARAM)cle->hContact, 0);
+ SendMessageCommand(cle->hContact, 0);
return 0;
}
@@ -324,30 +324,35 @@ static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam)
return 0;
}
-static INT_PTR SetStatusText(WPARAM wParam, LPARAM lParam)
+static INT_PTR SetStatusText(WPARAM hContact, LPARAM lParam)
{
- // FIXME: Temporary workaround for crashing in x64 version (setting statusbar for group chats didn't work this way anyway)
- MCONTACT hContact = wParam;
- char *szProto = GetContactProto(hContact);
- if (szProto && db_get_b(hContact, szProto, "ChatRoom", 0))
+ StatusTextData *st = (StatusTextData*)lParam;
+ if (st != NULL && st->cbSize != sizeof(StatusTextData))
return 1;
- HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, wParam);
- if (hwnd == NULL)
- hwnd = SM_FindWindowByContact(wParam);
- if (hwnd == NULL)
- return 1;
+ ParentWindowData *pdat;
+ HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact);
+ if (hwnd == NULL) {
+ hwnd = SM_FindWindowByContact(hContact);
+ if (hwnd == NULL)
+ return 1;
- SrmmWindowData *dat = (SrmmWindowData*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if (dat == NULL || dat->parent == NULL)
- return 1;
+ SESSION_INFO *si = (SESSION_INFO*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ if (si == NULL || si->parent == NULL)
+ return 1;
- StatusTextData *st = (StatusTextData*)lParam;
- if (st != NULL && st->cbSize != sizeof(StatusTextData))
- return 1;
+ pdat = si->parent;
+ }
+ else {
+ SrmmWindowData *dat = (SrmmWindowData*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ if (dat == NULL || dat->parent == NULL)
+ return 1;
+
+ pdat = dat->parent;
+ }
- SendMessage(dat->parent->hwndStatus, SB_SETICON, 0, (LPARAM)(st == NULL ? 0 : st->hIcon));
- SendMessage(dat->parent->hwndStatus, SB_SETTEXT, 0, (LPARAM)(st == NULL ? _T("") : st->tszText));
+ SendMessage(pdat->hwndStatus, SB_SETICON, 0, (LPARAM)(st == NULL ? 0 : st->hIcon));
+ SendMessage(pdat->hwndStatus, SB_SETTEXT, 0, (LPARAM)(st == NULL ? _T("") : st->tszText));
return 0;
}
diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h
index f73587fc04..c823caff29 100644
--- a/plugins/Scriver/src/msgs.h
+++ b/plugins/Scriver/src/msgs.h
@@ -105,7 +105,7 @@ struct NewMessageWindowLParam
struct CommonWindowData
{
- MCONTACT hContact;
+ ParentWindowData *parent;
int codePage;
DWORD flags;
HWND hwndLog;
@@ -113,11 +113,11 @@ struct CommonWindowData
TCmdList *cmdList, *cmdListCurrent;
};
-struct SrmmWindowData
+struct SrmmWindowData : public CommonWindowData
{
HWND hwnd;
+ MCONTACT hContact;
int tabId;
- ParentWindowData *parent;
HWND hwndParent;
HANDLE hDbEventFirst, hDbEventLast, hDbUnreadEventFirst;
int splitterPos;
@@ -144,7 +144,6 @@ struct SrmmWindowData
HICON statusIcon;
HICON statusIconBig;
HICON statusIconOverlay;
- CommonWindowData windowData;
InfobarWindowData *infobarData;
};
diff --git a/plugins/Scriver/src/msgtimedout.cpp b/plugins/Scriver/src/msgtimedout.cpp
index 6a7bc06f49..26ebcdd992 100644
--- a/plugins/Scriver/src/msgtimedout.cpp
+++ b/plugins/Scriver/src/msgtimedout.cpp
@@ -47,7 +47,7 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
st.flags = ST_DEFAULT;
st.codepage = 1200;
- SendDlgItemMessage(hwndDlg, IDC_MSGTEXT, EM_SETTEXTEX, (WPARAM) &st, (LPARAM)ewd->szText);
+ SendDlgItemMessage(hwndDlg, IDC_MSGTEXT, EM_SETTEXTEX, (WPARAM)&st, (LPARAM)ewd->szText);
}
if (ewd->szName)
mir_sntprintf(szText, SIZEOF(szText), _T("%s - %s"), TranslateT("Send Error"), ewd->szName);
@@ -83,5 +83,4 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
}
return FALSE;
-
}
diff --git a/plugins/Scriver/src/utils.cpp b/plugins/Scriver/src/utils.cpp
index b40a5272fe..0ecbad553b 100644
--- a/plugins/Scriver/src/utils.cpp
+++ b/plugins/Scriver/src/utils.cpp
@@ -434,7 +434,7 @@ void GetContactUniqueId(SrmmWindowData *dat, char *buf, int maxlen)
CONTACTINFO ci;
memset(&ci, 0, sizeof(ci));
ci.cbSize = sizeof(ci);
- ci.hContact = dat->windowData.hContact;
+ ci.hContact = dat->hContact;
ci.szProto = dat->szProto;
ci.dwFlag = CNF_UNIQUEID;
buf[0] = 0;