diff options
author | George Hazan <ghazan@miranda.im> | 2018-08-31 12:08:32 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-08-31 12:08:32 +0300 |
commit | 7b5b64eba4ac63b03915d9050fe6c802ce8b1aa8 (patch) | |
tree | ff45d9ed9d423cf9f9ddfa1ebca7e5f17c9eeefb | |
parent | 536d3743d43843363a619dff4bb871793c471798 (diff) |
code cleaning
-rw-r--r-- | plugins/NewEventNotify/src/main.cpp | 71 | ||||
-rw-r--r-- | plugins/NewEventNotify/src/menuitem.cpp | 2 | ||||
-rw-r--r-- | plugins/NewEventNotify/src/options.cpp | 374 | ||||
-rw-r--r-- | plugins/NewEventNotify/src/popup.cpp | 217 | ||||
-rw-r--r-- | plugins/NewEventNotify/src/stdafx.h | 60 | ||||
-rw-r--r-- | plugins/NewEventNotify/src/version.h | 14 |
6 files changed, 357 insertions, 381 deletions
diff --git a/plugins/NewEventNotify/src/main.cpp b/plugins/NewEventNotify/src/main.cpp index a506d8206a..2897ceca63 100644 --- a/plugins/NewEventNotify/src/main.cpp +++ b/plugins/NewEventNotify/src/main.cpp @@ -1,33 +1,31 @@ /*
- Name: NewEventNotify - Plugin for Miranda IM
- File: main.c - Main DLL procedures
- Version: 0.2.2.2
- Description: Notifies you about some events
- Author: jokusoftware, <jokusoftware@miranda-im.org>
- Date: 18.07.02 13:59 / Update: 22.10.07 19:56
- Copyright: (C) 2002 Starzinger Michael
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Name: NewEventNotify - Plugin for Miranda IM
+ File: main.c - Main DLL procedures
+ Version: 0.2.2.2
+ Description: Notifies you about some events
+ Author: jokusoftware, <jokusoftware@miranda-im.org>
+ Date: 18.07.02 13:59 / Update: 22.10.07 19:56
+ Copyright: (C) 2002 Starzinger Michael
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "stdafx.h"
extern PLUGIN_DATA* PopupList[20];
-PLUGIN_OPTIONS pluginOptions;
-
//---------------------------
//---Some global variables for the plugin
@@ -63,7 +61,7 @@ CMPlugin::CMPlugin() : int HookedNewEvent(WPARAM hContact, LPARAM hDbEvent)
{
//are popups currently enabled?
- if (pluginOptions.bDisable)
+ if (g_plugin.bDisable)
return 0;
//get DBEVENTINFO without pBlob
@@ -81,13 +79,13 @@ int HookedNewEvent(WPARAM hContact, LPARAM hDbEvent) return 0;
//if event was allready read don't show it
- if (pluginOptions.bReadCheck && (dbe.flags & DBEF_READ))
+ if (g_plugin.bReadCheck && (dbe.flags & DBEF_READ))
return 0;
//is it an event sent by the user? -> don't show
if (dbe.flags & DBEF_SENT) {
// JK, only message event, do not influence others
- if (pluginOptions.bHideSend && NumberPopupData(hContact, EVENTTYPE_MESSAGE) != -1) {
+ if (g_plugin.bHideSend && NumberPopupData(hContact, EVENTTYPE_MESSAGE) != -1) {
PLUGIN_DATA *pdata = PopupList[NumberPopupData(hContact, EVENTTYPE_MESSAGE)];
PopupAct(pdata->hWnd, MASK_DISMISS, pdata); // JK, only dismiss, i.e. do not kill event (e.g. file transfer)
}
@@ -96,14 +94,14 @@ int HookedNewEvent(WPARAM hContact, LPARAM hDbEvent) // which status do we have, are we allowed to post popups?
// UNDER CONSTRUCTION!!!
CallService(MS_CLIST_GETSTATUSMODE, 0, 0); /// TODO: JK: ????
- if (dbe.eventType == EVENTTYPE_MESSAGE && (pluginOptions.bMsgWindowCheck && hContact && CheckMsgWnd(hContact)))
+ if (dbe.eventType == EVENTTYPE_MESSAGE && (g_plugin.bMsgWindowCheck && hContact && CheckMsgWnd(hContact)))
return 0;
//is another popup for this contact already present? -> merge message popups if enabled
- if (dbe.eventType == EVENTTYPE_MESSAGE && (pluginOptions.bMergePopup && NumberPopupData(hContact, EVENTTYPE_MESSAGE) != -1))
+ if (dbe.eventType == EVENTTYPE_MESSAGE && (g_plugin.bMergePopup && NumberPopupData(hContact, EVENTTYPE_MESSAGE) != -1))
PopupUpdate(hContact, hDbEvent);
else
- PopupShow(&pluginOptions, hContact, hDbEvent, (UINT)dbe.eventType);
+ PopupShow(hContact, hDbEvent, (UINT)dbe.eventType);
return 0;
}
@@ -116,15 +114,8 @@ int HookedInit(WPARAM, LPARAM) if (ServiceExists("PluginSweeper/Add"))
CallService("PluginSweeper/Add", (WPARAM)MODULENAME, (LPARAM)MODULENAME);
- if (pluginOptions.bMenuitem)
- MenuitemInit(!pluginOptions.bDisable);
- return 0;
-}
-
-//---Called when an options dialog has to be created
-int HookedOptions(WPARAM wParam, LPARAM)
-{
- OptionsAdd(g_plugin.getInst(), wParam);
+ if (g_plugin.bMenuitem)
+ MenuitemInit(!g_plugin.bDisable);
return 0;
}
@@ -133,9 +124,9 @@ int HookedOptions(WPARAM wParam, LPARAM) int CMPlugin::Load()
{
HookEvent(ME_SYSTEM_MODULESLOADED, HookedInit);
- HookEvent(ME_OPT_INITIALISE, HookedOptions);
+ HookEvent(ME_OPT_INITIALISE, OptionsAdd);
- OptionsInit(&pluginOptions);
+ g_plugin.OptionsRead();
return 0;
}
diff --git a/plugins/NewEventNotify/src/menuitem.cpp b/plugins/NewEventNotify/src/menuitem.cpp index b31d755faf..eccf612334 100644 --- a/plugins/NewEventNotify/src/menuitem.cpp +++ b/plugins/NewEventNotify/src/menuitem.cpp @@ -32,7 +32,7 @@ static INT_PTR MenuitemNotifyCmd(WPARAM, LPARAM) bNotify = !bNotify;
MenuitemUpdate(bNotify);
- //write changes to options->bDisable and into database
+ // write changes to options->bDisable and into database
Opt_DisableNEN(!bNotify);
return 0;
}
diff --git a/plugins/NewEventNotify/src/options.cpp b/plugins/NewEventNotify/src/options.cpp index 946cab50f3..144e7aea7f 100644 --- a/plugins/NewEventNotify/src/options.cpp +++ b/plugins/NewEventNotify/src/options.cpp @@ -24,86 +24,83 @@ #include "stdafx.h"
-PLUGIN_OPTIONS* options;
BOOL bWmNotify;
-int OptionsRead(void)
+void CMPlugin::OptionsRead(void)
{
- options->bDisable = db_get_b(NULL, MODULENAME, OPT_DISABLE, FALSE);
- options->bPreview = db_get_b(NULL, MODULENAME, OPT_PREVIEW, TRUE);
- options->bMenuitem = db_get_b(NULL, MODULENAME, OPT_MENUITEM, FALSE);
- options->bDefaultColorMsg = db_get_b(NULL, MODULENAME, OPT_COLDEFAULT_MESSAGE, FALSE);
- options->bDefaultColorUrl = db_get_b(NULL, MODULENAME, OPT_COLDEFAULT_URL, FALSE);
- options->bDefaultColorFile = db_get_b(NULL, MODULENAME, OPT_COLDEFAULT_FILE, FALSE);
- options->bDefaultColorOthers = db_get_b(NULL, MODULENAME, OPT_COLDEFAULT_OTHERS, FALSE);
- options->colBackMsg = (COLORREF)db_get_dw(NULL, MODULENAME, OPT_COLBACK_MESSAGE, DEFAULT_COLBACK);
- options->colTextMsg = (COLORREF)db_get_dw(NULL, MODULENAME, OPT_COLTEXT_MESSAGE, DEFAULT_COLTEXT);
- options->colBackUrl = (COLORREF)db_get_dw(NULL, MODULENAME, OPT_COLBACK_URL, DEFAULT_COLBACK);
- options->colTextUrl = (COLORREF)db_get_dw(NULL, MODULENAME, OPT_COLTEXT_URL, DEFAULT_COLTEXT);
- options->colBackFile = (COLORREF)db_get_dw(NULL, MODULENAME, OPT_COLBACK_FILE, DEFAULT_COLBACK);
- options->colTextFile = (COLORREF)db_get_dw(NULL, MODULENAME, OPT_COLTEXT_FILE, DEFAULT_COLTEXT);
- options->colBackOthers = (COLORREF)db_get_dw(NULL, MODULENAME, OPT_COLBACK_OTHERS, DEFAULT_COLBACK);
- options->colTextOthers = (COLORREF)db_get_dw(NULL, MODULENAME, OPT_COLTEXT_OTHERS, DEFAULT_COLTEXT);
- options->maskNotify = (UINT)db_get_b(NULL, MODULENAME, OPT_MASKNOTIFY, DEFAULT_MASKNOTIFY);
- options->maskActL = (UINT)db_get_b(NULL, MODULENAME, OPT_MASKACTL, DEFAULT_MASKACTL);
- options->maskActR = (UINT)db_get_b(NULL, MODULENAME, OPT_MASKACTR, DEFAULT_MASKACTR);
- options->maskActTE = (UINT)db_get_b(NULL, MODULENAME, OPT_MASKACTTE, DEFAULT_MASKACTE);
- options->bMsgWindowCheck = db_get_b(NULL, MODULENAME, OPT_MSGWINDOWCHECK, TRUE);
- options->bMsgReplyWindow = db_get_b(NULL, MODULENAME, OPT_MSGREPLYWINDOW, FALSE);
- options->bMergePopup = db_get_b(NULL, MODULENAME, OPT_MERGEPOPUP, TRUE);
- options->iDelayMsg = (int)db_get_dw(NULL, MODULENAME, OPT_DELAY_MESSAGE, DEFAULT_DELAY);
- options->iDelayUrl = (int)db_get_dw(NULL, MODULENAME, OPT_DELAY_URL, DEFAULT_DELAY);
- options->iDelayFile = (int)db_get_dw(NULL, MODULENAME, OPT_DELAY_FILE, DEFAULT_DELAY);
- options->iDelayOthers = (int)db_get_dw(NULL, MODULENAME, OPT_DELAY_OTHERS, DEFAULT_DELAY);
- options->iDelayDefault = (int)DBGetContactSettingRangedWord(NULL, "Popup", "Seconds", SETTING_LIFETIME_DEFAULT, SETTING_LIFETIME_MIN, SETTING_LIFETIME_MAX);
- options->bShowDate = db_get_b(NULL, MODULENAME, OPT_SHOW_DATE, TRUE);
- options->bShowTime = db_get_b(NULL, MODULENAME, OPT_SHOW_TIME, TRUE);
- options->bShowHeaders = db_get_b(NULL, MODULENAME, OPT_SHOW_HEADERS, TRUE);
- options->iNumberMsg = (BYTE)db_get_b(NULL, MODULENAME, OPT_NUMBER_MSG, TRUE);
- options->bShowON = db_get_b(NULL, MODULENAME, OPT_SHOW_ON, TRUE);
- options->bHideSend = db_get_b(NULL, MODULENAME, OPT_HIDESEND, TRUE);
- options->bNoRSS = db_get_b(NULL, MODULENAME, OPT_NORSS, FALSE);
- options->bReadCheck = db_get_b(NULL, MODULENAME, OPT_READCHECK, FALSE);
- return 0;
+ bDisable = getByte(OPT_DISABLE, FALSE);
+ bPreview = getByte(OPT_PREVIEW, TRUE);
+ bMenuitem = getByte(OPT_MENUITEM, FALSE);
+ bDefaultColorMsg = getByte(OPT_COLDEFAULT_MESSAGE, FALSE);
+ bDefaultColorUrl = getByte(OPT_COLDEFAULT_URL, FALSE);
+ bDefaultColorFile = getByte(OPT_COLDEFAULT_FILE, FALSE);
+ bDefaultColorOthers = getByte(OPT_COLDEFAULT_OTHERS, FALSE);
+ colBackMsg = getDword(OPT_COLBACK_MESSAGE, DEFAULT_COLBACK);
+ colTextMsg = getDword(OPT_COLTEXT_MESSAGE, DEFAULT_COLTEXT);
+ colBackUrl = getDword(OPT_COLBACK_URL, DEFAULT_COLBACK);
+ colTextUrl = getDword(OPT_COLTEXT_URL, DEFAULT_COLTEXT);
+ colBackFile = getDword(OPT_COLBACK_FILE, DEFAULT_COLBACK);
+ colTextFile = getDword(OPT_COLTEXT_FILE, DEFAULT_COLTEXT);
+ colBackOthers = getDword(OPT_COLBACK_OTHERS, DEFAULT_COLBACK);
+ colTextOthers = getDword(OPT_COLTEXT_OTHERS, DEFAULT_COLTEXT);
+ maskNotify = getByte(OPT_MASKNOTIFY, DEFAULT_MASKNOTIFY);
+ maskActL = getByte(OPT_MASKACTL, DEFAULT_MASKACTL);
+ maskActR = getByte(OPT_MASKACTR, DEFAULT_MASKACTR);
+ maskActTE = getByte(OPT_MASKACTTE, DEFAULT_MASKACTE);
+ bMsgWindowCheck = getByte(OPT_MSGWINDOWCHECK, TRUE);
+ bMsgReplyWindow = getByte(OPT_MSGREPLYWINDOW, FALSE);
+ bMergePopup = getByte(OPT_MERGEPOPUP, TRUE);
+ iDelayMsg = getDword(OPT_DELAY_MESSAGE, DEFAULT_DELAY);
+ iDelayUrl = getDword(OPT_DELAY_URL, DEFAULT_DELAY);
+ iDelayFile = getDword(OPT_DELAY_FILE, DEFAULT_DELAY);
+ iDelayOthers = getDword(OPT_DELAY_OTHERS, DEFAULT_DELAY);
+ iDelayDefault = DBGetContactSettingRangedWord(NULL, "Popup", "Seconds", SETTING_LIFETIME_DEFAULT, SETTING_LIFETIME_MIN, SETTING_LIFETIME_MAX);
+ bShowDate = getByte(OPT_SHOW_DATE, TRUE);
+ bShowTime = getByte(OPT_SHOW_TIME, TRUE);
+ bShowHeaders = getByte(OPT_SHOW_HEADERS, TRUE);
+ iNumberMsg = getByte(OPT_NUMBER_MSG, TRUE);
+ bShowON = getByte(OPT_SHOW_ON, TRUE);
+ bHideSend = getByte(OPT_HIDESEND, TRUE);
+ bNoRSS = getByte(OPT_NORSS, FALSE);
+ bReadCheck = getByte(OPT_READCHECK, FALSE);
}
-int OptionsWrite(void)
+void CMPlugin::OptionsWrite(void)
{
- db_set_b(NULL, MODULENAME, OPT_DISABLE, options->bDisable);
- db_set_b(NULL, MODULENAME, OPT_PREVIEW, options->bPreview);
- db_set_b(NULL, MODULENAME, OPT_MENUITEM, options->bMenuitem);
- db_set_b(NULL, MODULENAME, OPT_COLDEFAULT_MESSAGE, options->bDefaultColorMsg);
- db_set_b(NULL, MODULENAME, OPT_COLDEFAULT_URL, options->bDefaultColorUrl);
- db_set_b(NULL, MODULENAME, OPT_COLDEFAULT_FILE, options->bDefaultColorFile);
- db_set_b(NULL, MODULENAME, OPT_COLDEFAULT_OTHERS, options->bDefaultColorOthers);
- db_set_dw(NULL, MODULENAME, OPT_COLBACK_MESSAGE, (DWORD)options->colBackMsg);
- db_set_dw(NULL, MODULENAME, OPT_COLTEXT_MESSAGE, (DWORD)options->colTextMsg);
- db_set_dw(NULL, MODULENAME, OPT_COLBACK_URL, (DWORD)options->colBackUrl);
- db_set_dw(NULL, MODULENAME, OPT_COLTEXT_URL, (DWORD)options->colTextUrl);
- db_set_dw(NULL, MODULENAME, OPT_COLBACK_FILE, (DWORD)options->colBackFile);
- db_set_dw(NULL, MODULENAME, OPT_COLTEXT_FILE, (DWORD)options->colTextFile);
- db_set_dw(NULL, MODULENAME, OPT_COLBACK_OTHERS, (DWORD)options->colBackOthers);
- db_set_dw(NULL, MODULENAME, OPT_COLTEXT_OTHERS, (DWORD)options->colTextOthers);
- db_set_b(NULL, MODULENAME, OPT_MASKNOTIFY, (BYTE)options->maskNotify);
- db_set_b(NULL, MODULENAME, OPT_MASKACTL, (BYTE)options->maskActL);
- db_set_b(NULL, MODULENAME, OPT_MASKACTR, (BYTE)options->maskActR);
- db_set_b(NULL, MODULENAME, OPT_MASKACTTE, (BYTE)options->maskActTE);
- db_set_b(NULL, MODULENAME, OPT_MSGWINDOWCHECK, options->bMsgWindowCheck);
- db_set_b(NULL, MODULENAME, OPT_MSGREPLYWINDOW, options->bMsgReplyWindow);
- db_set_b(NULL, MODULENAME, OPT_MERGEPOPUP, options->bMergePopup);
- db_set_dw(NULL, MODULENAME, OPT_DELAY_MESSAGE, (DWORD)options->iDelayMsg);
- db_set_dw(NULL, MODULENAME, OPT_DELAY_URL, (DWORD)options->iDelayUrl);
- db_set_dw(NULL, MODULENAME, OPT_DELAY_FILE, (DWORD)options->iDelayFile);
- db_set_dw(NULL, MODULENAME, OPT_DELAY_OTHERS, (DWORD)options->iDelayOthers);
- db_set_b(NULL, MODULENAME, OPT_SHOW_DATE, options->bShowDate);
- db_set_b(NULL, MODULENAME, OPT_SHOW_TIME, options->bShowTime);
- db_set_b(NULL, MODULENAME, OPT_SHOW_HEADERS, options->bShowHeaders);
- db_set_b(NULL, MODULENAME, OPT_NUMBER_MSG, (BYTE)options->iNumberMsg);
- db_set_b(NULL, MODULENAME, OPT_SHOW_ON, options->bShowON);
- db_set_b(NULL, MODULENAME, OPT_HIDESEND, options->bHideSend);
- db_set_b(NULL, MODULENAME, OPT_NORSS, options->bNoRSS);
- db_set_b(NULL, MODULENAME, OPT_READCHECK, options->bReadCheck);
- return 0;
+ setByte(OPT_DISABLE, bDisable);
+ setByte(OPT_PREVIEW, bPreview);
+ setByte(OPT_MENUITEM, bMenuitem);
+ setByte(OPT_COLDEFAULT_MESSAGE, bDefaultColorMsg);
+ setByte(OPT_COLDEFAULT_URL, bDefaultColorUrl);
+ setByte(OPT_COLDEFAULT_FILE, bDefaultColorFile);
+ setByte(OPT_COLDEFAULT_OTHERS, bDefaultColorOthers);
+ setDword(OPT_COLBACK_MESSAGE, colBackMsg);
+ setDword(OPT_COLTEXT_MESSAGE, colTextMsg);
+ setDword(OPT_COLBACK_URL, colBackUrl);
+ setDword(OPT_COLTEXT_URL, colTextUrl);
+ setDword(OPT_COLBACK_FILE, colBackFile);
+ setDword(OPT_COLTEXT_FILE, colTextFile);
+ setDword(OPT_COLBACK_OTHERS, colBackOthers);
+ setDword(OPT_COLTEXT_OTHERS, colTextOthers);
+ setByte(OPT_MASKNOTIFY, (BYTE)maskNotify);
+ setByte(OPT_MASKACTL, (BYTE)maskActL);
+ setByte(OPT_MASKACTR, (BYTE)maskActR);
+ setByte(OPT_MASKACTTE, (BYTE)maskActTE);
+ setByte(OPT_MSGWINDOWCHECK, bMsgWindowCheck);
+ setByte(OPT_MSGREPLYWINDOW, bMsgReplyWindow);
+ setByte(OPT_MERGEPOPUP, bMergePopup);
+ setDword(OPT_DELAY_MESSAGE, iDelayMsg);
+ setDword(OPT_DELAY_URL, iDelayUrl);
+ setDword(OPT_DELAY_FILE, iDelayFile);
+ setDword(OPT_DELAY_OTHERS, iDelayOthers);
+ setByte(OPT_SHOW_DATE, bShowDate);
+ setByte(OPT_SHOW_TIME, bShowTime);
+ setByte(OPT_SHOW_HEADERS, bShowHeaders);
+ setByte(OPT_NUMBER_MSG, (BYTE)iNumberMsg);
+ setByte(OPT_SHOW_ON, bShowON);
+ setByte(OPT_HIDESEND, bHideSend);
+ setByte(OPT_NORSS, bNoRSS);
+ setByte(OPT_READCHECK, bReadCheck);
}
static void SetCheckBoxState(HWND hWnd, int iCtrl, BOOL bState)
@@ -119,28 +116,28 @@ static void EnableDlgItem(HWND hWnd, int iCtrl, BOOL bEnable) static void UpdateOptionsDlgItemsState(HWND hWnd)
{
//disable color picker when using default colors
- EnableDlgItem(hWnd, IDC_COLBACK_MESSAGE, !options->bDefaultColorMsg);
- EnableDlgItem(hWnd, IDC_COLTEXT_MESSAGE, !options->bDefaultColorMsg);
- EnableDlgItem(hWnd, IDC_COLBACK_URL, !options->bDefaultColorUrl);
- EnableDlgItem(hWnd, IDC_COLTEXT_URL, !options->bDefaultColorUrl);
- EnableDlgItem(hWnd, IDC_COLBACK_FILE, !options->bDefaultColorFile);
- EnableDlgItem(hWnd, IDC_COLTEXT_FILE, !options->bDefaultColorFile);
- EnableDlgItem(hWnd, IDC_COLBACK_OTHERS, !options->bDefaultColorOthers);
- EnableDlgItem(hWnd, IDC_COLTEXT_OTHERS, !options->bDefaultColorOthers);
+ EnableDlgItem(hWnd, IDC_COLBACK_MESSAGE, !g_plugin.bDefaultColorMsg);
+ EnableDlgItem(hWnd, IDC_COLTEXT_MESSAGE, !g_plugin.bDefaultColorMsg);
+ EnableDlgItem(hWnd, IDC_COLBACK_URL, !g_plugin.bDefaultColorUrl);
+ EnableDlgItem(hWnd, IDC_COLTEXT_URL, !g_plugin.bDefaultColorUrl);
+ EnableDlgItem(hWnd, IDC_COLBACK_FILE, !g_plugin.bDefaultColorFile);
+ EnableDlgItem(hWnd, IDC_COLTEXT_FILE, !g_plugin.bDefaultColorFile);
+ EnableDlgItem(hWnd, IDC_COLBACK_OTHERS, !g_plugin.bDefaultColorOthers);
+ EnableDlgItem(hWnd, IDC_COLTEXT_OTHERS, !g_plugin.bDefaultColorOthers);
//disable merge messages options when is not using
- EnableDlgItem(hWnd, IDC_CHKSHOWDATE, options->bMergePopup);
- EnableDlgItem(hWnd, IDC_CHKSHOWTIME, options->bMergePopup);
- EnableDlgItem(hWnd, IDC_CHKSHOWHEADERS, options->bMergePopup);
- EnableDlgItem(hWnd, IDC_CMDEDITHEADERS, options->bMergePopup && options->bShowHeaders);
- EnableDlgItem(hWnd, IDC_NUMBERMSG, options->bMergePopup);
- EnableDlgItem(hWnd, IDC_LBNUMBERMSG, options->bMergePopup);
- EnableDlgItem(hWnd, IDC_RDNEW, options->bMergePopup && options->iNumberMsg);
- EnableDlgItem(hWnd, IDC_RDOLD, options->bMergePopup && options->iNumberMsg);
+ EnableDlgItem(hWnd, IDC_CHKSHOWDATE, g_plugin.bMergePopup);
+ EnableDlgItem(hWnd, IDC_CHKSHOWTIME, g_plugin.bMergePopup);
+ EnableDlgItem(hWnd, IDC_CHKSHOWHEADERS, g_plugin.bMergePopup);
+ EnableDlgItem(hWnd, IDC_CMDEDITHEADERS, g_plugin.bMergePopup && g_plugin.bShowHeaders);
+ EnableDlgItem(hWnd, IDC_NUMBERMSG, g_plugin.bMergePopup);
+ EnableDlgItem(hWnd, IDC_LBNUMBERMSG, g_plugin.bMergePopup);
+ EnableDlgItem(hWnd, IDC_RDNEW, g_plugin.bMergePopup && g_plugin.iNumberMsg);
+ EnableDlgItem(hWnd, IDC_RDOLD, g_plugin.bMergePopup && g_plugin.iNumberMsg);
//disable delay textbox when infinite is checked
- EnableDlgItem(hWnd, IDC_DELAY_MESSAGE, options->iDelayMsg != -1);
- EnableDlgItem(hWnd, IDC_DELAY_URL, options->iDelayUrl != -1);
- EnableDlgItem(hWnd, IDC_DELAY_FILE, options->iDelayFile != -1);
- EnableDlgItem(hWnd, IDC_DELAY_OTHERS, options->iDelayOthers != -1);
+ EnableDlgItem(hWnd, IDC_DELAY_MESSAGE, g_plugin.iDelayMsg != -1);
+ EnableDlgItem(hWnd, IDC_DELAY_URL, g_plugin.iDelayUrl != -1);
+ EnableDlgItem(hWnd, IDC_DELAY_FILE, g_plugin.iDelayFile != -1);
+ EnableDlgItem(hWnd, IDC_DELAY_OTHERS, g_plugin.iDelayOthers != -1);
}
static INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
@@ -150,54 +147,54 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, L TranslateDialogDefault(hWnd);
//make dialog represent the current options
bWmNotify = TRUE;
- SendDlgItemMessage(hWnd, IDC_COLBACK_MESSAGE, CPM_SETCOLOUR, 0, options->colBackMsg);
- SendDlgItemMessage(hWnd, IDC_COLTEXT_MESSAGE, CPM_SETCOLOUR, 0, options->colTextMsg);
- SendDlgItemMessage(hWnd, IDC_COLBACK_URL, CPM_SETCOLOUR, 0, options->colBackUrl);
- SendDlgItemMessage(hWnd, IDC_COLTEXT_URL, CPM_SETCOLOUR, 0, options->colTextUrl);
- SendDlgItemMessage(hWnd, IDC_COLBACK_FILE, CPM_SETCOLOUR, 0, options->colBackFile);
- SendDlgItemMessage(hWnd, IDC_COLTEXT_FILE, CPM_SETCOLOUR, 0, options->colTextFile);
- SendDlgItemMessage(hWnd, IDC_COLBACK_OTHERS, CPM_SETCOLOUR, 0, options->colBackOthers);
- SendDlgItemMessage(hWnd, IDC_COLTEXT_OTHERS, CPM_SETCOLOUR, 0, options->colTextOthers);
- SetCheckBoxState(hWnd, IDC_CHKDEFAULTCOL_MESSAGE, options->bDefaultColorMsg);
- SetCheckBoxState(hWnd, IDC_CHKDEFAULTCOL_URL, options->bDefaultColorUrl);
- SetCheckBoxState(hWnd, IDC_CHKDEFAULTCOL_FILE, options->bDefaultColorFile);
- SetCheckBoxState(hWnd, IDC_CHKDEFAULTCOL_OTHERS, options->bDefaultColorOthers);
- SetCheckBoxState(hWnd, IDC_CHKMENUITEM, options->bMenuitem);
- SetCheckBoxState(hWnd, IDC_CHKDISABLE, options->bDisable);
- SetCheckBoxState(hWnd, IDC_CHKPREVIEW, options->bPreview);
- SetCheckBoxState(hWnd, IDC_CHKMERGEPOPUP, options->bMergePopup);
- SetCheckBoxState(hWnd, IDC_CHKNOTIFY_MESSAGE, options->maskNotify & MASK_MESSAGE);
- SetCheckBoxState(hWnd, IDC_CHKNOTIFY_URL, options->maskNotify & MASK_URL);
- SetCheckBoxState(hWnd, IDC_CHKNOTIFY_FILE, options->maskNotify & MASK_FILE);
- SetCheckBoxState(hWnd, IDC_CHKNOTIFY_OTHER, options->maskNotify & MASK_OTHER);
- SetCheckBoxState(hWnd, IDC_CHKACTL_DISMISS, options->maskActL & MASK_DISMISS);
- SetCheckBoxState(hWnd, IDC_CHKACTL_OPEN, options->maskActL & MASK_OPEN);
- SetCheckBoxState(hWnd, IDC_CHKACTL_REMOVE, options->maskActL & MASK_REMOVE);
- SetCheckBoxState(hWnd, IDC_CHKACTR_DISMISS, options->maskActR & MASK_DISMISS);
- SetCheckBoxState(hWnd, IDC_CHKACTR_OPEN, options->maskActR & MASK_OPEN);
- SetCheckBoxState(hWnd, IDC_CHKACTR_REMOVE, options->maskActR & MASK_REMOVE);
- SetCheckBoxState(hWnd, IDC_CHKACTTE_DISMISS, options->maskActTE & MASK_DISMISS);
- SetCheckBoxState(hWnd, IDC_CHKACTTE_OPEN, options->maskActTE & MASK_OPEN);
- SetCheckBoxState(hWnd, IDC_CHKACTTE_REMOVE, options->maskActTE & MASK_REMOVE);
- SetCheckBoxState(hWnd, IDC_CHKWINDOWCHECK, options->bMsgWindowCheck);
- SetCheckBoxState(hWnd, IDC_CHKREPLYWINDOW, options->bMsgReplyWindow);
- SetCheckBoxState(hWnd, IDC_CHKSHOWDATE, options->bShowDate);
- SetCheckBoxState(hWnd, IDC_CHKSHOWTIME, options->bShowTime);
- SetCheckBoxState(hWnd, IDC_CHKSHOWHEADERS, options->bShowHeaders);
- SetCheckBoxState(hWnd, IDC_RDNEW, !options->bShowON);
- SetCheckBoxState(hWnd, IDC_RDOLD, options->bShowON);
- SetCheckBoxState(hWnd, IDC_CHKHIDESEND, options->bHideSend);
- SetCheckBoxState(hWnd, IDC_SUPRESSRSS, options->bNoRSS);
- SetCheckBoxState(hWnd, IDC_READCHECK, options->bReadCheck);
- SetCheckBoxState(hWnd, IDC_CHKINFINITE_MESSAGE, options->iDelayMsg == -1);
- SetCheckBoxState(hWnd, IDC_CHKINFINITE_URL, options->iDelayUrl == -1);
- SetCheckBoxState(hWnd, IDC_CHKINFINITE_FILE, options->iDelayFile == -1);
- SetCheckBoxState(hWnd, IDC_CHKINFINITE_OTHERS, options->iDelayOthers == -1);
- SetDlgItemInt(hWnd, IDC_DELAY_MESSAGE, options->iDelayMsg != -1 ? options->iDelayMsg : 0, TRUE);
- SetDlgItemInt(hWnd, IDC_DELAY_URL, options->iDelayUrl != -1 ? options->iDelayUrl : 0, TRUE);
- SetDlgItemInt(hWnd, IDC_DELAY_FILE, options->iDelayFile != -1 ? options->iDelayFile : 0, TRUE);
- SetDlgItemInt(hWnd, IDC_DELAY_OTHERS, options->iDelayOthers != -1 ? options->iDelayOthers : 0, TRUE);
- SetDlgItemInt(hWnd, IDC_NUMBERMSG, options->iNumberMsg, FALSE);
+ SendDlgItemMessage(hWnd, IDC_COLBACK_MESSAGE, CPM_SETCOLOUR, 0, g_plugin.colBackMsg);
+ SendDlgItemMessage(hWnd, IDC_COLTEXT_MESSAGE, CPM_SETCOLOUR, 0, g_plugin.colTextMsg);
+ SendDlgItemMessage(hWnd, IDC_COLBACK_URL, CPM_SETCOLOUR, 0, g_plugin.colBackUrl);
+ SendDlgItemMessage(hWnd, IDC_COLTEXT_URL, CPM_SETCOLOUR, 0, g_plugin.colTextUrl);
+ SendDlgItemMessage(hWnd, IDC_COLBACK_FILE, CPM_SETCOLOUR, 0, g_plugin.colBackFile);
+ SendDlgItemMessage(hWnd, IDC_COLTEXT_FILE, CPM_SETCOLOUR, 0, g_plugin.colTextFile);
+ SendDlgItemMessage(hWnd, IDC_COLBACK_OTHERS, CPM_SETCOLOUR, 0, g_plugin.colBackOthers);
+ SendDlgItemMessage(hWnd, IDC_COLTEXT_OTHERS, CPM_SETCOLOUR, 0, g_plugin.colTextOthers);
+ SetCheckBoxState(hWnd, IDC_CHKDEFAULTCOL_MESSAGE, g_plugin.bDefaultColorMsg);
+ SetCheckBoxState(hWnd, IDC_CHKDEFAULTCOL_URL, g_plugin.bDefaultColorUrl);
+ SetCheckBoxState(hWnd, IDC_CHKDEFAULTCOL_FILE, g_plugin.bDefaultColorFile);
+ SetCheckBoxState(hWnd, IDC_CHKDEFAULTCOL_OTHERS, g_plugin.bDefaultColorOthers);
+ SetCheckBoxState(hWnd, IDC_CHKMENUITEM, g_plugin.bMenuitem);
+ SetCheckBoxState(hWnd, IDC_CHKDISABLE, g_plugin.bDisable);
+ SetCheckBoxState(hWnd, IDC_CHKPREVIEW, g_plugin.bPreview);
+ SetCheckBoxState(hWnd, IDC_CHKMERGEPOPUP, g_plugin.bMergePopup);
+ SetCheckBoxState(hWnd, IDC_CHKNOTIFY_MESSAGE, g_plugin.maskNotify & MASK_MESSAGE);
+ SetCheckBoxState(hWnd, IDC_CHKNOTIFY_URL, g_plugin.maskNotify & MASK_URL);
+ SetCheckBoxState(hWnd, IDC_CHKNOTIFY_FILE, g_plugin.maskNotify & MASK_FILE);
+ SetCheckBoxState(hWnd, IDC_CHKNOTIFY_OTHER, g_plugin.maskNotify & MASK_OTHER);
+ SetCheckBoxState(hWnd, IDC_CHKACTL_DISMISS, g_plugin.maskActL & MASK_DISMISS);
+ SetCheckBoxState(hWnd, IDC_CHKACTL_OPEN, g_plugin.maskActL & MASK_OPEN);
+ SetCheckBoxState(hWnd, IDC_CHKACTL_REMOVE, g_plugin.maskActL & MASK_REMOVE);
+ SetCheckBoxState(hWnd, IDC_CHKACTR_DISMISS, g_plugin.maskActR & MASK_DISMISS);
+ SetCheckBoxState(hWnd, IDC_CHKACTR_OPEN, g_plugin.maskActR & MASK_OPEN);
+ SetCheckBoxState(hWnd, IDC_CHKACTR_REMOVE, g_plugin.maskActR & MASK_REMOVE);
+ SetCheckBoxState(hWnd, IDC_CHKACTTE_DISMISS, g_plugin.maskActTE & MASK_DISMISS);
+ SetCheckBoxState(hWnd, IDC_CHKACTTE_OPEN, g_plugin.maskActTE & MASK_OPEN);
+ SetCheckBoxState(hWnd, IDC_CHKACTTE_REMOVE, g_plugin.maskActTE & MASK_REMOVE);
+ SetCheckBoxState(hWnd, IDC_CHKWINDOWCHECK, g_plugin.bMsgWindowCheck);
+ SetCheckBoxState(hWnd, IDC_CHKREPLYWINDOW, g_plugin.bMsgReplyWindow);
+ SetCheckBoxState(hWnd, IDC_CHKSHOWDATE, g_plugin.bShowDate);
+ SetCheckBoxState(hWnd, IDC_CHKSHOWTIME, g_plugin.bShowTime);
+ SetCheckBoxState(hWnd, IDC_CHKSHOWHEADERS, g_plugin.bShowHeaders);
+ SetCheckBoxState(hWnd, IDC_RDNEW, !g_plugin.bShowON);
+ SetCheckBoxState(hWnd, IDC_RDOLD, g_plugin.bShowON);
+ SetCheckBoxState(hWnd, IDC_CHKHIDESEND, g_plugin.bHideSend);
+ SetCheckBoxState(hWnd, IDC_SUPRESSRSS, g_plugin.bNoRSS);
+ SetCheckBoxState(hWnd, IDC_READCHECK, g_plugin.bReadCheck);
+ SetCheckBoxState(hWnd, IDC_CHKINFINITE_MESSAGE, g_plugin.iDelayMsg == -1);
+ SetCheckBoxState(hWnd, IDC_CHKINFINITE_URL, g_plugin.iDelayUrl == -1);
+ SetCheckBoxState(hWnd, IDC_CHKINFINITE_FILE, g_plugin.iDelayFile == -1);
+ SetCheckBoxState(hWnd, IDC_CHKINFINITE_OTHERS, g_plugin.iDelayOthers == -1);
+ SetDlgItemInt(hWnd, IDC_DELAY_MESSAGE, g_plugin.iDelayMsg != -1 ? g_plugin.iDelayMsg : 0, TRUE);
+ SetDlgItemInt(hWnd, IDC_DELAY_URL, g_plugin.iDelayUrl != -1 ? g_plugin.iDelayUrl : 0, TRUE);
+ SetDlgItemInt(hWnd, IDC_DELAY_FILE, g_plugin.iDelayFile != -1 ? g_plugin.iDelayFile : 0, TRUE);
+ SetDlgItemInt(hWnd, IDC_DELAY_OTHERS, g_plugin.iDelayOthers != -1 ? g_plugin.iDelayOthers : 0, TRUE);
+ SetDlgItemInt(hWnd, IDC_NUMBERMSG, g_plugin.iNumberMsg, FALSE);
//update items' states
UpdateOptionsDlgItemsState(hWnd);
bWmNotify = FALSE;
@@ -207,60 +204,60 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, L if (!bWmNotify) {
switch (LOWORD(wParam)) {
case IDC_PREVIEW:
- PopupPreview(options);
+ PopupPreview();
break;
default:
//update options
- options->maskNotify = (IsDlgButtonChecked(hWnd, IDC_CHKNOTIFY_MESSAGE) ? MASK_MESSAGE : 0) |
+ g_plugin.maskNotify = (IsDlgButtonChecked(hWnd, IDC_CHKNOTIFY_MESSAGE) ? MASK_MESSAGE : 0) |
(IsDlgButtonChecked(hWnd, IDC_CHKNOTIFY_URL) ? MASK_URL : 0) |
(IsDlgButtonChecked(hWnd, IDC_CHKNOTIFY_FILE) ? MASK_FILE : 0) |
(IsDlgButtonChecked(hWnd, IDC_CHKNOTIFY_OTHER) ? MASK_OTHER : 0);
- options->maskActL = (IsDlgButtonChecked(hWnd, IDC_CHKACTL_DISMISS) ? MASK_DISMISS : 0) |
+ g_plugin.maskActL = (IsDlgButtonChecked(hWnd, IDC_CHKACTL_DISMISS) ? MASK_DISMISS : 0) |
(IsDlgButtonChecked(hWnd, IDC_CHKACTL_OPEN) ? MASK_OPEN : 0) |
(IsDlgButtonChecked(hWnd, IDC_CHKACTL_REMOVE) ? MASK_REMOVE : 0);
- options->maskActR = (IsDlgButtonChecked(hWnd, IDC_CHKACTR_DISMISS) ? MASK_DISMISS : 0) |
+ g_plugin.maskActR = (IsDlgButtonChecked(hWnd, IDC_CHKACTR_DISMISS) ? MASK_DISMISS : 0) |
(IsDlgButtonChecked(hWnd, IDC_CHKACTR_OPEN) ? MASK_OPEN : 0) |
(IsDlgButtonChecked(hWnd, IDC_CHKACTR_REMOVE) ? MASK_REMOVE : 0);
- options->maskActTE = (IsDlgButtonChecked(hWnd, IDC_CHKACTTE_DISMISS) ? MASK_DISMISS : 0) |
+ g_plugin.maskActTE = (IsDlgButtonChecked(hWnd, IDC_CHKACTTE_DISMISS) ? MASK_DISMISS : 0) |
(IsDlgButtonChecked(hWnd, IDC_CHKACTTE_OPEN) ? MASK_OPEN : 0) |
(IsDlgButtonChecked(hWnd, IDC_CHKACTTE_REMOVE) ? MASK_REMOVE : 0);
- options->bDefaultColorMsg = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_MESSAGE);
- options->bDefaultColorUrl = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_URL);
- options->bDefaultColorFile = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_FILE);
- options->bDefaultColorOthers = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_OTHERS);
- options->bMenuitem = IsDlgButtonChecked(hWnd, IDC_CHKMENUITEM);
- options->bDisable = IsDlgButtonChecked(hWnd, IDC_CHKDISABLE);
- options->bPreview = IsDlgButtonChecked(hWnd, IDC_CHKPREVIEW);
- options->iDelayMsg = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_MESSAGE) ? -1 : (DWORD)GetDlgItemInt(hWnd, IDC_DELAY_MESSAGE, nullptr, FALSE);
- options->iDelayUrl = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_URL) ? -1 : (DWORD)GetDlgItemInt(hWnd, IDC_DELAY_URL, nullptr, FALSE);
- options->iDelayFile = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_FILE) ? -1 : (DWORD)GetDlgItemInt(hWnd, IDC_DELAY_FILE, nullptr, FALSE);
- options->iDelayOthers = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_OTHERS) ? -1 : (DWORD)GetDlgItemInt(hWnd, IDC_DELAY_OTHERS, nullptr, FALSE);
- options->bMergePopup = IsDlgButtonChecked(hWnd, IDC_CHKMERGEPOPUP);
- options->bMsgWindowCheck = IsDlgButtonChecked(hWnd, IDC_CHKWINDOWCHECK);
- options->bMsgReplyWindow = IsDlgButtonChecked(hWnd, IDC_CHKREPLYWINDOW);
- options->bShowDate = IsDlgButtonChecked(hWnd, IDC_CHKSHOWDATE);
- options->bShowTime = IsDlgButtonChecked(hWnd, IDC_CHKSHOWTIME);
- options->bShowHeaders = IsDlgButtonChecked(hWnd, IDC_CHKSHOWHEADERS);
- options->bShowON = IsDlgButtonChecked(hWnd, IDC_RDOLD);
- options->bShowON = BST_UNCHECKED == IsDlgButtonChecked(hWnd, IDC_RDNEW);
- options->bHideSend = IsDlgButtonChecked(hWnd, IDC_CHKHIDESEND);
- options->iNumberMsg = GetDlgItemInt(hWnd, IDC_NUMBERMSG, nullptr, FALSE);
- options->bNoRSS = IsDlgButtonChecked(hWnd, IDC_SUPRESSRSS);
- options->bReadCheck = IsDlgButtonChecked(hWnd, IDC_READCHECK);
+ g_plugin.bDefaultColorMsg = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_MESSAGE);
+ g_plugin.bDefaultColorUrl = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_URL);
+ g_plugin.bDefaultColorFile = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_FILE);
+ g_plugin.bDefaultColorOthers = IsDlgButtonChecked(hWnd, IDC_CHKDEFAULTCOL_OTHERS);
+ g_plugin.bMenuitem = IsDlgButtonChecked(hWnd, IDC_CHKMENUITEM);
+ g_plugin.bDisable = IsDlgButtonChecked(hWnd, IDC_CHKDISABLE);
+ g_plugin.bPreview = IsDlgButtonChecked(hWnd, IDC_CHKPREVIEW);
+ g_plugin.iDelayMsg = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_MESSAGE) ? -1 : (DWORD)GetDlgItemInt(hWnd, IDC_DELAY_MESSAGE, nullptr, FALSE);
+ g_plugin.iDelayUrl = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_URL) ? -1 : (DWORD)GetDlgItemInt(hWnd, IDC_DELAY_URL, nullptr, FALSE);
+ g_plugin.iDelayFile = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_FILE) ? -1 : (DWORD)GetDlgItemInt(hWnd, IDC_DELAY_FILE, nullptr, FALSE);
+ g_plugin.iDelayOthers = IsDlgButtonChecked(hWnd, IDC_CHKINFINITE_OTHERS) ? -1 : (DWORD)GetDlgItemInt(hWnd, IDC_DELAY_OTHERS, nullptr, FALSE);
+ g_plugin.bMergePopup = IsDlgButtonChecked(hWnd, IDC_CHKMERGEPOPUP);
+ g_plugin.bMsgWindowCheck = IsDlgButtonChecked(hWnd, IDC_CHKWINDOWCHECK);
+ g_plugin.bMsgReplyWindow = IsDlgButtonChecked(hWnd, IDC_CHKREPLYWINDOW);
+ g_plugin.bShowDate = IsDlgButtonChecked(hWnd, IDC_CHKSHOWDATE);
+ g_plugin.bShowTime = IsDlgButtonChecked(hWnd, IDC_CHKSHOWTIME);
+ g_plugin.bShowHeaders = IsDlgButtonChecked(hWnd, IDC_CHKSHOWHEADERS);
+ g_plugin.bShowON = IsDlgButtonChecked(hWnd, IDC_RDOLD);
+ g_plugin.bShowON = BST_UNCHECKED == IsDlgButtonChecked(hWnd, IDC_RDNEW);
+ g_plugin.bHideSend = IsDlgButtonChecked(hWnd, IDC_CHKHIDESEND);
+ g_plugin.iNumberMsg = GetDlgItemInt(hWnd, IDC_NUMBERMSG, nullptr, FALSE);
+ g_plugin.bNoRSS = IsDlgButtonChecked(hWnd, IDC_SUPRESSRSS);
+ g_plugin.bReadCheck = IsDlgButtonChecked(hWnd, IDC_READCHECK);
//update items' states
UpdateOptionsDlgItemsState(hWnd);
if (HIWORD(wParam) == CPN_COLOURCHANGED) {
- options->colBackMsg = SendDlgItemMessage(hWnd, IDC_COLBACK_MESSAGE, CPM_GETCOLOUR, 0, 0);
- options->colTextMsg = SendDlgItemMessage(hWnd, IDC_COLTEXT_MESSAGE, CPM_GETCOLOUR, 0, 0);
- options->colBackUrl = SendDlgItemMessage(hWnd, IDC_COLBACK_URL, CPM_GETCOLOUR, 0, 0);
- options->colTextUrl = SendDlgItemMessage(hWnd, IDC_COLTEXT_URL, CPM_GETCOLOUR, 0, 0);
- options->colBackFile = SendDlgItemMessage(hWnd, IDC_COLBACK_FILE, CPM_GETCOLOUR, 0, 0);
- options->colTextFile = SendDlgItemMessage(hWnd, IDC_COLTEXT_FILE, CPM_GETCOLOUR, 0, 0);
- options->colBackOthers = SendDlgItemMessage(hWnd, IDC_COLBACK_OTHERS, CPM_GETCOLOUR, 0, 0);
- options->colTextOthers = SendDlgItemMessage(hWnd, IDC_COLTEXT_OTHERS, CPM_GETCOLOUR, 0, 0);
+ g_plugin.colBackMsg = SendDlgItemMessage(hWnd, IDC_COLBACK_MESSAGE, CPM_GETCOLOUR, 0, 0);
+ g_plugin.colTextMsg = SendDlgItemMessage(hWnd, IDC_COLTEXT_MESSAGE, CPM_GETCOLOUR, 0, 0);
+ g_plugin.colBackUrl = SendDlgItemMessage(hWnd, IDC_COLBACK_URL, CPM_GETCOLOUR, 0, 0);
+ g_plugin.colTextUrl = SendDlgItemMessage(hWnd, IDC_COLTEXT_URL, CPM_GETCOLOUR, 0, 0);
+ g_plugin.colBackFile = SendDlgItemMessage(hWnd, IDC_COLBACK_FILE, CPM_GETCOLOUR, 0, 0);
+ g_plugin.colTextFile = SendDlgItemMessage(hWnd, IDC_COLTEXT_FILE, CPM_GETCOLOUR, 0, 0);
+ g_plugin.colBackOthers = SendDlgItemMessage(hWnd, IDC_COLBACK_OTHERS, CPM_GETCOLOUR, 0, 0);
+ g_plugin.colTextOthers = SendDlgItemMessage(hWnd, IDC_COLTEXT_OTHERS, CPM_GETCOLOUR, 0, 0);
}
//send changes to mi
- MenuitemUpdate(!options->bDisable);
+ MenuitemUpdate(!g_plugin.bDisable);
//enable "Apply" button
SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
break;
@@ -271,14 +268,14 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, L case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- OptionsWrite();
+ g_plugin.OptionsWrite();
break;
case PSN_RESET:
- OptionsRead();
+ g_plugin.OptionsRead();
//maybe something changed with the mi
- MenuitemUpdate(!options->bDisable);
+ MenuitemUpdate(!g_plugin.bDisable);
break;
}
break;
@@ -286,7 +283,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, L return FALSE;
}
-int OptionsAdd(HINSTANCE hInst, WPARAM addInfo)
+int OptionsAdd(WPARAM addInfo, LPARAM)
{
if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
OPTIONSDIALOGPAGE odp = {};
@@ -301,16 +298,9 @@ int OptionsAdd(HINSTANCE hInst, WPARAM addInfo) return 0;
}
-int OptionsInit(PLUGIN_OPTIONS* pluginOptions)
-{
- options = pluginOptions;
- OptionsRead();
- return 0;
-}
-
int Opt_DisableNEN(BOOL Status)
{
- options->bDisable = Status;
- OptionsWrite(); // JK: really necessary to write everything here ????
+ g_plugin.bDisable = Status;
+ g_plugin.OptionsWrite(); // JK: really necessary to write everything here ????
return 0;
}
diff --git a/plugins/NewEventNotify/src/popup.cpp b/plugins/NewEventNotify/src/popup.cpp index e3126f4bb3..6a371aa8c4 100644 --- a/plugins/NewEventNotify/src/popup.cpp +++ b/plugins/NewEventNotify/src/popup.cpp @@ -1,25 +1,25 @@ /*
- Name: NewEventNotify - Plugin for Miranda IM
- File: popup.c - Displays a popup using the popup-plugin by hrk
- Version: 2.2.3
- Description: Notifies you about some events
- Author: icebreaker, <icebreaker@newmail.net>
- Date: 21.07.02 15:46 / Update: 16.09.02 17:45
- Copyright: (C) 2002 Starzinger Michael
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Name: NewEventNotify - Plugin for Miranda IM
+ File: popup.c - Displays a popup using the popup-plugin by hrk
+ Version: 2.2.3
+ Description: Notifies you about some events
+ Author: icebreaker, <icebreaker@newmail.net>
+ Date: 21.07.02 15:46 / Update: 16.09.02 17:45
+ Copyright: (C) 2002 Starzinger Michael
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "stdafx.h"
@@ -32,7 +32,7 @@ PLUGIN_DATA* PopupList[MAX_POPUPS]; int NumberPopupData(MCONTACT hContact, int eventType)
{
- for (int n=0; n < MAX_POPUPS; n++) {
+ for (int n = 0; n < MAX_POPUPS; n++) {
if (!PopupList[n] && !hContact && eventType == -1)
return n;
@@ -44,8 +44,8 @@ int NumberPopupData(MCONTACT hContact, int eventType) static int FindPopupData(PLUGIN_DATA* pdata)
{
- for (int n=0; n < MAX_POPUPS; n++)
- if (PopupList[n] == pdata)
+ for (int n = 0; n < MAX_POPUPS; n++)
+ if (PopupList[n] == pdata)
return n;
return -1;
@@ -65,7 +65,7 @@ static void FreePopupEventData(PLUGIN_DATA* pdata) mir_free(eventData);
eventData = nullptr;
}
- }
+ }
pdata->lastEventData = pdata->firstEventData = pdata->firstShowEventData = nullptr;
// remove from popup list if present
if (FindPopupData(pdata) != -1)
@@ -77,7 +77,7 @@ int PopupAct(HWND hWnd, UINT mask, PLUGIN_DATA* pdata) if (mask & MASK_OPEN) {
if (pdata) {
// do MS_MSG_SENDMESSAGE instead if wanted to reply and not read!
- if (pdata->pluginOptions->bMsgReplyWindow && pdata->eventType == EVENTTYPE_MESSAGE)
+ if (g_plugin.bMsgReplyWindow && pdata->eventType == EVENTTYPE_MESSAGE)
CallServiceSync(MS_MSG_SENDMESSAGE, (WPARAM)pdata->hContact, 0); // JK, use core (since 0.3.3+)
else {
EVENT_DATA_EX *eventData = pdata->firstEventData;
@@ -105,9 +105,9 @@ int PopupAct(HWND hWnd, UINT mask, PLUGIN_DATA* pdata) pdata->iLock = 1;
while (eventData) {
g_clistApi.pfnRemoveEvent(pdata->hContact, eventData->hEvent);
- db_event_markRead(pdata->hContact, eventData->hEvent);
+ db_event_markRead(pdata->hContact, eventData->hEvent);
eventData = eventData->next;
- }
+ }
FreePopupEventData(pdata);
}
}
@@ -129,10 +129,10 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA switch (message) {
case WM_COMMAND:
- PopupAct(hWnd, pdata->pluginOptions->maskActL, pdata);
+ PopupAct(hWnd, g_plugin.maskActL, pdata);
break;
case WM_CONTEXTMENU:
- PopupAct(hWnd, pdata->pluginOptions->maskActR, pdata);
+ PopupAct(hWnd, g_plugin.maskActR, pdata);
break;
case UM_FREEPLUGINDATA:
PopupCount--;
@@ -144,14 +144,12 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA break;
case WM_MOUSEWHEEL:
if ((short)HIWORD(wParam) > 0 && pdata->firstShowEventData->prev &&
- (pdata->pluginOptions->bShowON || pdata->firstShowEventData->number >= pdata->pluginOptions->iNumberMsg))
- {
+ (g_plugin.bShowON || pdata->firstShowEventData->number >= g_plugin.iNumberMsg)) {
pdata->firstShowEventData = pdata->firstShowEventData->prev;
PopupUpdate(pdata->hContact, NULL);
}
- if ((short)HIWORD(wParam) < 0 && pdata->firstShowEventData->next &&
- (!pdata->pluginOptions->bShowON || pdata->countEvent - pdata->firstShowEventData->number >= pdata->pluginOptions->iNumberMsg))
- {
+ if ((short)HIWORD(wParam) < 0 && pdata->firstShowEventData->next &&
+ (!g_plugin.bShowON || pdata->countEvent - pdata->firstShowEventData->number >= g_plugin.iNumberMsg)) {
pdata->firstShowEventData = pdata->firstShowEventData->next;
PopupUpdate(pdata->hContact, NULL);
}
@@ -162,7 +160,7 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA case WM_TIMER:
if (wParam != TIMER_TO_ACTION)
break;
- PopupAct(hWnd, pdata->pluginOptions->maskActTE, pdata);
+ PopupAct(hWnd, g_plugin.maskActTE, pdata);
break;
}
return DefWindowProc(hWnd, message, wParam, lParam);
@@ -172,9 +170,9 @@ static wchar_t* GetEventPreview(DBEVENTINFO *dbei) {
wchar_t *comment1 = nullptr;
wchar_t *comment2 = nullptr;
- char *commentFix = nullptr;
+ char *commentFix = nullptr;
- //now get text
+ // now get text
switch (dbei->eventType) {
case EVENTTYPE_MESSAGE:
if (dbei->pBlob) {
@@ -182,7 +180,7 @@ static wchar_t* GetEventPreview(DBEVENTINFO *dbei) // utf-8 in blob
comment1 = mir_utf8decodeW((char*)dbei->pBlob);
}
- else if (dbei->cbBlob == (mir_wstrlen((wchar_t *)dbei->pBlob)+1)*(sizeof(wchar_t)+1)) {
+ else if (dbei->cbBlob == (mir_wstrlen((wchar_t *)dbei->pBlob) + 1)*(sizeof(wchar_t) + 1)) {
// wchar in blob (the old hack)
comment1 = mir_wstrdup((wchar_t*)dbei->pBlob);
}
@@ -211,9 +209,9 @@ static wchar_t* GetEventPreview(DBEVENTINFO *dbei) commentFix = POPUP_COMMENT_FILE;
break;
- //blob format is:
- //ASCIIZ nick
- //ASCIIZ UID
+ // blob format is:
+ // ASCIIZ nick
+ // ASCIIZ UID
case EVENTTYPE_CONTACTS:
if (dbei->pBlob) {
// count contacts in event
@@ -237,13 +235,13 @@ static wchar_t* GetEventPreview(DBEVENTINFO *dbei) commentFix = POPUP_COMMENT_CONTACTS;
break;
- //blob format is:
- //DWORD numeric uin (ICQ only afaik)
- //DWORD HANDLE to contact
- //ASCIIZ nick (or text UID)
- //ASCIIZ first name
- //ASCIIZ last name
- //ASCIIZ email (or YID)
+ // blob format is:
+ // DWORD numeric uin (ICQ only afaik)
+ // DWORD HANDLE to contact
+ // ASCIIZ nick (or text UID)
+ // ASCIIZ first name
+ // ASCIIZ last name
+ // ASCIIZ email (or YID)
case EVENTTYPE_ADDED:
if (dbei->pBlob) {
char szUin[16];
@@ -300,33 +298,33 @@ static wchar_t* GetEventPreview(DBEVENTINFO *dbei) commentFix = POPUP_COMMENT_AUTH;
break;
- //blob format is:
- //ASCIIZ text, usually "Sender IP: xxx.xxx.xxx.xxx\r\n%s"
- //ASCIIZ from name
- //ASCIIZ from e-mail
+ // blob format is:
+ // ASCIIZ text, usually "Sender IP: xxx.xxx.xxx.xxx\r\n%s"
+ // ASCIIZ from name
+ // ASCIIZ from e-mail
case ICQEVENTTYPE_WEBPAGER:
if (dbei->pBlob) comment1 = mir_a2u((const char *)dbei->pBlob);
commentFix = POPUP_COMMENT_WEBPAGER;
break;
- //blob format is:
- //ASCIIZ text, usually of the form "Subject: %s\r\n%s"
- //ASCIIZ from name
- //ASCIIZ from e-mail
+ // blob format is:
+ // ASCIIZ text, usually of the form "Subject: %s\r\n%s"
+ // ASCIIZ from name
+ // ASCIIZ from e-mail
case ICQEVENTTYPE_EMAILEXPRESS:
if (dbei->pBlob) comment1 = mir_a2u((const char *)dbei->pBlob);
commentFix = POPUP_COMMENT_EMAILEXP;
break;
- //blob format is:
- //ASCIIZ text, usually of the form "SMS From: +XXXXXXXX\r\nTEXT"
+ // blob format is:
+ // ASCIIZ text, usually of the form "SMS From: +XXXXXXXX\r\nTEXT"
case ICQEVENTTYPE_SMS:
if (dbei->pBlob) {
if (dbei->flags & DBEF_UTF) {
// utf-8 in blob
comment1 = mir_utf8decodeW((char*)dbei->pBlob);
}
- else if (dbei->cbBlob == (mir_wstrlen((wchar_t *)dbei->pBlob)+1)*(sizeof(wchar_t)+1)) {
+ else if (dbei->cbBlob == (mir_wstrlen((wchar_t *)dbei->pBlob) + 1)*(sizeof(wchar_t) + 1)) {
// wchar in blob (the old hack)
comment1 = mir_wstrdup((wchar_t*)dbei->pBlob);
}
@@ -335,15 +333,15 @@ static wchar_t* GetEventPreview(DBEVENTINFO *dbei) commentFix = POPUP_COMMENT_SMS;
break;
- //blob format is:
- //ASCIIZ text, usually of the form "SMS Confirmation From: +XXXXXXXXXXXX\r\nSMS was sent succesfully"
+ // blob format is:
+ // ASCIIZ text, usually of the form "SMS Confirmation From: +XXXXXXXXXXXX\r\nSMS was sent succesfully"
case ICQEVENTTYPE_SMSCONFIRMATION:
if (dbei->pBlob) {
if (dbei->flags & DBEF_UTF) {
// utf-8 in blob
comment1 = mir_utf8decodeW((char*)dbei->pBlob);
}
- else if (dbei->cbBlob == (mir_wstrlen((wchar_t *)dbei->pBlob)+1)*(sizeof(wchar_t)+1)) {
+ else if (dbei->cbBlob == (mir_wstrlen((wchar_t *)dbei->pBlob) + 1)*(sizeof(wchar_t) + 1)) {
// wchar in blob (the old hack)
comment1 = mir_wstrdup((wchar_t*)dbei->pBlob);
}
@@ -372,66 +370,66 @@ static wchar_t* GetEventPreview(DBEVENTINFO *dbei) }
mir_free(comment1);
mir_free(comment2);
- return TranslateW( mir_a2u(commentFix));
+ return TranslateW(mir_a2u(commentFix));
}
-int PopupShow(PLUGIN_OPTIONS* pluginOptions, MCONTACT hContact, MEVENT hEvent, UINT eventType)
+int PopupShow(MCONTACT hContact, MEVENT hEvent, UINT eventType)
{
- wchar_t* sampleEvent;
+ wchar_t *sampleEvent;
long iSeconds;
- //there has to be a maximum number of popups shown at the same time
+ // there has to be a maximum number of popups shown at the same time
if (PopupCount >= MAX_POPUPS)
return 2;
- //check if we should report this kind of event
- //get the prefered icon as well
- //CHANGE: iSeconds is -1 because I use my timer to hide popup
+ // check if we should report this kind of event
+ // get the prefered icon as well
+ // CHANGE: iSeconds is -1 because I use my timer to hide popup
POPUPDATAW pudw;
- pudw.iSeconds = -1;
+ pudw.iSeconds = -1;
switch (eventType) {
case EVENTTYPE_MESSAGE:
- if (!(pluginOptions->maskNotify & MASK_MESSAGE)) return 1;
+ if (!(g_plugin.maskNotify & MASK_MESSAGE)) return 1;
pudw.lchIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
- pudw.colorBack = pluginOptions->bDefaultColorMsg ? 0 : pluginOptions->colBackMsg;
- pudw.colorText = pluginOptions->bDefaultColorMsg ? 0 : pluginOptions->colTextMsg;
- iSeconds = pluginOptions->iDelayMsg;
+ pudw.colorBack = g_plugin.bDefaultColorMsg ? 0 : g_plugin.colBackMsg;
+ pudw.colorText = g_plugin.bDefaultColorMsg ? 0 : g_plugin.colTextMsg;
+ iSeconds = g_plugin.iDelayMsg;
sampleEvent = TranslateT("This is a sample message event :-)");
break;
case EVENTTYPE_URL:
- if (!(pluginOptions->maskNotify & MASK_URL)) return 1;
+ if (!(g_plugin.maskNotify & MASK_URL)) return 1;
pudw.lchIcon = Skin_LoadIcon(SKINICON_EVENT_URL);
- pudw.colorBack = pluginOptions->bDefaultColorUrl ? 0 : pluginOptions->colBackUrl;
- pudw.colorText = pluginOptions->bDefaultColorUrl ? 0 : pluginOptions->colTextUrl;
- iSeconds = pluginOptions->iDelayUrl;
+ pudw.colorBack = g_plugin.bDefaultColorUrl ? 0 : g_plugin.colBackUrl;
+ pudw.colorText = g_plugin.bDefaultColorUrl ? 0 : g_plugin.colTextUrl;
+ iSeconds = g_plugin.iDelayUrl;
sampleEvent = TranslateT("This is a sample URL event ;-)");
break;
case EVENTTYPE_FILE:
- if (!(pluginOptions->maskNotify & MASK_FILE)) return 1;
+ if (!(g_plugin.maskNotify & MASK_FILE)) return 1;
pudw.lchIcon = Skin_LoadIcon(SKINICON_EVENT_FILE);
- pudw.colorBack = pluginOptions->bDefaultColorFile ? 0 : pluginOptions->colBackFile;
- pudw.colorText = pluginOptions->bDefaultColorFile ? 0 : pluginOptions->colTextFile;
- iSeconds = pluginOptions->iDelayFile;
+ pudw.colorBack = g_plugin.bDefaultColorFile ? 0 : g_plugin.colBackFile;
+ pudw.colorText = g_plugin.bDefaultColorFile ? 0 : g_plugin.colTextFile;
+ iSeconds = g_plugin.iDelayFile;
sampleEvent = TranslateT("This is a sample file event :-D");
break;
default:
- if (!(pluginOptions->maskNotify & MASK_OTHER)) return 1;
+ if (!(g_plugin.maskNotify & MASK_OTHER)) return 1;
pudw.lchIcon = Skin_LoadIcon(SKINICON_OTHER_MIRANDA);
- pudw.colorBack = pluginOptions->bDefaultColorOthers ? 0 : pluginOptions->colBackOthers;
- pudw.colorText = pluginOptions->bDefaultColorOthers ? 0 : pluginOptions->colTextOthers;
- iSeconds = pluginOptions->iDelayOthers;
+ pudw.colorBack = g_plugin.bDefaultColorOthers ? 0 : g_plugin.colBackOthers;
+ pudw.colorText = g_plugin.bDefaultColorOthers ? 0 : g_plugin.colTextOthers;
+ iSeconds = g_plugin.iDelayOthers;
sampleEvent = TranslateT("This is a sample other event ;-D");
break;
}
- //get DBEVENTINFO with pBlob if preview is needed (when is test then is off)
+ // get DBEVENTINFO with pBlob if preview is needed (when is test then is off)
DBEVENTINFO dbe = {};
if (hEvent) {
- if ((pluginOptions->bPreview || eventType == EVENTTYPE_ADDED || eventType == EVENTTYPE_AUTHREQUEST)) {
+ if ((g_plugin.bPreview || eventType == EVENTTYPE_ADDED || eventType == EVENTTYPE_AUTHREQUEST)) {
dbe.cbBlob = db_event_getBlobSize(hEvent);
dbe.pBlob = (PBYTE)mir_alloc(dbe.cbBlob);
}
@@ -452,10 +450,9 @@ int PopupShow(PLUGIN_OPTIONS* pluginOptions, MCONTACT hContact, MEVENT hEvent, U PLUGIN_DATA *pdata = (PLUGIN_DATA*)mir_alloc(sizeof(PLUGIN_DATA));
pdata->eventType = eventType;
pdata->hContact = hContact;
- pdata->pluginOptions = pluginOptions;
pdata->countEvent = 1;
pdata->iLock = 0;
- pdata->iSeconds = (iSeconds > 0) ? iSeconds : pluginOptions->iDelayDefault;
+ pdata->iSeconds = (iSeconds > 0) ? iSeconds : g_plugin.iDelayDefault;
pdata->firstEventData = pdata->firstShowEventData = pdata->lastEventData = eventData;
// finally create the popup
@@ -506,23 +503,23 @@ int PopupUpdate(MCONTACT hContact, MEVENT hEvent) pdata->lastEventData->hEvent = hEvent;
pdata->lastEventData->number = pdata->lastEventData->prev->number + 1;
pdata->lastEventData->next = nullptr;
- if (!pdata->pluginOptions->bShowON && pdata->countEvent > pdata->pluginOptions->iNumberMsg && pdata->pluginOptions->iNumberMsg)
+ if (!g_plugin.bShowON && pdata->countEvent > g_plugin.iNumberMsg && g_plugin.iNumberMsg)
pdata->firstShowEventData = pdata->firstShowEventData->next;
- //re-init timer delay
+ // re-init timer delay
KillTimer(pdata->hWnd, TIMER_TO_ACTION);
SetTimer(pdata->hWnd, TIMER_TO_ACTION, pdata->iSeconds * 1000, nullptr);
}
- wchar_t lpzText[MAX_SECONDLINE*2] = L"\0\0";
- if (pdata->pluginOptions->bShowHeaders)
+ wchar_t lpzText[MAX_SECONDLINE * 2] = L"\0\0";
+ if (g_plugin.bShowHeaders)
mir_snwprintf(lpzText, TranslateT("[b]Number of new message(s): %d[/b]\n"), pdata->countEvent);
- int doReverse = pdata->pluginOptions->bShowON;
+ int doReverse = g_plugin.bShowON;
if ((pdata->firstShowEventData != pdata->firstEventData && doReverse) || (pdata->firstShowEventData != pdata->lastEventData && !doReverse))
mir_snwprintf(lpzText, L"%s...\n", lpzText);
- //take the active event as starting one
+ // take the active event as starting one
EVENT_DATA_EX *eventData = pdata->firstShowEventData;
int iEvent = 0;
@@ -531,11 +528,11 @@ int PopupUpdate(MCONTACT hContact, MEVENT hEvent) eventData = (doReverse) ? eventData->next : eventData->prev;
iEvent++;
- //get DBEVENTINFO with pBlob if preview is needed (when is test then is off)
+ // get DBEVENTINFO with pBlob if preview is needed (when is test then is off)
DBEVENTINFO dbe = {};
dbe.pBlob = nullptr;
dbe.cbBlob = 0;
- if (pdata->pluginOptions->bPreview && eventData->hEvent) {
+ if (g_plugin.bPreview && eventData->hEvent) {
dbe.cbBlob = db_event_getBlobSize(eventData->hEvent);
dbe.pBlob = (PBYTE)mir_alloc(dbe.cbBlob);
}
@@ -543,12 +540,12 @@ int PopupUpdate(MCONTACT hContact, MEVENT hEvent) if (eventData->hEvent)
db_event_get(eventData->hEvent, &dbe);
- if (pdata->pluginOptions->bShowDate || pdata->pluginOptions->bShowTime) {
+ if (g_plugin.bShowDate || g_plugin.bShowTime) {
wchar_t timestamp[MAX_DATASIZE];
wchar_t formatTime[MAX_DATASIZE];
- if (pdata->pluginOptions->bShowDate)
+ if (g_plugin.bShowDate)
wcsncpy(formatTime, L"%Y.%m.%d", _countof(formatTime));
- else if (pdata->pluginOptions->bShowTime)
+ else if (g_plugin.bShowTime)
mir_wstrncat(formatTime, L" %H:%M", _countof(formatTime) - mir_wstrlen(formatTime));
time_t localTime = dbe.timestamp;
wcsftime(timestamp, _countof(timestamp), formatTime, localtime(&localTime));
@@ -559,14 +556,14 @@ int PopupUpdate(MCONTACT hContact, MEVENT hEvent) wchar_t* szEventPreview = GetEventPreview(&dbe);
mir_snwprintf(lpzText, L"%s%s", lpzText, szEventPreview);
mir_free(szEventPreview);
-
+
if (dbe.pBlob)
mir_free(dbe.pBlob);
if (doReverse) {
- if ((iEvent >= pdata->pluginOptions->iNumberMsg && pdata->pluginOptions->iNumberMsg) || !eventData->next)
+ if ((iEvent >= g_plugin.iNumberMsg && g_plugin.iNumberMsg) || !eventData->next)
break;
}
- else if ((iEvent >= pdata->pluginOptions->iNumberMsg && pdata->pluginOptions->iNumberMsg) || !eventData->prev)
+ else if ((iEvent >= g_plugin.iNumberMsg && g_plugin.iNumberMsg) || !eventData->prev)
break;
mir_snwprintf(lpzText, L"%s\n", lpzText);
@@ -579,11 +576,11 @@ int PopupUpdate(MCONTACT hContact, MEVENT hEvent) return 0;
}
-int PopupPreview(PLUGIN_OPTIONS* pluginOptions)
+int PopupPreview()
{
- PopupShow(pluginOptions, NULL, NULL, EVENTTYPE_MESSAGE);
- PopupShow(pluginOptions, NULL, NULL, EVENTTYPE_URL);
- PopupShow(pluginOptions, NULL, NULL, EVENTTYPE_FILE);
- PopupShow(pluginOptions, NULL, NULL, -1);
+ PopupShow(0, 0, EVENTTYPE_MESSAGE);
+ PopupShow(0, 0, EVENTTYPE_URL);
+ PopupShow(0, 0, EVENTTYPE_FILE);
+ PopupShow(0, 0, -1);
return 0;
}
diff --git a/plugins/NewEventNotify/src/stdafx.h b/plugins/NewEventNotify/src/stdafx.h index daaff09e99..249bbb3607 100644 --- a/plugins/NewEventNotify/src/stdafx.h +++ b/plugins/NewEventNotify/src/stdafx.h @@ -1,25 +1,25 @@ /*
- Name: NewEventNotify - Plugin for Miranda IM
- File: neweventnotify.h - Main Header File
- Version: 0.2.2.2
- Description: Notifies you about some events
- Author: icebreaker, <icebreaker@newmail.net>
- Date: 18.07.02 13:59 / Update: 16.09.02 17:45
- Copyright: (C) 2002 Starzinger Michael
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Name: NewEventNotify - Plugin for Miranda IM
+ File: neweventnotify.h - Main Header File
+ Version: 0.2.2.2
+ Description: Notifies you about some events
+ Author: icebreaker, <icebreaker@newmail.net>
+ Date: 18.07.02 13:59 / Update: 16.09.02 17:45
+ Copyright: (C) 2002 Starzinger Michael
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#pragma once
@@ -153,10 +153,10 @@ struct CMPlugin : public PLUGIN<CMPlugin> CMPlugin();
int Load() override;
-};
-struct PLUGIN_OPTIONS
-{
+ void OptionsRead(void);
+ void OptionsWrite(void);
+
BOOL bDisable;
BOOL bPreview;
BOOL bMenuitem;
@@ -187,11 +187,11 @@ struct PLUGIN_OPTIONS BOOL bShowDate;
BOOL bShowTime;
BOOL bShowHeaders;
- BYTE iNumberMsg;
BOOL bShowON;
BOOL bHideSend;
BOOL bNoRSS;
BOOL bReadCheck;
+ BYTE iNumberMsg;
};
struct EVENT_DATA_EX
@@ -206,7 +206,6 @@ struct PLUGIN_DATA {
UINT eventType;
MCONTACT hContact;
- PLUGIN_OPTIONS* pluginOptions;
HWND hWnd;
struct EVENT_DATA_EX* firstEventData;
struct EVENT_DATA_EX* firstShowEventData;
@@ -219,12 +218,11 @@ struct PLUGIN_DATA //---------------------------
//---External Procedure Definitions
-int PopupShow(PLUGIN_OPTIONS* pluginOptions, MCONTACT hContact, MEVENT hEvent, UINT eventType);
+int PopupShow(MCONTACT hContact, MEVENT hEvent, UINT eventType);
int PopupUpdate(MCONTACT hContact, MEVENT hEvent);
-int PopupPreview(PLUGIN_OPTIONS* pluginOptions);
-int PopupAct(HWND hWnd, UINT mask, PLUGIN_DATA* pdata);
-int OptionsInit(PLUGIN_OPTIONS* pluginOptions);
-int OptionsAdd(HINSTANCE hInst, WPARAM addInfo);
+int PopupPreview();
+int PopupAct(HWND hWnd, UINT mask, PLUGIN_DATA *pdata);
+int OptionsAdd(WPARAM addInfo, LPARAM);
int Opt_DisableNEN(BOOL Status);
int MenuitemInit(BOOL bStatus);
int MenuitemUpdate(BOOL bStatus);
diff --git a/plugins/NewEventNotify/src/version.h b/plugins/NewEventNotify/src/version.h index 908b73fc10..c395bd7ba5 100644 --- a/plugins/NewEventNotify/src/version.h +++ b/plugins/NewEventNotify/src/version.h @@ -1,13 +1,13 @@ -#define __MAJOR_VERSION 0 -#define __MINOR_VERSION 2 +#define __MAJOR_VERSION 0 +#define __MINOR_VERSION 2 #define __RELEASE_NUM 2 -#define __BUILD_NUM 3 +#define __BUILD_NUM 4 #include <stdver.h> #define __PLUGIN_NAME "NewEventNotify" #define __FILENAME "NewEventNotify.dll" -#define __DESCRIPTION "Notifies you when you receive a message, URL, file or any other event by displaying a popup." -#define __AUTHOR "icebreaker, Prezes, vj, vlko, Joe @ Whale" -#define __AUTHORWEB "https://miranda-ng.org/p/NewEventNotify/" -#define __COPYRIGHT "" +#define __DESCRIPTION "Notifies you when you receive a message, URL, file or any other event by displaying a popup." +#define __AUTHOR "icebreaker, Prezes, vj, vlko, Joe @ Whale" +#define __AUTHORWEB "https://miranda-ng.org/p/NewEventNotify/" +#define __COPYRIGHT "" |