diff options
author | George Hazan <george.hazan@gmail.com> | 2013-03-13 18:46:27 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-03-13 18:46:27 +0000 |
commit | 535e64d18c2aef81455f3bcbf80681c66b475830 (patch) | |
tree | 68396f1ecc5615e70ad9c76cf63d2b6490bed10e /src/core | |
parent | 1c7f56b0db5cb2eb3460e5d33212b291a6d5824c (diff) |
- fix for a crash on dynamic unload;
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@4005 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/stdmsg/src/cmdlist.cpp | 2 | ||||
-rw-r--r-- | src/core/stdmsg/src/globals.cpp | 99 | ||||
-rw-r--r-- | src/core/stdmsg/src/globals.h | 3 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgdialog.cpp | 64 | ||||
-rw-r--r-- | src/core/stdmsg/src/msglog.cpp | 14 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgoptions.cpp | 35 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgs.cpp | 39 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgs.h | 1 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgtimedout.cpp | 4 | ||||
-rw-r--r-- | src/core/stdmsg/src/srmm.cpp | 2 | ||||
-rw-r--r-- | src/core/stdmsg/src/statusicon.cpp | 10 |
11 files changed, 124 insertions, 149 deletions
diff --git a/src/core/stdmsg/src/cmdlist.cpp b/src/core/stdmsg/src/cmdlist.cpp index f394a30e57..77dc44f3ee 100644 --- a/src/core/stdmsg/src/cmdlist.cpp +++ b/src/core/stdmsg/src/cmdlist.cpp @@ -74,7 +74,7 @@ static VOID CALLBACK MsgTimer(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTi for (i = 0; i < msgQueue.realCount; ++i)
{
TMsgQueue *item = (TMsgQueue*)msgQueue.items[i];
- if (dwTime - item->ts > g_dat->msgTimeout)
+ if (dwTime - item->ts > g_dat.msgTimeout)
{
if (!ntl)
tmlst = (TMsgQueue**)alloca((msgQueue.realCount - i) * sizeof(TMsgQueue*));
diff --git a/src/core/stdmsg/src/globals.cpp b/src/core/stdmsg/src/globals.cpp index 6d32aedc08..ee2b0550dc 100644 --- a/src/core/stdmsg/src/globals.cpp +++ b/src/core/stdmsg/src/globals.cpp @@ -21,8 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h"
-struct GlobalMessageData *g_dat;
-static HANDLE g_hooks[4];
+GlobalMessageData g_dat;
static int dbaddedevent(WPARAM wParam, LPARAM lParam);
static int ackevent(WPARAM wParam, LPARAM lParam);
@@ -48,89 +47,86 @@ static int IconsChanged(WPARAM wParam, LPARAM lParam) return 0;
}
-void InitGlobals()
+static int OnShutdown(WPARAM, LPARAM)
{
- g_dat = (struct GlobalMessageData *)mir_alloc(sizeof(struct GlobalMessageData));
- g_dat->hMessageWindowList = (HANDLE) CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
- g_hooks[0] = HookEvent(ME_DB_EVENT_ADDED, dbaddedevent);
- g_hooks[1] = HookEvent(ME_PROTO_ACK, ackevent);
- g_hooks[2] = HookEvent(ME_SKIN2_ICONSCHANGED, IconsChanged);
- g_hooks[3] = HookEvent(ME_AV_AVATARCHANGED, AvatarChanged);
-
- ReloadGlobals();
- InitIcons();
+ WindowList_Broadcast(g_dat.hMessageWindowList, WM_CLOSE, 0, 0);
+ return 0;
}
-void FreeGlobals()
+void InitGlobals()
{
- int i;
- mir_free(g_dat);
+ g_dat.hMessageWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
+
+ HookEvent(ME_DB_EVENT_ADDED, dbaddedevent);
+ HookEvent(ME_PROTO_ACK, ackevent);
+ HookEvent(ME_SKIN2_ICONSCHANGED, IconsChanged);
+ HookEvent(ME_AV_AVATARCHANGED, AvatarChanged);
+ HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown);
- for (i=0; i < SIZEOF(g_hooks); ++i)
- if (g_hooks[i])
- UnhookEvent(g_hooks[i]);
+ ReloadGlobals();
+ InitIcons();
}
void ReloadGlobals()
{
- g_dat->flags = 0;
+ g_dat.flags = 0;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWINFOLINE, SRMSGDEFSET_SHOWINFOLINE))
- g_dat->flags |= SMF_SHOWINFO;
+ g_dat.flags |= SMF_SHOWINFO;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWBUTTONLINE, SRMSGDEFSET_SHOWBUTTONLINE))
- g_dat->flags |= SMF_SHOWBTNS;
+ g_dat.flags |= SMF_SHOWBTNS;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SENDBUTTON, SRMSGDEFSET_SENDBUTTON))
- g_dat->flags |= SMF_SENDBTN;
+ g_dat.flags |= SMF_SENDBTN;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPING, SRMSGDEFSET_SHOWTYPING))
- g_dat->flags |= SMF_SHOWTYPING;
+ g_dat.flags |= SMF_SHOWTYPING;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGWIN, SRMSGDEFSET_SHOWTYPINGWIN))
- g_dat->flags |= SMF_SHOWTYPINGWIN;
+ g_dat.flags |= SMF_SHOWTYPINGWIN;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGNOWIN, SRMSGDEFSET_SHOWTYPINGNOWIN))
- g_dat->flags |= SMF_SHOWTYPINGTRAY;
+ g_dat.flags |= SMF_SHOWTYPINGTRAY;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST))
- g_dat->flags |= SMF_SHOWTYPINGCLIST;
+ g_dat.flags |= SMF_SHOWTYPINGCLIST;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWLOGICONS, SRMSGDEFSET_SHOWLOGICONS))
- g_dat->flags |= SMF_SHOWICONS;
+ g_dat.flags |= SMF_SHOWICONS;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTIME, SRMSGDEFSET_SHOWTIME))
- g_dat->flags |= SMF_SHOWTIME;
+ g_dat.flags |= SMF_SHOWTIME;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_AVATARENABLE, SRMSGDEFSET_AVATARENABLE))
- g_dat->flags |= SMF_AVATAR;
+ g_dat.flags |= SMF_AVATAR;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWDATE, SRMSGDEFSET_SHOWDATE))
- g_dat->flags |= SMF_SHOWDATE;
+ g_dat.flags |= SMF_SHOWDATE;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWSECS, SRMSGDEFSET_SHOWSECS))
- g_dat->flags |= SMF_SHOWSECS;
+ g_dat.flags |= SMF_SHOWSECS;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_HIDENAMES, SRMSGDEFSET_HIDENAMES))
- g_dat->flags |= SMF_HIDENAMES;
+ g_dat.flags |= SMF_HIDENAMES;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_CHARCOUNT, SRMSGDEFSET_CHARCOUNT))
- g_dat->flags |= SMF_SHOWREADCHAR;
+ g_dat.flags |= SMF_SHOWREADCHAR;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SENDONENTER, SRMSGDEFSET_SENDONENTER))
- g_dat->flags |= SMF_SENDONENTER;
+ g_dat.flags |= SMF_SENDONENTER;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SENDONDBLENTER, SRMSGDEFSET_SENDONDBLENTER))
- g_dat->flags |= SMF_SENDONDBLENTER;
+ g_dat.flags |= SMF_SENDONDBLENTER;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_AUTOCLOSE, SRMSGDEFSET_AUTOCLOSE))
- g_dat->flags |= SMF_AUTOCLOSE;
+ g_dat.flags |= SMF_AUTOCLOSE;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_AUTOMIN, SRMSGDEFSET_AUTOMIN))
- g_dat->flags |= SMF_AUTOMIN;
+ g_dat.flags |= SMF_AUTOMIN;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN))
- g_dat->flags |= SMF_TYPINGUNKNOWN;
+ g_dat.flags |= SMF_TYPINGUNKNOWN;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_CTRLSUPPORT, SRMSGDEFSET_CTRLSUPPORT))
- g_dat->flags |= SMF_CTRLSUPPORT;
+ g_dat.flags |= SMF_CTRLSUPPORT;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWFORMAT, SRMSGDEFSET_SHOWFORMAT))
- g_dat->flags |= SMF_SHOWFORMAT;
+ g_dat.flags |= SMF_SHOWFORMAT;
- g_dat->openFlags = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS);
- g_dat->nFlashMax = db_get_b(NULL, SRMMMOD, SRMSGSET_FLASHCOUNT, SRMSGDEFSET_FLASHCOUNT);
+ g_dat.openFlags = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS);
+ g_dat.nFlashMax = db_get_b(NULL, SRMMMOD, SRMSGSET_FLASHCOUNT, SRMSGDEFSET_FLASHCOUNT);
- g_dat->msgTimeout = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, SRMSGDEFSET_MSGTIMEOUT);
- if (g_dat->msgTimeout < SRMSGSET_MSGTIMEOUT_MIN) g_dat->msgTimeout = SRMSGDEFSET_MSGTIMEOUT;
+ g_dat.msgTimeout = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, SRMSGDEFSET_MSGTIMEOUT);
+ if (g_dat.msgTimeout < SRMSGSET_MSGTIMEOUT_MIN) g_dat.msgTimeout = SRMSGDEFSET_MSGTIMEOUT;
}
static int dbaddedevent(WPARAM wParam, LPARAM lParam)
{
HANDLE hContact = (HANDLE)wParam;
- if (hContact)
- {
- HWND h = WindowList_Find(g_dat->hMessageWindowList, hContact);
- if (h) SendMessage(h, HM_DBEVENTADDED, (WPARAM)hContact, lParam);
+ if (hContact) {
+ HWND h = WindowList_Find(g_dat.hMessageWindowList, hContact);
+ if (h)
+ SendMessage(h, HM_DBEVENTADDED, (WPARAM)hContact, lParam);
}
return 0;
}
@@ -138,10 +134,7 @@ static int dbaddedevent(WPARAM wParam, LPARAM lParam) static int ackevent(WPARAM wParam, LPARAM lParam)
{
ACKDATA *pAck = (ACKDATA *)lParam;
-
- if (!pAck) return 0;
- if (pAck->type == ACKTYPE_MESSAGE)
- {
+ if (pAck && pAck->type == ACKTYPE_MESSAGE) {
msgQueue_processack(pAck->hContact, pAck->hProcess, pAck->result == ACKRESULT_SUCCESS, (char*)pAck->lParam);
if (pAck->result == ACKRESULT_SUCCESS)
@@ -153,7 +146,7 @@ static int ackevent(WPARAM wParam, LPARAM lParam) int AvatarChanged(WPARAM wParam, LPARAM lParam)
{
HANDLE hContact = (HANDLE)wParam;
- HWND h = WindowList_Find(g_dat->hMessageWindowList, hContact);
+ HWND h = WindowList_Find(g_dat.hMessageWindowList, hContact);
if (h) SendMessage(h, HM_AVATARACK, wParam, lParam);
return 0;
}
diff --git a/src/core/stdmsg/src/globals.h b/src/core/stdmsg/src/globals.h index 03574f1ed3..064db8eb6d 100644 --- a/src/core/stdmsg/src/globals.h +++ b/src/core/stdmsg/src/globals.h @@ -56,9 +56,8 @@ struct GlobalMessageData };
void InitGlobals();
-void FreeGlobals();
void ReloadGlobals();
-extern struct GlobalMessageData *g_dat;
+extern GlobalMessageData g_dat;
#endif
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index f0d40a305b..9293591a58 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -182,7 +182,7 @@ static void ShowMultipleControls(HWND hwndDlg, const UINT * controls, int cContr static void UpdateReadChars(HWND hwndDlg, HWND hwndStatus)
{
- if (hwndStatus && (g_dat->flags & SMF_SHOWREADCHAR)) {
+ if (hwndStatus && (g_dat.flags & SMF_SHOWREADCHAR)) {
TCHAR buf[32];
int len = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE));
@@ -198,7 +198,7 @@ static void ShowTime(struct SrmmWindowData *dat) GetSystemTime(&st);
if (dat->wMinute != st.wMinute) {
TCHAR buf[32];
- unsigned i = (g_dat->flags & SMF_SHOWREADCHAR) ? 2 : 1;
+ unsigned i = (g_dat.flags & SMF_SHOWREADCHAR) ? 2 : 1;
tmi.printDateTime(dat->hTimeZone, _T("t"), buf, SIZEOF(buf), 0);
SendMessage(dat->hwndStatus, SB_SETTEXT, i, (LPARAM) buf);
@@ -217,11 +217,11 @@ static void SetupStatusBar(HWND hwndDlg, struct SrmmWindowData *dat) cx = rc.right - rc.left;
if (dat->hTimeZone) {
- if (g_dat->flags & SMF_SHOWREADCHAR)
+ if (g_dat.flags & SMF_SHOWREADCHAR)
statwidths[i++] = cx - SB_TIME_WIDTH - SB_CHAR_WIDTH - icons_width;
statwidths[i++] = cx - SB_TIME_WIDTH - icons_width;
}
- else if (g_dat->flags & SMF_SHOWREADCHAR)
+ else if (g_dat.flags & SMF_SHOWREADCHAR)
statwidths[i++] = cx - SB_CHAR_WIDTH - icons_width;
statwidths[i++] = cx - icons_width;
@@ -239,12 +239,12 @@ static void SetDialogToType(HWND hwndDlg) dat = (struct SrmmWindowData *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (dat->hContact)
- ShowMultipleControls(hwndDlg, infoLineControls, SIZEOF(infoLineControls), (g_dat->flags&SMF_SHOWINFO) ? SW_SHOW : SW_HIDE);
+ ShowMultipleControls(hwndDlg, infoLineControls, SIZEOF(infoLineControls), (g_dat.flags&SMF_SHOWINFO) ? SW_SHOW : SW_HIDE);
else
ShowMultipleControls(hwndDlg, infoLineControls, SIZEOF(infoLineControls), SW_HIDE);
if (dat->hContact) {
- ShowMultipleControls(hwndDlg, buttonLineControls, SIZEOF(buttonLineControls), (g_dat->flags&SMF_SHOWBTNS) ? SW_SHOW : SW_HIDE);
+ ShowMultipleControls(hwndDlg, buttonLineControls, SIZEOF(buttonLineControls), (g_dat.flags&SMF_SHOWBTNS) ? SW_SHOW : SW_HIDE);
if ( !db_get_b(dat->hContact, "CList", "NotOnList", 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE);
}
@@ -259,9 +259,9 @@ static void SetDialogToType(HWND hwndDlg) ShowWindow(GetDlgItem(hwndDlg, IDCANCEL), SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_SPLITTER), SW_SHOW);
- ShowWindow(GetDlgItem(hwndDlg, IDOK), (g_dat->flags & SMF_SENDBTN) ? SW_SHOW : SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDOK), (g_dat.flags & SMF_SENDBTN) ? SW_SHOW : SW_HIDE);
EnableWindow(GetDlgItem(hwndDlg, IDOK), GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE)) != 0);
- if (dat->avatarPic == NULL || !(g_dat->flags & SMF_AVATAR))
+ if (dat->avatarPic == NULL || !(g_dat.flags & SMF_AVATAR))
ShowWindow(GetDlgItem(hwndDlg, IDC_AVATAR), SW_HIDE);
SendMessage(hwndDlg, DM_UPDATETITLE, 0, 0);
SendMessage(hwndDlg, WM_SIZE, 0, 0);
@@ -316,11 +316,11 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar case WM_KEYDOWN:
if (wParam == VK_RETURN) {
if ( !(GetKeyState(VK_SHIFT) & 0x8000) &&
- ((GetKeyState(VK_CONTROL) & 0x8000) != 0) != ((g_dat->flags & SMF_SENDONENTER) != 0)) {
+ ((GetKeyState(VK_CONTROL) & 0x8000) != 0) != ((g_dat.flags & SMF_SENDONENTER) != 0)) {
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 {
@@ -340,7 +340,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar }
if (wParam == VK_UP && (GetKeyState(VK_CONTROL) & 0x8000) &&
- ((g_dat->flags & (SMF_AUTOCLOSE | SMF_CTRLSUPPORT)) == SMF_CTRLSUPPORT)) {
+ ((g_dat.flags & (SMF_AUTOCLOSE | SMF_CTRLSUPPORT)) == SMF_CTRLSUPPORT)) {
if (pdat->cmdList->realCount) {
if (pdat->cmdListInd < 0) {
pdat->cmdListInd = pdat->cmdList->realCount - 1;
@@ -356,7 +356,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar }
if (wParam == VK_DOWN && (GetKeyState(VK_CONTROL) & 0x8000) &&
- ((g_dat->flags & (SMF_AUTOCLOSE | SMF_CTRLSUPPORT)) == SMF_CTRLSUPPORT)) {
+ ((g_dat.flags & (SMF_AUTOCLOSE | SMF_CTRLSUPPORT)) == SMF_CTRLSUPPORT)) {
if (pdat->cmdList->realCount && pdat->cmdListInd >= 0) {
if (pdat->cmdListInd < (pdat->cmdList->realCount - 1))
SetEditorText(hwnd, tcmdlist_getitem(pdat->cmdList, ++pdat->cmdListInd));
@@ -546,7 +546,7 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * {
struct SrmmWindowData *dat = (struct SrmmWindowData *) lParam;
- if ( !(g_dat->flags & SMF_SHOWINFO) && !(g_dat->flags & SMF_SHOWBTNS)) {
+ if ( !(g_dat.flags & SMF_SHOWINFO) && !(g_dat.flags & SMF_SHOWBTNS)) {
for (int i = 0; i < SIZEOF(buttonLineControls); i++)
if (buttonLineControls[i] == urc->wId)
OffsetRect(&urc->rcItem, 0, -dat->lineHeight);
@@ -567,7 +567,7 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * SIZE textSize;
GetTextExtentPoint32(hdc, buf, lstrlen(buf), &textSize);
urc->rcItem.right = urc->rcItem.left + textSize.cx + 10;
- if ((g_dat->flags&SMF_SHOWBTNS) && urc->rcItem.right > urc->dlgNewSize.cx - dat->nLabelRight)
+ if ((g_dat.flags&SMF_SHOWBTNS) && urc->rcItem.right > urc->dlgNewSize.cx - dat->nLabelRight)
urc->rcItem.right = urc->dlgNewSize.cx - dat->nLabelRight;
SelectObject(hdc, hFont);
ReleaseDC(h, hdc);
@@ -583,7 +583,7 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * return RD_ANCHORX_RIGHT | RD_ANCHORY_TOP;
case IDC_LOG:
- if ( !(g_dat->flags&SMF_SHOWINFO) && !(g_dat->flags&SMF_SHOWBTNS))
+ if ( !(g_dat.flags&SMF_SHOWINFO) && !(g_dat.flags&SMF_SHOWBTNS))
urc->rcItem.top -= dat->lineHeight;
urc->rcItem.bottom -= dat->splitterPos - dat->originalSplitterPos;
return RD_ANCHORX_WIDTH | RD_ANCHORY_HEIGHT;
@@ -594,13 +594,13 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * return RD_ANCHORX_WIDTH | RD_ANCHORY_BOTTOM;
case IDC_MESSAGE:
- if ( !(g_dat->flags & SMF_SENDBTN))
+ if ( !(g_dat.flags & SMF_SENDBTN))
urc->rcItem.right = urc->dlgNewSize.cx - urc->rcItem.left;
- if ((g_dat->flags & SMF_AVATAR) && dat->avatarPic)
+ if ((g_dat.flags & SMF_AVATAR) && dat->avatarPic)
urc->rcItem.left = dat->avatarWidth+4;
urc->rcItem.top -= dat->splitterPos - dat->originalSplitterPos;
- if ( !(g_dat->flags & SMF_SENDBTN))
+ if ( !(g_dat.flags & SMF_SENDBTN))
return RD_ANCHORX_CUSTOM | RD_ANCHORY_BOTTOM;
return RD_ANCHORX_WIDTH | RD_ANCHORY_BOTTOM;
@@ -619,7 +619,7 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * void ShowAvatar(HWND hwndDlg, struct SrmmWindowData *dat)
{
- if (g_dat->flags & SMF_AVATAR) {
+ if (g_dat.flags & SMF_AVATAR) {
AVATARCACHEENTRY *ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)dat->hContact, 0);
if (ace && (INT_PTR)ace != CALLSERVICE_NOTFOUND && (ace->dwFlags & AVS_BITMAP_VALID) && !(ace->dwFlags & AVS_HIDEONCLIST))
dat->avatarPic = ace->hbmPic;
@@ -664,7 +664,7 @@ static void NotifyTyping(struct SrmmWindowData *dat, int mode) if (protoCaps & PF1_INVISLIST && protoStatus == ID_STATUS_INVISIBLE && DBGetContactSettingWord(dat->hContact, dat->szProto, "ApparentMode", 0) != ID_STATUS_ONLINE)
return;
- if ( !(g_dat->flags & SMF_TYPINGUNKNOWN) && db_get_b(dat->hContact, "CList", "NotOnList", 0))
+ if ( !(g_dat.flags & SMF_TYPINGUNKNOWN) && db_get_b(dat->hContact, "CList", "NotOnList", 0))
return;
// End user check
@@ -754,7 +754,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP GetWindowRect(GetDlgItem(hwndDlg, IDC_ADD), &rc);
dat->lineHeight = rc.bottom - rc.top + 3;
}
- WindowList_Add(g_dat->hMessageWindowList, hwndDlg, dat->hContact);
+ WindowList_Add(g_dat.hMessageWindowList, hwndDlg, dat->hContact);
GetWindowRect(GetDlgItem(hwndDlg, IDC_MESSAGE), &dat->minEditInit);
SendMessage(hwndDlg, DM_UPDATESIZEBAR, 0, 0);
dat->hwndStatus = NULL;
@@ -892,7 +892,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SetWindowPos(hwndDlg, 0, 0, 0, 450, 300, SWP_NOZORDER | SWP_NOMOVE | SWP_SHOWWINDOW);
}
if ( !savePerContact && db_get_b(NULL, SRMMMOD, SRMSGSET_CASCADE, SRMSGDEFSET_CASCADE))
- WindowList_Broadcast(g_dat->hMessageWindowList, DM_CASCADENEWWINDOW, (WPARAM) hwndDlg, (LPARAM) & dat->windowWasCascaded);
+ WindowList_Broadcast(g_dat.hMessageWindowList, DM_CASCADENEWWINDOW, (WPARAM) hwndDlg, (LPARAM) & dat->windowWasCascaded);
}
if (newData->noActivate) {
SetWindowPos(hwndDlg, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_SHOWWINDOW);
@@ -959,7 +959,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP {
BITMAP bminfo;
- if (dat->avatarPic == NULL || !(g_dat->flags&SMF_AVATAR))
+ if (dat->avatarPic == NULL || !(g_dat.flags&SMF_AVATAR))
{
dat->avatarWidth=50;
dat->avatarHeight=50;
@@ -980,7 +980,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case DM_UPDATESIZEBAR:
dat->minEditBoxSize.cx = dat->minEditInit.right - dat->minEditInit.left;
dat->minEditBoxSize.cy = dat->minEditInit.bottom - dat->minEditInit.top;
- if(g_dat->flags&SMF_AVATAR) {
+ if(g_dat.flags&SMF_AVATAR) {
SendMessage(hwndDlg, DM_AVATARCALCSIZE, 0, 0);
if(dat->avatarPic && dat->minEditBoxSize.cy <= dat->avatarHeight)
dat->minEditBoxSize.cy = dat->avatarHeight;
@@ -1336,7 +1336,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP RedrawWindow(GetDlgItem(hwndDlg, IDOK), NULL, NULL, RDW_INVALIDATE);
RedrawWindow(GetDlgItem(hwndDlg, IDC_MESSAGE), NULL, NULL, RDW_INVALIDATE);
}
- if ((g_dat->flags & SMF_AVATAR) && dat->avatarPic)
+ if ((g_dat.flags & SMF_AVATAR) && dat->avatarPic)
RedrawWindow(GetDlgItem(hwndDlg, IDC_AVATAR), NULL, NULL, RDW_INVALIDATE);
if (bottomScroll)
@@ -1447,7 +1447,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case WM_TIMER:
if (wParam == TIMERID_FLASHWND) {
FlashWindow(hwndDlg, TRUE);
- if (dat->nFlash > 2 * g_dat->nFlashMax) {
+ if (dat->nFlash > 2 * g_dat.nFlashMax) {
KillTimer(hwndDlg, TIMERID_FLASHWND);
FlashWindow(hwndDlg, FALSE);
dat->nFlash = 0;
@@ -1467,7 +1467,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
else {
SendMessage(hwndDlg, DM_UPDATELASTMESSAGE, 0, 0);
- if (g_dat->flags & SMF_SHOWTYPINGWIN)
+ if (g_dat.flags & SMF_SHOWTYPINGWIN)
SendMessage(hwndDlg, DM_UPDATEWINICON, 0, 0);
dat->showTyping = 0;
}
@@ -1483,7 +1483,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SendMessage(dat->hwndStatus, SB_SETTEXT, 0, (LPARAM) szBuf);
SendMessage(dat->hwndStatus, SB_SETICON, 0, (LPARAM) hTyping);
- if ((g_dat->flags & SMF_SHOWTYPINGWIN) && GetForegroundWindow() != hwndDlg) {
+ if ((g_dat.flags & SMF_SHOWTYPINGWIN) && GetForegroundWindow() != hwndDlg) {
HICON hIcon = (HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0);
SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)hTyping );
Skin_ReleaseIcon(hIcon);
@@ -1534,7 +1534,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
}
}
- else if (dis->CtlID == IDC_AVATAR && dat->avatarPic && (g_dat->flags & SMF_AVATAR)) {
+ else if (dis->CtlID == IDC_AVATAR && dat->avatarPic && (g_dat.flags & SMF_AVATAR)) {
HPEN hPen = CreatePen(PS_SOLID, 1, RGB(0,0,0));
HPEN hOldPen = (HPEN)SelectObject(dis->hDC, hPen);
Rectangle(dis->hDC, 0, 0, dat->avatarWidth, dat->avatarHeight);
@@ -1593,9 +1593,9 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SetDlgItemText(hwndDlg, IDC_MESSAGE, _T(""));
- if (g_dat->flags & SMF_AUTOCLOSE)
+ if (g_dat.flags & SMF_AUTOCLOSE)
DestroyWindow(hwndDlg);
- else if (g_dat->flags & SMF_AUTOMIN)
+ else if (g_dat.flags & SMF_AUTOMIN)
ShowWindow(hwndDlg, SW_MINIMIZE);
}
}
@@ -1848,7 +1848,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (dat->hwndStatus)
DestroyWindow(dat->hwndStatus);
tcmdlist_free(dat->cmdList);
- WindowList_Remove(g_dat->hMessageWindowList, hwndDlg);
+ WindowList_Remove(g_dat.hMessageWindowList, hwndDlg);
DBWriteContactSettingDword(db_get_b(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT)?dat->hContact:NULL, SRMMMOD, "splitterPos", dat->splitterPos);
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_UNSUBCLASSED, 0, 0);
{
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index 96941ff722..ec601d5952 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -110,7 +110,7 @@ static int AppendToBufferWithRTF(char **buffer, int *cbBufferEnd, int *cbBufferA *d++ = '\\';
*d++ = (char) *line;
}
- else if (*line == '[' && (g_dat->flags & SMF_SHOWFORMAT))
+ else if (*line == '[' && (g_dat.flags & SMF_SHOWFORMAT))
{
int i, found = 0;
for (i = 0; i < SIZEOF(bbcodes); ++i)
@@ -317,7 +317,7 @@ static char *CreateRTFFromDbEvent(struct SrmmWindowData *dat, HANDLE hContact, H }
}
- if (g_dat->flags&SMF_SHOWICONS) {
+ if (g_dat.flags & SMF_SHOWICONS) {
int i;
switch (dbei.eventType) {
@@ -344,15 +344,15 @@ static char *CreateRTFFromDbEvent(struct SrmmWindowData *dat, HANDLE hContact, H CopyMemory(buffer + bufferEnd, pLogIconBmpBits[i], logIconBmpSize[i]);
bufferEnd += logIconBmpSize[i];
}
- if (g_dat->flags & SMF_SHOWTIME)
+ if (g_dat.flags & SMF_SHOWTIME)
{
const TCHAR* szFormat;
TCHAR str[64];
- if (g_dat->flags & SMF_SHOWSECS)
- szFormat = g_dat->flags & SMF_SHOWDATE ? _T("d s") : _T("s");
+ if (g_dat.flags & SMF_SHOWSECS)
+ szFormat = g_dat.flags & SMF_SHOWDATE ? _T("d s") : _T("s");
else
- szFormat = g_dat->flags & SMF_SHOWDATE ? _T("d t") : _T("t");
+ szFormat = g_dat.flags & SMF_SHOWDATE ? _T("d t") : _T("t");
tmi.printTimeStamp(NULL, dbei.timestamp, szFormat, str, SIZEOF(str), 0);
@@ -360,7 +360,7 @@ static char *CreateRTFFromDbEvent(struct SrmmWindowData *dat, HANDLE hContact, H AppendToBufferWithRTF(&buffer, &bufferEnd, &bufferAlloced, str);
showColon = 1;
}
- if (!(g_dat->flags&SMF_HIDENAMES) && dbei.eventType != EVENTTYPE_STATUSCHANGE && dbei.eventType != EVENTTYPE_JABBER_CHATSTATES && dbei.eventType != EVENTTYPE_JABBER_PRESENCE) {
+ if (!(g_dat.flags&SMF_HIDENAMES) && dbei.eventType != EVENTTYPE_STATUSCHANGE && dbei.eventType != EVENTTYPE_JABBER_CHATSTATES && dbei.eventType != EVENTTYPE_JABBER_PRESENCE) {
TCHAR* szName;
CONTACTINFO ci = {0};
diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp index 5d729ed3a9..0c557afda0 100644 --- a/src/core/stdmsg/src/msgoptions.cpp +++ b/src/core/stdmsg/src/msgoptions.cpp @@ -194,8 +194,8 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_POPLIST), statusValues, SIZEOF(statusValues), DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS));
CheckDlgButton(hwndDlg, IDC_DONOTSTEALFOCUS, db_get_b(NULL, SRMMMOD, SRMSGSET_DONOTSTEALFOCUS, SRMSGDEFSET_DONOTSTEALFOCUS));
SetDlgItemInt(hwndDlg, IDC_NFLASHES, db_get_b(NULL, SRMMMOD, SRMSGSET_FLASHCOUNT, SRMSGDEFSET_FLASHCOUNT), FALSE);
- CheckDlgButton(hwndDlg, IDC_SHOWBUTTONLINE, g_dat->flags&SMF_SHOWBTNS);
- CheckDlgButton(hwndDlg, IDC_SHOWINFOLINE, g_dat->flags&SMF_SHOWINFO);
+ CheckDlgButton(hwndDlg, IDC_SHOWBUTTONLINE, g_dat.flags&SMF_SHOWBTNS);
+ CheckDlgButton(hwndDlg, IDC_SHOWINFOLINE, g_dat.flags&SMF_SHOWINFO);
CheckDlgButton(hwndDlg, IDC_AUTOMIN, db_get_b(NULL, SRMMMOD, SRMSGSET_AUTOMIN, SRMSGDEFSET_AUTOMIN));
CheckDlgButton(hwndDlg, IDC_AUTOCLOSE, db_get_b(NULL, SRMMMOD, SRMSGSET_AUTOCLOSE, SRMSGDEFSET_AUTOCLOSE));
CheckDlgButton(hwndDlg, IDC_SAVEPERCONTACT, db_get_b(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT));
@@ -204,7 +204,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP CheckDlgButton(hwndDlg, IDC_SENDONDBLENTER, db_get_b(NULL, SRMMMOD, SRMSGSET_SENDONDBLENTER, SRMSGDEFSET_SENDONDBLENTER));
CheckDlgButton(hwndDlg, IDC_STATUSWIN, db_get_b(NULL, SRMMMOD, SRMSGSET_STATUSICON, SRMSGDEFSET_STATUSICON));
- CheckDlgButton(hwndDlg, IDC_AVATARSUPPORT, g_dat->flags&SMF_AVATAR);
+ CheckDlgButton(hwndDlg, IDC_AVATARSUPPORT, g_dat.flags&SMF_AVATAR);
CheckDlgButton(hwndDlg, IDC_LIMITAVATARH, db_get_b(NULL, SRMMMOD, SRMSGSET_LIMITAVHEIGHT, SRMSGDEFSET_LIMITAVHEIGHT));
avatarHeight = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_AVHEIGHT, SRMSGDEFSET_AVHEIGHT);
SetDlgItemInt(hwndDlg, IDC_AVATARHEIGHT, avatarHeight, FALSE);
@@ -212,7 +212,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (!IsDlgButtonChecked(hwndDlg, IDC_AVATARSUPPORT))
EnableWindow(GetDlgItem(hwndDlg, IDC_AVATARHEIGHT), FALSE);
else EnableWindow(GetDlgItem(hwndDlg, IDC_AVATARHEIGHT), IsDlgButtonChecked(hwndDlg, IDC_LIMITAVATARH));
- CheckDlgButton(hwndDlg, IDC_SHOWSENDBTN, g_dat->flags&SMF_SENDBTN);
+ CheckDlgButton(hwndDlg, IDC_SHOWSENDBTN, g_dat.flags&SMF_SENDBTN);
CheckDlgButton(hwndDlg, IDC_CHARCOUNT, db_get_b(NULL, SRMMMOD, SRMSGSET_CHARCOUNT, SRMSGDEFSET_CHARCOUNT));
CheckDlgButton(hwndDlg, IDC_CTRLSUPPORT, db_get_b(NULL, SRMMMOD, SRMSGSET_CTRLSUPPORT, SRMSGDEFSET_CTRLSUPPORT));
CheckDlgButton(hwndDlg, IDC_DELTEMP, db_get_b(NULL, SRMMMOD, SRMSGSET_DELTEMP, SRMSGDEFSET_DELTEMP));
@@ -314,7 +314,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, msgTimeout);
ReloadGlobals();
- WindowList_Broadcast(g_dat->hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0);
+ WindowList_Broadcast(g_dat.hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0);
return TRUE;
}
}
@@ -415,7 +415,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, FreeMsgLogIcons();
LoadMsgLogIcons();
ReloadGlobals();
- WindowList_Broadcast(g_dat->hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0);
+ WindowList_Broadcast(g_dat.hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0);
return TRUE;
}
break;
@@ -571,7 +571,7 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGNOWIN, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TYPETRAY));
DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY));
ReloadGlobals();
- WindowList_Broadcast(g_dat->hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0);
+ WindowList_Broadcast(g_dat.hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0);
}
}
break;
@@ -583,8 +583,7 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam static int OptInitialise(WPARAM wParam, LPARAM lParam)
{
- OPTIONSDIALOGPAGE odp = { 0 };
- odp.cbSize = sizeof(odp);
+ OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.position = 910000000;
odp.hInstance = g_hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSGDLG);
@@ -614,9 +613,7 @@ static int ModernOptInitialise(WPARAM wParam, LPARAM lParam) MODERNOPT_CTRL_LAST
};
- MODERNOPTOBJECT obj = {0};
-
- obj.cbSize = sizeof(obj);
+ MODERNOPTOBJECT obj = { sizeof(obj) };
obj.dwFlags = MODEROPT_FLG_TCHAR|MODEROPT_FLG_NORESIZE;
obj.hIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE);
obj.hInstance = g_hInst;
@@ -639,18 +636,8 @@ static int ModernOptInitialise(WPARAM wParam, LPARAM lParam) return 0;
}
-static HANDLE oHooks[2];
-
void InitOptions(void)
{
- oHooks[0] = HookEvent(ME_OPT_INITIALISE, OptInitialise);
- oHooks[1] = HookEvent(ME_MODERNOPT_INITIALIZE, ModernOptInitialise);
-}
-
-void UnloadOptions(void)
-{
- int i;
- for (i=0; i < SIZEOF(oHooks); ++i)
- if (oHooks[i])
- UnhookEvent(oHooks[i]);
+ HookEvent(ME_OPT_INITIALISE, OptInitialise);
+ HookEvent(ME_MODERNOPT_INITIALIZE, ModernOptInitialise);
}
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 249a60c6ca..c72f94c9f2 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -63,7 +63,7 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam) CallServiceSync(MS_CLIST_REMOVEEVENT, wParam, (LPARAM) 1);
/* does a window for the contact exist? */
- hwnd = WindowList_Find(g_dat->hMessageWindowList, (HANDLE) wParam);
+ hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE) wParam);
if (hwnd)
{
if (!db_get_b(NULL, SRMMMOD, SRMSGSET_DONOTSTEALFOCUS, SRMSGDEFSET_DONOTSTEALFOCUS))
@@ -86,7 +86,7 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam) SkinPlaySound("AlertMsg");
{
char *szProto = GetContactProto((HANDLE)wParam);
- if (szProto && (g_dat->openFlags & SRMMStatusToPf2(CallProtoService(szProto, PS_GETSTATUS, 0, 0))))
+ if (szProto && (g_dat.openFlags & SRMMStatusToPf2(CallProtoService(szProto, PS_GETSTATUS, 0, 0))))
{
struct NewMessageWindowLParam newData = { 0 };
newData.hContact = (HANDLE) wParam;
@@ -122,7 +122,7 @@ INT_PTR SendMessageCmd(HANDLE hContact, char* msg, int isWchar) if (!szProto || (!CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND))
return 1;
- if (hwnd = WindowList_Find(g_dat->hMessageWindowList, hContact))
+ if (hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact))
{
if (msg)
{
@@ -174,17 +174,17 @@ static int TypingMessage(WPARAM wParam, LPARAM lParam) HWND hwnd;
int foundWin = 0;
- if (!(g_dat->flags&SMF_SHOWTYPING))
+ if (!(g_dat.flags&SMF_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);
foundWin = 1;
}
- if (lParam && !foundWin && (g_dat->flags&SMF_SHOWTYPINGTRAY)) {
+ if (lParam && !foundWin && (g_dat.flags&SMF_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->flags&SMF_SHOWTYPINGCLIST)) {
+ if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY) && !(g_dat.flags&SMF_SHOWTYPINGCLIST)) {
MIRANDASYSTRAYNOTIFY tn = {0};
tn.cbSize = sizeof(tn);
tn.tszInfoTitle = TranslateT("Typing Notification");
@@ -220,16 +220,16 @@ static int MessageSettingChanged(WPARAM wParam, LPARAM lParam) if (cws->szModule == NULL) return 0;
if (!strcmp(cws->szModule, "CList"))
- WindowList_Broadcast(g_dat->hMessageWindowList, DM_UPDATETITLE, (WPARAM) cws, 0);
+ WindowList_Broadcast(g_dat.hMessageWindowList, DM_UPDATETITLE, (WPARAM) cws, 0);
else if (hContact)
{
if (cws->szSetting && !strcmp(cws->szSetting, "Timezone"))
- WindowList_Broadcast(g_dat->hMessageWindowList, DM_NEWTIMEZONE, (WPARAM) cws, 0);
+ WindowList_Broadcast(g_dat.hMessageWindowList, DM_NEWTIMEZONE, (WPARAM) cws, 0);
else
{
char * szProto = GetContactProto((HANDLE)wParam);
if (szProto && !strcmp(cws->szModule, szProto))
- WindowList_Broadcast(g_dat->hMessageWindowList, DM_UPDATETITLE, (WPARAM) cws, 0);
+ WindowList_Broadcast(g_dat.hMessageWindowList, DM_UPDATETITLE, (WPARAM) cws, 0);
}
}
return 0;
@@ -238,7 +238,7 @@ static int MessageSettingChanged(WPARAM wParam, LPARAM lParam) 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;
@@ -271,12 +271,12 @@ static void RestoreUnreadMessageAlerts(void) CallService(MS_DB_EVENT_GET, (WPARAM) hDbEvent, (LPARAM) & dbei);
if (!(dbei.flags & (DBEF_SENT | DBEF_READ)) && ( dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei)))
{
- windowAlreadyExists = WindowList_Find(g_dat->hMessageWindowList, hContact) != NULL;
+ windowAlreadyExists = WindowList_Find(g_dat.hMessageWindowList, hContact) != NULL;
if (windowAlreadyExists)
continue;
{
char *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))))
{
autoPopup = 1;
}
@@ -306,7 +306,7 @@ void RegisterSRMMFonts( void ); static int FontsChanged(WPARAM wParam,LPARAM lParam)
{
- WindowList_Broadcast(g_dat->hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0);
+ WindowList_Broadcast(g_dat.hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0);
return 0;
}
@@ -331,14 +331,14 @@ static int SplitmsgModulesLoaded(WPARAM wParam, LPARAM lParam) int PreshutdownSendRecv(WPARAM wParam, LPARAM lParam)
{
- WindowList_BroadcastAsync(g_dat->hMessageWindowList, WM_CLOSE, 0, 0);
+ WindowList_BroadcastAsync(g_dat.hMessageWindowList, WM_CLOSE, 0, 0);
DeinitStatusIcons();
return 0;
}
int SplitmsgShutdown(void)
{
- int i;
+ int i;
DestroyCursor(hCurSplitNS);
DestroyCursor(hCurHyperlinkHand);
@@ -357,7 +357,6 @@ int SplitmsgShutdown(void) OleUninitialize();
RichUtil_Unload();
msgQueue_destroy();
- FreeGlobals();
return 0;
}
@@ -365,9 +364,9 @@ static int IconsChanged(WPARAM wParam, LPARAM lParam) {
FreeMsgLogIcons();
LoadMsgLogIcons();
- WindowList_Broadcast(g_dat->hMessageWindowList, DM_REMAKELOG, 0, 0);
+ WindowList_Broadcast(g_dat.hMessageWindowList, DM_REMAKELOG, 0, 0);
// change all the icons
- WindowList_Broadcast(g_dat->hMessageWindowList, DM_UPDATEWINICON, 0, 0);
+ WindowList_Broadcast(g_dat.hMessageWindowList, DM_UPDATEWINICON, 0, 0);
return 0;
}
@@ -415,7 +414,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);
mwd->uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
mwd->hwndWindow = hwnd;
mwd->local = 0;
diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index 3414ee5e98..4e62cd530c 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -124,7 +124,6 @@ void LoadMsgLogIcons(void); void FreeMsgLogIcons(void);
void InitOptions(void);
-void UnloadOptions(void);
#define MSGFONTID_MYMSG 0
#define MSGFONTID_YOURMSG 1
diff --git a/src/core/stdmsg/src/msgtimedout.cpp b/src/core/stdmsg/src/msgtimedout.cpp index 86585c511a..9e112adb72 100644 --- a/src/core/stdmsg/src/msgtimedout.cpp +++ b/src/core/stdmsg/src/msgtimedout.cpp @@ -93,11 +93,11 @@ void MessageFailureProcess(TMsgQueue *item, const char* err) CallService(MS_DB_EVENT_DELETE, (WPARAM)item->hContact, (LPARAM)item->hDbEvent);
- hwnd = WindowList_Find(g_dat->hMessageWindowList, (HANDLE)item->hContact);
+ hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)item->hContact);
if (hwnd == NULL)
{
SendMessageCmd(item->hContact, NULL, 0);
- hwnd = WindowList_Find(g_dat->hMessageWindowList, (HANDLE)item->hContact);
+ hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)item->hContact);
}
else
SendMessage(hwnd, DM_REMAKELOG, 0, 0);
diff --git a/src/core/stdmsg/src/srmm.cpp b/src/core/stdmsg/src/srmm.cpp index e1b6bc6ab5..11159d77b1 100644 --- a/src/core/stdmsg/src/srmm.cpp +++ b/src/core/stdmsg/src/srmm.cpp @@ -57,7 +57,6 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_SRMM, M extern "C" int __declspec(dllexport) Load(void)
{
-
mir_getTMI(&tmi);
mir_getLP(&pluginInfo);
@@ -66,6 +65,5 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void)
{
- UnloadOptions();
return SplitmsgShutdown();
}
diff --git a/src/core/stdmsg/src/statusicon.cpp b/src/core/stdmsg/src/statusicon.cpp index 59fe583c5e..e13aa9172f 100644 --- a/src/core/stdmsg/src/statusicon.cpp +++ b/src/core/stdmsg/src/statusicon.cpp @@ -48,7 +48,7 @@ INT_PTR AddStatusIcon(WPARAM wParam, LPARAM lParam) { status_icon_list = siln;
status_icon_list_size++;
- WindowList_Broadcast(g_dat->hMessageWindowList, DM_STATUSICONCHANGE, 0, 0);
+ WindowList_Broadcast(g_dat.hMessageWindowList, DM_STATUSICONCHANGE, 0, 0);
return 0;
}
@@ -68,7 +68,7 @@ INT_PTR RemoveStatusIcon(WPARAM wParam, LPARAM lParam) { if(current->sid.hIconDisabled) DestroyIcon(current->sid.hIconDisabled);
mir_free(current->sid.szTooltip);
mir_free(current);
- WindowList_Broadcast(g_dat->hMessageWindowList, DM_STATUSICONCHANGE, 0, 0);
+ WindowList_Broadcast(g_dat.hMessageWindowList, DM_STATUSICONCHANGE, 0, 0);
return 0;
}
@@ -94,7 +94,7 @@ void RemoveAllStatusIcons(void) { mir_free(current);
}
- WindowList_Broadcast(g_dat->hMessageWindowList, DM_STATUSICONCHANGE, 0, 0);
+ WindowList_Broadcast(g_dat.hMessageWindowList, DM_STATUSICONCHANGE, 0, 0);
}
INT_PTR ModifyStatusIcon(WPARAM wParam, LPARAM lParam) {
@@ -120,13 +120,13 @@ INT_PTR ModifyStatusIcon(WPARAM wParam, LPARAM lParam) { current->sid.szTooltip = mir_strdup(sid->szTooltip);
}
- WindowList_Broadcast(g_dat->hMessageWindowList, DM_STATUSICONCHANGE, 0, 0);
+ WindowList_Broadcast(g_dat.hMessageWindowList, DM_STATUSICONCHANGE, 0, 0);
} else {
char buff[256];
HWND hwnd;
sprintf(buff, "SRMMStatusIconFlags%d", sid->dwId);
DBWriteContactSettingByte(hContact, sid->szModule, buff, (BYTE)sid->flags);
- if (hwnd = WindowList_Find(g_dat->hMessageWindowList, hContact)) {
+ if (hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact)) {
PostMessage(hwnd, DM_STATUSICONCHANGE, 0, 0);
}
}
|