diff options
-rw-r--r-- | plugins/Scriver/src/chat/log.cpp | 12 | ||||
-rw-r--r-- | plugins/Scriver/src/chat/options.cpp | 2 | ||||
-rw-r--r-- | plugins/Scriver/src/chat/services.cpp | 24 | ||||
-rw-r--r-- | plugins/Scriver/src/chat/tools.cpp | 2 | ||||
-rw-r--r-- | plugins/Scriver/src/chat/window.cpp | 22 | ||||
-rw-r--r-- | plugins/Scriver/src/commonheaders.h | 2 | ||||
-rw-r--r-- | plugins/Scriver/src/globals.cpp | 367 | ||||
-rw-r--r-- | plugins/Scriver/src/globals.h | 11 | ||||
-rw-r--r-- | plugins/Scriver/src/infobar.cpp | 12 | ||||
-rw-r--r-- | plugins/Scriver/src/msgdialog.cpp | 94 | ||||
-rw-r--r-- | plugins/Scriver/src/msglog.cpp | 118 | ||||
-rw-r--r-- | plugins/Scriver/src/msgoptions.cpp | 23 | ||||
-rw-r--r-- | plugins/Scriver/src/msgs.cpp | 152 | ||||
-rw-r--r-- | plugins/Scriver/src/msgwindow.cpp | 510 | ||||
-rw-r--r-- | plugins/Scriver/src/richutil.cpp | 22 | ||||
-rw-r--r-- | plugins/Scriver/src/statusicon.cpp | 12 | ||||
-rw-r--r-- | plugins/Scriver/src/utils.cpp | 52 | ||||
-rw-r--r-- | plugins/Scriver/src/utils.h | 4 |
18 files changed, 630 insertions, 811 deletions
diff --git a/plugins/Scriver/src/chat/log.cpp b/plugins/Scriver/src/chat/log.cpp index d3a73352fb..ad3b3092e6 100644 --- a/plugins/Scriver/src/chat/log.cpp +++ b/plugins/Scriver/src/chat/log.cpp @@ -88,7 +88,7 @@ static int EventToIcon(LOGINFO * lin) static char *Log_SetStyle(int style, int fontindex)
{
static char szStyle[128];
- mir_snprintf(szStyle, SIZEOF(szStyle), "\\f%u\\cf%u\\ul0\\highlight0\\b%d\\i%d\\fs%u", style, style+1, aFonts[fontindex].lf.lfWeight >= FW_BOLD ? 1 : 0, aFonts[fontindex].lf.lfItalic, 2 * abs(aFonts[fontindex].lf.lfHeight) * 74 / g_dat->logPixelSY);
+ mir_snprintf(szStyle, SIZEOF(szStyle), "\\f%u\\cf%u\\ul0\\highlight0\\b%d\\i%d\\fs%u", style, style+1, aFonts[fontindex].lf.lfWeight >= FW_BOLD ? 1 : 0, aFonts[fontindex].lf.lfItalic, 2 * abs(aFonts[fontindex].lf.lfHeight) * 74 / g_dat.logPixelSY);
return szStyle;
}
@@ -655,13 +655,13 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData, BOOL ieviewMode) if (lin->ptszNick && lin->iType == GC_EVENT_MESSAGE)
{
iii = lin->bIsHighlighted?16:(lin->bIsMe ? 2 : 1);
- mir_snprintf(szStyle, SIZEOF(szStyle), "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\fs%u", iii+1, aFonts[0].lf.lfWeight >= FW_BOLD ? 1 : 0, aFonts[0].lf.lfItalic, 2 * abs(aFonts[0].lf.lfHeight) * 74 / g_dat->logPixelSY);
+ mir_snprintf(szStyle, SIZEOF(szStyle), "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\fs%u", iii+1, aFonts[0].lf.lfWeight >= FW_BOLD ? 1 : 0, aFonts[0].lf.lfItalic, 2 * abs(aFonts[0].lf.lfHeight) * 74 / g_dat.logPixelSY);
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s ", szStyle);
}
else
{
iii = lin->bIsHighlighted?16:EventToIndex(lin);
- mir_snprintf(szStyle, SIZEOF(szStyle), "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\fs%u", iii+1, aFonts[0].lf.lfWeight >= FW_BOLD ? 1 : 0, aFonts[0].lf.lfItalic, 2 * abs(aFonts[0].lf.lfHeight) * 74 / g_dat->logPixelSY);
+ mir_snprintf(szStyle, SIZEOF(szStyle), "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\fs%u", iii+1, aFonts[0].lf.lfWeight >= FW_BOLD ? 1 : 0, aFonts[0].lf.lfItalic, 2 * abs(aFonts[0].lf.lfHeight) * 74 / g_dat.logPixelSY);
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s ", szStyle);
}
}
@@ -813,7 +813,7 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO* si, BOOL bRedr SendMessage(hwndRich, EM_STREAMIN, wp, (LPARAM) & stream);
// do smileys
- if (g_dat->smileyAddInstalled && (bRedraw
+ if (g_dat.smileyAddInstalled && (bRedraw
|| (lin->ptszText
&& lin->iType != GC_EVENT_JOIN
&& lin->iType != GC_EVENT_NICK
@@ -900,12 +900,12 @@ char * Log_CreateRtfHeader(MODULEINFO * mi, SESSION_INFO* si) if (g_Settings.dwIconFlags)
{
- iIndent += (14*1440)/g_dat->logPixelSX;
+ iIndent += (14*1440)/g_dat.logPixelSX;
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\tx%u", iIndent);
}
if (g_Settings.ShowTime)
{
- int iSize = (g_Settings.LogTextIndent*1440)/g_dat->logPixelSX;
+ int iSize = (g_Settings.LogTextIndent*1440)/g_dat.logPixelSX;
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\tx%u", iIndent + iSize );
if (g_Settings.LogIndentEnabled)
iIndent += iSize;
diff --git a/plugins/Scriver/src/chat/options.cpp b/plugins/Scriver/src/chat/options.cpp index a22618c363..86c21c65df 100644 --- a/plugins/Scriver/src/chat/options.cpp +++ b/plugins/Scriver/src/chat/options.cpp @@ -752,7 +752,7 @@ static INT_PTR CALLBACK DlgProcOptionsPopup(HWND hwndDlg,UINT uMsg,WPARAM wParam static int OptionsInitialize(WPARAM wParam, LPARAM lParam)
{
- if (g_dat->popupInstalled) {
+ if (g_dat.popupInstalled) {
OPTIONSDIALOGPAGE odp = {0};
odp.cbSize = sizeof(odp);
odp.position = 910000002;
diff --git a/plugins/Scriver/src/chat/services.cpp b/plugins/Scriver/src/chat/services.cpp index bd55310277..cb1375c491 100644 --- a/plugins/Scriver/src/chat/services.cpp +++ b/plugins/Scriver/src/chat/services.cpp @@ -636,22 +636,22 @@ static INT_PTR Service_GetAddEventPtr(WPARAM wParam, LPARAM lParam) void HookEvents(void)
{
- HookEvent_Ex(ME_CLIST_PREBUILDCONTACTMENU, CList_PrebuildContactMenu);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU, CList_PrebuildContactMenu);
}
void CreateServiceFunctions(void)
{
- CreateServiceFunction_Ex(MS_GC_REGISTER, Service_Register);
- CreateServiceFunction_Ex(MS_GC_NEWSESSION, Service_NewChat);
- CreateServiceFunction_Ex(MS_GC_EVENT, Service_AddEvent);
- CreateServiceFunction_Ex(MS_GC_GETEVENTPTR, Service_GetAddEventPtr);
- CreateServiceFunction_Ex(MS_GC_GETINFO, Service_GetInfo);
- CreateServiceFunction_Ex(MS_GC_GETSESSIONCOUNT, Service_GetCount);
-
- CreateServiceFunction_Ex("GChat/DblClickEvent", CList_EventDoubleclickedSvc);
- CreateServiceFunction_Ex("GChat/PrebuildMenuEvent", CList_PrebuildContactMenuSvc);
- CreateServiceFunction_Ex("GChat/JoinChat", CList_JoinChat);
- CreateServiceFunction_Ex("GChat/LeaveChat", CList_LeaveChat);
+ CreateServiceFunction(MS_GC_REGISTER, Service_Register);
+ CreateServiceFunction(MS_GC_NEWSESSION, Service_NewChat);
+ CreateServiceFunction(MS_GC_EVENT, Service_AddEvent);
+ CreateServiceFunction(MS_GC_GETEVENTPTR, Service_GetAddEventPtr);
+ CreateServiceFunction(MS_GC_GETINFO, Service_GetInfo);
+ CreateServiceFunction(MS_GC_GETSESSIONCOUNT, Service_GetCount);
+
+ CreateServiceFunction("GChat/DblClickEvent", CList_EventDoubleclickedSvc);
+ CreateServiceFunction("GChat/PrebuildMenuEvent", CList_PrebuildContactMenuSvc);
+ CreateServiceFunction("GChat/JoinChat", CList_JoinChat);
+ CreateServiceFunction("GChat/LeaveChat", CList_LeaveChat);
}
void CreateHookableEvents(void)
diff --git a/plugins/Scriver/src/chat/tools.cpp b/plugins/Scriver/src/chat/tools.cpp index a25a436964..7d12ba29b9 100644 --- a/plugins/Scriver/src/chat/tools.cpp +++ b/plugins/Scriver/src/chat/tools.cpp @@ -683,7 +683,7 @@ UINT CreateGCMenu(HWND hwnd, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO* s TCHAR szMenuText[4096];
mir_sntprintf( szMenuText, 4096, TranslateT("Look up \'%s\':"), pszWordText );
ModifyMenu( *hMenu, 4, MF_STRING|MF_BYPOSITION, 4, szMenuText );
- SetSearchEngineIcons(*hMenu, g_dat->hSearchEngineIconList);
+ SetSearchEngineIcons(*hMenu, g_dat.hSearchEngineIconList);
}
else ModifyMenu( *hMenu, 4, MF_STRING|MF_GRAYED|MF_BYPOSITION, 4, TranslateT( "No word to look up" ));
gcmi.Type = MENU_ON_LOG;
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index e0e1bd68b5..f93129a25f 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -147,9 +147,9 @@ static void MessageDialogResize(HWND hwndDlg, SESSION_INFO *si, int w, int h) { HDWP hdwp;
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 buttonVisibility = bToolbar ? g_dat.chatBbuttonVisibility : 0;
int hSplitterMinTop = TOOLBAR_HEIGHT + si->windowData.minLogBoxHeight, hSplitterMinBottom = si->windowData.minEditBoxHeight;
- int toolbarHeight = bToolbar ? IsToolbarVisible(SIZEOF(toolbarButtons), g_dat->chatBbuttonVisibility) ? TOOLBAR_HEIGHT : TOOLBAR_HEIGHT / 3 : 0;
+ int toolbarHeight = bToolbar ? IsToolbarVisible(SIZEOF(toolbarButtons), g_dat.chatBbuttonVisibility) ? TOOLBAR_HEIGHT : TOOLBAR_HEIGHT / 3 : 0;
si->iSplitterY = si->desiredInputAreaHeight + SPLITTER_HEIGHT + 3;
@@ -1228,14 +1228,14 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) {
TitleBarData tbd = {0};
TCHAR szTemp [100];
- if (g_dat->flags & SMF_STATUSICON) {
+ if (g_dat.flags & SMF_STATUSICON) {
MODULEINFO* mi = 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.hIconBig = g_dat.hIconChatBig;
}
tbd.hIconNot = (si->wState & (GC_EVENT_HIGHLIGHT | STATE_TALK)) ? GetCachedIcon("chat_overlay") : NULL;
@@ -1389,7 +1389,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) else
hIcon = (si->wStatus==ID_STATUS_ONLINE) ? MM_FindModule(si->pszModule)->hOnlineIcon : MM_FindModule(si->pszModule)->hOfflineIcon;
} else {
- hIcon = g_dat->hMsgIcon;
+ hIcon = g_dat.hMsgIcon;
}
tcd.iFlags = TCDF_ICON;
tcd.hIcon = hIcon;
@@ -1725,8 +1725,8 @@ LABEL_SHOWWINDOW: if (pNmhdr->idFrom == IDC_CHAT_MESSAGE) {
REQRESIZE *rr = (REQRESIZE *)lParam;
int height = rr->rc.bottom - rr->rc.top + 1;
- if (height < g_dat->minInputAreaHeight) {
- height = g_dat->minInputAreaHeight;
+ if (height < g_dat.minInputAreaHeight) {
+ height = g_dat.minInputAreaHeight;
}
if (si->desiredInputAreaHeight != height) {
si->desiredInputAreaHeight = height;
@@ -2076,9 +2076,9 @@ LABEL_SHOWWINDOW: mii.cbSize = 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.fState = (g_dat.chatBbuttonVisibility & (1<< i)) ? MFS_CHECKED : MFS_UNCHECKED;
mii.wID = i + 1;
- mii.dwItemData = (ULONG_PTR)g_dat->hChatButtonIconList;
+ mii.dwItemData = (ULONG_PTR)g_dat.hChatButtonIconList;
mii.hbmpItem = HBMMENU_CALLBACK;
mii.dwTypeData = TranslateTS((toolbarButtons[i].name));
InsertMenuItem(hToolbarMenu, i, TRUE, &mii);
@@ -2088,8 +2088,8 @@ LABEL_SHOWWINDOW: pt.y = (short) HIWORD(GetMessagePos());
i = TrackPopupMenu(hToolbarMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
if (i > 0) {
- g_dat->chatBbuttonVisibility ^= (1 << (i - 1));
- DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_CHATBUTTONVISIBILITY, g_dat->chatBbuttonVisibility);
+ g_dat.chatBbuttonVisibility ^= (1 << (i - 1));
+ DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_CHATBUTTONVISIBILITY, g_dat.chatBbuttonVisibility);
SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
}
DestroyMenu(hToolbarMenu);
diff --git a/plugins/Scriver/src/commonheaders.h b/plugins/Scriver/src/commonheaders.h index 2ea1687547..be6494897c 100644 --- a/plugins/Scriver/src/commonheaders.h +++ b/plugins/Scriver/src/commonheaders.h @@ -108,7 +108,7 @@ extern void ChangeStatusIcons(); extern void LoadInfobarFonts();
extern HCURSOR hDragCursor;
extern ITaskbarList3 * pTaskbarInterface;
-extern struct GlobalMessageData *g_dat;
+extern GlobalMessageData g_dat;
extern CRITICAL_SECTION cs;
extern TCHAR* pszActiveWndID ;
extern char* pszActiveWndModule ;
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index 1d4c12fb06..f4a44692b4 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h"
-struct GlobalMessageData *g_dat=NULL;
+GlobalMessageData g_dat;
extern PSLWA pSetLayeredWindowAttributes;
static int ackevent(WPARAM wParam, LPARAM lParam);
@@ -99,7 +99,7 @@ static IconItem iconList[] = void RegisterIcons(void)
{
- HookEvent_Ex(ME_SKIN2_ICONSCHANGED, IconsChanged);
+ HookEvent(ME_SKIN2_ICONSCHANGED, IconsChanged);
Icon_Register(g_hInst, LPGEN("Single Messaging"), iconList, 16);
Icon_Register(g_hInst, LPGEN("Group Chats"), iconList+16, 20);
@@ -110,9 +110,9 @@ void RegisterIcons(void) HICON hIconList[SIZEOF(iconList)];
-BOOL IsStaticIcon(HICON hIcon) {
- int i;
- for (i = 0; i < SIZEOF(hIconList); i++)
+BOOL IsStaticIcon(HICON hIcon)
+{
+ for (int i = 0; i < SIZEOF(hIconList); i++)
if (hIcon == hIconList[i])
return TRUE;
@@ -158,9 +158,9 @@ void ReleaseIcons() if (hIconList[i] != NULL)
Skin_ReleaseIcon(hIconList[i]);
- Skin_ReleaseIcon(g_dat->hMsgIcon);
- Skin_ReleaseIcon(g_dat->hMsgIconBig);
- Skin_ReleaseIcon(g_dat->hIconChatBig);
+ Skin_ReleaseIcon(g_dat.hMsgIcon);
+ Skin_ReleaseIcon(g_dat.hMsgIconBig);
+ Skin_ReleaseIcon(g_dat.hIconChatBig);
}
HICON GetCachedIcon(const char *name)
@@ -178,30 +178,29 @@ void LoadGlobalIcons() { for (i = 0; i < SIZEOF(iconList); i++)
hIconList[i] = Skin_GetIcon(iconList[i].szName);
- g_dat->hMsgIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE);
- g_dat->hMsgIconBig = LoadSkinnedIconBig(SKINICON_EVENT_MESSAGE);
- g_dat->hIconChatBig = Skin_GetIcon("chat_window");
-
- ImageList_RemoveAll(g_dat->hButtonIconList);
- ImageList_RemoveAll(g_dat->hChatButtonIconList);
- ImageList_RemoveAll(g_dat->hHelperIconList);
- ImageList_RemoveAll(g_dat->hSearchEngineIconList);
- for (i=0; i<SIZEOF(buttonIcons); i++) {
- if (buttonIcons[i] == NULL) {
- ImageList_AddIcon_ProtoEx(g_dat->hButtonIconList, NULL, ID_STATUS_OFFLINE);
- } else {
- ImageList_AddIcon(g_dat->hButtonIconList, GetCachedIcon(buttonIcons[i]));
- }
- }
- for (i=0; i<SIZEOF(chatButtonIcons); i++) {
- ImageList_AddIcon(g_dat->hChatButtonIconList, GetCachedIcon(chatButtonIcons[i]));
+ g_dat.hMsgIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE);
+ g_dat.hMsgIconBig = LoadSkinnedIconBig(SKINICON_EVENT_MESSAGE);
+ g_dat.hIconChatBig = Skin_GetIcon("chat_window");
+
+ ImageList_RemoveAll(g_dat.hButtonIconList);
+ ImageList_RemoveAll(g_dat.hChatButtonIconList);
+ ImageList_RemoveAll(g_dat.hHelperIconList);
+ ImageList_RemoveAll(g_dat.hSearchEngineIconList);
+ for (i=0; i < SIZEOF(buttonIcons); i++) {
+ if (buttonIcons[i] == NULL)
+ ImageList_AddIcon_ProtoEx(g_dat.hButtonIconList, NULL, ID_STATUS_OFFLINE);
+ else
+ ImageList_AddIcon(g_dat.hButtonIconList, GetCachedIcon(buttonIcons[i]));
}
- ImageList_AddIcon(g_dat->hHelperIconList, GetCachedIcon("scriver_OVERLAY"));
- overlayIcon = ImageList_AddIcon(g_dat->hHelperIconList, GetCachedIcon("scriver_OVERLAY"));
- ImageList_SetOverlayImage(g_dat->hHelperIconList, overlayIcon, 1);
+ for (i=0; i < SIZEOF(chatButtonIcons); i++)
+ ImageList_AddIcon(g_dat.hChatButtonIconList, GetCachedIcon(chatButtonIcons[i]));
+
+ ImageList_AddIcon(g_dat.hHelperIconList, GetCachedIcon("scriver_OVERLAY"));
+ overlayIcon = ImageList_AddIcon(g_dat.hHelperIconList, GetCachedIcon("scriver_OVERLAY"));
+ ImageList_SetOverlayImage(g_dat.hHelperIconList, overlayIcon, 1);
for (i=IDI_GOOGLE; i < IDI_LASTICON; i++) {
HICON hIcon = (HICON)LoadImage(g_hInst, MAKEINTRESOURCE(i), IMAGE_ICON, 0, 0, 0);
- ImageList_AddIcon(g_dat->hSearchEngineIconList, hIcon);
+ ImageList_AddIcon(g_dat.hSearchEngineIconList, hIcon);
DestroyIcon(hIcon);
}
}
@@ -230,7 +229,7 @@ static BOOL CALLBACK LangAddCallback(CHAR * str) { count = sizeof(cpTable)/sizeof(cpTable[0]);
for (i=0; i<count && cpTable[i].cpId!=cp; i++);
if (i < count)
- AppendMenu(g_dat->hMenuANSIEncoding, MF_STRING, cp, TranslateTS(cpTable[i].cpName));
+ AppendMenu(g_dat.hMenuANSIEncoding, MF_STRING, cp, TranslateTS(cpTable[i].cpName));
return TRUE;
}
@@ -239,231 +238,231 @@ void LoadInfobarFonts() {
LOGFONT lf;
LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, &lf, NULL, FALSE);
- g_dat->minInputAreaHeight = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_AUTORESIZELINES, SRMSGDEFSET_AUTORESIZELINES) * abs(lf.lfHeight) * g_dat->logPixelSY / 72;
- if (g_dat->hInfobarBrush != NULL)
- DeleteObject(g_dat->hInfobarBrush);
+ g_dat.minInputAreaHeight = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_AUTORESIZELINES, SRMSGDEFSET_AUTORESIZELINES) * abs(lf.lfHeight) * g_dat.logPixelSY / 72;
+ if (g_dat.hInfobarBrush != NULL)
+ DeleteObject(g_dat.hInfobarBrush);
- g_dat->hInfobarBrush = CreateSolidBrush(DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INFOBARBKGCOLOUR, SRMSGDEFSET_INFOBARBKGCOLOUR));
+ g_dat.hInfobarBrush = CreateSolidBrush(DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INFOBARBKGCOLOUR, SRMSGDEFSET_INFOBARBKGCOLOUR));
}
-void InitGlobals() {
+void InitGlobals()
+{
HDC hdc = GetDC(NULL);
- g_dat = (struct GlobalMessageData *)mir_alloc(sizeof(struct GlobalMessageData));
- ZeroMemory(g_dat, sizeof(struct GlobalMessageData));
- g_dat->hMessageWindowList = (HANDLE) CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
- g_dat->hParentWindowList = (HANDLE) CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
- HookEvent_Ex(ME_PROTO_ACK, ackevent);
+ ZeroMemory(&g_dat, sizeof(struct GlobalMessageData));
+ g_dat.hMessageWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
+ g_dat.hParentWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
+
+ HookEvent(ME_PROTO_ACK, ackevent);
ReloadGlobals();
- g_dat->lastParent = NULL;
- g_dat->lastChatParent = NULL;
- g_dat->hTabIconList = NULL;
- g_dat->tabIconListUsage = NULL;
- g_dat->tabIconListUsageSize = 0;
- g_dat->hButtonIconList = ImageList_Create(16, 16, IsWinVerXPPlus() ? ILC_COLOR32 | ILC_MASK : ILC_COLOR8 | ILC_MASK, 0, 0);
- g_dat->hChatButtonIconList = ImageList_Create(16, 16, IsWinVerXPPlus() ? ILC_COLOR32 | ILC_MASK : ILC_COLOR8 | ILC_MASK, 0, 0);
- g_dat->hTabIconList = ImageList_Create(16, 16, IsWinVerXPPlus() ? ILC_COLOR32 | ILC_MASK : ILC_COLOR8 | ILC_MASK, 0, 0);
- g_dat->hHelperIconList = ImageList_Create(16, 16, IsWinVerXPPlus() ? ILC_COLOR32 | ILC_MASK : ILC_COLOR8 | ILC_MASK, 0, 0);
- g_dat->hSearchEngineIconList = ImageList_Create(16, 16, IsWinVerXPPlus() ? ILC_COLOR32 | ILC_MASK : ILC_COLOR8 | ILC_MASK, 0, 0);
- g_dat->draftList = NULL;
- g_dat->logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX);
- g_dat->logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
+ g_dat.lastParent = NULL;
+ g_dat.lastChatParent = NULL;
+ g_dat.hTabIconList = NULL;
+ g_dat.tabIconListUsage = NULL;
+ g_dat.tabIconListUsageSize = 0;
+ g_dat.hButtonIconList = ImageList_Create(16, 16, IsWinVerXPPlus() ? ILC_COLOR32 | ILC_MASK : ILC_COLOR8 | ILC_MASK, 0, 0);
+ g_dat.hChatButtonIconList = ImageList_Create(16, 16, IsWinVerXPPlus() ? ILC_COLOR32 | ILC_MASK : ILC_COLOR8 | ILC_MASK, 0, 0);
+ g_dat.hTabIconList = ImageList_Create(16, 16, IsWinVerXPPlus() ? ILC_COLOR32 | ILC_MASK : ILC_COLOR8 | ILC_MASK, 0, 0);
+ g_dat.hHelperIconList = ImageList_Create(16, 16, IsWinVerXPPlus() ? ILC_COLOR32 | ILC_MASK : ILC_COLOR8 | ILC_MASK, 0, 0);
+ g_dat.hSearchEngineIconList = ImageList_Create(16, 16, IsWinVerXPPlus() ? ILC_COLOR32 | ILC_MASK : ILC_COLOR8 | ILC_MASK, 0, 0);
+ g_dat.draftList = NULL;
+ g_dat.logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX);
+ g_dat.logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
LoadInfobarFonts();
ReleaseDC(NULL, hdc);
}
-void FreeGlobals() {
- if (g_dat) {
- if (g_dat->hInfobarBrush != NULL) {
- DeleteObject(g_dat->hInfobarBrush);
- }
- if (g_dat->draftList != NULL) tcmdlist_free(g_dat->draftList);
- if (g_dat->hTabIconList)
- ImageList_Destroy(g_dat->hTabIconList);
- if (g_dat->hButtonIconList)
- ImageList_Destroy(g_dat->hButtonIconList);
- if (g_dat->hChatButtonIconList)
- ImageList_Destroy(g_dat->hChatButtonIconList);
- if (g_dat->hHelperIconList)
- ImageList_Destroy(g_dat->hHelperIconList);
- if (g_dat->hSearchEngineIconList)
- ImageList_Destroy(g_dat->hSearchEngineIconList);
- if (g_dat->hMenuANSIEncoding)
- DestroyMenu(g_dat->hMenuANSIEncoding);
- mir_free(g_dat->tabIconListUsage);
- mir_free(g_dat);
- g_dat = NULL;
- }
+void FreeGlobals()
+{
+ if (g_dat.hInfobarBrush != NULL)
+ DeleteObject(g_dat.hInfobarBrush);
+ if (g_dat.draftList != NULL)
+ tcmdlist_free(g_dat.draftList);
+ if (g_dat.hTabIconList)
+ ImageList_Destroy(g_dat.hTabIconList);
+ if (g_dat.hButtonIconList)
+ ImageList_Destroy(g_dat.hButtonIconList);
+ if (g_dat.hChatButtonIconList)
+ ImageList_Destroy(g_dat.hChatButtonIconList);
+ if (g_dat.hHelperIconList)
+ ImageList_Destroy(g_dat.hHelperIconList);
+ if (g_dat.hSearchEngineIconList)
+ ImageList_Destroy(g_dat.hSearchEngineIconList);
+ if (g_dat.hMenuANSIEncoding)
+ DestroyMenu(g_dat.hMenuANSIEncoding);
+ mir_free(g_dat.tabIconListUsage);
+
+ ZeroMemory(&g_dat, sizeof(g_dat));
}
-void ReloadGlobals() {
- g_dat->flags = 0;
- g_dat->flags2 = 0;
+void ReloadGlobals()
+{
+ g_dat.flags = 0;
+ g_dat.flags2 = 0;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_AVATARENABLE, SRMSGDEFSET_AVATARENABLE))
- g_dat->flags |= SMF_AVATAR;
+ g_dat.flags |= SMF_AVATAR;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWPROGRESS, SRMSGDEFSET_SHOWPROGRESS))
- g_dat->flags |= SMF_SHOWPROGRESS;
+ g_dat.flags |= SMF_SHOWPROGRESS;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWLOGICONS, SRMSGDEFSET_SHOWLOGICONS))
- g_dat->flags |= SMF_SHOWICONS;
+ g_dat.flags |= SMF_SHOWICONS;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTIME, SRMSGDEFSET_SHOWTIME))
- g_dat->flags |= SMF_SHOWTIME;
+ g_dat.flags |= SMF_SHOWTIME;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSECONDS, SRMSGDEFSET_SHOWSECONDS))
- g_dat->flags |= SMF_SHOWSECONDS;
+ g_dat.flags |= SMF_SHOWSECONDS;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWDATE, SRMSGDEFSET_SHOWDATE))
- g_dat->flags |= SMF_SHOWDATE;
+ g_dat.flags |= SMF_SHOWDATE;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USELONGDATE, SRMSGDEFSET_USELONGDATE))
- g_dat->flags |= SMF_LONGDATE;
+ g_dat.flags |= SMF_LONGDATE;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USERELATIVEDATE, SRMSGDEFSET_USERELATIVEDATE))
- g_dat->flags |= SMF_RELATIVEDATE;
+ g_dat.flags |= SMF_RELATIVEDATE;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_GROUPMESSAGES, SRMSGDEFSET_GROUPMESSAGES))
- g_dat->flags |= SMF_GROUPMESSAGES;
+ g_dat.flags |= SMF_GROUPMESSAGES;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_MARKFOLLOWUPS, SRMSGDEFSET_MARKFOLLOWUPS))
- g_dat->flags |= SMF_MARKFOLLOWUPS;
+ g_dat.flags |= SMF_MARKFOLLOWUPS;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_MESSAGEONNEWLINE, SRMSGDEFSET_MESSAGEONNEWLINE))
- g_dat->flags |= SMF_MSGONNEWLINE;
+ g_dat.flags |= SMF_MSGONNEWLINE;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_DRAWLINES, SRMSGDEFSET_DRAWLINES))
- g_dat->flags |= SMF_DRAWLINES;
+ g_dat.flags |= SMF_DRAWLINES;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDENAMES, SRMSGDEFSET_HIDENAMES))
- g_dat->flags |= SMF_HIDENAMES;
+ g_dat.flags |= SMF_HIDENAMES;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_AUTOPOPUP, SRMSGDEFSET_AUTOPOPUP))
- g_dat->flags |= SMF_AUTOPOPUP;
+ g_dat.flags |= SMF_AUTOPOPUP;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_STAYMINIMIZED, SRMSGDEFSET_STAYMINIMIZED))
- g_dat->flags |= SMF_STAYMINIMIZED;
+ g_dat.flags |= SMF_STAYMINIMIZED;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SAVEDRAFTS, SRMSGDEFSET_SAVEDRAFTS))
- g_dat->flags |= SMF_SAVEDRAFTS;
+ g_dat.flags |= SMF_SAVEDRAFTS;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_DELTEMP, SRMSGDEFSET_DELTEMP))
- g_dat->flags |= SMF_DELTEMP;
+ g_dat.flags |= SMF_DELTEMP;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SENDONENTER, SRMSGDEFSET_SENDONENTER))
- g_dat->flags |= SMF_SENDONENTER;
+ g_dat.flags |= SMF_SENDONENTER;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SENDONDBLENTER, SRMSGDEFSET_SENDONDBLENTER))
- g_dat->flags |= SMF_SENDONDBLENTER;
+ g_dat.flags |= SMF_SENDONDBLENTER;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_STATUSICON, SRMSGDEFSET_STATUSICON))
- g_dat->flags |= SMF_STATUSICON;
+ g_dat.flags |= SMF_STATUSICON;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_INDENTTEXT, SRMSGDEFSET_INDENTTEXT))
- g_dat->flags |= SMF_INDENTTEXT;
+ g_dat.flags |= SMF_INDENTTEXT;
- g_dat->openFlags = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS);
- g_dat->indentSize = DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_INDENTSIZE, SRMSGDEFSET_INDENTSIZE);
- g_dat->logLineColour = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LINECOLOUR, SRMSGDEFSET_LINECOLOUR);
+ g_dat.openFlags = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS);
+ g_dat.indentSize = DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_INDENTSIZE, SRMSGDEFSET_INDENTSIZE);
+ g_dat.logLineColour = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LINECOLOUR, SRMSGDEFSET_LINECOLOUR);
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USETABS, SRMSGDEFSET_USETABS))
- g_dat->flags2 |= SMF2_USETABS;
+ g_dat.flags2 |= SMF2_USETABS;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_TABSATBOTTOM, SRMSGDEFSET_TABSATBOTTOM))
- g_dat->flags2 |= SMF2_TABSATBOTTOM;
+ g_dat.flags2 |= SMF2_TABSATBOTTOM;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SWITCHTOACTIVE, SRMSGDEFSET_SWITCHTOACTIVE))
- g_dat->flags2 |= SMF2_SWITCHTOACTIVE;
+ g_dat.flags2 |= SMF2_SWITCHTOACTIVE;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_LIMITNAMES, SRMSGDEFSET_LIMITNAMES))
- g_dat->flags2 |= SMF2_LIMITNAMES;
+ g_dat.flags2 |= SMF2_LIMITNAMES;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDEONETAB, SRMSGDEFSET_HIDEONETAB))
- g_dat->flags2 |= SMF2_HIDEONETAB;
+ g_dat.flags2 |= SMF2_HIDEONETAB;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SEPARATECHATSCONTAINERS, SRMSGDEFSET_SEPARATECHATSCONTAINERS))
- g_dat->flags2 |= SMF2_SEPARATECHATSCONTAINERS;
+ g_dat.flags2 |= SMF2_SEPARATECHATSCONTAINERS;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_TABCLOSEBUTTON, SRMSGDEFSET_TABCLOSEBUTTON))
- g_dat->flags2 |= SMF2_TABCLOSEBUTTON;
+ g_dat.flags2 |= SMF2_TABCLOSEBUTTON;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_LIMITTABS, SRMSGDEFSET_LIMITTABS))
- g_dat->flags2 |= SMF2_LIMITTABS;
+ g_dat.flags2 |= SMF2_LIMITTABS;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABS, SRMSGDEFSET_LIMITCHATSTABS))
- g_dat->flags2 |= SMF2_LIMITCHATSTABS;
+ g_dat.flags2 |= SMF2_LIMITCHATSTABS;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDECONTAINERS, SRMSGDEFSET_HIDECONTAINERS))
- g_dat->flags2 |= SMF2_HIDECONTAINERS;
+ g_dat.flags2 |= SMF2_HIDECONTAINERS;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSBAR, SRMSGDEFSET_SHOWSTATUSBAR))
- g_dat->flags2 |= SMF2_SHOWSTATUSBAR;
+ g_dat.flags2 |= SMF2_SHOWSTATUSBAR;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTITLEBAR, SRMSGDEFSET_SHOWTITLEBAR))
- g_dat->flags2 |= SMF2_SHOWTITLEBAR;
+ g_dat.flags2 |= SMF2_SHOWTITLEBAR;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWBUTTONLINE, SRMSGDEFSET_SHOWBUTTONLINE))
- g_dat->flags2 |= SMF2_SHOWTOOLBAR;
+ g_dat.flags2 |= SMF2_SHOWTOOLBAR;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWINFOBAR, SRMSGDEFSET_SHOWINFOBAR))
- g_dat->flags2 |= SMF2_SHOWINFOBAR;
+ g_dat.flags2 |= SMF2_SHOWINFOBAR;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPING, SRMSGDEFSET_SHOWTYPING))
- g_dat->flags2 |= SMF2_SHOWTYPING;
+ g_dat.flags2 |= SMF2_SHOWTYPING;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGWIN, SRMSGDEFSET_SHOWTYPINGWIN))
- g_dat->flags2 |= SMF2_SHOWTYPINGWIN;
+ g_dat.flags2 |= SMF2_SHOWTYPINGWIN;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGNOWIN, SRMSGDEFSET_SHOWTYPINGNOWIN))
- g_dat->flags2 |= SMF2_SHOWTYPINGTRAY;
+ g_dat.flags2 |= SMF2_SHOWTYPINGTRAY;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST))
- g_dat->flags2 |= SMF2_SHOWTYPINGCLIST;
+ g_dat.flags2 |= SMF2_SHOWTYPINGCLIST;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGSWITCH, SRMSGDEFSET_SHOWTYPINGSWITCH))
- g_dat->flags2 |= SMF2_SHOWTYPINGSWITCH;
+ g_dat.flags2 |= SMF2_SHOWTYPINGSWITCH;
if (LOBYTE(LOWORD(GetVersion())) >= 5 && pSetLayeredWindowAttributes != NULL) {
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USETRANSPARENCY, SRMSGDEFSET_USETRANSPARENCY))
- g_dat->flags2 |= SMF2_USETRANSPARENCY;
- g_dat->activeAlpha = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_ACTIVEALPHA, SRMSGDEFSET_ACTIVEALPHA);
- g_dat->inactiveAlpha = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INACTIVEALPHA, SRMSGDEFSET_INACTIVEALPHA);
+ g_dat.flags2 |= SMF2_USETRANSPARENCY;
+ g_dat.activeAlpha = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_ACTIVEALPHA, SRMSGDEFSET_ACTIVEALPHA);
+ g_dat.inactiveAlpha = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INACTIVEALPHA, SRMSGDEFSET_INACTIVEALPHA);
}
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USEIEVIEW, SRMSGDEFSET_USEIEVIEW))
- g_dat->flags |= SMF_USEIEVIEW;
+ g_dat.flags |= SMF_USEIEVIEW;
- g_dat->buttonVisibility = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_BUTTONVISIBILITY, SRMSGDEFSET_BUTTONVISIBILITY);
- g_dat->chatBbuttonVisibility = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_CHATBUTTONVISIBILITY, SRMSGDEFSET_CHATBUTTONVISIBILITY);
+ g_dat.buttonVisibility = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_BUTTONVISIBILITY, SRMSGDEFSET_BUTTONVISIBILITY);
+ g_dat.chatBbuttonVisibility = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_CHATBUTTONVISIBILITY, SRMSGDEFSET_CHATBUTTONVISIBILITY);
- g_dat->limitNamesLength = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITNAMESLEN, SRMSGDEFSET_LIMITNAMESLEN);
- g_dat->limitTabsNum = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITTABSNUM, SRMSGDEFSET_LIMITTABSNUM);
- g_dat->limitChatsTabsNum = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABSNUM, SRMSGDEFSET_LIMITCHATSTABSNUM);
+ g_dat.limitNamesLength = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITNAMESLEN, SRMSGDEFSET_LIMITNAMESLEN);
+ g_dat.limitTabsNum = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITTABSNUM, SRMSGDEFSET_LIMITTABSNUM);
+ g_dat.limitChatsTabsNum = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABSNUM, SRMSGDEFSET_LIMITCHATSTABSNUM);
}
-static int ackevent(WPARAM wParam, LPARAM lParam) {
+static int ackevent(WPARAM wParam, LPARAM lParam)
+{
ACKDATA *pAck = (ACKDATA *)lParam;
-
- if (!pAck) return 0;
- else if (pAck->type==ACKTYPE_MESSAGE) {
- ACKDATA *ack = (ACKDATA *) lParam;
- DBEVENTINFO dbei = { 0 };
- HANDLE hNewEvent;
- MessageSendQueueItem * item;
- HWND hwndSender;
-
- item = FindSendQueueItem((HANDLE)pAck->hContact, (HANDLE)pAck->hProcess);
- if (item != NULL) {
- hwndSender = item->hwndSender;
- if (ack->result == ACKRESULT_FAILED) {
- if (item->hwndErrorDlg != NULL) {
- item = FindOldestPendingSendQueueItem(hwndSender, (HANDLE)pAck->hContact);
- }
- if (item != NULL && item->hwndErrorDlg == NULL) {
- if (hwndSender != NULL) {
- ErrorWindowData *ewd = (ErrorWindowData *) mir_alloc(sizeof(ErrorWindowData));
- ewd->szName = GetNickname(item->hContact, item->proto);
- ewd->szDescription = a2t((char *) ack->lParam);
- ewd->szText = GetSendBufferMsg(item);
- ewd->hwndParent = hwndSender;
- ewd->queueItem = item;
- SendMessage(hwndSender, DM_STOPMESSAGESENDING, 0, 0);
- SendMessage(hwndSender, DM_SHOWERRORMESSAGE, 0, (LPARAM)ewd);
- } else {
- RemoveSendQueueItem(item);
- }
- }
- return 0;
+ if (!pAck)
+ return 0;
+
+ if (pAck->type != ACKTYPE_MESSAGE)
+ return 0;
+
+ ACKDATA *ack = (ACKDATA*) lParam;
+ MessageSendQueueItem *item = FindSendQueueItem((HANDLE)pAck->hContact, (HANDLE)pAck->hProcess);
+ if (item != NULL) {
+ HWND hwndSender = item->hwndSender;
+ if (ack->result == ACKRESULT_FAILED) {
+ if (item->hwndErrorDlg != NULL) {
+ item = FindOldestPendingSendQueueItem(hwndSender, (HANDLE)pAck->hContact);
}
-
- dbei.cbSize = sizeof(dbei);
- dbei.eventType = EVENTTYPE_MESSAGE;
- dbei.flags = DBEF_SENT | (( item->flags & PREF_RTL) ? DBEF_RTL : 0 );
- if ( item->flags & PREF_UTF )
- dbei.flags |= DBEF_UTF;
- dbei.szModule = GetContactProto(item->hContact);
- dbei.timestamp = time(NULL);
- dbei.cbBlob = lstrlenA(item->sendBuffer) + 1;
- if ( !( item->flags & PREF_UTF ))
- dbei.cbBlob *= sizeof(TCHAR) + 1;
- dbei.pBlob = (PBYTE) item->sendBuffer;
- hNewEvent = (HANDLE) CallService(MS_DB_EVENT_ADD, (WPARAM) item->hContact, (LPARAM) & dbei);
-
- if (item->hwndErrorDlg != NULL)
- DestroyWindow(item->hwndErrorDlg);
-
- if (RemoveSendQueueItem(item) && DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_AUTOCLOSE, SRMSGDEFSET_AUTOCLOSE)) {
+ if (item != NULL && item->hwndErrorDlg == NULL) {
if (hwndSender != NULL) {
- DestroyWindow(hwndSender);
+ ErrorWindowData *ewd = (ErrorWindowData *) mir_alloc(sizeof(ErrorWindowData));
+ ewd->szName = GetNickname(item->hContact, item->proto);
+ ewd->szDescription = a2t((char *) ack->lParam);
+ ewd->szText = GetSendBufferMsg(item);
+ ewd->hwndParent = hwndSender;
+ ewd->queueItem = item;
+ SendMessage(hwndSender, DM_STOPMESSAGESENDING, 0, 0);
+ SendMessage(hwndSender, DM_SHOWERRORMESSAGE, 0, (LPARAM)ewd);
+ } else {
+ RemoveSendQueueItem(item);
}
- } else if (hwndSender != NULL) {
- SendMessage(hwndSender, DM_STOPMESSAGESENDING, 0, 0);
- SkinPlaySound("SendMsg");
}
+ return 0;
+ }
+
+ DBEVENTINFO dbei = { 0 };
+ dbei.cbSize = sizeof(dbei);
+ dbei.eventType = EVENTTYPE_MESSAGE;
+ dbei.flags = DBEF_SENT | (( item->flags & PREF_RTL) ? DBEF_RTL : 0 );
+ if ( item->flags & PREF_UTF )
+ dbei.flags |= DBEF_UTF;
+ dbei.szModule = GetContactProto(item->hContact);
+ dbei.timestamp = time(NULL);
+ dbei.cbBlob = lstrlenA(item->sendBuffer) + 1;
+ if ( !( item->flags & PREF_UTF ))
+ dbei.cbBlob *= sizeof(TCHAR) + 1;
+ dbei.pBlob = (PBYTE) item->sendBuffer;
+ CallService(MS_DB_EVENT_ADD, (WPARAM) item->hContact, (LPARAM) & dbei);
+
+ if (item->hwndErrorDlg != NULL)
+ DestroyWindow(item->hwndErrorDlg);
+
+ if (RemoveSendQueueItem(item) && DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_AUTOCLOSE, SRMSGDEFSET_AUTOCLOSE)) {
+ if (hwndSender != NULL)
+ DestroyWindow(hwndSender);
+ }
+ else if (hwndSender != NULL) {
+ SendMessage(hwndSender, DM_STOPMESSAGESENDING, 0, 0);
+ SkinPlaySound("SendMsg");
}
}
return 0;
diff --git a/plugins/Scriver/src/globals.h b/plugins/Scriver/src/globals.h index 3c13eb37a3..db2b7c512e 100644 --- a/plugins/Scriver/src/globals.h +++ b/plugins/Scriver/src/globals.h @@ -110,12 +110,12 @@ struct GlobalMessageData HBRUSH hInfobarBrush;
int toolbarPosition;
HWND hFocusWnd;
- DWORD logLineColour;
+ DWORD logLineColour;
int logPixelSX;
int logPixelSY;
- HICON hMsgIcon;
- HICON hMsgIconBig;
- HICON hIconChatBig;
+ HICON hMsgIcon;
+ HICON hMsgIconBig;
+ HICON hIconChatBig;
int minInputAreaHeight;
};
@@ -137,7 +137,6 @@ int ImageList_ReplaceIcon_Ex(HIMAGELIST hIml, int nIndex, int id); int ImageList_AddIcon_ProtoEx(HIMAGELIST hIml, const char* szProto, int status);
void ReleaseIconSmart(HICON hIcon);
-extern struct GlobalMessageData *g_dat;
-void StreamInTestEvents(HWND hEditWnd, struct GlobalMessageData *gdat);
+void StreamInTestEvents(HWND hEditWnd, GlobalMessageData *gdat);
#endif
diff --git a/plugins/Scriver/src/infobar.cpp b/plugins/Scriver/src/infobar.cpp index 9af2c54c49..b2ba79baf7 100644 --- a/plugins/Scriver/src/infobar.cpp +++ b/plugins/Scriver/src/infobar.cpp @@ -40,7 +40,7 @@ void SetupInfobar(InfobarWindowData* idat) { 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;
+ cf2.yHeight = abs(lf.lfHeight) * 1440 / g_dat.logPixelSY;
SendDlgItemMessageA(hwnd, IDC_INFOBAR_NAME, EM_SETCHARFORMAT, 0, (LPARAM)&cf2);
LoadMsgDlgFont(MSGFONTID_INFOBAR_STATUS, &lf, &colour, FALSE);
@@ -52,7 +52,7 @@ void SetupInfobar(InfobarWindowData* idat) { 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;
+ cf2.yHeight = abs(lf.lfHeight) * 1440 / g_dat.logPixelSY;
SendDlgItemMessageA(hwnd, IDC_INFOBAR_STATUS, EM_SETCHARFORMAT, 0, (LPARAM)&cf2);
RefreshInfobar(idat);
@@ -132,7 +132,7 @@ static INT_PTR CALLBACK InfobarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA GetClientRect(hwnd, &rc);
dlgWidth = rc.right - rc.left;
dlgHeight = rc.bottom - rc.top;
- if (idat->mwd->avatarPic && (g_dat->flags&SMF_AVATAR)) {
+ if (idat->mwd->avatarPic && (g_dat.flags&SMF_AVATAR)) {
BITMAP bminfo;
GetObject(idat->mwd->avatarPic, sizeof(bminfo), &bminfo);
if ( bminfo.bmWidth != 0 && bminfo.bmHeight != 0 ) {
@@ -160,7 +160,7 @@ static INT_PTR CALLBACK InfobarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA }
case WM_CTLCOLORDLG:
case WM_CTLCOLORSTATIC:
- return (INT_PTR)g_dat->hInfobarBrush;
+ return (INT_PTR)g_dat.hInfobarBrush;
case WM_DROPFILES:
SendMessage(GetParent(hwnd), WM_DROPFILES, wParam, lParam);
@@ -227,8 +227,8 @@ static INT_PTR CALLBACK InfobarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA rect.left = 0;
rect.right = itemWidth - 1;
rect.bottom = itemHeight - 1;
- FillRect(hdcMem, &rect, g_dat->hInfobarBrush);
- if (idat->mwd->avatarPic && (g_dat->flags&SMF_AVATAR)) {
+ FillRect(hdcMem, &rect, g_dat.hInfobarBrush);
+ 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 ) {
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 5c6f2156af..702a890bad 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -137,10 +137,10 @@ static TCHAR *GetQuotedTextW(TCHAR * text) { static void saveDraftMessage(HWND hwnd, HANDLE hContact, int codepage) {
char *textBuffer = GetRichTextEncoded(hwnd, codepage);
if (textBuffer != NULL) {
- g_dat->draftList = tcmdlist_append2(g_dat->draftList, hContact, textBuffer);
+ g_dat.draftList = tcmdlist_append2(g_dat.draftList, hContact, textBuffer);
mir_free(textBuffer);
} else {
- g_dat->draftList = tcmdlist_remove2(g_dat->draftList, hContact);
+ g_dat.draftList = tcmdlist_remove2(g_dat.draftList, hContact);
}
}
@@ -154,7 +154,7 @@ void NotifyLocalWinEvent(HANDLE hContact, HWND hwnd, unsigned int type) { mwe.szModule = SRMMMOD;
mwe.uType = type;
mwe.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
- bChat = (WindowList_Find(g_dat->hMessageWindowList, hContact) == NULL);
+ bChat = (WindowList_Find(g_dat.hMessageWindowList, hContact) == NULL);
mwe.hwndInput = GetDlgItem(hwnd, bChat ? IDC_CHAT_MESSAGE : IDC_MESSAGE);
mwe.hwndLog = GetDlgItem(hwnd, bChat ? IDC_CHAT_LOG : IDC_LOG);
NotifyEventHooks(hHookWinEvt, 0, (LPARAM)&mwe);
@@ -229,14 +229,14 @@ static void SetDialogToType(HWND hwndDlg) ShowWindow(dat->infobarData->hWnd, SW_HIDE);
if (dat->windowData.hContact) {
- ShowToolbarControls(hwndDlg, SIZEOF(toolbarButtons), toolbarButtons, g_dat->buttonVisibility, showToolbar ? SW_SHOW : SW_HIDE);
+ ShowToolbarControls(hwndDlg, SIZEOF(toolbarButtons), toolbarButtons, g_dat.buttonVisibility, showToolbar ? SW_SHOW : SW_HIDE);
if (!DBGetContactSettingByte(dat->windowData.hContact, "CList", "NotOnList", 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE);
- if (!g_dat->smileyAddInstalled)
+ if (!g_dat.smileyAddInstalled)
ShowWindow(GetDlgItem(hwndDlg, IDC_SMILEYS), SW_HIDE);
}
- else ShowToolbarControls(hwndDlg, SIZEOF(toolbarButtons), toolbarButtons, g_dat->buttonVisibility, SW_HIDE);
+ else ShowToolbarControls(hwndDlg, SIZEOF(toolbarButtons), toolbarButtons, g_dat.buttonVisibility, SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_MESSAGE), SW_SHOW);
if (dat->windowData.hwndLog != NULL)
@@ -279,21 +279,21 @@ void SetStatusIcon(struct SrmmWindowData *dat) { if (dat->statusIconOverlay != NULL)
DestroyIcon(dat->statusIconOverlay);
- int index = ImageList_ReplaceIcon(g_dat->hHelperIconList, 0, dat->statusIcon);
- dat->statusIconOverlay = ImageList_GetIcon(g_dat->hHelperIconList, index, ILD_TRANSPARENT|INDEXTOOVERLAYMASK(1));
+ int index = ImageList_ReplaceIcon(g_dat.hHelperIconList, 0, dat->statusIcon);
+ dat->statusIconOverlay = ImageList_GetIcon(g_dat.hHelperIconList, index, ILD_TRANSPARENT|INDEXTOOVERLAYMASK(1));
}
void GetTitlebarIcon(struct SrmmWindowData *dat, TitleBarData *tbd) {
- if (dat->showTyping && (g_dat->flags2 & SMF2_SHOWTYPINGWIN)) {
+ if (dat->showTyping && (g_dat.flags2 & SMF2_SHOWTYPINGWIN)) {
tbd->hIconNot = tbd->hIcon = GetCachedIcon("scriver_TYPING");
} else if (dat->showUnread && (GetActiveWindow() != dat->hwndParent || GetForegroundWindow() != dat->hwndParent)) {
- tbd->hIcon = (g_dat->flags & SMF_STATUSICON) ? dat->statusIcon : g_dat->hMsgIcon;
- tbd->hIconNot = (g_dat->flags & SMF_STATUSICON) ? g_dat->hMsgIcon : GetCachedIcon("scriver_OVERLAY");
+ tbd->hIcon = (g_dat.flags & SMF_STATUSICON) ? dat->statusIcon : g_dat.hMsgIcon;
+ tbd->hIconNot = (g_dat.flags & SMF_STATUSICON) ? g_dat.hMsgIcon : GetCachedIcon("scriver_OVERLAY");
} else {
- tbd->hIcon = (g_dat->flags & SMF_STATUSICON) ? dat->statusIcon : g_dat->hMsgIcon;
+ tbd->hIcon = (g_dat.flags & SMF_STATUSICON) ? dat->statusIcon : g_dat.hMsgIcon;
tbd->hIconNot = NULL;
}
- tbd->hIconBig = (g_dat->flags & SMF_STATUSICON) ? dat->statusIconBig : g_dat->hMsgIconBig;
+ tbd->hIconBig = (g_dat.flags & SMF_STATUSICON) ? dat->statusIconBig : g_dat.hMsgIconBig;
}
HICON GetTabIcon(struct SrmmWindowData *dat) {
@@ -355,7 +355,7 @@ static LRESULT CALLBACK LogEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, TCHAR szMenuText[4096];
mir_sntprintf( szMenuText, 4096, TranslateT("Look up \'%s\':"), pszWord );
ModifyMenu( hSubMenu, 5, MF_STRING|MF_BYPOSITION, 5, szMenuText );
- SetSearchEngineIcons(hMenu, g_dat->hSearchEngineIconList);
+ SetSearchEngineIcons(hMenu, g_dat.hSearchEngineIconList);
}
else ModifyMenu( hSubMenu, 5, MF_STRING|MF_GRAYED|MF_BYPOSITION, 5, TranslateT( "No word to look up" ));
inMenu = TRUE;
@@ -423,11 +423,11 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar case WM_KEYDOWN:
{
if (wParam == VK_RETURN) {
- if ((isCtrl != 0) ^ (0 != (g_dat->flags & SMF_SENDONENTER))) {
+ if ((isCtrl != 0) ^ (0 != (g_dat.flags & SMF_SENDONENTER))) {
PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
return 0;
}
- if (g_dat->flags & SMF_SENDONDBLENTER) {
+ if (g_dat.flags & SMF_SENDONDBLENTER) {
if (dat->lastEnterTime + ENTERCLICKTIME < GetTickCount())
dat->lastEnterTime = GetTickCount();
else {
@@ -516,7 +516,7 @@ static void UnsubclassLogEdit(HWND hwnd) { static void MessageDialogResize(HWND hwndDlg, struct SrmmWindowData *dat, int w, int h) {
HDWP hdwp;
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 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 infobarInnerHeight = INFO_BAR_INNER_HEIGHT;
int infobarHeight = INFO_BAR_HEIGHT;
@@ -547,7 +547,7 @@ static void MessageDialogResize(HWND hwndDlg, struct SrmmWindowData *dat, int w, hSplitterPos = hSplitterMinBottom;
}
if (!(pdat->flags2 & SMF2_SHOWINFOBAR)) {
- if (dat->avatarPic && (g_dat->flags&SMF_AVATAR)) {
+ if (dat->avatarPic && (g_dat.flags&SMF_AVATAR)) {
avatarWidth = BOTTOM_RIGHT_AVATAR_HEIGHT;
avatarHeight = toolbarHeight + hSplitterPos - 2;
if (avatarHeight < BOTTOM_RIGHT_AVATAR_HEIGHT) {
@@ -579,7 +579,7 @@ static void MessageDialogResize(HWND hwndDlg, struct SrmmWindowData *dat, int w, hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_AVATAR), 0, w-avatarWidth - 1, h - (avatarHeight + avatarWidth) / 2 - 1, avatarWidth, avatarWidth, SWP_NOZORDER);
hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_SPLITTER), 0, 0, h - hSplitterPos-1, toolbarWidth, SPLITTER_HEIGHT, SWP_NOZORDER);
- hdwp = ResizeToolbar(hwndDlg, hdwp, toolbarWidth, h - hSplitterPos - toolbarHeight + 1, toolbarHeight, SIZEOF(toolbarButtons), toolbarButtons, g_dat->buttonVisibility);
+ hdwp = ResizeToolbar(hwndDlg, hdwp, toolbarWidth, h - hSplitterPos - toolbarHeight + 1, toolbarHeight, SIZEOF(toolbarButtons), toolbarButtons, g_dat.buttonVisibility);
/*
if (hSplitterPos - SPLITTER_HEIGHT - toolbarHeight - 2< dat->avatarHeight) {
@@ -597,7 +597,7 @@ static void MessageDialogResize(HWND hwndDlg, struct SrmmWindowData *dat, int w, }
vPos = h - toolbarHeight;
hdwp = ResizeToolbar(hwndDlg, hdwp, w, vPos, toolbarHeight, SIZEOF(buttonControls),
- buttonControls, buttonWidth, buttonSpacing, buttonAlignment, g_dat->buttonVisibility);
+ buttonControls, buttonWidth, buttonSpacing, buttonAlignment, g_dat.buttonVisibility);
*/
EndDeferWindowPos(hdwp);
@@ -786,7 +786,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (DBGetContactSettingByte(dat->windowData.hContact, SRMMMOD, "UseRTL", (BYTE) 0)) {
dat->flags |= SMF_RTL;
}
- dat->flags |= g_dat->ieviewInstalled ? g_dat->flags & SMF_USEIEVIEW : 0;
+ dat->flags |= g_dat.ieviewInstalled ? g_dat.flags & SMF_USEIEVIEW : 0;
{
PARAFORMAT2 pf2;
ZeroMemory((void *)&pf2, sizeof(pf2));
@@ -827,15 +827,15 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (dat->splitterPos == -1) {
dat->splitterPos = dat->windowData.minEditBoxHeight;
}
- WindowList_Add(g_dat->hMessageWindowList, hwndDlg, dat->windowData.hContact);
+ WindowList_Add(g_dat.hMessageWindowList, hwndDlg, dat->windowData.hContact);
if (newData->szInitialText) {
if (newData->isWchar)
SetDlgItemText(hwndDlg, IDC_MESSAGE, (TCHAR *)newData->szInitialText);
else
SetDlgItemTextA(hwndDlg, IDC_MESSAGE, newData->szInitialText);
- } else if (g_dat->flags & SMF_SAVEDRAFTS) {
- TCmdList *draft = tcmdlist_get2(g_dat->draftList, dat->windowData.hContact);
+ } else if (g_dat.flags & SMF_SAVEDRAFTS) {
+ TCmdList *draft = tcmdlist_get2(g_dat.draftList, dat->windowData.hContact);
if (draft != NULL) {
len = SetRichTextEncoded(GetDlgItem(hwndDlg, IDC_MESSAGE), draft->szCmd, dat->windowData.codePage);
}
@@ -1031,9 +1031,9 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP mii.cbSize = sizeof(mii);
mii.fMask = MIIM_ID | MIIM_STRING | MIIM_STATE | MIIM_DATA | MIIM_BITMAP;
mii.fType = MFT_STRING;
- mii.fState = (g_dat->buttonVisibility & (1<< i)) ? MFS_CHECKED : MFS_UNCHECKED;
+ mii.fState = (g_dat.buttonVisibility & (1<< i)) ? MFS_CHECKED : MFS_UNCHECKED;
mii.wID = i + 1;
- mii.dwItemData = (ULONG_PTR)g_dat->hButtonIconList;
+ mii.dwItemData = (ULONG_PTR)g_dat.hButtonIconList;
mii.hbmpItem = HBMMENU_CALLBACK;
mii.dwTypeData = TranslateTS((toolbarButtons[i].name));
InsertMenuItem(hToolbarMenu, i, TRUE, &mii);
@@ -1043,9 +1043,9 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP pt.y = (short) HIWORD(GetMessagePos());
i = TrackPopupMenu(hToolbarMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
if (i > 0) {
- g_dat->buttonVisibility ^= (1 << (i - 1));
- DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_BUTTONVISIBILITY, g_dat->buttonVisibility);
- WindowList_Broadcast(g_dat->hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0);
+ g_dat.buttonVisibility ^= (1 << (i - 1));
+ DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_BUTTONVISIBILITY, g_dat.buttonVisibility);
+ WindowList_Broadcast(g_dat.hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0);
}
DestroyMenu(hToolbarMenu);
return TRUE;
@@ -1204,7 +1204,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP LOGFONT lf;
COLORREF colour;
dat->flags &= ~SMF_USEIEVIEW;
- dat->flags |= g_dat->ieviewInstalled ? g_dat->flags & SMF_USEIEVIEW : 0;
+ dat->flags |= g_dat.ieviewInstalled ? g_dat.flags & SMF_USEIEVIEW : 0;
if (dat->flags & SMF_USEIEVIEW && dat->windowData.hwndLog == NULL) {
IEVIEWWINDOW ieWindow;
ieWindow.cbSize = sizeof(IEVIEWWINDOW);
@@ -1249,13 +1249,13 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP 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;
+ 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_SETLANGOPTIONS, 0, (LPARAM) SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD);
pf2.cbSize = sizeof(pf2);
pf2.dwMask = PFM_OFFSET;
- pf2.dxOffset = (g_dat->flags & SMF_INDENTTEXT) ? g_dat->indentSize * 1440 / g_dat->logPixelSX : 0;
+ pf2.dxOffset = (g_dat.flags & SMF_INDENTTEXT) ? g_dat.indentSize * 1440 / g_dat.logPixelSX : 0;
SetDlgItemText(hwndDlg, IDC_LOG, _T(""));
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETLANGOPTIONS, 0, (LPARAM) SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETLANGOPTIONS, 0, 0) & ~(IMF_AUTOKEYBOARD | IMF_AUTOFONTSIZEADJUST));
@@ -1394,13 +1394,13 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP return TRUE;
}
}
- if (g_dat->hFocusWnd == hwndDlg) {
+ if (g_dat.hFocusWnd == hwndDlg) {
SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
}
return TRUE;
case WM_SETFOCUS:
SendMessage(dat->hwndParent, CM_ACTIVATECHILD, 0, (LPARAM)hwndDlg);
- g_dat->hFocusWnd = hwndDlg;
+ g_dat.hFocusWnd = hwndDlg;
PostMessage(hwndDlg, DM_SETFOCUS, 0, 0);
return TRUE;
case DM_SETPARENT:
@@ -1509,7 +1509,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (GetForegroundWindow()==dat->hwndParent && dat->parent->hwndActive == hwndDlg)
SkinPlaySound("RecvMsgActive");
else SkinPlaySound("RecvMsgInactive");
- if ((g_dat->flags2 & SMF2_SWITCHTOACTIVE) && (IsIconic(dat->hwndParent) || GetActiveWindow() != dat->hwndParent) && IsWindowVisible(dat->hwndParent)) {
+ 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)) {
@@ -1537,7 +1537,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP StatusBarData sbd= {0};
StatusIconData sid = {0};
sbd.iFlags = SBDF_TEXT | SBDF_ICON;
- if (dat->messagesInProgress && (g_dat->flags & SMF_SHOWPROGRESS)) {
+ if (dat->messagesInProgress && (g_dat.flags & SMF_SHOWPROGRESS)) {
sbd.hIcon = GetCachedIcon("scriver_DELIVERING");
sbd.pszText = szText;
mir_sntprintf(szText, SIZEOF(szText), TranslateT("Sending in progress: %d message(s) left..."), dat->messagesInProgress);
@@ -1564,7 +1564,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP sid.flags = MBF_DISABLED;
ModifyStatusIcon((WPARAM)dat->windowData.hContact, (LPARAM) &sid);
sid.dwId = 1;
- if (IsTypingNotificationSupported(dat) && g_dat->flags2 & SMF2_SHOWTYPINGSWITCH) {
+ if (IsTypingNotificationSupported(dat) && g_dat.flags2 & SMF2_SHOWTYPINGSWITCH) {
sid.flags = (DBGetContactSettingByte(dat->windowData.hContact, SRMMMOD, SRMSGSET_TYPING,
DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW))) ? 0 : MBF_DISABLED;
} else {
@@ -1665,14 +1665,14 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP dat->messagesInProgress++;
case DM_SHOWMESSAGESENDING:
SetTimer(hwndDlg, TIMERID_MSGSEND, 1000, NULL);
- if (g_dat->flags & SMF_SHOWPROGRESS) {
+ if (g_dat.flags & SMF_SHOWPROGRESS) {
SendMessage(dat->hwnd, DM_UPDATESTATUSBAR, 0, 0);
}
break;
case DM_STOPMESSAGESENDING:
if (dat->messagesInProgress>0) {
dat->messagesInProgress--;
- if (g_dat->flags & SMF_SHOWPROGRESS) {
+ if (g_dat.flags & SMF_SHOWPROGRESS) {
SendMessage(dat->hwnd, DM_UPDATESTATUSBAR, 0, 0);
}
}
@@ -1727,7 +1727,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP rect.bottom = itemHeight - 1;
FillRect(hdcMem, &rect, GetSysColorBrush(COLOR_BTNFACE));
- if (dat->avatarPic && (g_dat->flags&SMF_AVATAR)) {
+ if (dat->avatarPic && (g_dat.flags&SMF_AVATAR)) {
BITMAP bminfo;
GetObject(dat->avatarPic, sizeof(bminfo), &bminfo);
if ( bminfo.bmWidth != 0 && bminfo.bmHeight != 0 ) {
@@ -1871,7 +1871,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP CallService(MS_USERINFO_SHOWDIALOG, (WPARAM) dat->windowData.hContact, 0);
break;
case IDC_SMILEYS:
- if (g_dat->smileyAddInstalled) {
+ if (g_dat.smileyAddInstalled) {
SMADD_SHOWSEL3 smaddInfo;
RECT rc;
smaddInfo.cbSize = sizeof(SMADD_SHOWSEL3);
@@ -2042,8 +2042,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP {
REQRESIZE *rr = (REQRESIZE *)lParam;
int height = rr->rc.bottom - rr->rc.top + 1;
- if (height < g_dat->minInputAreaHeight) {
- height = g_dat->minInputAreaHeight;
+ if (height < g_dat.minInputAreaHeight) {
+ height = g_dat.minInputAreaHeight;
}
if (dat->desiredInputAreaHeight != height) {
dat->desiredInputAreaHeight = height;
@@ -2071,13 +2071,13 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP dat->statusIcon = NULL;
dat->statusIconOverlay = NULL;
ReleaseSendQueueItems(hwndDlg);
- if (g_dat->flags & SMF_SAVEDRAFTS) {
+ if (g_dat.flags & SMF_SAVEDRAFTS) {
saveDraftMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), dat->windowData.hContact, dat->windowData.codePage);
} else {
- g_dat->draftList = tcmdlist_remove2(g_dat->draftList, dat->windowData.hContact);
+ g_dat.draftList = tcmdlist_remove2(g_dat.draftList, dat->windowData.hContact);
}
tcmdlist_free(dat->windowData.cmdList);
- WindowList_Remove(g_dat->hMessageWindowList, hwndDlg);
+ WindowList_Remove(g_dat.hMessageWindowList, hwndDlg);
UnsubclassMessageEdit(GetDlgItem(hwndDlg, IDC_MESSAGE));
UnsubclassLogEdit(GetDlgItem(hwndDlg, IDC_LOG));
{
@@ -2088,7 +2088,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
DBWriteContactSettingByte(dat->windowData.hContact, SRMMMOD, "UseRTL", (BYTE) ((dat->flags & SMF_RTL) ? 1 : 0));
DBWriteContactSettingWord(dat->windowData.hContact, SRMMMOD, "CodePage", (WORD) dat->windowData.codePage);
- if (dat->windowData.hContact && (g_dat->flags & SMF_DELTEMP)) {
+ if (dat->windowData.hContact && (g_dat.flags & SMF_DELTEMP)) {
if (DBGetContactSettingByte(dat->windowData.hContact, "CList", "NotOnList", 0)) {
CallService(MS_DB_CONTACT_DELETE, (WPARAM)dat->windowData.hContact, 0);
}
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index 22bf09d128..91e9c2a9b7 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -906,104 +906,16 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG }
return 0;
}
-/*
-#ifndef CFE_LINK
-#define CFE_LINK 32
-#endif
-
-
-static const CLSID IID_ITextDocument=
-{ 0x8CC497C0,0xA1DF,0x11CE,
- { 0x80,0x98, 0x00,0xAA,
- 0x00,0x47,0xBE,0x5D} };
-
-void AutoURLDetect(HWND hwnd, CHARRANGE* sel) {
- CHARFORMAT2 cf;
- long cnt;
- BSTR btxt = 0;
- CHARRANGE oldSel;
- LOGFONT lf;
- COLORREF colour;
-
- IRichEditOle* RichEditOle;
- ITextDocument* TextDocument;
- ITextRange* TextRange;
- ITextSelection* TextSelection;
-
- LoadMsgDlgFont(MSGFONTID_MYMSG, &lf, &colour);
-
- SendMessage(hwnd, EM_GETOLEINTERFACE, 0, (LPARAM)&RichEditOle);
- if (RichEditOle->lpVtbl->QueryInterface(RichEditOle, &IID_ITextDocument, (void**)&TextDocument) != S_OK)
- {
- RichEditOle->lpVtbl->Release(RichEditOle);
- return;
- }
- // retrieve text range
- if (TextDocument->lpVtbl->Range(TextDocument,sel->cpMin, sel->cpMax, &TextRange) != S_OK)
- {
- TextDocument->lpVtbl->Release(TextDocument);
- RichEditOle->lpVtbl->Release(RichEditOle);
- return;
- }
-
- // retrieve text to parse for URLs
- if (TextRange->lpVtbl->GetText(TextRange, &btxt) != S_OK)
- {
- TextRange->lpVtbl->Release(TextRange);
- TextDocument->lpVtbl->Release(TextDocument);
- RichEditOle->lpVtbl->Release(RichEditOle);
- return;
- }
- TextRange->lpVtbl->Release(TextRange);
-
- // disable screen updates
-
- TextDocument->lpVtbl->Freeze(TextDocument, &cnt);
-
- TextDocument->lpVtbl->GetSelection(TextDocument, &TextSelection);
-
- cf.cbSize = sizeof(cf);
- cf.dwMask = CFM_LINK | CFM_COLOR | CFM_UNDERLINE | CFM_BOLD | CFM_ITALIC | CFM_FACE | CFM_SIZE;
- cf.dwEffects = CFE_UNDERLINE | (lf.lfWeight >= FW_BOLD ? CFE_BOLD : 0) | (lf.lfItalic ? CFE_ITALIC : 0);
- _tcsncpy(cf.szFaceName, lf.lfFaceName, SIZEOF(cf.szFaceName));
- cf.crTextColor = RGB(255,255,255);//colour;
- cf.yHeight = 20 * lf.lfHeight;
-
- //text = GetRichEditSelection(hwnd);
- if (btxt!=NULL) {
- int cpMin = sel->cpMin;
- int cpMax = sel->cpMax;
- int i, j, len = _tcslen(btxt);
- for (j = 0; j < len ; j++) {
- int l = DetectURL(btxt+j);
- if (l > 0) {
- sel->cpMin = cpMin + j;
- sel->cpMax = cpMin + j + l;
- TextSelection->lpVtbl->SetRange(TextSelection, cpMin + j, cpMin + j + l);
- SendMessage(hwnd, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- j+= l-1;
- }
- }
- }
- TextSelection->lpVtbl->SetRange(TextSelection,oldSel.cpMin, oldSel.cpMax);
- TextSelection->lpVtbl->Release(TextSelection);
- TextDocument->lpVtbl->Unfreeze(TextDocument,&cnt);
- SysFreeString(btxt);
- TextDocument->lpVtbl->Release(TextDocument);
- RichEditOle->lpVtbl->Release(RichEditOle);
- UpdateWindow(hwnd);
-}
-*/
void StreamInTestEvents(HWND hEditWnd, struct GlobalMessageData *gdat)
{
EDITSTREAM stream = { 0 };
struct LogStreamData streamData = { 0 };
- struct SrmmWindowData dat = { 0 };
+ struct SrmmWindowData dat = { 0 };
streamData.isFirst = TRUE;
- streamData.events = GetTestEvents();
- streamData.dlgDat = &dat;
- streamData.gdat = gdat;
+ streamData.events = GetTestEvents();
+ streamData.dlgDat = &dat;
+ streamData.gdat = gdat;
stream.pfnCallback = LogStreamInEvents;
stream.dwCookie = (DWORD_PTR) & streamData;
SendMessage(hEditWnd, EM_STREAMIN, SF_RTF, (LPARAM) & stream);
@@ -1045,8 +957,8 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend) CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
return;
}
-// IEVIew MOD End
+ // 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;
@@ -1055,7 +967,7 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend) streamData.dlgDat = dat;
streamData.eventsToInsert = count;
streamData.isFirst = fAppend ? GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), dat->windowData.codePage, FALSE) == 0 : 1;
- streamData.gdat = g_dat;
+ streamData.gdat = &g_dat;
stream.pfnCallback = LogStreamInEvents;
stream.dwCookie = (DWORD_PTR) & streamData;
sel.cpMin = 0;
@@ -1076,11 +988,11 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend) fi.chrg.cpMin = 0;
dat->isMixed = 0;
}
-//SFF_SELECTION |
+
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_STREAMIN, fAppend ? SFF_SELECTION | SF_RTF : SFF_SELECTION | SF_RTF, (LPARAM) & stream);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXSETSEL, 0, (LPARAM) & oldSel);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_HIDESELECTION, FALSE, 0);
- if (g_dat->smileyAddInstalled) {
+ if (g_dat.smileyAddInstalled) {
SMADD_RICHEDIT3 smre;
smre.cbSize = sizeof(SMADD_RICHEDIT3);
smre.hwndRichEditControl = GetDlgItem(hwndDlg, IDC_LOG);
@@ -1104,15 +1016,13 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend) smre.flags = 0;
CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM) &smre);
}
-// if (GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_LOG), GWL_STYLE) & WS_VSCROLL)
- {
- int len;
- len = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), dat->windowData.codePage, FALSE);
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETSEL, len - 1, len - 1);
- }
- if (!fAppend) {
+
+ int len = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), dat->windowData.codePage, FALSE);
+ SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETSEL, len - 1, len - 1);
+
+ if (!fAppend)
SendDlgItemMessage(hwndDlg, IDC_LOG, WM_SETREDRAW, TRUE, 0);
- }
+
dat->hDbEventLast = streamData.hDbEventLast;
PostMessage(hwndDlg, DM_SCROLLLOGTOBOTTOM, 0, 0);
}
diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index fde75c3562..7d6b358cac 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -125,7 +125,7 @@ int FontServiceFontsChanged(WPARAM wParam, LPARAM lParam) {
LoadMsgLogIcons();
LoadInfobarFonts();
- WindowList_Broadcast(g_dat->hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0);
+ WindowList_Broadcast(g_dat.hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0);
Chat_FontsChanged(wParam, lParam);
return 0;
}
@@ -234,15 +234,15 @@ int IconsChanged(WPARAM wParam, LPARAM lParam) FreeMsgLogIcons();
LoadMsgLogIcons();
ChangeStatusIcons();
- WindowList_Broadcast(g_dat->hMessageWindowList, DM_REMAKELOG, 0, 0);
- WindowList_Broadcast(g_dat->hMessageWindowList, DM_CHANGEICONS, 0, 1);
+ WindowList_Broadcast(g_dat.hMessageWindowList, DM_REMAKELOG, 0, 0);
+ WindowList_Broadcast(g_dat.hMessageWindowList, DM_CHANGEICONS, 0, 1);
Chat_IconsChanged(wParam, lParam);
return 0;
}
int SmileySettingsChanged(WPARAM wParam, LPARAM lParam)
{
- WindowList_Broadcast(g_dat->hMessageWindowList, DM_REMAKELOG, wParam, 0);
+ WindowList_Broadcast(g_dat.hMessageWindowList, DM_REMAKELOG, wParam, 0);
Chat_SmileyOptionsChanged(wParam, lParam);
return 0;
}
@@ -342,12 +342,13 @@ static DWORD MakeCheckBoxTreeFlags(HWND hwndTree) static int changed = 0;
-static void ApplyChanges(int i) {
+static void ApplyChanges(int i)
+{
changed &= ~i;
if (changed == 0) {
ReloadGlobals();
- WindowList_Broadcast(g_dat->hParentWindowList, DM_OPTIONSAPPLIED, 0, 0);
- WindowList_Broadcast(g_dat->hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0);
+ WindowList_Broadcast(g_dat.hParentWindowList, DM_OPTIONSAPPLIED, 0, 0);
+ WindowList_Broadcast(g_dat.hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0);
SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
}
}
@@ -529,7 +530,7 @@ static INT_PTR CALLBACK DlgProcLayoutOptions(HWND hwndDlg, UINT msg, WPARAM wPar CheckDlgButton(hwndDlg, IDC_STATUSWIN, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_STATUSICON, SRMSGDEFSET_STATUSICON));
CheckDlgButton(hwndDlg, IDC_SHOWPROGRESS, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWPROGRESS, SRMSGDEFSET_SHOWPROGRESS));
- CheckDlgButton(hwndDlg, IDC_AVATARSUPPORT, g_dat->flags&SMF_AVATAR);
+ CheckDlgButton(hwndDlg, IDC_AVATARSUPPORT, g_dat.flags&SMF_AVATAR);
return TRUE;
}
@@ -740,7 +741,7 @@ static void ShowPreview(HWND hwndDlg) gdat.indentSize = (int) SendDlgItemMessage(hwndDlg, IDC_INDENTSPIN, UDM_GETPOS, 0, 0);
pf2.cbSize = sizeof(pf2);
pf2.dwMask = PFM_OFFSET;
- pf2.dxOffset = (gdat.flags & SMF_INDENTTEXT) ? gdat.indentSize * 1440 /g_dat->logPixelSX : 0;
+ pf2.dxOffset = (gdat.flags & SMF_INDENTTEXT) ? gdat.indentSize * 1440 /g_dat.logPixelSX : 0;
SetDlgItemText(hwndDlg, IDC_LOG, _T(""));
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
StreamInTestEvents(GetDlgItem(hwndDlg, IDC_LOG), &gdat);
@@ -786,7 +787,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, EnableWindow(GetDlgItem(hwndDlg, IDC_USELONGDATE), IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES) && IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES));
EnableWindow(GetDlgItem(hwndDlg, IDC_USERELATIVEDATE), IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES) && IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES));
- if (!g_dat->ieviewInstalled) {
+ if (!g_dat.ieviewInstalled) {
EnableWindow(GetDlgItem(hwndDlg, IDC_USEIEVIEW), FALSE);
}
CheckDlgButton(hwndDlg, IDC_USEIEVIEW, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USEIEVIEW, SRMSGDEFSET_USEIEVIEW));
@@ -1076,7 +1077,7 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY));
DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGSWITCH, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TYPINGSWITCH));
ReloadGlobals();
- WindowList_Broadcast(g_dat->hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0);
+ WindowList_Broadcast(g_dat.hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0);
}
}
break;
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index c68a2397b7..93aca689e1 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -62,14 +62,14 @@ static int SRMMStatusToPf2(int status) }
int IsAutoPopup(HANDLE hContact) {
- if (g_dat->flags & SMF_AUTOPOPUP) {
+ if (g_dat.flags & SMF_AUTOPOPUP) {
char *szProto = GetContactProto(hContact);
if (strcmp(szProto, "MetaContacts") == 0 ) {
hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)hContact, 0);
if (hContact != NULL)
szProto = GetContactProto(hContact);
}
- if (szProto && (g_dat->openFlags & SRMMStatusToPf2(CallProtoService(szProto, PS_GETSTATUS, 0, 0)))) {
+ if (szProto && (g_dat.openFlags & SRMMStatusToPf2(CallProtoService(szProto, PS_GETSTATUS, 0, 0)))) {
return 1;
}
}
@@ -82,7 +82,7 @@ static INT_PTR ReadMessageCommand(WPARAM wParam, LPARAM lParam) HWND hwndExisting;
HWND hParent;
- hwndExisting = WindowList_Find(g_dat->hMessageWindowList, ((CLISTEVENT *) lParam)->hContact);
+ hwndExisting = WindowList_Find(g_dat.hMessageWindowList, ((CLISTEVENT *) lParam)->hContact);
if (hwndExisting == NULL) {
newData.hContact = ((CLISTEVENT *) lParam)->hContact;
hParent = GetParentWindow(newData.hContact, FALSE);
@@ -102,7 +102,7 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam) CallService(MS_DB_EVENT_GET, lParam, (LPARAM) & dbei);
if (dbei.eventType == EVENTTYPE_MESSAGE && (dbei.flags & DBEF_READ))
return 0;
- hwnd = WindowList_Find(g_dat->hMessageWindowList, (HANDLE) wParam);
+ hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE) wParam);
if (hwnd) {
SendMessage(hwnd, HM_DBEVENTADDED, wParam, lParam);
}
@@ -157,7 +157,7 @@ static INT_PTR SendMessageCommandW(WPARAM wParam, LPARAM lParam) if (!CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND)
return 1;
- if ((hwnd = WindowList_Find(g_dat->hMessageWindowList, (HANDLE) wParam))) {
+ if ((hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE) wParam))) {
if (lParam) {
HWND hEdit;
hEdit = GetDlgItem(hwnd, IDC_MESSAGE);
@@ -201,7 +201,7 @@ static INT_PTR SendMessageCommand(WPARAM wParam, LPARAM lParam) } //if
}
- if ((hwnd = WindowList_Find(g_dat->hMessageWindowList, (HANDLE) wParam))) {
+ if ((hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE) wParam))) {
if (lParam) {
HWND hEdit;
hEdit = GetDlgItem(hwnd, IDC_MESSAGE);
@@ -240,15 +240,15 @@ static int TypingMessage(WPARAM wParam, LPARAM lParam) {
HWND hwnd;
- if (!(g_dat->flags2&SMF2_SHOWTYPING))
+ if (!(g_dat.flags2&SMF2_SHOWTYPING))
return 0;
- if ((hwnd = WindowList_Find(g_dat->hMessageWindowList, (HANDLE) wParam))) {
+ if ((hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE) wParam))) {
SendMessage(hwnd, DM_TYPING, 0, lParam);
- } else if ((int) lParam && (g_dat->flags2&SMF2_SHOWTYPINGTRAY)) {
+ } else if ((int) lParam && (g_dat.flags2&SMF2_SHOWTYPINGTRAY)) {
TCHAR szTip[256];
mir_sntprintf(szTip, SIZEOF(szTip), TranslateT("%s is typing a message"), (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, wParam, GCDNF_TCHAR));
- if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY) && !(g_dat->flags2&SMF2_SHOWTYPINGCLIST)) {
+ if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY) && !(g_dat.flags2&SMF2_SHOWTYPINGCLIST)) {
MIRANDASYSTRAYNOTIFY tn;
tn.szProto = NULL;
tn.cbSize = sizeof(tn);
@@ -281,7 +281,7 @@ static int MessageSettingChanged(WPARAM wParam, LPARAM lParam) char *szProto = GetContactProto((HANDLE)wParam);
if (lstrcmpA(cws->szModule, "CList") && (szProto == NULL || lstrcmpA(cws->szModule, szProto)))
return 0;
- WindowList_Broadcast(g_dat->hMessageWindowList, DM_CLISTSETTINGSCHANGED, wParam, lParam);
+ WindowList_Broadcast(g_dat.hMessageWindowList, DM_CLISTSETTINGSCHANGED, wParam, lParam);
return 0;
}
@@ -289,7 +289,7 @@ static int ContactDeleted(WPARAM wParam, LPARAM lParam) {
HWND hwnd;
- if ((hwnd = WindowList_Find(g_dat->hMessageWindowList, (HANDLE) wParam))) {
+ if ((hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE) wParam))) {
SendMessage(hwnd, WM_CLOSE, 0, 0);
}
return 0;
@@ -297,47 +297,42 @@ static int ContactDeleted(WPARAM wParam, LPARAM lParam) static void RestoreUnreadMessageAlerts(void)
{
- CLISTEVENT cle = { 0 };
- DBEVENTINFO dbei = { 0 };
TCHAR toolTip[256];
- int windowAlreadyExists;
- HANDLE hDbEvent, hContact;
- dbei.cbSize = sizeof(dbei);
- cle.cbSize = sizeof(cle);
+ DBEVENTINFO dbei = { sizeof(dbei) };
+
+ CLISTEVENT cle = { sizeof(cle) };
cle.hIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE);
cle.pszService = "SRMsg/ReadMessage";
cle.flags = CLEF_TCHAR;
cle.ptszTooltip = toolTip;
- hContact = db_find_first();
+ HANDLE hContact = db_find_first();
while (hContact) {
- hDbEvent = (HANDLE) CallService(MS_DB_EVENT_FINDFIRSTUNREAD, (WPARAM) hContact, 0);
+ HANDLE hDbEvent = (HANDLE) CallService(MS_DB_EVENT_FINDFIRSTUNREAD, (WPARAM) hContact, 0);
while (hDbEvent) {
dbei.cbBlob = 0;
- CallService(MS_DB_EVENT_GET, (WPARAM) hDbEvent, (LPARAM) & dbei);
+ CallService(MS_DB_EVENT_GET, (WPARAM) hDbEvent, (LPARAM) &dbei);
if (!(dbei.flags & (DBEF_SENT | DBEF_READ)) && DbEventIsMessageOrCustom(&dbei)) {
- windowAlreadyExists = WindowList_Find(g_dat->hMessageWindowList, hContact) != NULL;
+ int windowAlreadyExists = WindowList_Find(g_dat.hMessageWindowList, hContact) != NULL;
if (windowAlreadyExists)
continue;
- if (IsAutoPopup(hContact) && !windowAlreadyExists) {
- HWND hParent;
- NewMessageWindowLParam newData = { 0 };
- newData.hContact = hContact;
- newData.flags = NMWLP_INCOMING;
- hParent = GetParentWindow(newData.hContact, FALSE);
- CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSG), hParent, DlgProcMessage, (LPARAM) & newData);
-// CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSG), NULL, DlgProcMessage, (LPARAM) & newData);
- }
- else {
- cle.hContact = hContact;
- cle.hDbEvent = hDbEvent;
- mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("Message from %s"), (char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, GCDNF_TCHAR));
- CallService(MS_CLIST_ADDEVENT, 0, (LPARAM) & cle);
- }
- }
- hDbEvent = (HANDLE) CallService(MS_DB_EVENT_FINDNEXT, (WPARAM) hDbEvent, 0);
+ if (IsAutoPopup(hContact) && !windowAlreadyExists) {
+ NewMessageWindowLParam newData = { 0 };
+ newData.hContact = hContact;
+ newData.flags = NMWLP_INCOMING;
+ HWND hParent = GetParentWindow(newData.hContact, FALSE);
+ CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSG), hParent, DlgProcMessage, (LPARAM) & newData);
+ }
+ else {
+ cle.hContact = hContact;
+ cle.hDbEvent = hDbEvent;
+ mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("Message from %s"), (char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, GCDNF_TCHAR));
+ CallService(MS_CLIST_ADDEVENT, 0, (LPARAM) & cle);
+ }
+ }
+ hDbEvent = (HANDLE) CallService(MS_DB_EVENT_FINDNEXT, (WPARAM) hDbEvent, 0);
}
hContact = db_find_next(hContact);
}
@@ -366,7 +361,7 @@ static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam) if (mwid->cbSize != sizeof(MessageWindowInputData) || mwd->cbSize != sizeof(SrmmWindowData)) return 1;
if (mwid->hContact == NULL) return 1;
if (mwid->uFlags != MSG_WINDOW_UFLAG_MSG_BOTH) return 1;
- hwnd = WindowList_Find(g_dat->hMessageWindowList, mwid->hContact);
+ hwnd = WindowList_Find(g_dat.hMessageWindowList, mwid->hContact);
if (hwnd == NULL)
hwnd = SM_FindWindowByContact(mwid->hContact);
mwd->uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
@@ -398,9 +393,9 @@ static int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { static int AvatarChanged(WPARAM wParam, LPARAM lParam) {
if (wParam == 0) { // protocol picture has changed...
- WindowList_Broadcast(g_dat->hMessageWindowList, DM_AVATARCHANGED, wParam, lParam);
+ WindowList_Broadcast(g_dat.hMessageWindowList, DM_AVATARCHANGED, wParam, lParam);
} else {
- HWND hwnd = WindowList_Find(g_dat->hMessageWindowList, (HANDLE)wParam);
+ HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)wParam);
SendMessage(hwnd, DM_AVATARCHANGED, wParam, lParam);
}
return 0;
@@ -441,27 +436,27 @@ void ChangeStatusIcons() { int StatusIconPressed(WPARAM wParam, LPARAM lParam) {
// HANDLE hContact = (HANDLE) wParam;
StatusIconClickData *sicd = (StatusIconClickData *) lParam;
- HWND hwnd = WindowList_Find(g_dat->hMessageWindowList, (HANDLE)wParam);
+ HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)wParam);
if (hwnd == NULL) {
hwnd = SM_FindWindowByContact((HANDLE)wParam);
}
if (hwnd != NULL) {
if (!strcmp(SRMMMOD, sicd->szModule)) {
- if (sicd->dwId == 0 && g_dat->hMenuANSIEncoding) {
+ if (sicd->dwId == 0 && g_dat.hMenuANSIEncoding) {
if (sicd->flags & MBCF_RIGHTBUTTON) {
int codePage = (int) SendMessage(hwnd, DM_GETCODEPAGE, 0, 0);
if (codePage != 1200) {
int i, iSel;
- for (i = 0; i < GetMenuItemCount(g_dat->hMenuANSIEncoding); i++) {
- CheckMenuItem (g_dat->hMenuANSIEncoding, i, MF_BYPOSITION | MF_UNCHECKED);
+ for (i = 0; i < GetMenuItemCount(g_dat.hMenuANSIEncoding); i++) {
+ CheckMenuItem (g_dat.hMenuANSIEncoding, i, MF_BYPOSITION | MF_UNCHECKED);
}
if (codePage == CP_ACP) {
- CheckMenuItem(g_dat->hMenuANSIEncoding, 0, MF_BYPOSITION | MF_CHECKED);
+ CheckMenuItem(g_dat.hMenuANSIEncoding, 0, MF_BYPOSITION | MF_CHECKED);
} else {
- CheckMenuItem(g_dat->hMenuANSIEncoding, codePage, MF_BYCOMMAND | MF_CHECKED);
+ CheckMenuItem(g_dat.hMenuANSIEncoding, codePage, MF_BYCOMMAND | MF_CHECKED);
}
- iSel = TrackPopupMenu(g_dat->hMenuANSIEncoding, TPM_RETURNCMD, sicd->clickLocation.x, sicd->clickLocation.y, 0, GetParent(hwnd), NULL);
+ iSel = TrackPopupMenu(g_dat.hMenuANSIEncoding, TPM_RETURNCMD, sicd->clickLocation.x, sicd->clickLocation.y, 0, GetParent(hwnd), NULL);
if (iSel >= 500) {
if (iSel == 500) iSel = CP_ACP;
SendMessage(hwnd, DM_SETCODEPAGE, 0, iSel);
@@ -478,9 +473,9 @@ int StatusIconPressed(WPARAM wParam, LPARAM lParam) { static int ModuleLoad(WPARAM wParam, LPARAM lParam)
{
- g_dat->smileyAddInstalled = ServiceExists(MS_SMILEYADD_SHOWSELECTION) && ServiceExists(MS_SMILEYADD_REPLACESMILEYS) != 0;
- g_dat->popupInstalled = ServiceExists(MS_POPUP_ADDPOPUPEX) != 0;
- g_dat->ieviewInstalled = ServiceExists(MS_IEVIEW_WINDOW) != 0;
+ g_dat.smileyAddInstalled = ServiceExists(MS_SMILEYADD_SHOWSELECTION) && ServiceExists(MS_SMILEYADD_REPLACESMILEYS) != 0;
+ g_dat.popupInstalled = ServiceExists(MS_POPUP_ADDPOPUPEX) != 0;
+ g_dat.ieviewInstalled = ServiceExists(MS_IEVIEW_WINDOW) != 0;
return 0;
}
@@ -503,11 +498,11 @@ static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) hMsgMenuItem = Menu_AddContactMenuItem(&mi);
Skin_ReleaseIcon(mi.hIcon);
- HookEvent_Ex(ME_SMILEYADD_OPTIONSCHANGED, SmileySettingsChanged);
- HookEvent_Ex(ME_IEVIEW_OPTIONSCHANGED, SmileySettingsChanged);
- HookEvent_Ex(ME_AV_AVATARCHANGED, AvatarChanged);
- HookEvent_Ex(ME_FONT_RELOAD, FontServiceFontsChanged);
- HookEvent_Ex(ME_MSG_ICONPRESSED, StatusIconPressed);
+ HookEvent(ME_SMILEYADD_OPTIONSCHANGED, SmileySettingsChanged);
+ HookEvent(ME_IEVIEW_OPTIONSCHANGED, SmileySettingsChanged);
+ HookEvent(ME_AV_AVATARCHANGED, AvatarChanged);
+ HookEvent(ME_FONT_RELOAD, FontServiceFontsChanged);
+ HookEvent(ME_MSG_ICONPRESSED, StatusIconPressed);
RestoreUnreadMessageAlerts();
Chat_ModulesLoaded(wParam, lParam);
@@ -518,7 +513,8 @@ static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) int OnSystemPreshutdown(WPARAM wParam, LPARAM lParam)
{
Chat_PreShutdown(wParam, lParam);
- WindowList_BroadcastAsync(g_dat->hMessageWindowList, WM_CLOSE, 0, 0);
+ WindowList_Broadcast(g_dat.hMessageWindowList, WM_CLOSE, 0, 0);
+ WindowList_Broadcast(g_dat.hParentWindowList, WM_CLOSE, 0, 0);
DeinitStatusIcons();
return 0;
}
@@ -530,8 +526,6 @@ int OnUnloadModule(void) DestroyCursor(hCurHyperlinkHand);
DestroyCursor(hCurSplitWE);
DestroyCursor(hDragCursor);
- UnhookEvents_Ex();
- DestroyServices_Ex();
DestroyHookableEvent(hHookWinEvt);
DestroyHookableEvent(hHookWinPopup);
ReleaseIcons();
@@ -562,25 +556,25 @@ int OnLoadModule(void) { OleInitialize(NULL);
InitStatusIcons();
- HookEvent_Ex(ME_OPT_INITIALISE, OptInitialise);
- HookEvent_Ex(ME_DB_EVENT_ADDED, MessageEventAdded);
- HookEvent_Ex(ME_DB_CONTACT_SETTINGCHANGED, MessageSettingChanged);
- HookEvent_Ex(ME_DB_CONTACT_DELETED, ContactDeleted);
- HookEvent_Ex(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
- HookEvent_Ex(ME_SKIN_ICONSCHANGED, IconsChanged);
- HookEvent_Ex(ME_PROTO_CONTACTISTYPING, TypingMessage);
- HookEvent_Ex(ME_SYSTEM_PRESHUTDOWN, OnSystemPreshutdown);
- HookEvent_Ex(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu);
- HookEvent_Ex(ME_SYSTEM_MODULELOAD, ModuleLoad);
- HookEvent_Ex(ME_SYSTEM_MODULEUNLOAD, ModuleLoad);
-
- CreateServiceFunction_Ex(MS_MSG_SENDMESSAGE, SendMessageCommand);
- CreateServiceFunction_Ex(MS_MSG_SENDMESSAGEW, SendMessageCommandW);
- CreateServiceFunction_Ex(MS_MSG_GETWINDOWAPI, GetWindowAPI);
- CreateServiceFunction_Ex(MS_MSG_GETWINDOWCLASS, GetWindowClass);
- CreateServiceFunction_Ex(MS_MSG_GETWINDOWDATA, GetWindowData);
- CreateServiceFunction_Ex("SRMsg/ReadMessage", ReadMessageCommand);
- CreateServiceFunction_Ex("SRMsg/TypingMessage", TypingMessageCommand);
+ HookEvent(ME_OPT_INITIALISE, OptInitialise);
+ HookEvent(ME_DB_EVENT_ADDED, MessageEventAdded);
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED, MessageSettingChanged);
+ HookEvent(ME_DB_CONTACT_DELETED, ContactDeleted);
+ HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
+ HookEvent(ME_SKIN_ICONSCHANGED, IconsChanged);
+ HookEvent(ME_PROTO_CONTACTISTYPING, TypingMessage);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, OnSystemPreshutdown);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu);
+ HookEvent(ME_SYSTEM_MODULELOAD, ModuleLoad);
+ HookEvent(ME_SYSTEM_MODULEUNLOAD, ModuleLoad);
+
+ CreateServiceFunction(MS_MSG_SENDMESSAGE, SendMessageCommand);
+ CreateServiceFunction(MS_MSG_SENDMESSAGEW, SendMessageCommandW);
+ CreateServiceFunction(MS_MSG_GETWINDOWAPI, GetWindowAPI);
+ CreateServiceFunction(MS_MSG_GETWINDOWCLASS, GetWindowClass);
+ CreateServiceFunction(MS_MSG_GETWINDOWDATA, GetWindowData);
+ CreateServiceFunction("SRMsg/ReadMessage", ReadMessageCommand);
+ CreateServiceFunction("SRMsg/TypingMessage", TypingMessageCommand);
hHookWinEvt = CreateHookableEvent(ME_MSG_WINDOWEVENT);
hHookWinPopup = CreateHookableEvent(ME_MSG_WINDOWPOPUP);
diff --git a/plugins/Scriver/src/msgwindow.cpp b/plugins/Scriver/src/msgwindow.cpp index 08d4d2e104..0edc1b0447 100644 --- a/plugins/Scriver/src/msgwindow.cpp +++ b/plugins/Scriver/src/msgwindow.cpp @@ -90,7 +90,7 @@ TCHAR* GetWindowTitle(HANDLE *hContact, const char *szProto) if (tmplt != NULL) {
isTemplate = 1;
} else {
- if (g_dat->flags & SMF_STATUSICON) {
+ if (g_dat.flags & SMF_STATUSICON) {
tmplt = _T("%name% - ");
} else {
tmplt = _T("%name% (%status%) : ");
@@ -276,32 +276,32 @@ static void SetupStatusBar(ParentWindowData *dat) static int AddOrReplaceIcon(HIMAGELIST hList, int prevIndex, HICON hIcon) {
int usageIdx = -1;
int i;
- for (i = 0; i < g_dat->tabIconListUsageSize; i++) {
- if (!g_dat->tabIconListUsage[i].used && usageIdx == -1) {
+ for (i = 0; i < g_dat.tabIconListUsageSize; i++) {
+ if (!g_dat.tabIconListUsage[i].used && usageIdx == -1) {
usageIdx = i;
}
- if (g_dat->tabIconListUsage[i].index == prevIndex) {
+ if (g_dat.tabIconListUsage[i].index == prevIndex) {
usageIdx = i;
break;
}
}
if (usageIdx == -1) {
- usageIdx = g_dat->tabIconListUsageSize;
- g_dat->tabIconListUsage = (ImageListUsageEntry*) mir_realloc(g_dat->tabIconListUsage, sizeof(ImageListUsageEntry) * (g_dat->tabIconListUsageSize + 1));
- g_dat->tabIconListUsageSize++;
+ usageIdx = g_dat.tabIconListUsageSize;
+ g_dat.tabIconListUsage = (ImageListUsageEntry*) mir_realloc(g_dat.tabIconListUsage, sizeof(ImageListUsageEntry) * (g_dat.tabIconListUsageSize + 1));
+ g_dat.tabIconListUsageSize++;
} else {
- prevIndex = g_dat->tabIconListUsage[usageIdx].index;
+ prevIndex = g_dat.tabIconListUsage[usageIdx].index;
}
- g_dat->tabIconListUsage[usageIdx].used = 1;
- g_dat->tabIconListUsage[usageIdx].index = (int) ImageList_ReplaceIcon(hList, prevIndex, hIcon);
- return g_dat->tabIconListUsage[usageIdx].index;
+ g_dat.tabIconListUsage[usageIdx].used = 1;
+ g_dat.tabIconListUsage[usageIdx].index = (int) ImageList_ReplaceIcon(hList, prevIndex, hIcon);
+ return g_dat.tabIconListUsage[usageIdx].index;
}
static void ReleaseIcon(int index) {
int i;
- for (i = 0; i < g_dat->tabIconListUsageSize; i++) {
- if (g_dat->tabIconListUsage[i].index == index) {
- g_dat->tabIconListUsage[i].used = 0;
+ for (i = 0; i < g_dat.tabIconListUsageSize; i++) {
+ if (g_dat.tabIconListUsage[i].index == index) {
+ g_dat.tabIconListUsage[i].used = 0;
}
}
}
@@ -426,38 +426,33 @@ static void ActivateChildByIndex(ParentWindowData *dat, int index) static void SetContainerWindowStyle(ParentWindowData *dat)
{
- DWORD ws;
- RECT rc;
- if (!(dat->flags2 & SMF2_SHOWSTATUSBAR)) {
- ShowWindow(dat->hwndStatus, SW_HIDE);
- } else {
- ShowWindow(dat->hwndStatus, SW_SHOW);
- }
- ws = GetWindowLongPtr(dat->hwnd, GWL_STYLE) & ~(WS_CAPTION);
- if (dat->flags2 & SMF2_SHOWTITLEBAR) {
+ ShowWindow(dat->hwndStatus, (dat->flags2 & SMF2_SHOWSTATUSBAR) ? SW_SHOW : SW_HIDE);
+
+ DWORD ws = GetWindowLongPtr(dat->hwnd, GWL_STYLE) & ~(WS_CAPTION);
+ if (dat->flags2 & SMF2_SHOWTITLEBAR)
ws |= WS_CAPTION;
- }
+
SetWindowLongPtr(dat->hwnd, GWL_STYLE, ws);
ws = GetWindowLongPtr(dat->hwnd, GWL_EXSTYLE)& ~WS_EX_LAYERED;
ws |= dat->flags2 & SMF2_USETRANSPARENCY ? WS_EX_LAYERED : 0;
SetWindowLongPtr(dat->hwnd , GWL_EXSTYLE , ws);
- if (dat->flags2 & SMF2_USETRANSPARENCY) {
- pSetLayeredWindowAttributes(dat->hwnd, RGB(255,255,255), (BYTE)(255-g_dat->inactiveAlpha), LWA_ALPHA);
- }
+ if (dat->flags2 & SMF2_USETRANSPARENCY)
+ pSetLayeredWindowAttributes(dat->hwnd, RGB(255,255,255), (BYTE)(255-g_dat.inactiveAlpha), LWA_ALPHA);
ws = GetWindowLongPtr(dat->hwndTabs, GWL_STYLE) & ~(TCS_BOTTOM | 0x2000);
- if (dat->flags2 & SMF2_TABSATBOTTOM) {
+ if (dat->flags2 & SMF2_TABSATBOTTOM)
ws |= TCS_BOTTOM;
- }
- ws |= 0x2000; //TCS_OWNERDRAWFIXED
- if (dat->flags2 & SMF2_TABCLOSEBUTTON) {
-// ws |= 0x2000; //TCS_OWNERDRAWFIXED
+
+ ws |= 0x2000;
+ if (dat->flags2 & SMF2_TABCLOSEBUTTON)
TabCtrl_SetPadding(dat->hwndTabs, GetSystemMetrics(SM_CXEDGE) + 12, GetSystemMetrics(SM_CYEDGE) + 1);
- } else {
+ else
TabCtrl_SetPadding(dat->hwndTabs, GetSystemMetrics(SM_CXEDGE) + 4, GetSystemMetrics(SM_CYEDGE) + 1);
- }
+
SetWindowLongPtr(dat->hwndTabs, GWL_STYLE, ws);
+
+ RECT rc;
GetWindowRect(dat->hwnd, &rc);
SetWindowPos(dat->hwnd, 0, 0, 0, rc.right - rc.left, rc.bottom - rc.top,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOSENDCHANGING);
@@ -486,7 +481,7 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR dat->windowWasCascaded = 0;
dat->bMinimized = 0;
dat->bVMaximized = 0;
- dat->flags2 = g_dat->flags2;
+ dat->flags2 = g_dat.flags2;
dat->hwndStatus = CreateWindowEx(0, STATUSCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP, 0, 0, 0, 0, hwndDlg, NULL, g_hInst, NULL);
dat->isChat = newData->isChat;
SendMessage(dat->hwndStatus, SB_SETMINHEIGHT, GetSystemMetrics(SM_CYSMICON), 0);
@@ -494,84 +489,80 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR dat->hwndTabs = GetDlgItem(hwndDlg, IDC_TABS);
dat->hwndActive = NULL;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) dat);
- if (g_dat->hTabIconList != NULL) {
- TabCtrl_SetImageList(dat->hwndTabs, g_dat->hTabIconList);
+ if (g_dat.hTabIconList != NULL) {
+ TabCtrl_SetImageList(dat->hwndTabs, g_dat.hTabIconList);
}
dat->next = NULL;
if (!newData->isChat) {
- dat->prev = g_dat->lastParent;
- g_dat->lastParent = dat;
+ dat->prev = g_dat.lastParent;
+ g_dat.lastParent = dat;
} else {
- dat->prev = g_dat->lastChatParent;
- g_dat->lastChatParent = dat;
+ dat->prev = g_dat.lastChatParent;
+ g_dat.lastChatParent = dat;
}
if (dat->prev != NULL) {
dat->prev->next = dat;
}
- WindowList_Add(g_dat->hParentWindowList, hwndDlg, hwndDlg);
+ WindowList_Add(g_dat.hParentWindowList, hwndDlg, hwndDlg);
SubclassTabCtrl(dat->hwndTabs);
SetContainerWindowStyle(dat);
-// hSContact = !(dat->flags2 & SMF2_USETABS) && savePerContact ? dat->hContact : NULL;
hSContact = savePerContact ? dat->hContact : NULL;
dat->bTopmost = DBGetContactSettingByte(hSContact, SRMMMOD, SRMSGSET_TOPMOST, SRMSGDEFSET_TOPMOST);
- if (ScriverRestoreWindowPosition(hwndDlg, hSContact, SRMMMOD, (newData->isChat && !savePerContact) ? "chat" : "", 0, SW_HIDE)) {
+ if (ScriverRestoreWindowPosition(hwndDlg, hSContact, SRMMMOD, (newData->isChat && !savePerContact) ? "chat" : "", 0, SW_HIDE))
SetWindowPos(hwndDlg, 0, 0, 0, 450, 300, SWP_NOZORDER | SWP_NOMOVE | SWP_HIDEWINDOW);
- }
-// if (!(dat->flags2 & SMF2_USETABS)) {
- if (!savePerContact && DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_CASCADE, SRMSGDEFSET_CASCADE))
- WindowList_Broadcast(g_dat->hParentWindowList, DM_CASCADENEWWINDOW, (WPARAM) hwndDlg, (LPARAM) &dat->windowWasCascaded);
- // }
+
+ if (!savePerContact && DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_CASCADE, SRMSGDEFSET_CASCADE))
+ WindowList_Broadcast(g_dat.hParentWindowList, DM_CASCADENEWWINDOW, (WPARAM) hwndDlg, (LPARAM) &dat->windowWasCascaded);
+
hMenu = GetSystemMenu( hwndDlg, FALSE );
InsertMenu( hMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, NULL );
if (dat->bTopmost) {
InsertMenu( hMenu, 0, MF_BYPOSITION | MF_ENABLED | MF_CHECKED | MF_STRING, IDM_TOPMOST, TranslateT("Always On Top"));
- SetWindowPos(hwndDlg, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
- } else {
- InsertMenu( hMenu, 0, MF_BYPOSITION | MF_ENABLED | MF_UNCHECKED | MF_STRING, IDM_TOPMOST, TranslateT("Always On Top"));
+ SetWindowPos(hwndDlg, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
}
+ else InsertMenu( hMenu, 0, MF_BYPOSITION | MF_ENABLED | MF_UNCHECKED | MF_STRING, IDM_TOPMOST, TranslateT("Always On Top"));
}
return TRUE;
+
case WM_GETMINMAXINFO:
- {
- MINMAXINFO *mmi = (MINMAXINFO *) lParam;
- SIZE size;
- if (dat->bVMaximized) {
- MONITORINFO mi;
- HMONITOR hMonitor;
- WINDOWPLACEMENT wp;
- RECT rcDesktop;
- wp.length = sizeof(wp);
- GetWindowPlacement(hwndDlg, &wp);
- hMonitor = MonitorFromRect(&wp.rcNormalPosition, MONITOR_DEFAULTTONEAREST);
- mi.cbSize = sizeof(mi);
- GetMonitorInfo(hMonitor, &mi);
- rcDesktop = mi.rcWork;
- mmi->ptMaxSize.x = wp.rcNormalPosition.right - wp.rcNormalPosition.left;
- mmi->ptMaxSize.y = rcDesktop.bottom - rcDesktop.top;
- mmi->ptMaxPosition.x = wp.rcNormalPosition.left;
- if (IsIconic(hwndDlg)) {
- mmi->ptMaxPosition.y = rcDesktop.top;
- } else {
- mmi->ptMaxPosition.y = 0;
+ {
+ MINMAXINFO *mmi = (MINMAXINFO *) lParam;
+ SIZE size;
+ if (dat->bVMaximized) {
+ MONITORINFO mi;
+ HMONITOR hMonitor;
+ WINDOWPLACEMENT wp;
+ RECT rcDesktop;
+ wp.length = sizeof(wp);
+ GetWindowPlacement(hwndDlg, &wp);
+ hMonitor = MonitorFromRect(&wp.rcNormalPosition, MONITOR_DEFAULTTONEAREST);
+ mi.cbSize = sizeof(mi);
+ GetMonitorInfo(hMonitor, &mi);
+ rcDesktop = mi.rcWork;
+ mmi->ptMaxSize.x = wp.rcNormalPosition.right - wp.rcNormalPosition.left;
+ mmi->ptMaxSize.y = rcDesktop.bottom - rcDesktop.top;
+ mmi->ptMaxPosition.x = wp.rcNormalPosition.left;
+ if (IsIconic(hwndDlg)) {
+ mmi->ptMaxPosition.y = rcDesktop.top;
+ } else {
+ mmi->ptMaxPosition.y = 0;
+ }
}
+ GetMinimunWindowSize(dat, &size);
+ mmi->ptMinTrackSize.x = size.cx;
+ mmi->ptMinTrackSize.y = size.cy;
+ return FALSE;
}
- GetMinimunWindowSize(dat, &size);
- mmi->ptMinTrackSize.x = size.cx;
- mmi->ptMinTrackSize.y = size.cy;
- return FALSE;
- }
case WM_SIZE:
- if (wParam == SIZE_MINIMIZED) {
+ if (wParam == SIZE_MINIMIZED)
dat->bMinimized = 1;
- }
- if (IsIconic(hwndDlg)) {
+
+ if ( IsIconic(hwndDlg))
MoveWindow(dat->hwndActive, dat->childRect.left, dat->childRect.top, dat->childRect.right-dat->childRect.left, dat->childRect.bottom - dat->childRect.top, TRUE);
- } else {
-// }
-// if (!IsIconic(hwndDlg)) {
+ else {
RECT rc, rcStatus, rcChild, rcWindow;
SIZE size;
dat->bMinimized = 0;
@@ -586,12 +577,10 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR RedrawWindow(dat->hwndTabs, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_ERASE);
GetMinimunWindowSize(dat, &size);
if ((rcWindow.bottom-rcWindow.top) < size.cy || (rcWindow.right-rcWindow.left) < size.cx) {
- if ((rcWindow.bottom-rcWindow.top) < size.cy) {
+ if ((rcWindow.bottom-rcWindow.top) < size.cy)
rcWindow.bottom = rcWindow.top + size.cy;
- }
- if ((rcWindow.right-rcWindow.left) < size.cx) {
+ if ((rcWindow.right-rcWindow.left) < size.cx)
rcWindow.right = rcWindow.left + size.cx;
- }
MoveWindow(hwndDlg, rcWindow.left, rcWindow.top, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, TRUE);
}
GetChildWindowRect(dat, &rcChild);
@@ -604,20 +593,22 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }
}
return FALSE;
+
case WM_SETFOCUS:
- if (dat->hwndActive != NULL) {
+ if (dat->hwndActive != NULL)
SetFocus(dat->hwndActive);
- }
return TRUE;
+
case WM_CLOSE:
- if (g_dat->flags2 & SMF2_HIDECONTAINERS && dat->childrenCount > 0) {
+ if (g_dat.flags2 & SMF2_HIDECONTAINERS && dat->childrenCount > 0)
ShowWindow(hwndDlg, SW_HIDE);
- } else {
+ else
DestroyWindow(hwndDlg);
- }
return TRUE;
+
case WM_MEASUREITEM:
return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
+
case WM_DRAWITEM:
{
LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT) lParam;
@@ -627,22 +618,22 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR DrawStatusIcons(mwtd->hContact, dis->hDC, dis->rcItem, 2);
}
return TRUE;
- } else if (dis->hwndItem == dat->hwndTabs) {
+ }
+ if (dis->hwndItem == dat->hwndTabs) {
DrawTab(dat, dat->hwndTabs, wParam, lParam);
return TRUE;
}
return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
}
+
case WM_COMMAND:
- if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM) dat->hContact)) {
+ if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM) dat->hContact))
break;
- }
- switch (LOWORD(wParam)) {
- case IDCANCEL:
- //DestroyWindow(hwndDlg);
+
+ if ( LOWORD(wParam) == IDCANCEL)
return TRUE;
- }
break;
+
case WM_NOTIFY:
{
NMHDR* pNMHDR = (NMHDR*) lParam;
@@ -703,7 +694,7 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } else if (pNMHDR->hwndFrom == dat->hwndStatus) {
switch (pNMHDR->code) {
case NM_CLICK:
-// case NM_RCLICK:
+ // case NM_RCLICK:
{
NMMOUSE *nm=(NMMOUSE*)lParam;
RECT rc;
@@ -714,63 +705,65 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR CheckStatusIconClick(mwtd->hContact, dat->hwndStatus, nm->pt, rc, 2, (pNMHDR->code == NM_RCLICK ? MBCF_RIGHTBUTTON : 0));
}
}
- return TRUE;
+ return TRUE;
}
}
}
}
break;
+
case WM_DROPFILES:
SendMessage(dat->hwndActive, WM_DROPFILES, wParam, lParam);
break;
+
case WM_TIMER:
if (wParam == TIMERID_FLASHWND) {
if (dat->nFlash < 2 * dat->nFlashMax) {
FlashWindow(hwndDlg, TRUE);
dat->nFlash++;
- } else {// || ((GetActiveWindow() == hwndDlg) && (GetForegroundWindow() == hwndDlg))) {
+ }
+ else {
KillTimer(hwndDlg, TIMERID_FLASHWND);
FlashWindow(hwndDlg, FALSE);
}
}
break;
+
case WM_CONTEXTMENU:
if (dat->hwndStatus && dat->hwndStatus == (HWND) wParam) {
RECT rc;
POINT pt, pt2;
GetCursorPos(&pt);
- pt2.x = pt.x;
- pt2.y = pt.y;
+ pt2 = pt;
ScreenToClient(dat->hwndStatus, &pt);
SendMessage(dat->hwndStatus, SB_GETRECT, SendMessage(dat->hwndStatus, SB_GETPARTS, 0, 0) - 2, (LPARAM)&rc);
if (pt.x >= rc.left) {
MessageWindowTabData *mwtd = GetChildFromHWND(dat, dat->hwndActive);
- if (mwtd != NULL) {
+ if (mwtd != NULL)
CheckStatusIconClick(mwtd->hContact, dat->hwndStatus, pt, rc, 2, MBCF_RIGHTBUTTON);
- }
break;
- } else
- SendMessage(dat->hwndActive, WM_CONTEXTMENU, (WPARAM)hwndDlg, 0);
+ }
+ else SendMessage(dat->hwndActive, WM_CONTEXTMENU, (WPARAM)hwndDlg, 0);
}
break;
- case WM_ACTIVATE:
+ case WM_ACTIVATE:
if (LOWORD(wParam) == WA_INACTIVE) {
ws = GetWindowLongPtr(hwndDlg, GWL_EXSTYLE) & ~WS_EX_LAYERED;
ws |= dat->flags2 & SMF2_USETRANSPARENCY ? WS_EX_LAYERED : 0;
SetWindowLongPtr(hwndDlg , GWL_EXSTYLE , ws);
if (dat->flags2 & SMF2_USETRANSPARENCY) {
- pSetLayeredWindowAttributes(hwndDlg, RGB(255,255,255), (BYTE)(255-g_dat->inactiveAlpha), LWA_ALPHA);
-// RedrawWindow(hwndDlg, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN);
+ pSetLayeredWindowAttributes(hwndDlg, RGB(255,255,255), (BYTE)(255-g_dat.inactiveAlpha), LWA_ALPHA);
+ // RedrawWindow(hwndDlg, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN);
}
- break;
+ break;
}
if (dat->hwndActive != NULL) {
ActivateChild(dat, dat->hwndActive);
- g_dat->hFocusWnd = dat->hwndActive;
+ g_dat.hFocusWnd = dat->hwndActive;
PostMessage(dat->hwndActive, DM_SETFOCUS, 0, msg);
- }
+ }
if (KillTimer(hwndDlg, TIMERID_FLASHWND)) {
FlashWindow(hwndDlg, FALSE);
dat->nFlash = 0;
@@ -778,24 +771,20 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR ws = GetWindowLongPtr(hwndDlg, GWL_EXSTYLE) & ~WS_EX_LAYERED;
ws |= dat->flags2 & SMF2_USETRANSPARENCY ? WS_EX_LAYERED : 0;
SetWindowLongPtr(hwndDlg , GWL_EXSTYLE , ws);
- if (dat->flags2 & SMF2_USETRANSPARENCY) {
- pSetLayeredWindowAttributes(hwndDlg, RGB(255,255,255), (BYTE)(255-g_dat->activeAlpha), LWA_ALPHA);
-// RedrawWindow(hwndDlg, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN);
- }
+ if (dat->flags2 & SMF2_USETRANSPARENCY)
+ pSetLayeredWindowAttributes(hwndDlg, RGB(255,255,255), (BYTE)(255-g_dat.activeAlpha), LWA_ALPHA);
break;
+
case WM_LBUTTONDOWN:
if (!IsZoomed(hwndDlg)) {
POINT pt;
GetCursorPos(&pt);
- // dat->mouseLBDown = 1;
- // GetCursorPos(&dat->mouseLBDownPos);
return SendMessage(hwndDlg, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y));
- // SetCapture(hwndDlg);
-
}
break;
+
case WM_MOVING:
- if ((GetAsyncKeyState(VK_CONTROL) & 0x8000)) {
+ if ((GetAsyncKeyState(VK_CONTROL) & 0x8000)) {
int snapPixels = 10;
RECT rcDesktop;
RECT *pRect = (RECT *)lParam;
@@ -806,7 +795,7 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR mi.cbSize = sizeof(mi);
GetMonitorInfo(hMonitor, &mi);
GetCursorPos(&pt);
-// SystemParametersInfo(SPI_GETWORKAREA, 0, &rcDesktop, 0);
+ // SystemParametersInfo(SPI_GETWORKAREA, 0, &rcDesktop, 0);
rcDesktop = mi.rcWork;
pRect->left = pt.x-dat->mouseLBDownPos.x;
pRect->top = pt.y-dat->mouseLBDownPos.y;
@@ -844,27 +833,22 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR dat->mouseLBDownPos.x = LOWORD(lParam) - rc.left;
dat->mouseLBDownPos.y = HIWORD(lParam) - rc.top;
} else if (wParam == IDM_TOPMOST) {
- HMENU hMenu = GetSystemMenu(hwndDlg, FALSE);
- if (dat->bTopmost) {
- CheckMenuItem(hMenu, IDM_TOPMOST, MF_BYCOMMAND | MF_UNCHECKED);
- SetWindowPos(hwndDlg, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
- dat->bTopmost = FALSE;
- } else {
- CheckMenuItem(hMenu, IDM_TOPMOST, MF_BYCOMMAND | MF_CHECKED);
- SetWindowPos(hwndDlg, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
- dat->bTopmost = TRUE;
- }
- }
+ HMENU hMenu = GetSystemMenu(hwndDlg, FALSE);
+ if (dat->bTopmost) {
+ CheckMenuItem(hMenu, IDM_TOPMOST, MF_BYCOMMAND | MF_UNCHECKED);
+ SetWindowPos(hwndDlg, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+ dat->bTopmost = FALSE;
+ } else {
+ CheckMenuItem(hMenu, IDM_TOPMOST, MF_BYCOMMAND | MF_CHECKED);
+ SetWindowPos(hwndDlg, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+ dat->bTopmost = TRUE;
+ }
+ }
break;
case WM_DESTROY:
{
- WINDOWPLACEMENT wp = { 0 };
- HANDLE hContact;
- int i;
char szSettingName[64];
- char *szNamePrefix;
- int savePerContact = DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT);
- for (i=dat->childrenCount;--i>=0;) {
+ for (int i=dat->childrenCount; --i >= 0;) {
TCITEM tci;
tci.mask = TCIF_PARAM | TCIF_IMAGE;
TabCtrl_GetItem(dat->hwndTabs, i, &tci);
@@ -873,15 +857,15 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR ReleaseIcon(tci.iImage);
}
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
- WindowList_Remove(g_dat->hParentWindowList, hwndDlg);
- if (savePerContact)
-// if (!(dat->flags2 & SMF2_USETABS) && DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT))
- hContact = dat->hContact;
- else
- hContact = NULL;
- wp.length = sizeof(wp);
+ WindowList_Remove(g_dat.hParentWindowList, hwndDlg);
+
+ int savePerContact = DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT);
+ HANDLE hContact = (savePerContact) ? dat->hContact : NULL;
+
+ WINDOWPLACEMENT wp = { sizeof(wp) };
GetWindowPlacement(hwndDlg, &wp);
- szNamePrefix = (!savePerContact && dat->isChat) ? "chat" : "";
+
+ char *szNamePrefix = (!savePerContact && dat->isChat) ? "chat" : "";
if (!dat->windowWasCascaded) {
wsprintfA(szSettingName,"%sx",szNamePrefix);
DBWriteContactSettingDword(hContact, SRMMMOD, szSettingName, wp.rcNormalPosition.left);
@@ -893,122 +877,117 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR wsprintfA(szSettingName,"%sheight",szNamePrefix);
DBWriteContactSettingDword(hContact, SRMMMOD, szSettingName, wp.rcNormalPosition.bottom - wp.rcNormalPosition.top);
DBWriteContactSettingByte(hContact, SRMMMOD, SRMSGSET_TOPMOST, (BYTE)dat->bTopmost);
- if (g_dat->lastParent == dat) {
- g_dat->lastParent = dat->prev;
- }
- if (g_dat->lastChatParent == dat) {
- g_dat->lastChatParent = dat->prev;
- }
- if (dat->prev != NULL) {
+ if (g_dat.lastParent == dat)
+ g_dat.lastParent = dat->prev;
+
+ if (g_dat.lastChatParent == dat)
+ g_dat.lastChatParent = dat->prev;
+
+ if (dat->prev != NULL)
dat->prev->next = dat->next;
- }
- if (dat->next != NULL) {
+
+ if (dat->next != NULL)
dat->next->prev = dat->prev;
- }
+
UnsubclassTabCtrl(dat->hwndTabs);
mir_free(dat);
}
break;
+
case DM_ERRORDECIDED:
break;
+
case CM_STARTFLASHING:
- if ((GetActiveWindow() != hwndDlg || GetForegroundWindow() != hwndDlg)) {// && !(g_dat->flags2 & SMF2_STAYMINIMIZED)) {
+ if ((GetActiveWindow() != hwndDlg || GetForegroundWindow() != hwndDlg)) {// && !(g_dat.flags2 & SMF2_STAYMINIMIZED)) {
dat->nFlash = 0;
SetTimer(hwndDlg, TIMERID_FLASHWND, TIMEOUT_FLASHWND, NULL);
}
break;
+
case CM_POPUPWINDOW:
EnableWindow(hwndDlg, TRUE);
if (wParam) { /* incoming message */
- if (g_dat->flags & SMF_STAYMINIMIZED) {
- if (!IsWindowVisible(hwndDlg)) {
+ if (g_dat.flags & SMF_STAYMINIMIZED) {
+ if (!IsWindowVisible(hwndDlg))
ShowWindow(hwndDlg, SW_SHOWMINNOACTIVE);
- }
- if (dat->childrenCount == 1 ||
- ((g_dat->flags2 & SMF2_SWITCHTOACTIVE) && (IsIconic(hwndDlg) || GetForegroundWindow() != hwndDlg))) {
+
+ if (dat->childrenCount == 1 || ((g_dat.flags2 & SMF2_SWITCHTOACTIVE) && (IsIconic(hwndDlg) || GetForegroundWindow() != hwndDlg)))
SendMessage(hwndDlg, CM_ACTIVATECHILD, 0, (LPARAM) lParam);
- }
- } else {
- if (IsIconic(hwndDlg)) {
- ShowWindow(hwndDlg, SW_SHOWNORMAL);
- } else {
- ShowWindow(hwndDlg, SW_SHOWNA);
- }
- if (dat->childrenCount == 1 ||
- ((g_dat->flags2 & SMF2_SWITCHTOACTIVE) && (IsIconic(hwndDlg) || GetForegroundWindow() != hwndDlg))) {
+ }
+ else {
+ ShowWindow(hwndDlg, IsIconic(hwndDlg) ? SW_SHOWNORMAL : SW_SHOWNA);
+
+ if (dat->childrenCount == 1 || ((g_dat.flags2 & SMF2_SWITCHTOACTIVE) && (IsIconic(hwndDlg) || GetForegroundWindow() != hwndDlg)))
SendMessage(hwndDlg, CM_ACTIVATECHILD, 0, (LPARAM)lParam);
- }
+
SetWindowPos(hwndDlg, HWND_TOP, 0,0,0,0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
- //SetForegroundWindow(hwndDlg);
- }
- } else { /* outgoing message */
- if (IsIconic(hwndDlg)) {
- ShowWindow(hwndDlg, SW_SHOWNORMAL);
- } else {
- ShowWindow(hwndDlg, SW_SHOW);
}
+ }
+ else { /* outgoing message */
+ ShowWindow(hwndDlg, IsIconic(hwndDlg) ? SW_SHOWNORMAL : SW_SHOW);
SetForegroundWindow(hwndDlg);
- SetFocus((HWND) lParam);
+ SetFocus((HWND)lParam);
}
break;
+
case CM_REMOVECHILD:
- {
- RemoveChild(dat, (HWND) lParam);
- if (dat->childrenCount != 0) {
- SetFocus(dat->hwndActive);
- } else {
- PostMessage(hwndDlg, WM_CLOSE, 0, 0);
- }
- }
+ RemoveChild(dat, (HWND) lParam);
+ if (dat->childrenCount != 0)
+ SetFocus(dat->hwndActive);
+ else
+ PostMessage(hwndDlg, WM_CLOSE, 0, 0);
return TRUE;
+
case CM_ADDCHILD:
- {
- AddChild(dat, (HWND)wParam, (HANDLE)lParam);
- }
+ AddChild(dat, (HWND)wParam, (HANDLE)lParam);
return TRUE;
+
case CM_ACTIVATECHILD:
-// if ((HWND) lParam != dat->hwndActive) {
- ActivateChild(dat, (HWND) lParam);
-// }
+ ActivateChild(dat, (HWND) lParam);
return TRUE;
+
case CM_ACTIVATEPREV:
ActivatePrevChild(dat, (HWND) lParam);
SetFocus(dat->hwndActive);
return TRUE;
+
case CM_ACTIVATENEXT:
ActivateNextChild(dat, (HWND) lParam);
SetFocus(dat->hwndActive);
return TRUE;
+
case CM_ACTIVATEBYINDEX:
ActivateChildByIndex(dat, (int) lParam);
SetFocus(dat->hwndActive);
return TRUE;
+
case CM_GETCHILDCOUNT:
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LONG_PTR)GetChildCount(dat));
return TRUE;
+
case CM_GETACTIVECHILD:
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LONG_PTR)dat->hwndActive);
return TRUE;
+
case CM_GETTOOLBARSTATUS:
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LONG_PTR)(dat->flags2 & SMF2_SHOWTOOLBAR) != 0);
return TRUE;
+
case DM_SENDMESSAGE:
{
- int i;
- for (i=0;i<dat->childrenCount;i++) {
+ for (int i=0; i < dat->childrenCount; i++) {
MessageWindowTabData * mwtd = GetChildFromTab(dat->hwndTabs, i);
SendMessage(mwtd->hwnd, DM_SENDMESSAGE, wParam, lParam);
}
}
break;
+
case DM_OPTIONSAPPLIED:
- {
- dat->flags2 = g_dat->flags2;
- SetContainerWindowStyle(dat);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- //RedrawWindow(hwndDlg, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN);
- break;
- }
+ dat->flags2 = g_dat.flags2;
+ SetContainerWindowStyle(dat);
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ break;
+
case CM_UPDATETITLEBAR:
{
HWND hwnd = (HWND) lParam;
@@ -1024,9 +1003,9 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }
if (tbd->iFlags & TBDF_ICON) {
SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) tbd->hIcon);
- if (tbd->hIconBig != NULL) {
- SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) tbd->hIconBig);
- }
+ if (tbd->hIconBig != NULL) {
+ SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) tbd->hIconBig);
+ }
if (pTaskbarInterface)
pTaskbarInterface->SetOverlayIcon(hwndDlg, tbd->hIconNot, L"");
}
@@ -1046,13 +1025,15 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }
RedrawWindow(dat->hwndStatus, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW);
}
- break;
}
+ break;
+
case DM_STATUSICONCHANGE:
SendMessage(dat->hwndStatus, SB_SETTEXT, (WPARAM)(SBT_OWNERDRAW) | 2, 0);
SetupStatusBar(dat);
RedrawWindow(dat->hwndStatus, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW);
break;
+
case CM_UPDATETABCONTROL:
{
TCHAR *ptszTemp = NULL;
@@ -1064,81 +1045,76 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (tcd->iFlags & TCDF_TEXT) {
tci.mask |= TCIF_TEXT;
tci.pszText = tcd->pszText;
- if (g_dat->flags2 & SMF2_LIMITNAMES) {
- TCHAR * ltext = limitText(tcd->pszText, g_dat->limitNamesLength);
+ if (g_dat.flags2 & SMF2_LIMITNAMES) {
+ TCHAR * ltext = limitText(tcd->pszText, g_dat.limitNamesLength);
if (ltext != tcd->pszText)
- {
tci.pszText = ptszTemp = ltext;
- }
}
}
if (tcd->iFlags & TCDF_ICON) {
- int iconIdx = -1;
- if (tcd->hIcon != NULL) {
- TCITEM tci2;
- tci2.mask = TCIF_IMAGE;
- TabCtrl_GetItem(dat->hwndTabs, tabId, &tci2);
- iconIdx = AddOrReplaceIcon(g_dat->hTabIconList, tci2.iImage, tcd->hIcon);
- }
+ int iconIdx = -1;
+ if (tcd->hIcon != NULL) {
+ TCITEM tci2;
+ tci2.mask = TCIF_IMAGE;
+ TabCtrl_GetItem(dat->hwndTabs, tabId, &tci2);
+ iconIdx = AddOrReplaceIcon(g_dat.hTabIconList, tci2.iImage, tcd->hIcon);
+ }
tci.mask |= TCIF_IMAGE;
tci.iImage = iconIdx;
}
TabCtrl_SetItem(dat->hwndTabs, tabId, &tci);
}
mir_free(ptszTemp);
- break;
}
+ break;
+
case DM_SWITCHINFOBAR:
+ dat->flags2 ^= SMF2_SHOWINFOBAR;
{
- int i;
- dat->flags2 ^= SMF2_SHOWINFOBAR;
- for (i=0;i<dat->childrenCount;i++) {
+ for (int i=0; i < dat->childrenCount; i++) {
MessageWindowTabData * mwtd = GetChildFromTab(dat->hwndTabs, i);
SendMessage(mwtd->hwnd, DM_SWITCHINFOBAR, 0, 0);
}
SendMessage(hwndDlg, WM_SIZE, 0, 0);
}
break;
+
case DM_SWITCHSTATUSBAR:
dat->flags2 ^= SMF2_SHOWSTATUSBAR;
- if (!(dat->flags2 & SMF2_SHOWSTATUSBAR)) {
- ShowWindow(dat->hwndStatus, SW_HIDE);
- } else {
- ShowWindow(dat->hwndStatus, SW_SHOW);
- }
+ ShowWindow(dat->hwndStatus, (dat->flags2 & SMF2_SHOWSTATUSBAR) ? SW_SHOW : SW_HIDE);
SendMessage(hwndDlg, WM_SIZE, 0, 0);
break;
+
case DM_SWITCHTOOLBAR:
+ dat->flags2 ^= SMF2_SHOWTOOLBAR;
{
- int i;
- dat->flags2 ^= SMF2_SHOWTOOLBAR;
- for (i=0;i<dat->childrenCount;i++) {
+ for (int i=0; i < dat->childrenCount; i++) {
MessageWindowTabData * mwtd = GetChildFromTab(dat->hwndTabs, i);
SendMessage(mwtd->hwnd, DM_SWITCHTOOLBAR, 0, 0);
}
SendMessage(hwndDlg, WM_SIZE, 0, 0);
}
break;
+
case DM_SWITCHTITLEBAR:
{
RECT rc;
dat->flags2 ^= SMF2_SHOWTITLEBAR;
ws = GetWindowLongPtr(hwndDlg, GWL_STYLE) & ~(WS_CAPTION);
- if (dat->flags2 & SMF2_SHOWTITLEBAR) {
+ if (dat->flags2 & SMF2_SHOWTITLEBAR)
ws |= WS_CAPTION;
- }
+
SetWindowLongPtr(hwndDlg, GWL_STYLE, ws);
GetWindowRect(hwndDlg, &rc);
SetWindowPos(hwndDlg, 0, 0, 0, rc.right - rc.left, rc.bottom - rc.top,
- SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOSENDCHANGING);
-// SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOSENDCHANGING);
+ // SendMessage(hwndDlg, WM_SIZE, 0, 0);
RedrawWindow(hwndDlg, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
}
break;
+
case DM_CASCADENEWWINDOW:
- if ((HWND) wParam == hwndDlg)
- break;
- {
+ if ((HWND)wParam != hwndDlg) {
RECT rcThis, rcNew;
GetWindowRect(hwndDlg, &rcThis);
GetWindowRect((HWND) wParam, &rcNew);
@@ -1149,10 +1125,6 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }
}
break;
- //case DM_MESSAGESENDING:
- // dat->messagesInProgress += wParam ? -1 : 1;
- // if (dat->messagesInProgress < 0) dat->messagesInProgress = 0;
- // break;
}
return FALSE;
}
@@ -1207,14 +1179,14 @@ static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM wParam, LPARAM lPar rIcon.top = rect.top + GetSystemMetrics(SM_CYEDGE);
if (tci.iImage >= 0) {
rIcon.left = rect.left + GetSystemMetrics(SM_CXEDGE) + (bSelected ? 6 : 2);
- ImageList_GetImageInfo(g_dat->hTabIconList, tci.iImage, &info);
- ImageList_DrawEx(g_dat->hTabIconList, tci.iImage, lpDIS->hDC, rIcon.left, rIcon.top, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
+ ImageList_GetImageInfo(g_dat.hTabIconList, tci.iImage, &info);
+ ImageList_DrawEx(g_dat.hTabIconList, tci.iImage, lpDIS->hDC, rIcon.left, rIcon.top, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
rect.left = rIcon.left + (info.rcImage.right - info.rcImage.left);
}
if (dat->flags2 & SMF2_TABCLOSEBUTTON) {
- ImageList_GetImageInfo(g_dat->hButtonIconList, 0, &info);
+ ImageList_GetImageInfo(g_dat.hButtonIconList, 0, &info);
rIcon.left = rect.right - GetSystemMetrics(SM_CXEDGE) - (bSelected ? 6 : 2) - (info.rcImage.right - info.rcImage.left);
- ImageList_DrawEx(g_dat->hButtonIconList, 0, lpDIS->hDC, rIcon.left, rIcon.top, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
+ ImageList_DrawEx(g_dat.hButtonIconList, 0, lpDIS->hDC, rIcon.left, rIcon.top, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
rect.right = rIcon.left - 1;
}
rect.top += GetSystemMetrics(SM_CYEDGE) + 2;
@@ -1222,16 +1194,16 @@ static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM wParam, LPARAM lPar dwFormat = DT_SINGLELINE|DT_BOTTOM|DT_CENTER|DT_NOPREFIX|DT_NOCLIP;
rIcon.left = rect.left + GetSystemMetrics(SM_CXEDGE) + (bSelected ? 6 : 2);
if (tci.iImage >= 0) {
- ImageList_GetImageInfo(g_dat->hTabIconList, tci.iImage, &info);
+ ImageList_GetImageInfo(g_dat.hTabIconList, tci.iImage, &info);
rIcon.top = rect.bottom - (info.rcImage.bottom - info.rcImage.top) - 1;
- ImageList_DrawEx(g_dat->hTabIconList, tci.iImage, lpDIS->hDC, rIcon.left, rIcon.top, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
+ ImageList_DrawEx(g_dat.hTabIconList, tci.iImage, lpDIS->hDC, rIcon.left, rIcon.top, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
rect.left = rIcon.left + (info.rcImage.right - info.rcImage.left);
}
if (dat->flags2 & SMF2_TABCLOSEBUTTON) {
- ImageList_GetImageInfo(g_dat->hButtonIconList, 0, &info);
+ ImageList_GetImageInfo(g_dat.hButtonIconList, 0, &info);
rIcon.top = rect.bottom - (info.rcImage.bottom - info.rcImage.top) - 2;
rIcon.left = rect.right - GetSystemMetrics(SM_CXEDGE) - (bSelected ? 6 : 2) - (info.rcImage.right - info.rcImage.left);
- ImageList_DrawEx(g_dat->hButtonIconList, 0, lpDIS->hDC, rIcon.left, rIcon.top, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
+ ImageList_DrawEx(g_dat.hButtonIconList, 0, lpDIS->hDC, rIcon.left, rIcon.top, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
rect.right = rIcon.left - 1;
}
rect.bottom -= GetSystemMetrics(SM_CYEDGE) + 2;
@@ -1398,7 +1370,7 @@ LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) while (GetParent(hParent) != NULL) {
hParent = GetParent(hParent);
}
- hParent = WindowList_Find(g_dat->hParentWindowList, hParent);
+ hParent = WindowList_Find(g_dat.hParentWindowList, hParent);
if ((hParent != NULL && hParent != GetParent(hwnd)) || (hParent == NULL && mwtd->parent->childrenCount > 1 && (GetKeyState(VK_CONTROL) & 0x8000))) {
if (hParent == NULL) {
MONITORINFO mi;
@@ -1442,7 +1414,7 @@ LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) dat->destTab = -1;
RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
}
- } else if (dat->srcTab >= 0 && g_dat->flags2 & SMF2_TABCLOSEBUTTON) {
+ } else if (dat->srcTab >= 0 && g_dat.flags2 & SMF2_TABCLOSEBUTTON) {
IMAGEINFO info;
POINT pt;
RECT rect;
@@ -1450,7 +1422,7 @@ LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) TabCtrl_GetItemRect(hwnd, dat->srcTab, &rect);
pt.x = LOWORD(lParam);
pt.y = HIWORD(lParam);
- ImageList_GetImageInfo(g_dat->hButtonIconList, 0, &info);
+ ImageList_GetImageInfo(g_dat.hButtonIconList, 0, &info);
rect.left = rect.right - (info.rcImage.right - info.rcImage.left) - 6;
if (!atTop) {
rect.top = rect.bottom - (info.rcImage.bottom - info.rcImage.top);
@@ -1465,10 +1437,10 @@ LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) hBmp = CreateCompatibleBitmap(hdc, info.rcImage.right - info.rcImage.left + 1, info.rcImage.bottom - info.rcImage.top + 1);
hOldBitmap = (HBITMAP)SelectObject(hdcMem, hBmp);
SetPixel(hdcMem, pt.x, pt.y, 0x000000);
- ImageList_DrawEx(g_dat->hButtonIconList, 0, hdcMem, 0, 0, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
+ ImageList_DrawEx(g_dat.hButtonIconList, 0, hdcMem, 0, 0, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
color1 = GetPixel(hdcMem, pt.x, pt.y);
SetPixel(hdcMem, pt.x, pt.y, 0xFFFFFF);
- ImageList_DrawEx(g_dat->hButtonIconList, 0, hdcMem, 0, 0, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
+ ImageList_DrawEx(g_dat.hButtonIconList, 0, hdcMem, 0, 0, 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL);
color2 = GetPixel(hdcMem, pt.x, pt.y);
SelectObject(hdcMem, hOldBitmap);
DeleteDC(hdcMem);
@@ -1609,24 +1581,24 @@ HWND GetParentWindow(HANDLE hContact, BOOL bChat) { NewMessageWindowLParam newData = { 0 };
newData.hContact = hContact;
newData.isChat = bChat;
- if (g_dat->flags2 & SMF2_USETABS) {
- if (!bChat || !(g_dat->flags2 & SMF2_SEPARATECHATSCONTAINERS)) {
- if (g_dat->lastParent != NULL) {
- int tabsNum = (int) SendMessage(g_dat->lastParent->hwnd, CM_GETCHILDCOUNT, 0, 0);
- if (!(g_dat->flags2 & SMF2_LIMITTABS) || tabsNum < g_dat->limitTabsNum) {
- return g_dat->lastParent->hwnd;
+ if (g_dat.flags2 & SMF2_USETABS) {
+ if (!bChat || !(g_dat.flags2 & SMF2_SEPARATECHATSCONTAINERS)) {
+ if (g_dat.lastParent != NULL) {
+ int tabsNum = (int) SendMessage(g_dat.lastParent->hwnd, CM_GETCHILDCOUNT, 0, 0);
+ if (!(g_dat.flags2 & SMF2_LIMITTABS) || tabsNum < g_dat.limitTabsNum) {
+ return g_dat.lastParent->hwnd;
}
}
} else {
- if (g_dat->lastChatParent != NULL) {
- int tabsNum = (int) SendMessage(g_dat->lastChatParent->hwnd, CM_GETCHILDCOUNT, 0, 0);
- if (!(g_dat->flags2 & SMF2_LIMITCHATSTABS) || tabsNum < g_dat->limitChatsTabsNum) {
- return g_dat->lastChatParent->hwnd;
+ if (g_dat.lastChatParent != NULL) {
+ int tabsNum = (int) SendMessage(g_dat.lastChatParent->hwnd, CM_GETCHILDCOUNT, 0, 0);
+ if (!(g_dat.flags2 & SMF2_LIMITCHATSTABS) || tabsNum < g_dat.limitChatsTabsNum) {
+ return g_dat.lastChatParent->hwnd;
}
}
}
}
- if (!(g_dat->flags2 & SMF2_SEPARATECHATSCONTAINERS)) {
+ if (!(g_dat.flags2 & SMF2_SEPARATECHATSCONTAINERS)) {
newData.isChat =FALSE;
}
return CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSGWIN), NULL, DlgProcParentWindow, (LPARAM) & newData);
diff --git a/plugins/Scriver/src/richutil.cpp b/plugins/Scriver/src/richutil.cpp index 4a50df057b..cc7eb2b467 100644 --- a/plugins/Scriver/src/richutil.cpp +++ b/plugins/Scriver/src/richutil.cpp @@ -69,10 +69,11 @@ void RichUtil_Load(void) sListInt.increment = 10;
sListInt.sortFunc = RichUtil_CmpVal;
- mTheme = IsWinVerXPPlus() ? GetModuleHandleA("uxtheme") : 0;
-
InitializeCriticalSection(&csRich);
- if (!mTheme) return;
+
+ mTheme = IsWinVerXPPlus() ? GetModuleHandleA("uxtheme") : 0;
+ if (!mTheme)
+ return;
MyOpenThemeData = (HANDLE (WINAPI *)(HWND, LPCWSTR))GetProcAddress(mTheme, "OpenThemeData");
MyCloseThemeData = (HRESULT (WINAPI *)(HANDLE))GetProcAddress(mTheme, "CloseThemeData");
@@ -84,25 +85,16 @@ void RichUtil_Load(void) MyIsThemeBackgroundPartiallyTransparent = (BOOL (WINAPI *)(HANDLE, int, int))GetProcAddress(mTheme, "IsThemeBackgroundPartiallyTransparent");
MyDrawThemeText = (HRESULT (WINAPI *)(HANDLE, HDC, int, int, LPCWSTR, int, DWORD, DWORD, const RECT *))GetProcAddress(mTheme, "DrawThemeText");
MyEnableThemeDialogTexture = (HRESULT (WINAPI *)(HWND, DWORD))GetProcAddress(mTheme, "EnableThemeDialogTexture");
- if (!MyOpenThemeData ||
- !MyCloseThemeData ||
- !MyIsThemeActive ||
- !MyDrawThemeBackground ||
- !MyGetThemeBackgroundContentRect ||
- !MyDrawThemeParentBackground ||
- !MyIsThemeBackgroundPartiallyTransparent)
- {
- FreeLibrary(mTheme);
+ if (!MyOpenThemeData || !MyCloseThemeData || !MyIsThemeActive || !MyDrawThemeBackground ||
+ !MyGetThemeBackgroundContentRect || !MyDrawThemeParentBackground || !MyIsThemeBackgroundPartiallyTransparent)
mTheme = NULL;
- }
}
void RichUtil_Unload(void)
{
List_Destroy(&sListInt);
DeleteCriticalSection(&csRich);
- if (mTheme)
- FreeLibrary(mTheme);
+ mTheme = NULL;
}
int RichUtil_SubClass(HWND hwndEdit)
diff --git a/plugins/Scriver/src/statusicon.cpp b/plugins/Scriver/src/statusicon.cpp index 554f847ef8..3c828b4a43 100644 --- a/plugins/Scriver/src/statusicon.cpp +++ b/plugins/Scriver/src/statusicon.cpp @@ -49,7 +49,7 @@ static INT_PTR AddStatusIcon(WPARAM wParam, LPARAM lParam) { status_icon_list = siln;
status_icon_list_size++;
- WindowList_Broadcast(g_dat->hParentWindowList, DM_STATUSICONCHANGE, 0, 0);
+ WindowList_Broadcast(g_dat.hParentWindowList, DM_STATUSICONCHANGE, 0, 0);
return 0;
}
@@ -79,7 +79,7 @@ INT_PTR AddStickyStatusIcon(WPARAM wParam, LPARAM lParam) { status_icon_list_size++;
- WindowList_Broadcast(g_dat->hParentWindowList, DM_STATUSICONCHANGE, 0, 0);
+ WindowList_Broadcast(g_dat.hParentWindowList, DM_STATUSICONCHANGE, 0, 0);
return 0;
}
@@ -99,7 +99,7 @@ static INT_PTR RemoveStatusIcon(WPARAM wParam, LPARAM lParam) { ReleaseIconSmart(current->sid.hIconDisabled);
mir_free(current->sid.szTooltip);
mir_free(current);
- WindowList_Broadcast(g_dat->hParentWindowList, DM_STATUSICONCHANGE, 0, 0);
+ WindowList_Broadcast(g_dat.hParentWindowList, DM_STATUSICONCHANGE, 0, 0);
return 0;
}
@@ -125,7 +125,7 @@ static void RemoveAllStatusIcons(void) { mir_free(current);
}
- WindowList_Broadcast(g_dat->hParentWindowList, DM_STATUSICONCHANGE, 0, 0);
+ WindowList_Broadcast(g_dat.hParentWindowList, DM_STATUSICONCHANGE, 0, 0);
}
INT_PTR ModifyStatusIcon(WPARAM wParam, LPARAM lParam) {
@@ -151,13 +151,13 @@ INT_PTR ModifyStatusIcon(WPARAM wParam, LPARAM lParam) { current->sid.szTooltip = mir_strdup(sid->szTooltip);
}
- WindowList_Broadcast(g_dat->hParentWindowList, DM_STATUSICONCHANGE, 0, 0);
+ WindowList_Broadcast(g_dat.hParentWindowList, DM_STATUSICONCHANGE, 0, 0);
} else {
char buff[256];
HWND hwnd;
sprintf(buff, "SRMMStatusIconFlags%d", (int)sid->dwId);
DBWriteContactSettingByte(hContact, sid->szModule, buff, (BYTE)sid->flags);
- hwnd = WindowList_Find(g_dat->hMessageWindowList, hContact);
+ hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact);
if (hwnd == NULL) {
hwnd = SM_FindWindowByContact(hContact);
}
diff --git a/plugins/Scriver/src/utils.cpp b/plugins/Scriver/src/utils.cpp index 8822bf47f5..d72947f720 100644 --- a/plugins/Scriver/src/utils.cpp +++ b/plugins/Scriver/src/utils.cpp @@ -27,50 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define TTI_NONE 0
#endif
-static unsigned hookNum = 0;
-static unsigned serviceNum = 0;
-static HANDLE* hHooks = NULL;
-static HANDLE* hServices = NULL;
-
-HANDLE HookEvent_Ex(const char *name, MIRANDAHOOK hook) {
- hookNum ++;
- hHooks = (HANDLE *) mir_realloc(hHooks, sizeof(HANDLE) * (hookNum));
- hHooks[hookNum - 1] = HookEvent(name, hook);
- return hHooks[hookNum - 1] ;
-}
-
-HANDLE CreateServiceFunction_Ex(const char *name, MIRANDASERVICE service) {
- serviceNum++;
- hServices = (HANDLE *) mir_realloc(hServices, sizeof(HANDLE) * (serviceNum));
- hServices[serviceNum - 1] = CreateServiceFunction(name, service);
- return hServices[serviceNum - 1] ;
-}
-
-void UnhookEvents_Ex() {
- unsigned i;
- for (i=0; i<hookNum ; ++i) {
- if (hHooks[i] != NULL) {
- UnhookEvent(hHooks[i]);
- }
- }
- mir_free(hHooks);
- hookNum = 0;
- hHooks = NULL;
-}
-
-void DestroyServices_Ex() {
- unsigned i;
- for (i=0; i<serviceNum; ++i) {
- if (hServices[i] != NULL) {
- DestroyServiceFunction(hServices[i]);
- }
- }
- mir_free(hServices);
- serviceNum = 0;
- hServices = NULL;
-}
-
-
int safe_wcslen(wchar_t *msg, int maxLen) {
int i;
for (i = 0; i < maxLen; i++) {
@@ -292,7 +248,7 @@ void rtrimText(TCHAR *text) TCHAR *limitText(TCHAR *text, int limit)
{
int len = lstrlen(text);
- if (len > g_dat->limitNamesLength)
+ if (len > g_dat.limitNamesLength)
{
TCHAR *ptszTemp = (TCHAR *)mir_alloc(sizeof(TCHAR) * (limit + 4));
_tcsncpy(ptszTemp, text, limit + 1);
@@ -390,7 +346,7 @@ void AppendToBuffer(char **buffer, int *cbBufferEnd, int *cbBufferAlloced, const int MeasureMenuItem(WPARAM wParam, LPARAM lParam)
{
LPMEASUREITEMSTRUCT mis = (LPMEASUREITEMSTRUCT) lParam;
- if (mis->itemData != (ULONG_PTR) g_dat->hButtonIconList && mis->itemData != (ULONG_PTR) g_dat->hSearchEngineIconList && mis->itemData != (ULONG_PTR) g_dat->hChatButtonIconList) {
+ if (mis->itemData != (ULONG_PTR) g_dat.hButtonIconList && mis->itemData != (ULONG_PTR) g_dat.hSearchEngineIconList && mis->itemData != (ULONG_PTR) g_dat.hChatButtonIconList) {
return FALSE;
}
mis->itemWidth = max(0, GetSystemMetrics(SM_CXSMICON) - GetSystemMetrics(SM_CXMENUCHECK) + 4);
@@ -403,7 +359,7 @@ int DrawMenuItem(WPARAM wParam, LPARAM lParam) int y;
int id;
LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT) lParam;
- if (dis->itemData != (ULONG_PTR) g_dat->hButtonIconList && dis->itemData != (ULONG_PTR) g_dat->hSearchEngineIconList && dis->itemData != (ULONG_PTR) g_dat->hChatButtonIconList) {
+ if (dis->itemData != (ULONG_PTR) g_dat.hButtonIconList && dis->itemData != (ULONG_PTR) g_dat.hSearchEngineIconList && dis->itemData != (ULONG_PTR) g_dat.hChatButtonIconList) {
return FALSE;
}
id = dis->itemID;
@@ -624,7 +580,7 @@ int GetToolbarWidth(int cControls, const ToolbarButton * buttons) {
int w = 0;
for (int i = 0; i < cControls; i++)
- if (buttons[i].controlId != IDC_SMILEYS || g_dat->smileyAddInstalled)
+ if (buttons[i].controlId != IDC_SMILEYS || g_dat.smileyAddInstalled)
w += buttons[i].width + buttons[i].spacing;
return w;
diff --git a/plugins/Scriver/src/utils.h b/plugins/Scriver/src/utils.h index 5a51e87099..3387b0559b 100644 --- a/plugins/Scriver/src/utils.h +++ b/plugins/Scriver/src/utils.h @@ -34,10 +34,6 @@ enum SEARCHENGINES { SEARCHENGINE_FOODNETWORK = 8
};
-HANDLE HookEvent_Ex(const char *name, MIRANDAHOOK hook);
-HANDLE CreateServiceFunction_Ex(const char *name, MIRANDASERVICE service);
-extern void UnhookEvents_Ex();
-extern void DestroyServices_Ex();
extern int IsUnicodeMIM();
extern int safe_wcslen(wchar_t *msg, int maxLen) ;
extern TCHAR *a2t(const char *text);
|