summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-03-05 21:10:22 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-03-05 21:10:22 +0300
commitd9fddc0cfa9066eb1b5ad3f4807b37426ae6ca88 (patch)
treef09baaf9b91477d009cedc5bd77449b0fa3e3af7 /plugins/TabSRMM/src
parent8a1ff32e54b39ceef22df61bda17bbfda94918fc (diff)
Popup:
- wiping out checks for service presence; - code cleaning
Diffstat (limited to 'plugins/TabSRMM/src')
-rw-r--r--plugins/TabSRMM/src/chat_options.cpp2
-rw-r--r--plugins/TabSRMM/src/eventpopups.cpp21
-rw-r--r--plugins/TabSRMM/src/globals.cpp5
-rw-r--r--plugins/TabSRMM/src/globals.h2
-rw-r--r--plugins/TabSRMM/src/msgoptions.cpp9
-rw-r--r--plugins/TabSRMM/src/resource.h1
-rw-r--r--plugins/TabSRMM/src/sendlater.cpp12
-rw-r--r--plugins/TabSRMM/src/typingnotify.cpp159
8 files changed, 82 insertions, 129 deletions
diff --git a/plugins/TabSRMM/src/chat_options.cpp b/plugins/TabSRMM/src/chat_options.cpp
index 723b832a37..1ecc58c897 100644
--- a/plugins/TabSRMM/src/chat_options.cpp
+++ b/plugins/TabSRMM/src/chat_options.cpp
@@ -554,7 +554,7 @@ class CChatSettingsDlg : public CChatBaseOptionDlg
TVINSERTSTRUCT tvis = {};
- for (int i = 0; i < nValues; i++) {
+ for (size_t i = 0; i < nValues; i++) {
tvis.hParent = hParent;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp
index 2f380b2169..9ac79c631f 100644
--- a/plugins/TabSRMM/src/eventpopups.cpp
+++ b/plugins/TabSRMM/src/eventpopups.cpp
@@ -379,9 +379,6 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, MCONTACT hContact, MEVENT hEve
if (arPopupList.getCount() >= MAX_POPUPS)
return 2;
- if (!PluginConfig.g_bPopupAvail)
- return 0;
-
DBEVENTINFO dbe = {};
// fix for a crash
if (hEvent && (pluginOptions->bPreview || hContact == 0)) {
@@ -472,16 +469,6 @@ static INT_PTR CALLBACK DlgProcPopupOpts(HWND hWnd, UINT msg, WPARAM wParam, LPA
{
TreeViewInit(GetDlgItem(hWnd, IDC_EVENTOPTIONS), CTranslator::TREE_NEN, 0, TRUE);
- if (!PluginConfig.g_bPopupAvail) {
- HWND hwndChild = FindWindowEx(hWnd, nullptr, nullptr, nullptr);
- while (hwndChild) {
- ShowWindow(hwndChild, SW_HIDE);
- hwndChild = FindWindowEx(hWnd, hwndChild, nullptr, nullptr);
- }
- Utils::showDlgControl(hWnd, IDC_NOPOPUPAVAIL, SW_SHOW);
- }
- else Utils::showDlgControl(hWnd, IDC_NOPOPUPAVAIL, SW_HIDE);
-
SendDlgItemMessage(hWnd, IDC_COLBACK_MESSAGE, CPM_SETCOLOUR, 0, nen_options.colBackMsg);
SendDlgItemMessage(hWnd, IDC_COLTEXT_MESSAGE, CPM_SETCOLOUR, 0, nen_options.colTextMsg);
SendDlgItemMessage(hWnd, IDC_COLBACK_OTHERS, CPM_SETCOLOUR, 0, nen_options.colBackOthers);
@@ -647,9 +634,6 @@ static INT_PTR CALLBACK DlgProcPopupOpts(HWND hWnd, UINT msg, WPARAM wParam, LPA
void Popup_Options(WPARAM wParam)
{
- if (!ServiceExists(MS_POPUP_ADDPOPUPW))
- return;
-
OPTIONSDIALOGPAGE odp = {};
odp.flags = ODPF_BOLDGROUPS;
odp.position = 910000000;
@@ -772,9 +756,6 @@ int tabSRMM_ShowPopup(MCONTACT hContact, MEVENT hDbEvent, WORD eventType, int wi
return 0;
}
passed:
- if (!PluginConfig.g_bPopupAvail)
- return 0;
-
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);
@@ -787,7 +768,7 @@ passed:
// remove all popups for hContact, but only if the mask matches the current "mode"
void TSAPI DeletePopupsForContact(MCONTACT hContact, DWORD dwMask)
{
- if (!(dwMask & nen_options.dwRemoveMask) || nen_options.iDisable || !PluginConfig.g_bPopupAvail)
+ if (!(dwMask & nen_options.dwRemoveMask) || nen_options.iDisable)
return;
PLUGIN_DATAT *_T = nullptr;
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp
index 9c4d3b2fe1..052fd72127 100644
--- a/plugins/TabSRMM/src/globals.cpp
+++ b/plugins/TabSRMM/src/globals.cpp
@@ -113,8 +113,6 @@ void CGlobals::reloadSystemModulesChanged()
m_hwndClist = g_clistApi.hwndContactList;
- g_bPopupAvail = ServiceExists(MS_POPUP_ADDPOPUPW) != 0;
-
CMenuItem mi(&g_plugin);
SET_UID(mi, 0x58d8dc1, 0x1c25, 0x49c0, 0xb8, 0x7c, 0xa3, 0x22, 0x2b, 0x3d, 0xf1, 0xd8);
mi.position = -2000090000;
@@ -312,8 +310,7 @@ int CGlobals::ModulesLoaded(WPARAM, LPARAM)
::RegisterFontServiceFonts();
::CacheLogFonts();
- if (PluginConfig.g_bPopupAvail)
- TN_ModuleInit();
+ TN_ModuleInit();
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, DBSettingChanged);
HookEvent(ME_DB_CONTACT_DELETED, DBContactDeleted);
diff --git a/plugins/TabSRMM/src/globals.h b/plugins/TabSRMM/src/globals.h
index f8341fe67e..8863eb1eee 100644
--- a/plugins/TabSRMM/src/globals.h
+++ b/plugins/TabSRMM/src/globals.h
@@ -68,7 +68,7 @@ public:
HICON g_iconOverlayDisabled, g_iconOverlayEnabled, g_iconClock;
HCURSOR hCurSplitNS, hCurSplitWE;
HBITMAP g_hbmUnknown;
- bool g_SmileyAddAvail, g_WantIEView, g_bPopupAvail, g_WantHPP;
+ bool g_SmileyAddAvail, g_WantIEView, g_WantHPP;
HIMAGELIST g_hImageList;
HICON g_IconMsgEvent, g_IconTypingEvent, g_IconFileEvent, g_IconSend;
HICON g_IconMsgEventBig, g_IconTypingEventBig;
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp
index 14881c39b2..1da41d268b 100644
--- a/plugins/TabSRMM/src/msgoptions.cpp
+++ b/plugins/TabSRMM/src/msgoptions.cpp
@@ -940,12 +940,6 @@ public:
SendDlgItemMessage(m_hwnd, IDC_MTN_POPUPMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Only when no message window is open"));
SendDlgItemMessage(m_hwnd, IDC_MTN_POPUPMODE, CB_SETCURSEL, (WPARAM)M.GetByte("MTN_PopupMode", 0), 0);
-
- if (!PluginConfig.g_bPopupAvail) {
- Utils::showDlgControl(m_hwnd, IDC_NOTIFYPOPUP, SW_HIDE);
- Utils::showDlgControl(m_hwnd, IDC_STATIC111, SW_HIDE);
- Utils::showDlgControl(m_hwnd, IDC_MTN_POPUPMODE, SW_HIDE);
- }
return true;
}
@@ -1448,8 +1442,7 @@ INT_PTR CALLBACK DlgProcSetupStatusModes(HWND hwndDlg, UINT msg, WPARAM wParam,
int OptInitialise(WPARAM wParam, LPARAM lParam)
{
- if (PluginConfig.g_bPopupAvail)
- TN_OptionsInitialize(wParam, lParam);
+ TN_OptionsInitialize(wParam, lParam);
// message sessions' options
OPTIONSDIALOGPAGE odpnew = {};
diff --git a/plugins/TabSRMM/src/resource.h b/plugins/TabSRMM/src/resource.h
index b0ecaae43e..4cb7204346 100644
--- a/plugins/TabSRMM/src/resource.h
+++ b/plugins/TabSRMM/src/resource.h
@@ -433,7 +433,6 @@
#define IDC_THEME 1394
#define IDC_INFOPANEL 1395
#define IDC_SHOWAVATAR 1396
-#define IDC_NOPOPUPAVAIL 1398
#define IDC_QHTM 1399
#define IDC_TSLABEL_ACTIVE 1400
#define IDC_TSLABEL_INACTIVE 1401
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp
index 8212a9f840..cad78c179c 100644
--- a/plugins/TabSRMM/src/sendlater.cpp
+++ b/plugins/TabSRMM/src/sendlater.cpp
@@ -115,7 +115,7 @@ CSendLaterJob::~CSendLaterJob()
/*
* show a popup notification, unless they are disabled
*/
- if (PluginConfig.g_bPopupAvail && fShowPopup) {
+ if (fShowPopup) {
wchar_t *tszName = Clist_GetContactDisplayName(hContact);
POPUPDATAW ppd = { 0 };
@@ -678,14 +678,8 @@ INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
::SendMessage(m_hwndList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_LABELTIP | LVS_EX_DOUBLEBUFFER);
qMgrSetupColumns();
qMgrFillList();
- if (PluginConfig.g_bPopupAvail) {
- ::CheckDlgButton(m_hwndDlg, IDC_QMGR_SUCCESSPOPUPS, m_fSuccessPopups ? BST_CHECKED : BST_UNCHECKED);
- ::CheckDlgButton(m_hwndDlg, IDC_QMGR_ERRORPOPUPS, m_fErrorPopups ? BST_CHECKED : BST_UNCHECKED);
- }
- else {
- Utils::showDlgControl(m_hwndDlg, IDC_QMGR_ERRORPOPUPS, SW_HIDE);
- Utils::showDlgControl(m_hwndDlg, IDC_QMGR_SUCCESSPOPUPS, SW_HIDE);
- }
+ ::CheckDlgButton(m_hwndDlg, IDC_QMGR_SUCCESSPOPUPS, m_fSuccessPopups ? BST_CHECKED : BST_UNCHECKED);
+ ::CheckDlgButton(m_hwndDlg, IDC_QMGR_ERRORPOPUPS, m_fErrorPopups ? BST_CHECKED : BST_UNCHECKED);
::ShowWindow(hwnd, SW_NORMAL);
return FALSE;
diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp
index e4a59d5327..f65d1f8965 100644
--- a/plugins/TabSRMM/src/typingnotify.cpp
+++ b/plugins/TabSRMM/src/typingnotify.cpp
@@ -42,13 +42,10 @@ static colorPicker[4] =
static INT_PTR EnableDisableMenuCommand(WPARAM, LPARAM)
{
Disabled = !Disabled;
-
- if (PluginConfig.g_bPopupAvail) {
- if (!Disabled)
- Menu_ModifyItem(hDisableMenu, LPGENW("Disable &typing notification"), IcoLib_GetIcon("tabSRMM_popups_enabled"));
- else
- Menu_ModifyItem(hDisableMenu, LPGENW("Enable &typing notification"), IcoLib_GetIcon("tabSRMM_popups_disabled"));
- }
+ if (!Disabled)
+ Menu_ModifyItem(hDisableMenu, LPGENW("Disable &typing notification"), IcoLib_GetIcon("tabSRMM_popups_enabled"));
+ else
+ Menu_ModifyItem(hDisableMenu, LPGENW("Enable &typing notification"), IcoLib_GetIcon("tabSRMM_popups_disabled"));
return 0;
}
@@ -85,7 +82,7 @@ void TN_TypingMessage(MCONTACT hContact, int iMode)
if (db_get_b(hContact, "CList", "Hidden", 0) || (db_get_dw(hContact, "Ignore", "Mask1", 0) & 1)) // 9 - online notification
return;
- if (!PluginConfig.g_bPopupAvail || Disabled)
+ if (Disabled)
return;
wchar_t *szContactName = Clist_GetContactDisplayName(hContact);
@@ -167,7 +164,7 @@ void TN_TypingMessage(MCONTACT hContact, int iMode)
ppd.lchIcon = PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING];
ppd.lchContact = hContact;
ppd.PluginWindowProc = PopupDlgProc;
- CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&ppd, APF_NEWDATA);
+ PUAddPopupW(&ppd, APF_NEWDATA);
}
static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -215,10 +212,6 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
CheckDlgButton(hwndDlg, IDC_ONEPOPUP, (OnePopup) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SHOWMENU, (ShowMenu) ? BST_CHECKED : BST_UNCHECKED);
- Utils::enableDlgControl(hwndDlg, IDC_ONEPOPUP, PluginConfig.g_bPopupAvail);
- Utils::enableDlgControl(hwndDlg, IDC_SHOWMENU, PluginConfig.g_bPopupAvail);
- Utils::enableDlgControl(hwndDlg, IDC_PREVIEW, PluginConfig.g_bPopupAvail);
-
newTimeout = Timeout;
newTimeoutMode = TimeoutMode;
newTimeout2 = Timeout2;
@@ -291,72 +284,70 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
break;
case IDC_PREVIEW:
- if (PluginConfig.g_bPopupAvail) {
- POPUPDATAW ppd = { 0 };
- for (int i = 0; i < 2; i++) {
- int notyping;
- if (i == PROTOTYPE_CONTACTTYPING_OFF) {
- wcsncpy_s(ppd.lpwzContactName, TranslateT("Contact"), _TRUNCATE);
- wcsncpy_s(ppd.lpwzText, szStop, _TRUNCATE);
- notyping = 1;
- }
- else {
- wcsncpy_s(ppd.lpwzContactName, TranslateT("Contact"), _TRUNCATE);
- wcsncpy_s(ppd.lpwzText, szStart, _TRUNCATE);
- notyping = 0;
- }
-
- switch (newColorMode) {
- case COLOR_OWN:
- ppd.colorText = SendDlgItemMessage(hwndDlg, colorPicker[2 * notyping + 1].res, CPM_GETCOLOUR, 0, 0);
- ppd.colorBack = SendDlgItemMessage(hwndDlg, colorPicker[2 * notyping].res, CPM_GETCOLOUR, 0, 0);
+ for (int i = 0; i < 2; i++) {
+ POPUPDATAW ppd = {};
+ int notyping;
+ if (i == PROTOTYPE_CONTACTTYPING_OFF) {
+ wcsncpy_s(ppd.lpwzContactName, TranslateT("Contact"), _TRUNCATE);
+ wcsncpy_s(ppd.lpwzText, szStop, _TRUNCATE);
+ notyping = 1;
+ }
+ else {
+ wcsncpy_s(ppd.lpwzContactName, TranslateT("Contact"), _TRUNCATE);
+ wcsncpy_s(ppd.lpwzText, szStart, _TRUNCATE);
+ notyping = 0;
+ }
+
+ switch (newColorMode) {
+ case COLOR_OWN:
+ ppd.colorText = SendDlgItemMessage(hwndDlg, colorPicker[2 * notyping + 1].res, CPM_GETCOLOUR, 0, 0);
+ ppd.colorBack = SendDlgItemMessage(hwndDlg, colorPicker[2 * notyping].res, CPM_GETCOLOUR, 0, 0);
+ break;
+ case COLOR_WINDOWS:
+ ppd.colorBack = GetSysColor(COLOR_BTNFACE);
+ ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
+ break;
+ case COLOR_POPUP:
+ default:
+ ppd.colorBack = ppd.colorText = 0;
+ break;
+ }
+
+ if (notyping)
+ switch (newTimeoutMode2) {
+ case TIMEOUT_CUSTOM:
+ ppd.iSeconds = newTimeout2;
break;
- case COLOR_WINDOWS:
- ppd.colorBack = GetSysColor(COLOR_BTNFACE);
- ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
+ case TIMEOUT_PERMANENT:
+ ppd.iSeconds = -1;
break;
- case COLOR_POPUP:
+ case TIMEOUT_POPUP:
default:
- ppd.colorBack = ppd.colorText = 0;
+ ppd.iSeconds = 0;
break;
- }
-
- if (notyping)
- switch (newTimeoutMode2) {
- case TIMEOUT_CUSTOM:
- ppd.iSeconds = newTimeout2;
- break;
- case TIMEOUT_PERMANENT:
- ppd.iSeconds = -1;
- break;
- case TIMEOUT_POPUP:
- default:
- ppd.iSeconds = 0;
- break;
- }
- else
- switch (newTimeoutMode) {
- case TIMEOUT_CUSTOM:
- ppd.iSeconds = newTimeout;
- break;
- case TIMEOUT_PROTO:
- ppd.iSeconds = 10;
- break;
- case TIMEOUT_PERMANENT:
- ppd.iSeconds = -1;
- break;
- case TIMEOUT_POPUP:
- default:
- ppd.iSeconds = 0;
- break;
- }
-
- ppd.lchIcon = PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING];
- ppd.lchContact = wParam;
- ppd.PluginWindowProc = nullptr;
- ppd.PluginData = nullptr;
- PUAddPopupW(&ppd);
}
+ else
+ switch (newTimeoutMode) {
+ case TIMEOUT_CUSTOM:
+ ppd.iSeconds = newTimeout;
+ break;
+ case TIMEOUT_PROTO:
+ ppd.iSeconds = 10;
+ break;
+ case TIMEOUT_PERMANENT:
+ ppd.iSeconds = -1;
+ break;
+ case TIMEOUT_POPUP:
+ default:
+ ppd.iSeconds = 0;
+ break;
+ }
+
+ ppd.lchIcon = PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING];
+ ppd.lchContact = wParam;
+ ppd.PluginWindowProc = nullptr;
+ ppd.PluginData = nullptr;
+ PUAddPopupW(&ppd);
}
break;
@@ -489,16 +480,14 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
int TN_OptionsInitialize(WPARAM wParam, LPARAM)
{
- if (ServiceExists(MS_POPUP_ADDPOPUPW)) {
- OPTIONSDIALOGPAGE odp = {};
- odp.position = 100000000;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TYPINGNOTIFYPOPUP);
- odp.szTitle.a = LPGEN("Typing notify");
- odp.szGroup.a = LPGEN("Popups");
- odp.flags = ODPF_BOLDGROUPS;
- odp.pfnDlgProc = DlgProcOpts;
- g_plugin.addOptions(wParam, &odp);
- }
+ OPTIONSDIALOGPAGE odp = {};
+ odp.position = 100000000;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TYPINGNOTIFYPOPUP);
+ odp.szTitle.a = LPGEN("Typing notify");
+ odp.szGroup.a = LPGEN("Popups");
+ odp.flags = ODPF_BOLDGROUPS;
+ odp.pfnDlgProc = DlgProcOpts;
+ g_plugin.addOptions(wParam, &odp);
return 0;
}
@@ -527,7 +516,7 @@ int TN_ModuleInit()
mir_snwprintf(szStart, TranslateT("...is typing a message."));
mir_snwprintf(szStop, TranslateT("...has stopped typing."));
- if (PluginConfig.g_bPopupAvail && ShowMenu) {
+ if (ShowMenu) {
CreateServiceFunction("TypingNotify/EnableDisableMenuCommand", EnableDisableMenuCommand);
CMenuItem mi(&g_plugin);