summaryrefslogtreecommitdiff
path: root/plugins/WhenWasIt
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-05-20 15:08:48 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-05-20 15:08:48 +0300
commit8a74e7495ce5ad39de4f5c25121a84d35df90c36 (patch)
tree03e5b4870f09a3163306740c2eebee47bc15b042 /plugins/WhenWasIt
parentc5bf7d6123dd1c3b82ccb8fdb1b068077e9d56d4 (diff)
CMPlugin to receive a reference to PLUGININFOEX
Diffstat (limited to 'plugins/WhenWasIt')
-rw-r--r--plugins/WhenWasIt/src/WhenWasIt.cpp10
-rw-r--r--plugins/WhenWasIt/src/dlg_handlers.cpp56
-rw-r--r--plugins/WhenWasIt/src/hooked_events.cpp2
-rw-r--r--plugins/WhenWasIt/src/notifiers.h2
-rw-r--r--plugins/WhenWasIt/src/services.cpp46
-rw-r--r--plugins/WhenWasIt/src/stdafx.h6
-rw-r--r--plugins/WhenWasIt/src/utils.cpp2
7 files changed, 63 insertions, 61 deletions
diff --git a/plugins/WhenWasIt/src/WhenWasIt.cpp b/plugins/WhenWasIt/src/WhenWasIt.cpp
index eaccb2a2c5..54539d3a54 100644
--- a/plugins/WhenWasIt/src/WhenWasIt.cpp
+++ b/plugins/WhenWasIt/src/WhenWasIt.cpp
@@ -31,7 +31,7 @@ CommonData commonData = { 0 };
/////////////////////////////////////////////////////////////////////////////////////////
-PLUGININFOEX pluginInfo = {
+PLUGININFOEX pluginInfoEx = {
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
@@ -44,9 +44,13 @@ PLUGININFOEX pluginInfo = {
{ 0x2ff96c84, 0xb0b5, 0x470e, { 0xbb, 0xf9, 0x90, 0x7b, 0x9f, 0x3f, 0x5d, 0x2f } }
};
+CMPlugin::CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
+{}
+
extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD)
{
- return &pluginInfo;
+ return &pluginInfoEx;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -55,7 +59,7 @@ extern "C" int __declspec(dllexport) Load(void)
{
Log("%s", "Entering function " __FUNCTION__);
- mir_getLP(&pluginInfo);
+ mir_getLP(&pluginInfoEx);
INITCOMMONCONTROLSEX icex;
icex.dwSize = sizeof(icex);
diff --git a/plugins/WhenWasIt/src/dlg_handlers.cpp b/plugins/WhenWasIt/src/dlg_handlers.cpp
index 3f7f6d7ba4..e6916d60d9 100644
--- a/plugins/WhenWasIt/src/dlg_handlers.cpp
+++ b/plugins/WhenWasIt/src/dlg_handlers.cpp
@@ -347,35 +347,35 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
commonData.cDlgTimeout = wcstol(buffer, &stop, 10);
if (*stop) { commonData.cDlgTimeout = POPUP_TIMEOUT; }
- db_set_b(NULL, ModuleName, "IgnoreSubcontacts", commonData.bIgnoreSubcontacts);
- db_set_b(NULL, ModuleName, "UsePopups", commonData.bUsePopups);
- db_set_b(NULL, ModuleName, "UseDialog", commonData.bUseDialog);
- db_set_w(NULL, ModuleName, "CheckInterval", commonData.checkInterval);
- db_set_w(NULL, ModuleName, "DaysInAdvance", commonData.daysInAdvance);
- db_set_w(NULL, ModuleName, "DaysAfter", commonData.daysAfter);
- db_set_w(NULL, ModuleName, "PopupTimeout", commonData.popupTimeout);
- db_set_w(NULL, ModuleName, "PopupTimeoutToday", commonData.popupTimeoutToday);
+ db_set_b(NULL, MODULENAME, "IgnoreSubcontacts", commonData.bIgnoreSubcontacts);
+ db_set_b(NULL, MODULENAME, "UsePopups", commonData.bUsePopups);
+ db_set_b(NULL, MODULENAME, "UseDialog", commonData.bUseDialog);
+ db_set_w(NULL, MODULENAME, "CheckInterval", commonData.checkInterval);
+ db_set_w(NULL, MODULENAME, "DaysInAdvance", commonData.daysInAdvance);
+ db_set_w(NULL, MODULENAME, "DaysAfter", commonData.daysAfter);
+ db_set_w(NULL, MODULENAME, "PopupTimeout", commonData.popupTimeout);
+ db_set_w(NULL, MODULENAME, "PopupTimeoutToday", commonData.popupTimeoutToday);
- db_set_b(NULL, ModuleName, "ShowCurrentAge", commonData.cShowAgeMode);
- db_set_b(NULL, ModuleName, "NoBirthdaysPopup", commonData.bNoBirthdaysPopup);
+ db_set_b(NULL, MODULENAME, "ShowCurrentAge", commonData.cShowAgeMode);
+ db_set_b(NULL, MODULENAME, "NoBirthdaysPopup", commonData.bNoBirthdaysPopup);
- db_set_b(NULL, ModuleName, "OpenInBackground", commonData.bOpenInBackground);
+ db_set_b(NULL, MODULENAME, "OpenInBackground", commonData.bOpenInBackground);
- db_set_b(NULL, ModuleName, "SoundNearDays", commonData.cSoundNearDays);
+ db_set_b(NULL, MODULENAME, "SoundNearDays", commonData.cSoundNearDays);
- db_set_b(NULL, ModuleName, "DefaultModule", commonData.cDefaultModule);
+ db_set_b(NULL, MODULENAME, "DefaultModule", commonData.cDefaultModule);
- db_set_b(NULL, ModuleName, "PopupLeftClick", commonData.lPopupClick);
- db_set_b(NULL, ModuleName, "PopupRightClick", commonData.rPopupClick);
+ db_set_b(NULL, MODULENAME, "PopupLeftClick", commonData.lPopupClick);
+ db_set_b(NULL, MODULENAME, "PopupRightClick", commonData.rPopupClick);
- db_set_dw(NULL, ModuleName, "Foreground", commonData.foreground);
- db_set_dw(NULL, ModuleName, "Background", commonData.background);
+ db_set_dw(NULL, MODULENAME, "Foreground", commonData.foreground);
+ db_set_dw(NULL, MODULENAME, "Background", commonData.background);
- db_set_b(NULL, ModuleName, "OncePerDay", commonData.bOncePerDay);
+ db_set_b(NULL, MODULENAME, "OncePerDay", commonData.bOncePerDay);
- db_set_w(NULL, ModuleName, "DlgTimeout", commonData.cDlgTimeout);
+ db_set_w(NULL, MODULENAME, "DlgTimeout", commonData.cDlgTimeout);
- db_set_b(NULL, ModuleName, "NotifyFor", commonData.notifyFor);
+ db_set_b(NULL, MODULENAME, "NotifyFor", commonData.notifyFor);
RefreshAllContactListIcons();
@@ -401,7 +401,7 @@ INT_PTR CALLBACK DlgProcAddBirthday(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l
hContact = lParam;
WindowList_Add(hAddBirthdayWndsList, hWnd, hContact);
- Utils_RestoreWindowPositionNoSize(hWnd, hContact, ModuleName, "BirthdayWnd");
+ Utils_RestoreWindowPositionNoSize(hWnd, hContact, MODULENAME, "BirthdayWnd");
Window_SetIcon_IcoLib(hWnd, hAddBirthdayContact);
@@ -474,7 +474,7 @@ INT_PTR CALLBACK DlgProcAddBirthday(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l
case WM_DESTROY:
RefreshContactListIcons(hContact); //the birthday might be changed, refresh icon.
Window_FreeIcon_IcoLib(hWnd);
- Utils_SaveWindowPosition(hWnd, hContact, ModuleName, "BirthdayWnd");
+ Utils_SaveWindowPosition(hWnd, hContact, MODULENAME, "BirthdayWnd");
WindowList_Remove(hAddBirthdayWndsList, hWnd);
break;
@@ -746,14 +746,14 @@ INT_PTR CALLBACK DlgProcBirthdays(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
ListView_InsertColumn(hList, 5, &col);
LoadBirthdays(hWnd, 0);
- int column = db_get_b(NULL, ModuleName, "SortColumn", 0);
+ int column = db_get_b(NULL, MODULENAME, "SortColumn", 0);
BirthdaysSortParams params = {};
params.hList = GetDlgItem(hWnd, IDC_BIRTHDAYS_LIST);
params.column = column;
ListView_SortItemsEx(params.hList, BirthdaysCompare, (LPARAM)&params);
- Utils_RestoreWindowPosition(hWnd, NULL, ModuleName, "BirthdayList");
+ Utils_RestoreWindowPosition(hWnd, NULL, MODULENAME, "BirthdayList");
}
return TRUE;
@@ -818,7 +818,7 @@ INT_PTR CALLBACK DlgProcBirthdays(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
case LVN_COLUMNCLICK:
LPNMLISTVIEW lv = (LPNMLISTVIEW)lParam;
int column = lv->iSubItem;
- db_set_b(NULL, ModuleName, "SortColumn", column);
+ db_set_b(NULL, MODULENAME, "SortColumn", column);
BirthdaysSortParams params = {};
params.hList = GetDlgItem(hWnd, IDC_BIRTHDAYS_LIST);
params.column = column;
@@ -831,7 +831,7 @@ INT_PTR CALLBACK DlgProcBirthdays(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
case WM_DESTROY:
hBirthdaysDlg = nullptr;
- Utils_SaveWindowPosition(hWnd, NULL, ModuleName, "BirthdayList");
+ Utils_SaveWindowPosition(hWnd, NULL, MODULENAME, "BirthdayList");
Window_FreeIcon_IcoLib(hWnd);
lastColumn = -1;
break;
@@ -872,7 +872,7 @@ INT_PTR CALLBACK DlgProcUpcoming(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
if (timeout > 0)
SetTimer(hWnd, UPCOMING_TIMER_ID, 1000, nullptr);
- Utils_RestoreWindowPosition(hWnd, NULL, ModuleName, "BirthdayListUpcoming");
+ Utils_RestoreWindowPosition(hWnd, NULL, MODULENAME, "BirthdayListUpcoming");
}
return TRUE;
@@ -959,7 +959,7 @@ INT_PTR CALLBACK DlgProcUpcoming(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
case WM_DESTROY:
hUpcomingDlg = nullptr;
- Utils_SaveWindowPosition(hWnd, NULL, ModuleName, "BirthdayListUpcoming");
+ Utils_SaveWindowPosition(hWnd, NULL, MODULENAME, "BirthdayListUpcoming");
Window_FreeIcon_IcoLib(hWnd);
KillTimer(hWnd, UPCOMING_TIMER_ID);
break;
diff --git a/plugins/WhenWasIt/src/hooked_events.cpp b/plugins/WhenWasIt/src/hooked_events.cpp
index 7aa2881a96..ad79aab976 100644
--- a/plugins/WhenWasIt/src/hooked_events.cpp
+++ b/plugins/WhenWasIt/src/hooked_events.cpp
@@ -142,7 +142,7 @@ int RefreshContactListIcons(MCONTACT hContact)
int UpdateTimers()
{
- UINT interval = db_get_dw(NULL, ModuleName, "Interval", CHECK_INTERVAL);
+ UINT interval = db_get_dw(NULL, MODULENAME, "Interval", CHECK_INTERVAL);
interval *= (1000 * 60 * 60); //go from miliseconds to hours
hCheckTimer = SetTimer(nullptr, 0, interval, OnCheckTimer);
if (!hDateChangeTimer)
diff --git a/plugins/WhenWasIt/src/notifiers.h b/plugins/WhenWasIt/src/notifiers.h
index 815dc79b6d..3f22598539 100644
--- a/plugins/WhenWasIt/src/notifiers.h
+++ b/plugins/WhenWasIt/src/notifiers.h
@@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define BIRTHDAY_NEAR_DEFAULT_DAYS 3
-#define DUMMY_MODULE ModuleName
+#define DUMMY_MODULE MODULENAME
#define DUMMY_SETTING "refreshIconsDummyVal"
struct TUpcomingBirthday{
diff --git a/plugins/WhenWasIt/src/services.cpp b/plugins/WhenWasIt/src/services.cpp
index 1790c0c8f6..38319dc597 100644
--- a/plugins/WhenWasIt/src/services.cpp
+++ b/plugins/WhenWasIt/src/services.cpp
@@ -29,26 +29,26 @@ int InitServices()
{
Log("%s", "Entering function " __FUNCTION__);
- commonData.foreground = db_get_dw(NULL, ModuleName, "Foreground", FOREGROUND_COLOR);
- commonData.background = db_get_dw(NULL, ModuleName, "Background", BACKGROUND_COLOR);
- commonData.checkInterval = db_get_w(NULL, ModuleName, "CheckInterval", CHECK_INTERVAL);
- commonData.daysInAdvance = db_get_w(NULL, ModuleName, "DaysInAdvance", DAYS_TO_NOTIFY);
- commonData.daysAfter = db_get_w(NULL, ModuleName, "DaysAfter", DAYS_TO_NOTIFY_AFTER);
- commonData.popupTimeout = db_get_w(NULL, ModuleName, "PopupTimeout", POPUP_TIMEOUT);
- commonData.popupTimeoutToday = db_get_w(NULL, ModuleName, "PopupTimeoutToday", commonData.popupTimeout);
- commonData.bUsePopups = db_get_b(NULL, ModuleName, "UsePopups", TRUE);
- commonData.bUseDialog = db_get_b(NULL, ModuleName, "UseDialog", TRUE);
- commonData.bIgnoreSubcontacts = db_get_b(NULL, ModuleName, "IgnoreSubcontacts", FALSE);
- commonData.cShowAgeMode = db_get_b(NULL, ModuleName, "ShowCurrentAge", FALSE);
- commonData.bNoBirthdaysPopup = db_get_b(NULL, ModuleName, "NoBirthdaysPopup", FALSE);
- commonData.bOpenInBackground = db_get_b(NULL, ModuleName, "OpenInBackground", FALSE);
- commonData.cSoundNearDays = db_get_b(NULL, ModuleName, "SoundNearDays", BIRTHDAY_NEAR_DEFAULT_DAYS);
- commonData.cDefaultModule = db_get_b(NULL, ModuleName, "DefaultModule", 0);
- commonData.lPopupClick = db_get_b(NULL, ModuleName, "PopupLeftClick", 2);
- commonData.rPopupClick = db_get_b(NULL, ModuleName, "PopupRightClick", 1);
- commonData.bOncePerDay = db_get_b(NULL, ModuleName, "OncePerDay", 0);
- commonData.cDlgTimeout = db_get_w(NULL, ModuleName, "DlgTimeout", POPUP_TIMEOUT);
- commonData.notifyFor = db_get_b(NULL, ModuleName, "NotifyFor", 0);
+ commonData.foreground = db_get_dw(NULL, MODULENAME, "Foreground", FOREGROUND_COLOR);
+ commonData.background = db_get_dw(NULL, MODULENAME, "Background", BACKGROUND_COLOR);
+ commonData.checkInterval = db_get_w(NULL, MODULENAME, "CheckInterval", CHECK_INTERVAL);
+ commonData.daysInAdvance = db_get_w(NULL, MODULENAME, "DaysInAdvance", DAYS_TO_NOTIFY);
+ commonData.daysAfter = db_get_w(NULL, MODULENAME, "DaysAfter", DAYS_TO_NOTIFY_AFTER);
+ commonData.popupTimeout = db_get_w(NULL, MODULENAME, "PopupTimeout", POPUP_TIMEOUT);
+ commonData.popupTimeoutToday = db_get_w(NULL, MODULENAME, "PopupTimeoutToday", commonData.popupTimeout);
+ commonData.bUsePopups = db_get_b(NULL, MODULENAME, "UsePopups", TRUE);
+ commonData.bUseDialog = db_get_b(NULL, MODULENAME, "UseDialog", TRUE);
+ commonData.bIgnoreSubcontacts = db_get_b(NULL, MODULENAME, "IgnoreSubcontacts", FALSE);
+ commonData.cShowAgeMode = db_get_b(NULL, MODULENAME, "ShowCurrentAge", FALSE);
+ commonData.bNoBirthdaysPopup = db_get_b(NULL, MODULENAME, "NoBirthdaysPopup", FALSE);
+ commonData.bOpenInBackground = db_get_b(NULL, MODULENAME, "OpenInBackground", FALSE);
+ commonData.cSoundNearDays = db_get_b(NULL, MODULENAME, "SoundNearDays", BIRTHDAY_NEAR_DEFAULT_DAYS);
+ commonData.cDefaultModule = db_get_b(NULL, MODULENAME, "DefaultModule", 0);
+ commonData.lPopupClick = db_get_b(NULL, MODULENAME, "PopupLeftClick", 2);
+ commonData.rPopupClick = db_get_b(NULL, MODULENAME, "PopupRightClick", 1);
+ commonData.bOncePerDay = db_get_b(NULL, MODULENAME, "OncePerDay", 0);
+ commonData.cDlgTimeout = db_get_w(NULL, MODULENAME, "DlgTimeout", POPUP_TIMEOUT);
+ commonData.notifyFor = db_get_b(NULL, MODULENAME, "NotifyFor", 0);
CreateServiceFunction(MS_WWI_CHECK_BIRTHDAYS, CheckBirthdaysService);
CreateServiceFunction(MS_WWI_LIST_SHOW, ShowListService);
@@ -104,7 +104,7 @@ INT_PTR CheckBirthdaysService(WPARAM, LPARAM lParam)
SYSTEMTIME today;
GetLocalTime(&today);
- DWORD lastChecked = db_get_dw(NULL, ModuleName, "LastChecked", 0); //get last checked date
+ DWORD lastChecked = db_get_dw(NULL, MODULENAME, "LastChecked", 0); //get last checked date
int lcDay = LOBYTE(LOWORD(lastChecked));
int lcMonth = HIBYTE(LOWORD(lastChecked));
int lcYear = HIWORD(lastChecked);
@@ -131,7 +131,7 @@ INT_PTR CheckBirthdaysService(WPARAM, LPARAM lParam)
commonData.daysAfter = savedDaysAfter; //restore previous value
if (lParam) //if not forced - i.e. timer check
- db_set_dw(NULL, ModuleName, "LastChecked", MAKELONG(MAKEWORD(today.wDay, today.wMonth), today.wYear)); //write the value in DB so we don't check again today
+ db_set_dw(NULL, MODULENAME, "LastChecked", MAKELONG(MAKEWORD(today.wDay, today.wMonth), today.wYear)); //write the value in DB so we don't check again today
return 0;
}
@@ -170,7 +170,7 @@ void __cdecl RefreshUserDetailsWorkerThread(void*)
Thread_SetName("WhenWasIt: RefreshUserDetailsWorkerThread");
ShowPopupMessage(TranslateT("WhenWasIt"), TranslateT("Starting to refresh user details"), hRefreshUserDetails);
- int delay = db_get_w(NULL, ModuleName, "UpdateDelay", REFRESH_DETAILS_DELAY);
+ int delay = db_get_w(NULL, MODULENAME, "UpdateDelay", REFRESH_DETAILS_DELAY);
MCONTACT hContact = db_find_first();
while (hContact != NULL) {
diff --git a/plugins/WhenWasIt/src/stdafx.h b/plugins/WhenWasIt/src/stdafx.h
index f9bdc75670..25dbf33929 100644
--- a/plugins/WhenWasIt/src/stdafx.h
+++ b/plugins/WhenWasIt/src/stdafx.h
@@ -61,13 +61,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "dlg_handlers.h"
#include "events.h"
-#define ModuleName "WhenWasIt"
+#define MODULENAME "WhenWasIt"
struct CMPlugin : public PLUGIN<CMPlugin>
{
- CMPlugin() :
- PLUGIN<CMPlugin>(ModuleName)
- {}
+ CMPlugin();
};
extern HWND hBirthdaysDlg;
diff --git a/plugins/WhenWasIt/src/utils.cpp b/plugins/WhenWasIt/src/utils.cpp
index 9d3c338627..2b058289c4 100644
--- a/plugins/WhenWasIt/src/utils.cpp
+++ b/plugins/WhenWasIt/src/utils.cpp
@@ -135,7 +135,7 @@ int GetStringFromDatabase(MCONTACT hContact, char *szModule, char *szSettingName
int GetStringFromDatabase(char *szSettingName, char *szError, char *szResult, size_t size)
{
- return GetStringFromDatabase(NULL, ModuleName, szSettingName, szError, szResult, size);
+ return GetStringFromDatabase(NULL, MODULENAME, szSettingName, szError, szResult, size);
}
wchar_t* GetContactID(MCONTACT hContact)