summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-02-09 19:57:44 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-02-09 19:57:44 +0300
commit819d4cd22fc5e6f8c3e8497c64346c13d76f04ad (patch)
tree37dbad1767e7f21d84234d92e2251c62cf015304 /plugins
parenta43d5bcb1e0bdafb0193662168976aac989ed922 (diff)
fixes #1950 (Remove notification engine from TabSRMM)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/NewEventNotify/src/main.cpp6
-rw-r--r--plugins/NewEventNotify/src/options.cpp42
-rw-r--r--plugins/NewEventNotify/src/popup.cpp154
-rw-r--r--plugins/NewEventNotify/src/stdafx.h52
-rw-r--r--plugins/TabSRMM/src/chat_tools.cpp23
-rw-r--r--plugins/TabSRMM/src/container.cpp4
-rw-r--r--plugins/TabSRMM/src/containeroptions.cpp12
-rw-r--r--plugins/TabSRMM/src/controls.cpp2
-rw-r--r--plugins/TabSRMM/src/eventpopups.cpp746
-rw-r--r--plugins/TabSRMM/src/functions.h8
-rw-r--r--plugins/TabSRMM/src/generic_msghandlers.cpp7
-rw-r--r--plugins/TabSRMM/src/globals.cpp1
-rw-r--r--plugins/TabSRMM/src/mim.cpp11
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp12
-rw-r--r--plugins/TabSRMM/src/msgdlgother.cpp23
-rw-r--r--plugins/TabSRMM/src/msgoptions.cpp3
-rw-r--r--plugins/TabSRMM/src/msgs.cpp8
-rw-r--r--plugins/TabSRMM/src/nen.h117
-rw-r--r--plugins/TabSRMM/src/sendlater.cpp6
-rw-r--r--plugins/TabSRMM/src/sendqueue.cpp4
-rw-r--r--plugins/TabSRMM/src/stdafx.h2
-rw-r--r--plugins/TabSRMM/src/utils.cpp2
-rw-r--r--plugins/TabSRMM/src/version.h4
23 files changed, 216 insertions, 1033 deletions
diff --git a/plugins/NewEventNotify/src/main.cpp b/plugins/NewEventNotify/src/main.cpp
index 2897ceca63..0d164e9d7f 100644
--- a/plugins/NewEventNotify/src/main.cpp
+++ b/plugins/NewEventNotify/src/main.cpp
@@ -24,8 +24,6 @@
#include "stdafx.h"
-extern PLUGIN_DATA* PopupList[20];
-
//---------------------------
//---Some global variables for the plugin
@@ -86,8 +84,8 @@ int HookedNewEvent(WPARAM hContact, LPARAM hDbEvent)
if (dbe.flags & DBEF_SENT) {
// JK, only message event, do not influence others
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)
+ if (auto *pdata = PU_GetByContact(hContact, EVENTTYPE_MESSAGE))
+ PopupAct(pdata->hWnd, MASK_DISMISS, pdata); // JK, only dismiss, i.e. do not kill event (e.g. file transfer)
}
return 0;
}
diff --git a/plugins/NewEventNotify/src/options.cpp b/plugins/NewEventNotify/src/options.cpp
index 9bb9d51fdb..d004a1cfb7 100644
--- a/plugins/NewEventNotify/src/options.cpp
+++ b/plugins/NewEventNotify/src/options.cpp
@@ -28,42 +28,49 @@ BOOL bWmNotify;
void CMPlugin::OptionsRead(void)
{
- bDisable = getByte(OPT_DISABLE, FALSE);
- bPreview = getByte(OPT_PREVIEW, TRUE);
- bMenuitem = getByte(OPT_MENUITEM, FALSE);
- bDefaultColorMsg = getByte(OPT_COLDEFAULT_MESSAGE, FALSE);
- bDefaultColorFile = getByte(OPT_COLDEFAULT_FILE, FALSE);
- bDefaultColorOthers = getByte(OPT_COLDEFAULT_OTHERS, FALSE);
+ bDisable = getBool(OPT_DISABLE, false);
+ bMUCDisable = getBool(OPT_MUCDISABLE, false);
+
+ bPreview = getBool(OPT_PREVIEW, true);
+ bMenuitem = getBool(OPT_MENUITEM, false);
+ bMergePopup = getBool(OPT_MERGEPOPUP, true);
+ bMsgWindowCheck = getBool(OPT_MSGWINDOWCHECK, true);
+ bMsgReplyWindow = getBool(OPT_MSGREPLYWINDOW, false);
+ bDefaultColorMsg = getBool(OPT_COLDEFAULT_MESSAGE, false);
+ bDefaultColorFile = getBool(OPT_COLDEFAULT_FILE, false);
+ bDefaultColorOthers = getBool(OPT_COLDEFAULT_OTHERS, false);
+
colBackMsg = getDword(OPT_COLBACK_MESSAGE, DEFAULT_COLBACK);
colTextMsg = getDword(OPT_COLTEXT_MESSAGE, 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);
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);
+
+ bShowDate = getBool(OPT_SHOW_DATE, true);
+ bShowTime = getBool(OPT_SHOW_TIME, true);
+ bShowHeaders = getBool(OPT_SHOW_HEADERS, false);
+ iNumberMsg = getByte(OPT_NUMBER_MSG, 1);
+ bShowON = getBool(OPT_SHOW_ON, true);
+ bHideSend = getBool(OPT_HIDESEND, true);
+ bNoRSS = getBool(OPT_NORSS, false);
+ bReadCheck = getBool(OPT_READCHECK, false);
}
void CMPlugin::OptionsWrite(void)
{
setByte(OPT_DISABLE, bDisable);
+ setByte(OPT_MUCDISABLE, bMUCDisable);
setByte(OPT_PREVIEW, bPreview);
setByte(OPT_MENUITEM, bMenuitem);
setByte(OPT_COLDEFAULT_MESSAGE, bDefaultColorMsg);
@@ -75,6 +82,7 @@ void CMPlugin::OptionsWrite(void)
setDword(OPT_COLTEXT_FILE, colTextFile);
setDword(OPT_COLBACK_OTHERS, colBackOthers);
setDword(OPT_COLTEXT_OTHERS, colTextOthers);
+ setDword(OPT_LIMITPREVIEW, iLimitPreview);
setByte(OPT_MASKNOTIFY, (uint8_t)maskNotify);
setByte(OPT_MASKACTL, (uint8_t)maskActL);
setByte(OPT_MASKACTR, (uint8_t)maskActR);
diff --git a/plugins/NewEventNotify/src/popup.cpp b/plugins/NewEventNotify/src/popup.cpp
index 6fdb090a42..71bb4a55f5 100644
--- a/plugins/NewEventNotify/src/popup.cpp
+++ b/plugins/NewEventNotify/src/popup.cpp
@@ -26,35 +26,29 @@
extern int g_IsServiceAvail;
-static int PopupCount = 0;
+static LIST<PLUGIN_DATA> arPopupList(10, NumericKeySortT);
-PLUGIN_DATA* PopupList[MAX_POPUPS];
-
-int NumberPopupData(MCONTACT hContact, int eventType)
+PLUGIN_DATA* PU_GetByContact(MCONTACT hContact, UINT eventType)
{
- for (int n = 0; n < MAX_POPUPS; n++) {
- if (!PopupList[n] && !hContact && eventType == -1)
- return n;
+ for (auto &it : arPopupList)
+ if (it->hContact == hContact && (eventType == -1 || it->eventType == (UINT)eventType))
+ return it;
- if (PopupList[n] && (PopupList[n]->hContact == hContact) && (PopupList[n]->iLock == 0) && (eventType == -1 || PopupList[n]->eventType == (UINT)eventType))
- return n;
- }
- return -1;
+ return nullptr;
}
-static int FindPopupData(PLUGIN_DATA* pdata)
+int NumberPopupData(MCONTACT hContact, UINT eventType)
{
- for (int n = 0; n < MAX_POPUPS; n++)
- if (PopupList[n] == pdata)
- return n;
+ for (auto &it : arPopupList)
+ if (it->hContact == hContact && (eventType == -1 || it->eventType == (UINT)eventType))
+ return arPopupList.indexOf(&it);
return -1;
}
-static void FreePopupEventData(PLUGIN_DATA* pdata)
+static void FreePopupEventData(PLUGIN_DATA *pdata)
{
- pdata->iLock = 1;
- EVENT_DATA_EX* eventData = pdata->firstEventData;
+ EVENT_DATA_EX *eventData = pdata->firstEventData;
while (eventData) {
if (eventData->next) {
eventData = eventData->next;
@@ -66,19 +60,26 @@ static void FreePopupEventData(PLUGIN_DATA* pdata)
eventData = nullptr;
}
}
- pdata->lastEventData = pdata->firstEventData = pdata->firstShowEventData = nullptr;
- // remove from popup list if present
- if (FindPopupData(pdata) != -1)
- PopupList[FindPopupData(pdata)] = nullptr;
}
-int PopupAct(HWND hWnd, UINT mask, PLUGIN_DATA* pdata)
+static void DoDefaultHandling(PLUGIN_DATA *pdata)
+{
+ if (pdata->hContact == 0)
+ return;
+
+ auto *pDlg = Srmm_FindDialog(pdata->hContact);
+ if (pDlg && IsWindow(pDlg->GetHwnd()))
+ CallService(MS_MSG_SENDMESSAGE, pdata->hContact, 0);
+ else
+ Clist_ContactDoubleClicked(pdata->hContact);
+}
+
+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 (g_plugin.bMsgReplyWindow && pdata->eventType == EVENTTYPE_MESSAGE)
- CallServiceSync(MS_MSG_SENDMESSAGE, (WPARAM)pdata->hContact, 0); // JK, use core (since 0.3.3+)
+ DoDefaultHandling(pdata);
else {
EVENT_DATA_EX *eventData = pdata->firstEventData;
if (eventData == nullptr)
@@ -86,8 +87,10 @@ int PopupAct(HWND hWnd, UINT mask, PLUGIN_DATA* pdata)
for (int idx = 0;; idx++) {
CLISTEVENT *cle = g_clistApi.pfnGetEvent(pdata->hContact, idx);
- if (cle == nullptr)
+ if (cle == nullptr) {
+ DoDefaultHandling(pdata);
break;
+ }
if (cle->hDbEvent == eventData->hEvent) {
if (ServiceExists(cle->pszService))
@@ -102,7 +105,6 @@ int PopupAct(HWND hWnd, UINT mask, PLUGIN_DATA* pdata)
if (mask & MASK_REMOVE) {
if (pdata) {
EVENT_DATA_EX *eventData = pdata->firstEventData;
- pdata->iLock = 1;
while (eventData) {
g_clistApi.pfnRemoveEvent(pdata->hContact, eventData->hEvent);
db_event_markRead(pdata->hContact, eventData->hEvent);
@@ -123,10 +125,12 @@ int PopupAct(HWND hWnd, UINT mask, PLUGIN_DATA* pdata)
static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- PLUGIN_DATA *pdata = (PLUGIN_DATA*)PUGetPluginData(hWnd);
+ auto *pdata = (PLUGIN_DATA*)PUGetPluginData(hWnd);
if (pdata == nullptr)
return FALSE;
+ RECT rc;
+ POINT pt;
switch (message) {
case WM_COMMAND:
PopupAct(hWnd, g_plugin.maskActL, pdata);
@@ -135,12 +139,12 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA
PopupAct(hWnd, g_plugin.maskActR, pdata);
break;
case UM_FREEPLUGINDATA:
- PopupCount--;
mir_free(pdata);
return TRUE;
case UM_INITPOPUP:
pdata->hWnd = hWnd;
- SetTimer(hWnd, TIMER_TO_ACTION, pdata->iSeconds * 1000, nullptr);
+ if (pdata->iSeconds > 0)
+ SetTimer(hWnd, TIMER_TO_ACTION, pdata->iSeconds * 1000, nullptr);
break;
case WM_MOUSEWHEEL:
if ((short)HIWORD(wParam) > 0 && pdata->firstShowEventData->prev &&
@@ -160,43 +164,70 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA
case WM_TIMER:
if (wParam != TIMER_TO_ACTION)
break;
+
+ GetCursorPos(&pt);
+ GetWindowRect(hWnd, &rc);
+ if (PtInRect(&rc, pt))
+ break;
+
+ if (pdata->iSeconds > 0)
+ KillTimer(hWnd, TIMER_TO_ACTION);
PopupAct(hWnd, g_plugin.maskActTE, pdata);
break;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static wchar_t *ShortenPreview(DBEVENTINFO *dbe)
+{
+ bool fAddEllipsis = false;
+ size_t iPreviewLimit = g_plugin.iLimitPreview;
+ if (iPreviewLimit > 500 || iPreviewLimit == 0)
+ iPreviewLimit = 500;
+
+ wchar_t *buf = DbEvent_GetTextW(dbe, CP_ACP);
+ if (mir_wstrlen(buf) > iPreviewLimit) {
+ fAddEllipsis = true;
+ size_t iIndex = iPreviewLimit;
+ size_t iWordThreshold = 20;
+ while (iIndex && buf[iIndex] != ' ' && iWordThreshold--)
+ buf[iIndex--] = 0;
+
+ buf[iIndex] = 0;
+ }
+ if (fAddEllipsis) {
+ buf = (wchar_t *)mir_realloc(buf, (mir_wstrlen(buf) + 5) * sizeof(wchar_t));
+ mir_wstrcat(buf, L"...");
+ }
+ return buf;
+}
+
static wchar_t* GetEventPreview(DBEVENTINFO *dbei)
{
wchar_t *comment1 = nullptr;
wchar_t *comment2 = nullptr;
char *commentFix = nullptr;
+ char *pBlob = (char *)dbei->pBlob;
// now get text
switch (dbei->eventType) {
case EVENTTYPE_MESSAGE:
- 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)) {
- // wchar in blob (the old hack)
- comment1 = mir_wstrdup((wchar_t*)dbei->pBlob);
- }
- else comment1 = mir_a2u((char *)dbei->pBlob);
- }
+ if (pBlob)
+ comment1 = ShortenPreview(dbei);
commentFix = POPUP_COMMENT_MESSAGE;
break;
case EVENTTYPE_FILE:
- if (dbei->pBlob) {
- char *p = (char*)dbei->pBlob + sizeof(uint32_t);
+ if (pBlob) {
+ char *p = pBlob + sizeof(uint32_t);
// filenames
- comment2 = (dbei->flags & DBEF_UTF) ? mir_utf8decodeW(p) : mir_a2u(p);
- p += mir_strlen(p) + 1;
+ comment2 = DbEvent_GetString(dbei, p);
// description
- comment1 = (dbei->flags & DBEF_UTF) ? mir_utf8decodeW(p) : mir_a2u(p);
+ p += mir_strlen(p) + 1;
+ if (*p)
+ comment1 = DbEvent_GetString(dbei, p);
}
commentFix = POPUP_COMMENT_FILE;
break;
@@ -205,10 +236,10 @@ static wchar_t* GetEventPreview(DBEVENTINFO *dbei)
// blob format is:
// ASCIIZ nick
// ASCIIZ UID
- if (dbei->pBlob) {
+ if (pBlob) {
// count contacts in event
- char* pcBlob = (char *)dbei->pBlob;
- char* pcEnd = (char *)(dbei->pBlob + dbei->cbBlob);
+ char* pcBlob = pBlob;
+ char* pcEnd = pBlob + dbei->cbBlob;
int nContacts;
wchar_t szBuf[512];
@@ -235,16 +266,16 @@ static wchar_t* GetEventPreview(DBEVENTINFO *dbei)
// ASCIIZ first name
// ASCIIZ last name
// ASCIIZ email (or YID)
- if (dbei->pBlob) {
+ if (pBlob) {
char szUin[16];
wchar_t szBuf[2048];
wchar_t* szNick = nullptr;
- char *pszNick = (char *)dbei->pBlob + 8;
+ char *pszNick = pBlob + 8;
char *pszFirst = pszNick + mir_strlen(pszNick) + 1;
char *pszLast = pszFirst + mir_strlen(pszFirst) + 1;
char *pszEmail = pszLast + mir_strlen(pszLast) + 1;
- mir_snprintf(szUin, "%d", *((uint32_t*)dbei->pBlob));
+ mir_snprintf(szUin, "%d", *((uint32_t*)pBlob));
if (mir_strlen(pszNick) > 0) {
if (dbei->flags & DBEF_UTF)
szNick = mir_utf8decodeW(pszNick);
@@ -257,7 +288,7 @@ static wchar_t* GetEventPreview(DBEVENTINFO *dbei)
else
szNick = mir_a2u(pszEmail);
}
- else if (*((uint32_t*)dbei->pBlob) > 0)
+ else if (*((uint32_t*)pBlob) > 0)
szNick = mir_a2u(szUin);
if (szNick) {
@@ -271,7 +302,7 @@ static wchar_t* GetEventPreview(DBEVENTINFO *dbei)
break;
case EVENTTYPE_AUTHREQUEST:
- if (dbei->pBlob) {
+ if (pBlob) {
DB::AUTH_BLOB blob(dbei->pBlob);
wchar_t *szNick = nullptr;
@@ -293,7 +324,7 @@ static wchar_t* GetEventPreview(DBEVENTINFO *dbei)
default:
DBEVENTTYPEDESCR *pei = DbEvent_GetType(dbei->szModule, dbei->eventType);
// support for custom database event types
- if (pei && dbei->pBlob) {
+ if (pBlob) {
comment1 = DbEvent_GetTextW(dbei, CP_ACP);
commentFix = pei->descr;
}
@@ -318,10 +349,6 @@ int PopupShow(MCONTACT hContact, MEVENT hEvent, UINT eventType)
wchar_t *sampleEvent;
long iSeconds;
- // 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
@@ -380,7 +407,6 @@ int PopupShow(MCONTACT hContact, MEVENT hEvent, UINT eventType)
pdata->eventType = eventType;
pdata->hContact = hContact;
pdata->countEvent = 1;
- pdata->iLock = 0;
pdata->iSeconds = (iSeconds > 0) ? iSeconds : g_plugin.iDelayDefault;
pdata->firstEventData = pdata->firstShowEventData = pdata->lastEventData = eventData;
@@ -399,13 +425,11 @@ int PopupShow(MCONTACT hContact, MEVENT hEvent, UINT eventType)
wcsncpy(pudw.lpwzText, ptrW(GetEventPreview(&dbe)), MAX_SECONDLINE);
}
- PopupCount++;
+ arPopupList.insert(pdata);
- PopupList[NumberPopupData(NULL, -1)] = pdata;
// send data to popup plugin
-
- // popup creation failed, release popupdata
if (PUAddPopupW(&pudw) < 0) {
+ // popup creation failed, release popupdata
FreePopupEventData(pdata);
mir_free(pdata);
}
@@ -417,7 +441,7 @@ int PopupShow(MCONTACT hContact, MEVENT hEvent, UINT eventType)
int PopupUpdate(MCONTACT hContact, MEVENT hEvent)
{
// merge only message popups
- PLUGIN_DATA *pdata = (PLUGIN_DATA*)PopupList[NumberPopupData(hContact, EVENTTYPE_MESSAGE)];
+ PLUGIN_DATA *pdata = arPopupList[NumberPopupData(hContact, EVENTTYPE_MESSAGE)];
if (hEvent) {
pdata->countEvent++;
diff --git a/plugins/NewEventNotify/src/stdafx.h b/plugins/NewEventNotify/src/stdafx.h
index 1938092f4c..9ef71031b2 100644
--- a/plugins/NewEventNotify/src/stdafx.h
+++ b/plugins/NewEventNotify/src/stdafx.h
@@ -37,6 +37,7 @@
#include <m_langpack.h>
#include <m_popup.h>
#include <m_skin.h>
+#include <m_srmm_int.h>
#include <m_clistint.h>
#include <m_protosvc.h>
#include <m_message.h>
@@ -55,7 +56,6 @@
//---Definitions
#define MODULENAME "NewEventNotify"
-#define MAX_POPUPS 20
#define DEFAULT_COLBACK RGB(255,255,128)
#define DEFAULT_COLTEXT RGB(0,0,0)
@@ -86,8 +86,10 @@
//Entries in the database, don't translate
#define OPT_DISABLE "Disabled"
+#define OPT_MUCDISABLE "MUCDisabled"
#define OPT_PREVIEW "Preview"
#define OPT_MENUITEM "MenuItem"
+#define OPT_LIMITPREVIEW "LimitPreview"
#define OPT_COLDEFAULT_MESSAGE "DefaultColorMsg"
#define OPT_COLBACK_MESSAGE "ColorBackMsg"
#define OPT_COLTEXT_MESSAGE "ColorTextMsg"
@@ -143,36 +145,45 @@ struct CMPlugin : public PLUGIN<CMPlugin>
void OptionsRead(void);
void OptionsWrite(void);
- BOOL bDisable;
- BOOL bPreview;
- BOOL bMenuitem;
- BOOL bDefaultColorMsg;
- BOOL bDefaultColorFile;
- BOOL bDefaultColorOthers;
+ bool bDisable;
+ bool bMUCDisable;
+ bool bPreview;
+ bool bMenuitem;
+ bool bDefaultColorMsg;
+ bool bDefaultColorFile;
+ bool bDefaultColorOthers;
+ bool bDisableNonMessage;
+ bool bMsgWindowCheck;
+ bool bMsgReplyWindow;
+ bool bMergePopup;
+ bool bShowDate;
+ bool bShowTime;
+ bool bShowHeaders;
+ bool bShowON;
+ bool bHideSend;
+ bool bNoRSS;
+ bool iNoSounds;
+ bool bReadCheck;
+ bool bWindowCheck;
+
COLORREF colBackMsg;
COLORREF colTextMsg;
COLORREF colBackFile;
COLORREF colTextFile;
COLORREF colBackOthers;
COLORREF colTextOthers;
+
UINT maskNotify;
UINT maskActL;
UINT maskActR;
UINT maskActTE;
- BOOL bMsgWindowCheck;
- BOOL bMsgReplyWindow;
+
int iDelayMsg;
int iDelayFile;
int iDelayOthers;
int iDelayDefault;
- BOOL bMergePopup;
- BOOL bShowDate;
- BOOL bShowTime;
- BOOL bShowHeaders;
- BOOL bShowON;
- BOOL bHideSend;
- BOOL bNoRSS;
- BOOL bReadCheck;
+ int iLimitPreview;
+
uint8_t iNumberMsg;
};
@@ -186,15 +197,14 @@ struct EVENT_DATA_EX
struct PLUGIN_DATA
{
- UINT eventType;
MCONTACT hContact;
+ UINT eventType;
HWND hWnd;
struct EVENT_DATA_EX* firstEventData;
struct EVENT_DATA_EX* firstShowEventData;
struct EVENT_DATA_EX* lastEventData;
long countEvent;
long iSeconds;
- int iLock;
};
//---------------------------
@@ -208,5 +218,7 @@ int OptionsAdd(WPARAM addInfo, LPARAM);
int Opt_DisableNEN(BOOL Status);
int MenuitemInit(BOOL bStatus);
int MenuitemUpdate(BOOL bStatus);
-int NumberPopupData(MCONTACT hContact, int eventType);
+int NumberPopupData(MCONTACT hContact, UINT eventType);
int CheckMsgWnd(MCONTACT hContact);
+
+PLUGIN_DATA* PU_GetByContact(MCONTACT hContact, UINT eventType);
diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp
index 9a5652cd4f..d65fc14b60 100644
--- a/plugins/TabSRMM/src/chat_tools.cpp
+++ b/plugins/TabSRMM/src/chat_tools.cpp
@@ -55,7 +55,7 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA
case WM_COMMAND:
if (HIWORD(wParam) == STN_CLICKED) {
if (si) {
- if (nen_options.maskActL & MASK_OPEN)
+ if (NEN::ActionLeft & MASK_OPEN)
CallFunctionAsync(ShowRoomFromPopup, si);
else
CallFunctionAsync(Chat_DismissPopup, si);
@@ -67,7 +67,7 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA
case WM_CONTEXTMENU:
if (si && si->hContact) {
- if (nen_options.maskActR & MASK_OPEN)
+ if (NEN::ActionRight & MASK_OPEN)
CallFunctionAsync(ShowRoomFromPopup, si);
else
CallFunctionAsync(Chat_DismissPopup, si);
@@ -145,20 +145,19 @@ BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce)
}
else bbStart = bbEnd = L"";
- if (nen_options.iMUCDisable) // no popups at all. Period
+ if (NEN::bMUCDisabled) // no popups at all. Period
return 0;
// check the status mode against the status mask
char *szProto = dat ? dat->m_szProto : si->pszModule;
- if (nen_options.dwStatusMask != -1) {
- if (szProto != nullptr) {
- int dwStatus = Proto_GetStatus(szProto);
- if (!(dwStatus == 0 || dwStatus <= ID_STATUS_OFFLINE || ((1 << (dwStatus - ID_STATUS_ONLINE)) & nen_options.dwStatusMask))) // should never happen, but...
- return 0;
- }
+ if (szProto != nullptr) {
+ int dwStatus = Proto_GetStatus(szProto);
+ if (!(dwStatus == 0 || dwStatus <= ID_STATUS_OFFLINE))
+ return 0;
}
+
if (dat && pContainer != nullptr) { // message window is open, need to check the container config if we want to see a popup nonetheless
- if (nen_options.bWindowCheck) { // no popups at all for open windows... no exceptions
+ if (NEN::bWindowCheck) { // no popups at all for open windows... no exceptions
if (!PluginConfig.m_bHideOnClose)
return 0;
if (pContainer->m_bHidden)
@@ -225,7 +224,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight
DoTrayIcon(si, gce);
}
- if (dat || !nen_options.iMUCDisable)
+ if (dat || !NEN::bMUCDisabled)
if (iMuteMode != CHATMODE_MUTE)
DoPopup(si, gce);
@@ -255,7 +254,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight
// stupid thing to not create multiple popups for a QUIT event for instance
if (bManyFix == 0) {
// do popups
- if (dat || !nen_options.iMUCDisable)
+ if (dat || !NEN::bMUCDisabled)
if (iMuteMode != CHATMODE_MUTE)
DoPopup(si, gce);
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp
index fbce4c4a19..7ed0e0d687 100644
--- a/plugins/TabSRMM/src/container.cpp
+++ b/plugins/TabSRMM/src/container.cpp
@@ -2239,7 +2239,7 @@ void TSAPI AutoCreateWindow(MCONTACT hContact, MEVENT hDbEvent)
if (szProto) {
int dwStatus = Proto_GetStatus(szProto);
- if (dwStatus == 0 || dwStatus <= ID_STATUS_OFFLINE || ((1 << (dwStatus - ID_STATUS_ONLINE)) & dwStatusMask)) // should never happen, but...
+ if (dwStatus == 0 || dwStatus <= ID_STATUS_OFFLINE)
bAllowAutoCreate = true;
}
}
@@ -2287,8 +2287,6 @@ void TSAPI AutoCreateWindow(MCONTACT hContact, MEVENT hDbEvent)
cle.pszService = MS_MSG_READMESSAGE;
cle.szTooltip.w = toolTip;
g_clistApi.pfnAddEvent(&cle);
-
- tabSRMM_ShowPopup(hContact, hDbEvent, dbei.eventType, 0, nullptr, nullptr, dbei.szModule);
}
}
diff --git a/plugins/TabSRMM/src/containeroptions.cpp b/plugins/TabSRMM/src/containeroptions.cpp
index 6ed5bc790e..959818fc10 100644
--- a/plugins/TabSRMM/src/containeroptions.cpp
+++ b/plugins/TabSRMM/src/containeroptions.cpp
@@ -101,7 +101,7 @@ static void ShowPage(HWND hwndDlg, int iPage, BOOL fShow)
else
SetDlgItemText(hwndDlg, IDC_DESC, L"");
}
- Utils::showDlgControl(hwndDlg, IDC_O_EXPLAINGLOBALNOTIFY, (iPage == 3 && nen_options.bWindowCheck) ? SW_SHOW : SW_HIDE);
+ Utils::showDlgControl(hwndDlg, IDC_O_EXPLAINGLOBALNOTIFY, (iPage == 3 && NEN::bWindowCheck) ? SW_SHOW : SW_HIDE);
if (iPage == 8 && !IsWinVer7Plus())
Utils::showDlgControl(hwndDlg, IDC_AVATARSONTASKBAR, SW_HIDE);
@@ -415,15 +415,15 @@ do_apply: Utils::enableDlgControl(hwndDlg, IDC_APPLY, true);
SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_ACTIVE, TBM_SETPOS, TRUE, (LPARAM)LOWORD(dwTransparency));
SendDlgItemMessage(hwndDlg, IDC_TRANSPARENCY_INACTIVE, TBM_SETPOS, TRUE, (LPARAM)HIWORD(dwTransparency));
- Utils::enableDlgControl(hwndDlg, IDC_O_DONTREPORT, !nen_options.bWindowCheck);
- Utils::enableDlgControl(hwndDlg, IDC_DONTREPORTUNFOCUSED2, !nen_options.bWindowCheck);
- Utils::enableDlgControl(hwndDlg, IDC_DONTREPORTFOCUSED2, !nen_options.bWindowCheck);
- Utils::enableDlgControl(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE, !nen_options.bWindowCheck);
+ Utils::enableDlgControl(hwndDlg, IDC_O_DONTREPORT, !NEN::bWindowCheck);
+ Utils::enableDlgControl(hwndDlg, IDC_DONTREPORTUNFOCUSED2, !NEN::bWindowCheck);
+ Utils::enableDlgControl(hwndDlg, IDC_DONTREPORTFOCUSED2, !NEN::bWindowCheck);
+ Utils::enableDlgControl(hwndDlg, IDC_ALWAYSPOPUPSINACTIVE, !NEN::bWindowCheck);
SendDlgItemMessage(hwndDlg, IDC_AVATARMODE, CB_SETCURSEL, (WPARAM)cs->avatarMode, 0);
SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_SETCURSEL, (WPARAM)cs->ownAvatarMode, 0);
- Utils::showDlgControl(hwndDlg, IDC_O_EXPLAINGLOBALNOTIFY, nen_options.bWindowCheck ? SW_SHOW : SW_HIDE);
+ Utils::showDlgControl(hwndDlg, IDC_O_EXPLAINGLOBALNOTIFY, NEN::bWindowCheck ? SW_SHOW : SW_HIDE);
SendDlgItemMessage(hwndDlg, IDC_AUTOCLOSETABSPIN, UDM_SETRANGE, 0, MAKELONG(1000, 0));
SendDlgItemMessage(hwndDlg, IDC_AUTOCLOSETABSPIN, UDM_SETPOS, 0, (LPARAM)cs->autoCloseSeconds);
diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp
index ec93e0dc85..e2cfc1d90f 100644
--- a/plugins/TabSRMM/src/controls.cpp
+++ b/plugins/TabSRMM/src/controls.cpp
@@ -461,7 +461,7 @@ void CMenuBar::updateState(const HMENU hMenu) const
MY_CheckMenu(hMenu, ID_VIEW_SHOWMULTISENDCONTACTLIST, dat->m_sendMode & SMODE_MULTIPLE);
MY_CheckMenu(hMenu, ID_VIEW_STAYONTOP, f.m_bSticky);
- ::EnableMenuItem(hMenu, 2, MF_BYPOSITION | (nen_options.bWindowCheck ? MF_GRAYED : MF_ENABLED));
+ ::EnableMenuItem(hMenu, 2, MF_BYPOSITION | (NEN::bWindowCheck ? MF_GRAYED : MF_ENABLED));
MY_CheckMenu(hMenu, ID_EVENTPOPUPS_DISABLEALLEVENTPOPUPS, !f.m_bDontReport && !f.m_bDontReportUnfocused && !f.m_bDontReportFocused && !f.m_bAlwaysReportInactive);
MY_CheckMenu(hMenu, ID_EVENTPOPUPS_SHOWPOPUPSIFWINDOWISMINIMIZED, f.m_bDontReport);
MY_CheckMenu(hMenu, ID_EVENTPOPUPS_SHOWPOPUPSFORALLINACTIVESESSIONS, f.m_bAlwaysReportInactive);
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp
index 31496bf213..6810131760 100644
--- a/plugins/TabSRMM/src/eventpopups.cpp
+++ b/plugins/TabSRMM/src/eventpopups.cpp
@@ -36,740 +36,20 @@
#include "stdafx.h"
-static LIST<PLUGIN_DATAT> arPopupList(10, NumericKeySortT);
+CMOption<int> NEN::ActionLeft(NEN_MODULE, "ActionLeft", MASK_OPEN | MASK_DISMISS);
+CMOption<int> NEN::ActionRight(NEN_MODULE, "ActionRight", MASK_DISMISS);
-static PLUGIN_DATAT* PU_GetByContact(const MCONTACT hContact)
-{
- return arPopupList.find((PLUGIN_DATAT*)&hContact);
-}
+CMOption<bool> NEN::bMUCDisabled(NEN_MODULE, "MUCDisabled", false);
+CMOption<bool> NEN::bWindowCheck(NEN_MODULE, "WindowCheck", false);
+CMOption<bool> NEN::bNoSounds(NEN_MODULE, "NoSounds", false);
+CMOption<bool> NEN::bNoAutoPopup(NEN_MODULE, "NoAutoPopup", false);
-/**
- * remove stale popup data which has been marked for removal by the popup
- * window procedure.
- *
- */
-static void PU_CleanUp()
-{
- for (auto &p : arPopupList.rev_iter()) {
- if (p->hContact != 0)
- continue;
+CMOption<int> NEN::iDelayMsg(NEN_MODULE, "DelayMessage", 0);
+CMOption<DWORD> NEN::colTextMsg(NEN_MODULE, "ColorTextMsg", 0);
+CMOption<DWORD> NEN::colBackMsg(NEN_MODULE, "ColorBackMsg", RGB(255, 255, 128));
- mir_free(p->eventData);
- mir_free(p);
- arPopupList.removeItem(&p);
- }
-}
-static void CheckForRemoveMask()
-{
- if (!db_get_b(0, MODULE, "firsttime", 0) && (nen_options.maskActL & MASK_REMOVE || nen_options.maskActR & MASK_REMOVE || nen_options.maskActTE & MASK_REMOVE)) {
- MessageBox(nullptr, TranslateT("One of your popup actions is set to DISMISS EVENT.\nNote that this options may have unwanted side effects as it REMOVES the event from the unread queue.\nThis may lead to events not showing up as \"new\". If you don't want this behavior, please review the 'Event notifications' settings page."), TranslateT("TabSRMM warning message"), MB_OK | MB_ICONSTOP);
- db_set_b(0, MODULE, "firsttime", 1);
- }
-}
-
-int TSAPI NEN_ReadOptions(NEN_OPTIONS *options)
-{
- options->bPreview = (BOOL)db_get_b(0, MODULE, OPT_PREVIEW, TRUE);
- options->bDefaultColorMsg = (BOOL)db_get_b(0, MODULE, OPT_COLDEFAULT_MESSAGE, TRUE);
- options->bDefaultColorOthers = (BOOL)db_get_b(0, MODULE, OPT_COLDEFAULT_OTHERS, TRUE);
- options->bDefaultColorErr = (BOOL)db_get_b(0, MODULE, OPT_COLDEFAULT_ERR, TRUE);
- options->colBackMsg = db_get_dw(0, MODULE, OPT_COLBACK_MESSAGE, DEFAULT_COLBACK);
- options->colTextMsg = db_get_dw(0, MODULE, OPT_COLTEXT_MESSAGE, DEFAULT_COLTEXT);
- options->colBackOthers = db_get_dw(0, MODULE, OPT_COLBACK_OTHERS, DEFAULT_COLBACK);
- options->colTextOthers = db_get_dw(0, MODULE, OPT_COLTEXT_OTHERS, DEFAULT_COLTEXT);
- options->colBackErr = db_get_dw(0, MODULE, OPT_COLBACK_ERR, DEFAULT_COLBACK);
- options->colTextErr = db_get_dw(0, MODULE, OPT_COLTEXT_ERR, DEFAULT_COLTEXT);
- options->maskActL = (UINT)db_get_b(0, MODULE, OPT_MASKACTL, DEFAULT_MASKACTL);
- options->maskActR = (UINT)db_get_b(0, MODULE, OPT_MASKACTR, DEFAULT_MASKACTR);
- options->maskActTE = (UINT)db_get_b(0, MODULE, OPT_MASKACTTE, DEFAULT_MASKACTR) & (MASK_OPEN | MASK_DISMISS);
- options->bMergePopup = (BOOL)db_get_b(0, MODULE, OPT_MERGEPOPUP, 0);
- options->iDelayMsg = db_get_dw(0, MODULE, OPT_DELAY_MESSAGE, DEFAULT_DELAY);
- options->iDelayOthers = db_get_dw(0, MODULE, OPT_DELAY_OTHERS, DEFAULT_DELAY);
- options->iDelayErr = db_get_dw(0, MODULE, OPT_DELAY_ERR, DEFAULT_DELAY);
- options->iDelayDefault = (int)DBGetContactSettingRangedWord(0, "Popup", "Seconds", SETTING_LIFETIME_DEFAULT, SETTING_LIFETIME_MIN, SETTING_LIFETIME_MAX);
- options->bShowHeaders = (uint8_t)db_get_b(0, MODULE, OPT_SHOW_HEADERS, FALSE);
- options->bNoRSS = (BOOL)db_get_b(0, MODULE, OPT_NORSS, FALSE);
- options->iDisable = (uint8_t)db_get_b(0, MODULE, OPT_DISABLE, 0);
- options->iMUCDisable = (uint8_t)db_get_b(0, MODULE, OPT_MUCDISABLE, 0);
- options->dwStatusMask = db_get_dw(0, MODULE, "statusmask", (uint32_t)-1);
- options->bWindowCheck = (BOOL)db_get_b(0, MODULE, OPT_WINDOWCHECK, 0);
- options->bNoRSS = (BOOL)db_get_b(0, MODULE, OPT_NORSS, 0);
- options->iLimitPreview = db_get_dw(0, MODULE, OPT_LIMITPREVIEW, 0);
- options->wMaxFavorites = 15;
- options->wMaxRecent = 15;
- options->dwRemoveMask = db_get_dw(0, MODULE, OPT_REMOVEMASK, 0);
- options->bDisableNonMessage = db_get_b(0, MODULE, "disablenonmessage", 0);
- CheckForRemoveMask();
- return 0;
-}
-
-int TSAPI NEN_WriteOptions(NEN_OPTIONS *options)
-{
- db_set_b(0, MODULE, OPT_PREVIEW, (uint8_t)options->bPreview);
- db_set_b(0, MODULE, OPT_COLDEFAULT_MESSAGE, (uint8_t)options->bDefaultColorMsg);
- db_set_b(0, MODULE, OPT_COLDEFAULT_OTHERS, (uint8_t)options->bDefaultColorOthers);
- db_set_b(0, MODULE, OPT_COLDEFAULT_ERR, (uint8_t)options->bDefaultColorErr);
- db_set_dw(0, MODULE, OPT_COLBACK_MESSAGE, (uint32_t)options->colBackMsg);
- db_set_dw(0, MODULE, OPT_COLTEXT_MESSAGE, (uint32_t)options->colTextMsg);
- db_set_dw(0, MODULE, OPT_COLBACK_OTHERS, (uint32_t)options->colBackOthers);
- db_set_dw(0, MODULE, OPT_COLTEXT_OTHERS, (uint32_t)options->colTextOthers);
- db_set_dw(0, MODULE, OPT_COLBACK_ERR, (uint32_t)options->colBackErr);
- db_set_dw(0, MODULE, OPT_COLTEXT_ERR, (uint32_t)options->colTextErr);
- db_set_b(0, MODULE, OPT_MASKACTL, (uint8_t)options->maskActL);
- db_set_b(0, MODULE, OPT_MASKACTR, (uint8_t)options->maskActR);
- db_set_b(0, MODULE, OPT_MASKACTTE, (uint8_t)options->maskActTE);
- db_set_b(0, MODULE, OPT_MERGEPOPUP, (uint8_t)options->bMergePopup);
- db_set_dw(0, MODULE, OPT_DELAY_MESSAGE, (uint32_t)options->iDelayMsg);
- db_set_dw(0, MODULE, OPT_DELAY_OTHERS, (uint32_t)options->iDelayOthers);
- db_set_dw(0, MODULE, OPT_DELAY_ERR, (uint32_t)options->iDelayErr);
- db_set_b(0, MODULE, OPT_SHOW_HEADERS, (uint8_t)options->bShowHeaders);
- db_set_b(0, MODULE, OPT_DISABLE, (uint8_t)options->iDisable);
- db_set_b(0, MODULE, OPT_MUCDISABLE, (uint8_t)options->iMUCDisable);
- db_set_b(0, MODULE, OPT_WINDOWCHECK, (uint8_t)options->bWindowCheck);
- db_set_b(0, MODULE, OPT_NORSS, (uint8_t)options->bNoRSS);
- db_set_dw(0, MODULE, OPT_LIMITPREVIEW, options->iLimitPreview);
- db_set_dw(0, MODULE, OPT_REMOVEMASK, options->dwRemoveMask);
- db_set_b(0, MODULE, "disablenonmessage", options->bDisableNonMessage);
- return 0;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-static int PopupAct(HWND hWnd, UINT mask, PLUGIN_DATAT* pdata)
-{
- pdata->iActionTaken = TRUE;
- if (mask & MASK_OPEN) {
- for (int i = 0; i < pdata->nrMerged; i++) {
- if (pdata->eventData[i].hEvent != 0) {
- PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_HANDLECLISTEVENT, pdata->hContact, pdata->eventData[i].hEvent);
- pdata->eventData[i].hEvent = 0;
- }
- }
- }
- if (mask & MASK_REMOVE) {
- for (int i = 0; i < pdata->nrMerged; i++) {
- if (pdata->eventData[i].hEvent != 0) {
- PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_REMOVECLISTEVENT, pdata->hContact, pdata->eventData[i].hEvent);
- pdata->eventData[i].hEvent = 0;
- }
- }
- }
- if (mask & MASK_DISMISS) {
- PUDeletePopup(hWnd);
- if (pdata->hContainer) {
- FLASHWINFO fwi = { sizeof(fwi) };
- fwi.dwFlags = FLASHW_STOP;
- fwi.hwnd = pdata->hContainer;
- FlashWindowEx(&fwi);
- }
- }
- return 0;
-}
-
-static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- PLUGIN_DATAT *pdata = (PLUGIN_DATAT*)PUGetPluginData(hWnd);
- if (pdata == nullptr)
- return FALSE;
-
- switch (message) {
- case WM_COMMAND:
- PopupAct(hWnd, pdata->pluginOptions->maskActL, pdata);
- break;
- case WM_CONTEXTMENU:
- PopupAct(hWnd, pdata->pluginOptions->maskActR, pdata);
- break;
- case UM_FREEPLUGINDATA:
- pdata->hContact = 0; // mark as removeable
- pdata->hWnd = nullptr;
- return TRUE;
- case UM_INITPOPUP:
- pdata->hWnd = hWnd;
- if (pdata->iSeconds > 0)
- SetTimer(hWnd, TIMER_TO_ACTION, pdata->iSeconds * 1000, nullptr);
- break;
- case WM_MOUSEWHEEL:
- break;
- case WM_SETCURSOR:
- break;
- case WM_TIMER:
- POINT pt;
- RECT rc;
-
- if (wParam != TIMER_TO_ACTION)
- break;
-
- GetCursorPos(&pt);
- GetWindowRect(hWnd, &rc);
- if (PtInRect(&rc, pt))
- break;
-
- if (pdata->iSeconds > 0)
- KillTimer(hWnd, TIMER_TO_ACTION);
- PopupAct(hWnd, pdata->pluginOptions->maskActTE, pdata);
- break;
- }
- return DefWindowProc(hWnd, message, wParam, lParam);
-}
-
-/**
-* Get a preview for the message
-* caller must always mir_free() the return value
-*
-* @param eventType the event type
-* @param dbe DBEVENTINFO *: database event structure
-*
-* @return
-*/
-
-static wchar_t* ShortenPreview(DBEVENTINFO *dbe)
-{
- bool fAddEllipsis = false;
- size_t iPreviewLimit = nen_options.iLimitPreview;
- if (iPreviewLimit > 500 || iPreviewLimit == 0)
- iPreviewLimit = 500;
-
- wchar_t *buf = DbEvent_GetTextW(dbe, CP_ACP);
- if (mir_wstrlen(buf) > iPreviewLimit) {
- fAddEllipsis = true;
- size_t iIndex = iPreviewLimit;
- size_t iWordThreshold = 20;
- while (iIndex && buf[iIndex] != ' ' && iWordThreshold--)
- buf[iIndex--] = 0;
-
- buf[iIndex] = 0;
- }
- if (fAddEllipsis) {
- buf = (wchar_t*)mir_realloc(buf, (mir_wstrlen(buf) + 5) * sizeof(wchar_t));
- mir_wstrcat(buf, L"...");
- }
- return buf;
-}
-
-static wchar_t* GetPreviewT(uint16_t eventType, DBEVENTINFO *dbe)
-{
- char *pBlob = (char*)dbe->pBlob;
-
- switch (eventType) {
- case EVENTTYPE_MESSAGE:
- if (pBlob && nen_options.bPreview)
- return ShortenPreview(dbe);
-
- return mir_wstrdup(TranslateT("Message"));
-
- case EVENTTYPE_FILE:
- if (pBlob) {
- if (!nen_options.bPreview)
- return mir_wstrdup(TranslateT("Incoming file"));
-
- if (dbe->cbBlob > 5) { // min valid size = (sizeof(uint32_t) + 1 character file name + terminating 0)
- char* szFileName = (char *)dbe->pBlob + sizeof(uint32_t);
- char* szDescr = nullptr;
- size_t namelength = Utils::safe_strlen(szFileName, dbe->cbBlob - sizeof(uint32_t));
-
- if (dbe->cbBlob > (sizeof(uint32_t) + namelength + 1))
- szDescr = szFileName + namelength + 1;
-
- ptrW tszFileName(DbEvent_GetString(dbe, szFileName));
- wchar_t buf[1024];
-
- if (szDescr && Utils::safe_strlen(szDescr, dbe->cbBlob - sizeof(uint32_t) - namelength - 1) > 0) {
- ptrW tszDescr(DbEvent_GetString(dbe, szDescr));
- if (tszFileName && tszDescr) {
- mir_snwprintf(buf, L"%s: %s (%s)", TranslateT("Incoming file"), tszFileName.get(), tszDescr.get());
- return mir_wstrdup(buf);
- }
- }
-
- if (tszFileName) {
- mir_snwprintf(buf, L"%s: %s (%s)", TranslateT("Incoming file"), tszFileName.get(), TranslateT("No description given"));
- return mir_wstrdup(buf);
- }
- }
- }
- return mir_wstrdup(TranslateT("Incoming file (invalid format)"));
-
- default:
- if (nen_options.bPreview)
- return ShortenPreview(dbe);
-
- return mir_wstrdup(TranslateT("Unknown event"));
- }
-}
-
-static int PopupUpdateT(MCONTACT hContact, MEVENT hEvent)
-{
- PLUGIN_DATAT *pdata = const_cast<PLUGIN_DATAT *>(PU_GetByContact(hContact));
- if (!pdata)
- return 1;
-
- if (hEvent == 0)
- return 0;
-
- wchar_t szHeader[256];
- if (pdata->pluginOptions->bShowHeaders)
- mir_snwprintf(szHeader, L"%s %d\n", TranslateT("New messages: "), pdata->nrMerged + 1);
- else
- szHeader[0] = 0;
-
- DB::EventInfo dbe;
- if (pdata->pluginOptions->bPreview && hContact)
- dbe.cbBlob = -1;
- db_event_get(hEvent, &dbe);
-
- wchar_t timestamp[MAX_DATASIZE];
- wcsftime(timestamp, MAX_DATASIZE, L"%Y.%m.%d %H:%M", _localtime32((__time32_t *)&dbe.timestamp));
- mir_snwprintf(pdata->eventData[pdata->nrMerged].tszText, L"\n\n%s\n", timestamp);
-
- wchar_t *szPreview = GetPreviewT(dbe.eventType, &dbe);
- if (szPreview) {
- mir_wstrncat(pdata->eventData[pdata->nrMerged].tszText, szPreview, _countof(pdata->eventData[pdata->nrMerged].tszText) - mir_wstrlen(pdata->eventData[pdata->nrMerged].tszText));
- mir_free(szPreview);
- }
- else mir_wstrncat(pdata->eventData[pdata->nrMerged].tszText, L" ", _countof(pdata->eventData[pdata->nrMerged].tszText) - mir_wstrlen(pdata->eventData[pdata->nrMerged].tszText));
-
- pdata->eventData[pdata->nrMerged].tszText[MAX_SECONDLINE - 1] = 0;
-
- // now, reassemble the popup text, make sure the *last* event is shown, and then show the most recent events
- // for which there is enough space in the popup text
-
- wchar_t lpzText[MAX_SECONDLINE];
- int i, available = MAX_SECONDLINE - 1;
- if (pdata->pluginOptions->bShowHeaders) {
- wcsncpy_s(lpzText, szHeader, _TRUNCATE);
- available -= (int)mir_wstrlen(szHeader);
- }
- else lpzText[0] = 0;
-
- for (i = pdata->nrMerged; i >= 0; i--) {
- available -= (int)mir_wstrlen(pdata->eventData[i].tszText);
- if (available <= 0)
- break;
- }
- i = (available > 0) ? i + 1 : i + 2;
- for (; i <= pdata->nrMerged; i++)
- mir_wstrncat(lpzText, pdata->eventData[i].tszText, _countof(lpzText) - mir_wstrlen(lpzText));
-
- pdata->eventData[pdata->nrMerged].hEvent = hEvent;
- pdata->eventData[pdata->nrMerged].timestamp = dbe.timestamp;
- pdata->nrMerged++;
- if (pdata->nrMerged >= pdata->nrEventsAlloced) {
- pdata->nrEventsAlloced += 5;
- pdata->eventData = (EVENT_DATAT *)mir_realloc(pdata->eventData, pdata->nrEventsAlloced * sizeof(EVENT_DATAT));
- }
-
- PUChangeTextW(pdata->hWnd, lpzText);
- return 0;
-}
-
-static int PopupShowT(NEN_OPTIONS *pluginOptions, MCONTACT hContact, MEVENT hEvent, UINT eventType, HWND hContainer)
-{
- // there has to be a maximum number of popups shown at the same time
- if (arPopupList.getCount() >= MAX_POPUPS)
- return 2;
-
- DB::EventInfo dbe;
- // fix for a crash
- if (hEvent && (pluginOptions->bPreview || hContact == 0))
- dbe.cbBlob = -1;
- db_event_get(hEvent, &dbe);
-
- if (hEvent == 0 && hContact == 0)
- dbe.szModule = Translate("Unknown module or contact");
-
- POPUPDATAW pud;
- long iSeconds;
- switch (eventType) {
- case EVENTTYPE_MESSAGE:
- pud.lchIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
- pud.colorBack = pluginOptions->bDefaultColorMsg ? 0 : pluginOptions->colBackMsg;
- pud.colorText = pluginOptions->bDefaultColorMsg ? 0 : pluginOptions->colTextMsg;
- iSeconds = pluginOptions->iDelayMsg;
- break;
-
- default:
- pud.lchIcon = DbEvent_GetIcon(&dbe, LR_SHARED);
- pud.colorBack = pluginOptions->bDefaultColorOthers ? 0 : pluginOptions->colBackOthers;
- pud.colorText = pluginOptions->bDefaultColorOthers ? 0 : pluginOptions->colTextOthers;
- iSeconds = pluginOptions->iDelayOthers;
- break;
- }
-
- PLUGIN_DATAT *pdata = (PLUGIN_DATAT *)mir_calloc(sizeof(PLUGIN_DATAT));
- pdata->eventType = eventType;
- pdata->hContact = hContact;
- pdata->pluginOptions = pluginOptions;
- pdata->pud = &pud;
- pdata->iSeconds = iSeconds; // ? iSeconds : pluginOptions->iDelayDefault;
- pdata->hContainer = hContainer;
- pud.iSeconds = pdata->iSeconds ? -1 : 0;
-
- // finally create the popup
- pud.lchContact = hContact;
- pud.PluginWindowProc = PopupDlgProc;
- pud.PluginData = pdata;
-
- if (hContact)
- wcsncpy_s(pud.lpwzContactName, Clist_GetContactDisplayName(hContact), _TRUNCATE);
- else
- wcsncpy_s(pud.lpwzContactName, _A2T(dbe.szModule), _TRUNCATE);
-
- wchar_t *szPreview = GetPreviewT((uint16_t)eventType, &dbe);
- if (szPreview) {
- wcsncpy_s(pud.lpwzText, szPreview, _TRUNCATE);
- mir_free(szPreview);
- }
- else wcsncpy_s(pud.lpwzText, L" ", _TRUNCATE);
-
- pdata->eventData = (EVENT_DATAT *)mir_alloc(NR_MERGED * sizeof(EVENT_DATAT));
- pdata->eventData[0].hEvent = hEvent;
- pdata->eventData[0].timestamp = dbe.timestamp;
- wcsncpy_s(pdata->eventData[0].tszText, pud.lpwzText, _TRUNCATE);
- pdata->eventData[0].tszText[MAX_SECONDLINE - 1] = 0;
- pdata->nrEventsAlloced = NR_MERGED;
- pdata->nrMerged = 1;
- PUAddPopupW(&pud);
- arPopupList.insert(pdata);
- return 0;
-}
-
-static TOptionListItem lvItemsNEN[] =
-{
- { 0, LPGENW("Show a preview of the event"), IDC_CHKPREVIEW, LOI_TYPE_SETTING, (UINT_PTR)&nen_options.bPreview, 1 },
- { 0, LPGENW("Don't announce event when message dialog is open"), IDC_CHKWINDOWCHECK, LOI_TYPE_SETTING, (UINT_PTR)&nen_options.bWindowCheck, 1 },
- { 0, LPGENW("Don't announce events from RSS protocols"), IDC_NORSS, LOI_TYPE_SETTING, (UINT_PTR)&nen_options.bNoRSS, 1 },
- { 0, LPGENW("Merge new events for the same contact into existing popup"), 1, LOI_TYPE_SETTING, (UINT_PTR)&nen_options.bMergePopup, 6 },
- { 0, LPGENW("Show headers"), IDC_CHKSHOWHEADERS, LOI_TYPE_SETTING, (UINT_PTR)&nen_options.bShowHeaders, 6 },
- { 0, LPGENW("Dismiss popup"), MASK_DISMISS, LOI_TYPE_FLAG, (UINT_PTR)&nen_options.maskActL, 3 },
- { 0, LPGENW("Open event"), MASK_OPEN, LOI_TYPE_FLAG, (UINT_PTR)&nen_options.maskActL, 3 },
- { 0, LPGENW("Dismiss event"), MASK_REMOVE, LOI_TYPE_FLAG, (UINT_PTR)&nen_options.maskActL, 3 },
-
- { 0, LPGENW("Dismiss popup"), MASK_DISMISS, LOI_TYPE_FLAG, (UINT_PTR)&nen_options.maskActR, 4 },
- { 0, LPGENW("Open event"), MASK_OPEN, LOI_TYPE_FLAG, (UINT_PTR)&nen_options.maskActR, 4 },
- { 0, LPGENW("Dismiss event"), MASK_REMOVE, LOI_TYPE_FLAG, (UINT_PTR)&nen_options.maskActR, 4 },
-
- { 0, LPGENW("Dismiss popup"), MASK_DISMISS, LOI_TYPE_FLAG, (UINT_PTR)&nen_options.maskActTE, 5 },
- { 0, LPGENW("Open event"), MASK_OPEN, LOI_TYPE_FLAG, (UINT_PTR)&nen_options.maskActTE, 5 },
-
- { 0, LPGENW("Disable event notifications for instant messages"), IDC_CHKWINDOWCHECK, LOI_TYPE_SETTING, (UINT_PTR)&nen_options.iDisable, 0 },
- { 0, LPGENW("Disable event notifications for group chats"), IDC_CHKWINDOWCHECK, LOI_TYPE_SETTING, (UINT_PTR)&nen_options.iMUCDisable, 0 },
- { 0, LPGENW("Disable notifications for non-message events"), IDC_CHKWINDOWCHECK, LOI_TYPE_SETTING, (UINT_PTR)&nen_options.bDisableNonMessage, 0 },
-
- { 0, LPGENW("Remove popups for a contact when the message window is focused"), PU_REMOVE_ON_FOCUS, LOI_TYPE_FLAG, (UINT_PTR)&nen_options.dwRemoveMask, 7 },
- { 0, LPGENW("Remove popups for a contact when I start typing a reply"), PU_REMOVE_ON_TYPE, LOI_TYPE_FLAG, (UINT_PTR)&nen_options.dwRemoveMask, 7 },
- { 0, LPGENW("Remove popups for a contact when I send a reply"), PU_REMOVE_ON_SEND, LOI_TYPE_FLAG, (UINT_PTR)&nen_options.dwRemoveMask, 7 },
-
- { 0, nullptr, 0, 0, 0, 0 }
-};
-
-static TOptionListGroup lvGroupsNEN[] =
-{
- { 0, LPGENW("Disable notifications") },
- { 0, LPGENW("General options") },
- { 0, LPGENW("System tray icon") },
- { 0, LPGENW("Left click actions (popups only)") },
- { 0, LPGENW("Right click actions (popups only)") },
- { 0, LPGENW("Timeout actions (popups only)") },
- { 0, LPGENW("Combine notifications for the same contact") },
- { 0, LPGENW("Remove popups under following conditions") },
- { 0, nullptr }
-};
-
-class CPopupOptionsDlg : public CDlgBase
-{
- NEN_OPTIONS tmpOpts;
-
- void GrabData()
- {
- tmpOpts.iLimitPreview = (chkLimit.GetState()) ? spinLimit.GetPosition() : 0;
-
- tmpOpts.colBackMsg = msgBack.GetColor();
- tmpOpts.colTextMsg = msgText.GetColor();
- tmpOpts.colBackOthers = otherBack.GetColor();
- tmpOpts.colTextOthers = otherText.GetColor();
- tmpOpts.colBackErr = errBack.GetColor();
- tmpOpts.colTextErr = errText.GetColor();
-
- if (chkMuc.GetState())
- g_Settings.iPopupStyle = 2;
- else if (chkLogColors.GetState())
- g_Settings.iPopupStyle = 1;
- else
- g_Settings.iPopupStyle = 3;
-
- g_Settings.crPUBkgColour = mucBack.GetColor();
- g_Settings.crPUTextColour = mucText.GetColor();
- }
-
- CCtrlTreeView eventOptions;
- CCtrlButton btnPreview, btnModes;
- CCtrlSpin spinMessage, spinOthers, spinMuc, spinErr, spinLimit;
- CCtrlCheck chkMessage, chkOthers, chkMuc, chkErr, chkLimit, chkLogColors;
- CCtrlColor mucBack, mucText, msgBack, msgText, otherBack, otherText, errBack, errText;
-
-public:
- CPopupOptionsDlg() :
- CDlgBase(g_plugin, IDD_POPUP_OPT),
- errBack(this, IDC_COLBACK_ERR),
- errText(this, IDC_COLTEXT_ERR),
- msgBack(this, IDC_COLBACK_MESSAGE),
- msgText(this, IDC_COLTEXT_MESSAGE),
- mucBack(this, IDC_COLBACK_MUC),
- mucText(this, IDC_COLTEXT_MUC),
- otherBack(this, IDC_COLBACK_OTHERS),
- otherText(this, IDC_COLTEXT_OTHERS),
- btnModes(this, IDC_POPUPSTATUSMODES),
- btnPreview(this, IDC_PREVIEW),
- eventOptions(this, IDC_EVENTOPTIONS),
- spinMessage(this, IDC_DELAY_MESSAGE_SPIN, 3600, -1),
- spinOthers(this, IDC_DELAY_OTHERS_SPIN, 3600, -1),
- spinMuc(this, IDC_DELAY_MUC_SPIN, 3600, -1),
- spinErr(this, IDC_DELAY_ERR_SPIN, 3600, -1),
- spinLimit(this, IDC_MESSAGEPREVIEWLIMITSPIN, 2048),
- chkLogColors(this, IDC_MUC_LOGCOLORS),
- chkMessage(this, IDC_CHKDEFAULTCOL_MESSAGE),
- chkOthers(this, IDC_CHKDEFAULTCOL_OTHERS),
- chkLimit(this, IDC_LIMITPREVIEW),
- chkErr(this, IDC_CHKDEFAULTCOL_ERR),
- chkMuc(this, IDC_CHKDEFAULTCOL_MUC)
- {
- btnModes.OnClick = Callback(this, &CPopupOptionsDlg::onClick_Modes);
- btnPreview.OnClick = Callback(this, &CPopupOptionsDlg::onClick_Preview);
-
- chkLimit.OnChange = Callback(this, &CPopupOptionsDlg::onChange_Limit);
- chkMessage.OnChange = Callback(this, &CPopupOptionsDlg::onChange_Message);
- chkOthers.OnChange = Callback(this, &CPopupOptionsDlg::onChange_Others);
- chkErr.OnChange = Callback(this, &CPopupOptionsDlg::onChange_Error);
- chkMuc.OnChange = chkLogColors.OnChange = Callback(this, &CPopupOptionsDlg::onChange_Muc);
-
- spinMessage.OnChange = Callback(this, &CPopupOptionsDlg::onChange_DelayMsg);
- spinOthers.OnChange = Callback(this, &CPopupOptionsDlg::onChange_DelayOther);
- spinErr.OnChange = Callback(this, &CPopupOptionsDlg::onChange_DelayErr);
- spinMuc.OnChange = Callback(this, &CPopupOptionsDlg::onChange_DelayMuc);
-
- tmpOpts = nen_options;
- }
-
- bool OnInitDialog() override
- {
- TreeViewInit(eventOptions, lvGroupsNEN, lvItemsNEN, 0, 0, TRUE);
-
- msgBack.SetColor(tmpOpts.colBackMsg);
- msgText.SetColor(tmpOpts.colTextMsg);
- otherBack.SetColor(tmpOpts.colBackOthers);
- otherText.SetColor(tmpOpts.colTextOthers);
- errBack.SetColor(tmpOpts.colBackErr);
- errText.SetColor(tmpOpts.colTextErr);
- chkMessage.SetState(tmpOpts.bDefaultColorMsg);
- chkOthers.SetState(tmpOpts.bDefaultColorOthers);
- chkErr.SetState(tmpOpts.bDefaultColorErr);
-
- mucText.SetColor(g_Settings.crPUTextColour);
- mucBack.SetColor(g_Settings.crPUBkgColour);
- chkMuc.SetState(g_Settings.iPopupStyle == 2);
-
- spinMessage.SetPosition(tmpOpts.iDelayMsg);
- spinOthers.SetPosition(tmpOpts.iDelayOthers);
- spinErr.SetPosition(tmpOpts.iDelayErr);
- spinMuc.SetPosition(g_Settings.iPopupTimeout);
-
- msgBack.Enable(!tmpOpts.bDefaultColorMsg);
- msgText.Enable(!tmpOpts.bDefaultColorMsg);
- otherBack.Enable(!tmpOpts.bDefaultColorOthers);
- otherText.Enable(!tmpOpts.bDefaultColorOthers);
- errBack.Enable(!tmpOpts.bDefaultColorErr);
- errText.Enable(!tmpOpts.bDefaultColorErr);
- mucText.Enable(g_Settings.iPopupStyle == 3);
- mucBack.Enable(g_Settings.iPopupStyle == 3);
-
- chkLogColors.SetState(g_Settings.iPopupStyle == 1);
- chkLogColors.Enable(g_Settings.iPopupStyle != 2);
-
- chkLimit.SetState(tmpOpts.iLimitPreview > 0);
- spinLimit.SetPosition(tmpOpts.iLimitPreview);
- return true;
- }
-
- bool OnApply() override
- {
- GrabData();
- nen_options = tmpOpts;
-
- // scan the tree view and obtain the options...
- TreeViewToDB(eventOptions, lvItemsNEN, nullptr, nullptr);
-
- db_set_b(0, CHAT_MODULE, "PopupStyle", (uint8_t)g_Settings.iPopupStyle);
- db_set_w(0, CHAT_MODULE, "PopupTimeout", g_Settings.iPopupTimeout);
- db_set_dw(0, CHAT_MODULE, "PopupColorBG", g_Settings.crPUBkgColour = mucBack.GetColor());
- db_set_dw(0, CHAT_MODULE, "PopupColorText", g_Settings.crPUTextColour = mucText.GetColor());
-
- NEN_WriteOptions(&nen_options);
- CheckForRemoveMask();
- return true;
- }
-
- void OnReset() override
- {
- NEN_ReadOptions(&tmpOpts);
- }
-
- INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override
- {
- if (msg == WM_COMMAND && wParam == DM_STATUSMASKSET) {
- db_set_dw(0, MODULE, "statusmask", (uint32_t)lParam);
- tmpOpts.dwStatusMask = (int)lParam;
- }
-
- return CDlgBase::DlgProc(msg, wParam, lParam);
- }
-
- void onClick_Preview(CCtrlButton *)
- {
- GrabData();
- PopupShowT(&tmpOpts, 0, 0, EVENTTYPE_MESSAGE, nullptr);
- }
-
- void onClick_Modes(CCtrlButton *)
- {
- CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CHOOSESTATUSMODES), m_hwnd, DlgProcSetupStatusModes, db_get_dw(0, MODULE, "statusmask", -1));
- }
-
- void onChange_Limit(CCtrlCheck *)
- {
- bool bEnabled = chkLimit.GetState();
- spinLimit.Enable(bEnabled);
- Utils::enableDlgControl(m_hwnd, IDC_MESSAGEPREVIEWLIMIT, bEnabled);
- }
-
- void onChange_Message(CCtrlCheck *)
- {
- tmpOpts.bDefaultColorMsg = chkMessage.GetState();
- msgBack.Enable(!tmpOpts.bDefaultColorMsg);
- msgText.Enable(!tmpOpts.bDefaultColorMsg);
- }
-
- void onChange_Error(CCtrlCheck *)
- {
- tmpOpts.bDefaultColorErr = chkErr.GetState();
- errBack.Enable(!tmpOpts.bDefaultColorErr);
- errText.Enable(!tmpOpts.bDefaultColorErr);
- }
-
- void onChange_Others(CCtrlCheck *)
- {
- tmpOpts.bDefaultColorOthers = chkOthers.GetState();
- otherBack.Enable(!tmpOpts.bDefaultColorOthers);
- otherText.Enable(!tmpOpts.bDefaultColorOthers);
- }
-
- void onChange_Muc(CCtrlCheck *)
- {
- bool bMuc = chkMuc.GetState(), bLog = chkLogColors.GetState();
-
- mucText.Enable(!bMuc && !bLog);
- mucBack.Enable(!bMuc && !bLog);
- chkLogColors.Enable(!bMuc);
- }
-
- void onChange_DelayMsg(CCtrlSpin *)
- {
- tmpOpts.iDelayMsg = spinMessage.GetPosition();
- Utils::enableDlgControl(m_hwnd, IDC_DELAY_MESSAGE, tmpOpts.iDelayMsg != -1);
- }
-
- void onChange_DelayOther(CCtrlSpin *)
- {
- tmpOpts.iDelayOthers = spinOthers.GetPosition();
- Utils::enableDlgControl(m_hwnd, IDC_DELAY_OTHERS, tmpOpts.iDelayOthers != -1);
- }
-
- void onChange_DelayErr(CCtrlSpin *)
- {
- tmpOpts.iDelayErr = spinErr.GetPosition();
- Utils::enableDlgControl(m_hwnd, IDC_DELAY_ERR, tmpOpts.iDelayErr != -1);
- }
-
- void onChange_DelayMuc(CCtrlSpin *)
- {
- g_Settings.iPopupTimeout = spinMuc.GetPosition();
- Utils::enableDlgControl(m_hwnd, IDC_DELAY_MUC, g_Settings.iPopupTimeout != -1);
- }
-};
-
-void Popup_Options(WPARAM wParam)
-{
- OPTIONSDIALOGPAGE odp = {};
- odp.flags = ODPF_BOLDGROUPS;
- odp.position = 910000000;
- odp.pDialog = new CPopupOptionsDlg();
- odp.szTitle.a = LPGEN("Event notifications");
- odp.szGroup.a = LPGEN("Popups");
- g_plugin.addOptions(wParam, &odp);
-}
-
-int tabSRMM_ShowPopup(MCONTACT hContact, MEVENT hDbEvent, uint16_t eventType, int windowOpen, TContainerData *pContainer, HWND hwndChild, const char *szProto)
-{
- if (nen_options.iDisable) // no popups at all. Period
- return 0;
-
- PU_CleanUp();
-
- if (nen_options.bDisableNonMessage && eventType != EVENTTYPE_MESSAGE)
- return 0;
-
- // check the status mode against the status mask
- if (nen_options.dwStatusMask != -1) {
- if (szProto != nullptr) {
- int dwStatus = Proto_GetStatus(szProto);
- if (!(dwStatus == 0 || dwStatus <= ID_STATUS_OFFLINE || ((1 << (dwStatus - ID_STATUS_ONLINE)) & nen_options.dwStatusMask))) // should never happen, but...
- return 0;
- }
- }
- if (nen_options.bNoRSS && szProto != nullptr && !strncmp(szProto, "NewsAggregator", 3))
- return 0; // filter out RSS popups
-
- // message window is open, need to check the container config if we want to see a popup nonetheless
- if (windowOpen && pContainer != nullptr) {
- if (nen_options.bWindowCheck) // no popups at all for open windows... no exceptions
- return 0;
-
- if (pContainer->m_flags.m_bDontReport && (IsIconic(pContainer->m_hwnd))) // in tray counts as "minimised"
- goto passed;
-
- if (pContainer->m_flags.m_bDontReportUnfocused)
- if (!IsIconic(pContainer->m_hwnd) && !pContainer->IsActive())
- goto passed;
-
- if (pContainer->m_flags.m_bAlwaysReportInactive) {
- if (pContainer->m_flags.m_bDontReportFocused)
- goto passed;
-
- if (pContainer->m_hwndActive != hwndChild)
- goto passed;
- }
- return 0;
- }
-passed:
- if (PU_GetByContact(hContact) && nen_options.bMergePopup && eventType == EVENTTYPE_MESSAGE) {
- if (PopupUpdateT(hContact, hDbEvent) != 0)
- PopupShowT(&nen_options, hContact, hDbEvent, eventType, pContainer ? pContainer->m_hwnd : nullptr);
- }
- else PopupShowT(&nen_options, hContact, hDbEvent, eventType, pContainer ? pContainer->m_hwnd : nullptr);
-
- return 0;
-}
-
-// remove all popups for hContact, but only if the mask matches the current "mode"
-void TSAPI DeletePopupsForContact(MCONTACT hContact, uint32_t dwMask)
-{
- if (!(dwMask & nen_options.dwRemoveMask) || nen_options.iDisable)
- return;
-
- PLUGIN_DATAT *_T = nullptr;
- while ((_T = PU_GetByContact(hContact)) != nullptr) {
- _T->hContact = 0; // make sure, it never "comes back"
- if (_T->hWnd != nullptr)
- PUDeletePopup(_T->hWnd);
- }
-}
+CMOption<bool> NEN::bColDefaultErr(NEN_MODULE, "DefaultColorErr", true);
+CMOption<int> NEN::iDelayErr(NEN_MODULE, "DelayErr", 0);
+CMOption<DWORD> NEN::colTextErr(NEN_MODULE, "ColorBackErr", 0);
+CMOption<DWORD> NEN::colBackErr(NEN_MODULE, "ColorBackErr", RGB(255, 255, 128));
diff --git a/plugins/TabSRMM/src/functions.h b/plugins/TabSRMM/src/functions.h
index 5d81e311f3..e8c57f4476 100644
--- a/plugins/TabSRMM/src/functions.h
+++ b/plugins/TabSRMM/src/functions.h
@@ -45,14 +45,6 @@ void RegisterFontServiceFonts();
LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
/*
- * nen / event popup stuff
- */
-
-int TSAPI NEN_ReadOptions(NEN_OPTIONS *options);
-int TSAPI NEN_WriteOptions(NEN_OPTIONS *options);
-void TSAPI DeletePopupsForContact(MCONTACT hContact, uint32_t dwMask);
-
-/*
* gneric msgwindow functions(creation, container management etc.)
*/
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp
index f9ab7b2761..6e816b548c 100644
--- a/plugins/TabSRMM/src/generic_msghandlers.cpp
+++ b/plugins/TabSRMM/src/generic_msghandlers.cpp
@@ -801,8 +801,6 @@ void CMsgDialog::DM_ThemeChanged()
void CMsgDialog::DM_NotifyTyping(int mode)
{
- DeletePopupsForContact(m_hContact, PU_REMOVE_ON_TYPE);
-
const char *szProto = m_cache->getActiveProto();
MCONTACT hContact = m_cache->getActiveContact();
@@ -1046,7 +1044,7 @@ void CMsgDialog::DM_AddDivider()
/////////////////////////////////////////////////////////////////////////////////////////
// incoming event handler
-void CMsgDialog::DM_EventAdded(WPARAM hContact, LPARAM lParam)
+void CMsgDialog::DM_EventAdded(WPARAM, LPARAM lParam)
{
MEVENT hDbEvent = (MEVENT)lParam;
@@ -1087,8 +1085,7 @@ void CMsgDialog::DM_EventAdded(WPARAM hContact, LPARAM lParam)
else if (m_pContainer->m_hwndActive != m_hwnd)
DM_AddDivider();
}
- if (!bDisableNotify)
- tabSRMM_ShowPopup(hContact, hDbEvent, dbei.eventType, m_pContainer->m_bHidden ? 0 : 1, m_pContainer, m_hwnd, m_cache->getActiveProto());
+
if (IsWindowVisible(m_pContainer->m_hwnd))
m_pContainer->m_bHidden = false;
}
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp
index 3cc4e83ffe..2e6e269b0f 100644
--- a/plugins/TabSRMM/src/globals.cpp
+++ b/plugins/TabSRMM/src/globals.cpp
@@ -416,7 +416,6 @@ int CGlobals::PreshutdownSendRecv(WPARAM, LPARAM)
for (auto &hContact : Contacts())
db_set_dw(hContact, SRMSGMOD_T, "messagecount", 0);
- ::NEN_WriteOptions(&nen_options);
::DestroyWindow(PluginConfig.g_hwndHotkeyHandler);
::UnregisterClass(L"TSStatusBarClass", g_plugin.getInst());
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp
index 268bf999c1..7039c21bbe 100644
--- a/plugins/TabSRMM/src/mim.cpp
+++ b/plugins/TabSRMM/src/mim.cpp
@@ -450,20 +450,15 @@ int CMimAPI::MessageEventAdded(WPARAM hContact, LPARAM hDbEvent)
switch (dbei.eventType) {
case EVENTTYPE_AUTHREQUEST:
case EVENTTYPE_ADDED:
- return 0;
-
case EVENTTYPE_FILE:
- tabSRMM_ShowPopup(hContact, hDbEvent, dbei.eventType, 0, nullptr, nullptr, dbei.szModule);
return 0;
}
}
- // if no window is open, we are not interested in anything else but unread message events
- // new message
- if (!nen_options.iNoSounds)
+ if (!NEN::bNoSounds)
Skin_PlaySound("AlertMsg");
- if (nen_options.iNoAutoPopup)
+ if (NEN::bNoAutoPopup)
goto nowindowcreate;
PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_CREATECONTAINER, hContact, hDbEvent);
@@ -486,8 +481,6 @@ nowindowcreate:
cle.pszService = MS_MSG_READMESSAGE;
cle.szTooltip.w = toolTip;
g_clistApi.pfnAddEvent(&cle);
-
- tabSRMM_ShowPopup(hContact, hDbEvent, dbei.eventType, 0, nullptr, nullptr, dbei.szModule);
}
return 0;
}
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index df7c76f935..92c03c4464 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -428,13 +428,6 @@ bool CMsgDialog::OnInitDialog()
CustomizeButton(GetDlgItem(m_hwnd, it));
}
- // show a popup if wanted...
- if (m_bWantPopup) {
- DBEVENTINFO dbei = {};
- m_bWantPopup = false;
- db_event_get(m_hDbEventFirst, &dbei);
- tabSRMM_ShowPopup(m_hContact, m_hDbEventFirst, dbei.eventType, 0, nullptr, m_hwnd, m_cache->getActiveProto());
- }
m_hDbEventFirst = 0;
if (m_szProto != nullptr) {
@@ -828,7 +821,7 @@ void CMsgDialog::onClick_Ok(CCtrlButton *)
m_si->pMI->idleTimeStamp = time(0);
UpdateStatusBar();
if (m_pContainer)
- if (fSound && !nen_options.iNoSounds && !m_pContainer->m_flags.m_bNoSound)
+ if (fSound && !NEN::bNoSounds && !m_pContainer->m_flags.m_bNoSound)
Skin_PlaySound("SendMsg");
}
else {
@@ -891,7 +884,6 @@ void CMsgDialog::onClick_Ok(CCtrlButton *)
if (m_nTypeMode == PROTOTYPE_SELFTYPING_ON)
DM_NotifyTyping(PROTOTYPE_SELFTYPING_OFF);
- DeletePopupsForContact(m_hContact, PU_REMOVE_ON_SEND);
sendQueue->addTo(this, memRequired, flags);
}
@@ -2618,7 +2610,7 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
KillTimer(m_hwnd, wParam);
mir_snwprintf(job->szErrorMsg, TranslateT("Delivery failure: %s"), TranslateT("The message send timed out"));
job->iStatus = SendQueue::SQ_ERROR;
- if (!nen_options.iNoSounds && !m_pContainer->m_flags.m_bNoSound)
+ if (!NEN::bNoSounds && !m_pContainer->m_flags.m_bNoSound)
Skin_PlaySound("SendError");
if (!m_bErrorState)
sendQueue->handleError(this, iIndex);
diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp
index f7ecd69d74..64f33d1837 100644
--- a/plugins/TabSRMM/src/msgdlgother.cpp
+++ b/plugins/TabSRMM/src/msgdlgother.cpp
@@ -1197,21 +1197,17 @@ void CMsgDialog::NotifyDeliveryFailure() const
if (!Popup_Enabled())
return;
- POPUPDATAW ppd;
+ POPUPDATAW ppd = {};
ppd.lchContact = m_hContact;
- wcsncpy_s(ppd.lpwzContactName, m_cache->getNick(), _TRUNCATE);
- wcsncpy_s(ppd.lpwzText, TranslateT("A message delivery has failed.\nClick to open the message window."), _TRUNCATE);
-
- if (!(BOOL)db_get_b(0, MODULE, OPT_COLDEFAULT_ERR, TRUE)) {
- ppd.colorText = (COLORREF)db_get_dw(0, MODULE, OPT_COLTEXT_ERR, DEFAULT_COLTEXT);
- ppd.colorBack = (COLORREF)db_get_dw(0, MODULE, OPT_COLBACK_ERR, DEFAULT_COLBACK);
- }
- else ppd.colorText = ppd.colorBack = 0;
-
ppd.PluginWindowProc = Utils::PopupDlgProcError;
ppd.lchIcon = PluginConfig.g_iconErr;
- ppd.PluginData = nullptr;
- ppd.iSeconds = (int)db_get_dw(0, MODULE, OPT_DELAY_ERR, (uint32_t)DEFAULT_DELAY);
+ ppd.iSeconds = NEN::iDelayErr;
+ if (!NEN::bColDefaultErr) {
+ ppd.colorText = NEN::colTextErr;
+ ppd.colorBack = NEN::colBackErr;
+ }
+ wcsncpy_s(ppd.lpwzContactName, m_cache->getNick(), _TRUNCATE);
+ wcsncpy_s(ppd.lpwzText, TranslateT("A message delivery has failed.\nClick to open the message window."), _TRUNCATE);
PUAddPopupW(&ppd);
}
@@ -2457,9 +2453,6 @@ void CMsgDialog::UpdateWindowState(UINT msg)
m_pContainer->m_pMenuBar->configureMenu();
g_arUnreadWindows.remove(HANDLE(m_hContact));
- if (m_pContainer->m_hwndActive == m_hwnd)
- DeletePopupsForContact(m_hContact, PU_REMOVE_ON_FOCUS);
-
m_pPanel.Invalidate();
if (m_bDeferredScroll) {
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp
index 6a989b2dda..98199536a6 100644
--- a/plugins/TabSRMM/src/msgoptions.cpp
+++ b/plugins/TabSRMM/src/msgoptions.cpp
@@ -1654,9 +1654,6 @@ int OptInitialise(WPARAM wParam, LPARAM lParam)
odp.pDialog = new CTabConfigDlg();
g_plugin.addOptions(wParam, &odp);
- // popup options
- Popup_Options(wParam);
-
// group chats
Chat_Options(wParam);
return 0;
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp
index 5ac2bf91a6..c92dd843f0 100644
--- a/plugins/TabSRMM/src/msgs.cpp
+++ b/plugins/TabSRMM/src/msgs.cpp
@@ -31,7 +31,6 @@
#define IDI_CORE_LOAD 132 // icon id for the "connecting" icon
-NEN_OPTIONS nen_options;
static HANDLE hUserPrefsWindowLis = nullptr;
HMODULE g_hMsftedit;
@@ -687,18 +686,21 @@ int LoadSendRecvMessageModule(void)
Win7Taskbar = new CTaskbarInteract;
Win7Taskbar->updateMetrics();
- memset(&nen_options, 0, sizeof(nen_options));
PluginConfig.hUserPrefsWindowList = WindowList_Create();
sendQueue = new SendQueue;
Skin = new CSkin;
+ if (!db_is_module_empty(0, NEN_OLD_MODULE)) {
+ db_copy_module(NEN_OLD_MODULE, NEN_MODULE);
+ db_delete_module(0, NEN_OLD_MODULE);
+ }
+
HookEvent(ME_OPT_INITIALISE, OptInitialise);
InitAPI();
PluginConfig.reloadSystemStartup();
ReloadTabConfig();
- NEN_ReadOptions(&nen_options);
LoadDefaultTemplates();
return 0;
diff --git a/plugins/TabSRMM/src/nen.h b/plugins/TabSRMM/src/nen.h
index 4d81704776..e9889eb66c 100644
--- a/plugins/TabSRMM/src/nen.h
+++ b/plugins/TabSRMM/src/nen.h
@@ -37,17 +37,6 @@
#ifndef _NEN_H_
#define _NEN_H_
-#define MODULE "tabSRMM_NEN"
-
-int tabSRMM_ShowPopup(MCONTACT hContact, MEVENT hDbEvent, uint16_t eventType, int windowOpen, TContainerData *pContainer, HWND hwndChild, const char *szProto);
-
-#define DEFAULT_COLBACK RGB(255,255,128)
-#define DEFAULT_COLTEXT RGB(0,0,0)
-#define DEFAULT_MASKNOTIFY (MASK_MESSAGE|MASK_FILE|MASK_OTHER)
-#define DEFAULT_MASKACTL (MASK_OPEN|MASK_DISMISS)
-#define DEFAULT_MASKACTR (MASK_DISMISS)
-#define DEFAULT_DELAY 0
-
#define MASK_MESSAGE 0x0001
#define MASK_URL 0x0002
#define MASK_FILE 0x0004
@@ -57,105 +46,17 @@ int tabSRMM_ShowPopup(MCONTACT hContact, MEVENT hDbEvent, uint16_t eventType, in
#define MASK_OPEN 0x0002
#define MASK_REMOVE 0x0004
-#define PU_REMOVE_ON_FOCUS 1
-#define PU_REMOVE_ON_TYPE 2
-#define PU_REMOVE_ON_SEND 4
-
-#define SETTING_LIFETIME_MIN 1
-#define SETTING_LIFETIME_MAX 60
-#define SETTING_LIFETIME_DEFAULT 4
-
-//Entrys in the database, don't translate
-#define OPT_PREVIEW "Preview"
-#define OPT_COLDEFAULT_MESSAGE "DefaultColorMsg"
-#define OPT_COLBACK_MESSAGE "ColorBackMsg"
-#define OPT_COLTEXT_MESSAGE "ColorTextMsg"
-#define OPT_COLDEFAULT_OTHERS "DefaultColorOthers"
-#define OPT_COLDEFAULT_ERR "DefaultColorErr"
-#define OPT_COLBACK_OTHERS "ColorBackOthers"
-#define OPT_COLTEXT_OTHERS "ColorTextOthers"
-#define OPT_COLBACK_ERR "ColorBackErr"
-#define OPT_COLTEXT_ERR "ColorTextErr"
-#define OPT_MASKNOTIFY "Notify"
-#define OPT_MASKACTL "ActionLeft"
-#define OPT_MASKACTR "ActionRight"
-#define OPT_MASKACTTE "ActionTimeExpires"
-#define OPT_MERGEPOPUP "MergePopup"
-#define OPT_DELAY_MESSAGE "DelayMessage"
-#define OPT_DELAY_OTHERS "DelayOthers"
-#define OPT_DELAY_ERR "DelayErr"
-#define OPT_SHOW_HEADERS "ShowHeaders"
-#define OPT_NORSS "NoRSSAnnounces"
-#define OPT_DISABLE "Disabled"
-#define OPT_MUCDISABLE "MUCDisabled"
-#define OPT_WINDOWCHECK "WindowCheck"
-#define OPT_LIMITPREVIEW "LimitPreview"
-#define OPT_REMOVEMASK "removemask"
-
-struct NEN_OPTIONS
-{
- BOOL bPreview;
- BOOL bDefaultColorMsg;
- BOOL bDefaultColorOthers;
- BOOL bDefaultColorErr;
- BOOL bDisableNonMessage;
- UINT maskActL;
- UINT maskActR;
- UINT maskActTE;
- int iDelayMsg;
- int iDelayOthers;
- int iDelayErr;
- int iDelayDefault;
- BOOL bMergePopup;
- BOOL bShowHeaders;
- BOOL bNoRSS;
- int iDisable;
- int iMUCDisable;
- int dwStatusMask;
- BOOL bTrayExist;
- BOOL iNoSounds;
- BOOL iNoAutoPopup;
- BOOL bWindowCheck;
- int iLimitPreview;
- uint16_t wMaxRecent;
- uint16_t wMaxFavorites;
- uint32_t dwRemoveMask;
-
- COLORREF colBackMsg;
- COLORREF colTextMsg;
- COLORREF colBackOthers;
- COLORREF colTextOthers;
- COLORREF colBackErr;
- COLORREF colTextErr;
-};
-
-struct EVENT_DATAT
-{
- MEVENT hEvent;
- wchar_t tszText[MAX_SECONDLINE + 2];
- uint32_t timestamp;
-};
+#define NEN_MODULE "NewEventNotify"
+#define NEN_OLD_MODULE "tabSRMM_NEN"
-struct PLUGIN_DATAT
+namespace NEN
{
- MCONTACT hContact;
- UINT eventType;
- NEN_OPTIONS *pluginOptions;
- POPUPDATAW *pud;
- HWND hWnd;
- long iSeconds;
- int nrMerged;
- EVENT_DATAT *eventData;
- int nrEventsAlloced;
- int iActionTaken;
- HWND hContainer;
-};
-
-#define NR_MERGED 5
-
-#define TIMER_TO_ACTION 50685
+ extern CMOption<int> ActionLeft, ActionRight;
+ extern CMOption<bool> bMUCDisabled, bWindowCheck, bNoSounds, bNoAutoPopup, bColDefaultErr;
-#define MAX_DATASIZE 50
-#define MAX_POPUPS 20
+ extern CMOption<int> iDelayMsg, iDelayErr;
+ extern CMOption<DWORD> colTextMsg, colBackMsg;
+ extern CMOption<DWORD> colTextErr, colBackErr;
+}
#endif
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp
index 074d7f9736..fd5a80d6cc 100644
--- a/plugins/TabSRMM/src/sendlater.cpp
+++ b/plugins/TabSRMM/src/sendlater.cpp
@@ -212,12 +212,12 @@ struct CSendLaterJob : public MZeroedObject
/*
* use message settings (timeout/colors) for success popups
*/
- ppd.colorText = fFailed ? RGB(255, 245, 225) : nen_options.colTextMsg;
- ppd.colorBack = fFailed ? RGB(191, 0, 0) : nen_options.colBackMsg;
+ ppd.colorText = fFailed ? RGB(255, 245, 225) : NEN::colTextMsg;
+ ppd.colorBack = fFailed ? RGB(191, 0, 0) : NEN::colBackMsg;
ppd.PluginWindowProc = Utils::PopupDlgProcError;
ppd.lchIcon = fFailed ? PluginConfig.g_iconErr : PluginConfig.g_IconMsgEvent;
ppd.PluginData = nullptr;
- ppd.iSeconds = fFailed ? -1 : nen_options.iDelayMsg;
+ ppd.iSeconds = fFailed ? -1 : NEN::iDelayMsg;
PUAddPopupW(&ppd);
}
}
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp
index d0d1f5c4c2..ba8054bb6d 100644
--- a/plugins/TabSRMM/src/sendqueue.cpp
+++ b/plugins/TabSRMM/src/sendqueue.cpp
@@ -438,7 +438,7 @@ int SendQueue::ackMessage(CMsgDialog *dat, WPARAM wParam, LPARAM lParam)
if (dat) {
// "hard" errors are handled differently in multisend. There is no option to retry - once failed, they
// are discarded and the user is notified with a small log message.
- if (!nen_options.iNoSounds && !m_pContainer->m_flags.m_bNoSound)
+ if (!NEN::bNoSounds && !m_pContainer->m_flags.m_bNoSound)
Skin_PlaySound("SendError");
mir_snwprintf(job.szErrorMsg, TranslateT("Delivery failure: %s"), (wchar_t*)ack->lParam);
@@ -481,7 +481,7 @@ int SendQueue::ackMessage(CMsgDialog *dat, WPARAM wParam, LPARAM lParam)
MEVENT hNewEvent = db_event_add(job.hContact, &dbei);
if (m_pContainer)
- if (!nen_options.iNoSounds && !m_pContainer->m_flags.m_bNoSound)
+ if (!NEN::bNoSounds && !m_pContainer->m_flags.m_bNoSound)
Skin_PlaySound("SendMsg");
Srmm_Broadcast(DM_APPENDMCEVENT, job.hContact, hNewEvent);
diff --git a/plugins/TabSRMM/src/stdafx.h b/plugins/TabSRMM/src/stdafx.h
index 331a2021f7..db3fac0491 100644
--- a/plugins/TabSRMM/src/stdafx.h
+++ b/plugins/TabSRMM/src/stdafx.h
@@ -214,7 +214,6 @@ typedef struct _BP_PAINTPARAMS
#undef _USE_32BIT_TIME_T
#endif
-extern NEN_OPTIONS nen_options;
extern CSkinItem SkinItems[];
extern TContainerData *pFirstContainer, *pLastActiveContainer;
extern ButtonSet g_ButtonSet;
@@ -237,7 +236,6 @@ int LoadSendRecvMessageModule(void);
int SplitmsgShutdown(void);
int Chat_Load(), Chat_Unload();
void Chat_Options(WPARAM);
-void Popup_Options(WPARAM);
void FreeLogFonts();
INT_PTR SendMessageCommand(WPARAM, LPARAM);
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp
index 58de88ce5d..dc40e9da88 100644
--- a/plugins/TabSRMM/src/utils.cpp
+++ b/plugins/TabSRMM/src/utils.cpp
@@ -754,7 +754,7 @@ bool CMsgDialog::MustPlaySound() const
if (m_pContainer->m_bHidden) // hidden container is treated as closed, so play the sound
return true;
- if (m_pContainer->m_flags.m_bNoSound || nen_options.iNoSounds)
+ if (m_pContainer->m_flags.m_bNoSound || NEN::bNoSounds)
return false;
// window minimized, check if sound has to be played
diff --git a/plugins/TabSRMM/src/version.h b/plugins/TabSRMM/src/version.h
index a3489b2f22..82b20f1c15 100644
--- a/plugins/TabSRMM/src/version.h
+++ b/plugins/TabSRMM/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 3
#define __MINOR_VERSION 6
-#define __RELEASE_NUM 1
-#define __BUILD_NUM 6
+#define __RELEASE_NUM 2
+#define __BUILD_NUM 1
#include <stdver.h>