summaryrefslogtreecommitdiff
path: root/plugins/BasicHistory
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/BasicHistory
parentc5bf7d6123dd1c3b82ccb8fdb1b068077e9d56d4 (diff)
CMPlugin to receive a reference to PLUGININFOEX
Diffstat (limited to 'plugins/BasicHistory')
-rw-r--r--plugins/BasicHistory/src/BasicHistory.cpp26
-rw-r--r--plugins/BasicHistory/src/HistoryWindow.cpp34
-rw-r--r--plugins/BasicHistory/src/Options.cpp332
-rw-r--r--plugins/BasicHistory/src/Scheduler.cpp8
-rw-r--r--plugins/BasicHistory/src/stdafx.h6
5 files changed, 208 insertions, 198 deletions
diff --git a/plugins/BasicHistory/src/BasicHistory.cpp b/plugins/BasicHistory/src/BasicHistory.cpp
index 5f10890c00..86a5b606c3 100644
--- a/plugins/BasicHistory/src/BasicHistory.cpp
+++ b/plugins/BasicHistory/src/BasicHistory.cpp
@@ -21,8 +21,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MS_HISTORY_DELETEALLCONTACTHISTORY "BasicHistory/DeleteAllContactHistory"
#define MS_HISTORY_EXECUTE_TASK "BasicHistory/ExecuteTask"
-HCURSOR hCurSplitNS, hCurSplitWE;
-HANDLE g_hMainThread = nullptr;
+HCURSOR hCurSplitNS, hCurSplitWE;
+HANDLE g_hMainThread = nullptr;
HANDLE *hEventIcons = nullptr;
int iconsNum = 3;
@@ -34,7 +34,12 @@ bool g_SmileyAddAvail = false;
char* metaContactProto = nullptr;
const IID IID_ITextDocument = { 0x8CC497C0, 0xA1DF, 0x11ce, {0x80, 0x98, 0x00, 0xAA, 0x00, 0x47, 0xBE, 0x5D} };
-PLUGININFOEX pluginInfo = {
+CMPlugin g_plugin;
+int &hLangpack(g_plugin.m_hLang);
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+PLUGININFOEX pluginInfoEx = {
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
@@ -47,16 +52,21 @@ PLUGININFOEX pluginInfo = {
{0xe25367a2, 0x51ae, 0x4044, {0xbe, 0x28, 0x13, 0x1b, 0xc1, 0x8b, 0x71, 0xa4}}
};
-CMPlugin g_plugin;
-int &hLangpack(g_plugin.m_hLang);
+CMPlugin::CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
+{}
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
- return &pluginInfo;
+ return &pluginInfoEx;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_UIHISTORY, MIID_LAST };
+/////////////////////////////////////////////////////////////////////////////////////////
+
void InitScheduler();
void DeinitScheduler();
int DoLastTask(WPARAM, LPARAM);
@@ -232,7 +242,7 @@ int ModulesLoaded(WPARAM, LPARAM)
extern "C" int __declspec(dllexport) Load(void)
{
- mir_getLP(&pluginInfo);
+ mir_getLP(&pluginInfoEx);
hTaskMainMenu = nullptr;
DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &g_hMainThread, 0, FALSE, DUPLICATE_SAME_ACCESS);
@@ -255,6 +265,8 @@ extern "C" int __declspec(dllexport) Load(void)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" int __declspec(dllexport) Unload(void)
{
if (g_hMainThread)
diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp
index 1fbde4a55d..d6e8487d23 100644
--- a/plugins/BasicHistory/src/HistoryWindow.cpp
+++ b/plugins/BasicHistory/src/HistoryWindow.cpp
@@ -1600,22 +1600,22 @@ void HistoryWindow::RestorePos()
{
MCONTACT contactToLoad = m_hContact;
if (m_hContact == NULL) {
- Utils_RestoreWindowPosition(m_hWnd, NULL, MODULE, "history_");
+ Utils_RestoreWindowPosition(m_hWnd, NULL, MODULENAME, "history_");
contactToLoad = NULL;
}
- else if (Utils_RestoreWindowPosition(m_hWnd, m_hContact, MODULE, "history_") != 0) {
- Utils_RestoreWindowPosition(m_hWnd, NULL, MODULE, "history_");
+ else if (Utils_RestoreWindowPosition(m_hWnd, m_hContact, MODULENAME, "history_") != 0) {
+ Utils_RestoreWindowPosition(m_hWnd, NULL, MODULENAME, "history_");
contactToLoad = NULL;
}
- if (db_get_b(contactToLoad, MODULE, "history_ismax", 0))
+ if (db_get_b(contactToLoad, MODULENAME, "history_ismax", 0))
ShowWindow(m_hWnd, SW_SHOWMAXIMIZED);
- LONG pos = db_get_dw(contactToLoad, MODULE, "history_splitterv", 0);
+ LONG pos = db_get_dw(contactToLoad, MODULENAME, "history_splitterv", 0);
if (pos > 0)
SplitterMoved(splitterYhWnd, pos, false);
- pos = db_get_dw(contactToLoad, MODULE, "history_splitter", 0);
+ pos = db_get_dw(contactToLoad, MODULENAME, "history_splitter", 0);
if (pos > 0)
SplitterMoved(splitterXhWnd, pos, false);
}
@@ -1625,25 +1625,25 @@ void HistoryWindow::SavePos(bool all)
MCONTACT contactToSave = m_hContact;
if (all) {
for (auto &_hContact : Contacts()) {
- db_unset(_hContact, MODULE, "history_x");
- db_unset(_hContact, MODULE, "history_y");
- db_unset(_hContact, MODULE, "history_width");
- db_unset(_hContact, MODULE, "history_height");
- db_unset(_hContact, MODULE, "history_ismax");
- db_unset(_hContact, MODULE, "history_splitterv");
- db_unset(_hContact, MODULE, "history_splitter");
+ db_unset(_hContact, MODULENAME, "history_x");
+ db_unset(_hContact, MODULENAME, "history_y");
+ db_unset(_hContact, MODULENAME, "history_width");
+ db_unset(_hContact, MODULENAME, "history_height");
+ db_unset(_hContact, MODULENAME, "history_ismax");
+ db_unset(_hContact, MODULENAME, "history_splitterv");
+ db_unset(_hContact, MODULENAME, "history_splitter");
}
contactToSave = NULL;
}
- Utils_SaveWindowPosition(m_hWnd, contactToSave, MODULE, "history_");
+ Utils_SaveWindowPosition(m_hWnd, contactToSave, MODULENAME, "history_");
WINDOWPLACEMENT wp;
wp.length = sizeof(wp);
GetWindowPlacement(m_hWnd, &wp);
- db_set_b(contactToSave, MODULE, "history_ismax", wp.showCmd == SW_MAXIMIZE ? 1 : 0);
- db_set_dw(contactToSave, MODULE, "history_splitterv", splitterX);
- db_set_dw(contactToSave, MODULE, "history_splitter", splitterY);
+ db_set_b(contactToSave, MODULENAME, "history_ismax", wp.showCmd == SW_MAXIMIZE ? 1 : 0);
+ db_set_dw(contactToSave, MODULENAME, "history_splitterv", splitterX);
+ db_set_dw(contactToSave, MODULENAME, "history_splitter", splitterY);
}
#define DEF_FILTERS_START 50000
diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp
index c0d3b16b94..8e9ed171f4 100644
--- a/plugins/BasicHistory/src/Options.cpp
+++ b/plugins/BasicHistory/src/Options.cpp
@@ -275,58 +275,58 @@ void Options::Load(void)
Hotkey_Register(&hid);
}
- showContacts = db_get_b(0, MODULE, "showContacts", 0) ? true : false;
- showContactGroups = db_get_b(0, MODULE, "showContactGroups", 1) ? true : false;
- noFindBorder = db_get_b(0, MODULE, "noFindBorder", 0) ? true : false;
- groupNewOnTop = db_get_b(0, MODULE, "groupNewOnTop", 1) ? true : false;
- groupShowEvents = db_get_b(0, MODULE, "groupShowEvents", 1) ? true : false;
- groupShowTime = db_get_b(0, MODULE, "groupShowTime", 1) ? true : false;
- groupShowName = db_get_b(0, MODULE, "groupShowName", 0) ? true : false;
- groupShowMessage = db_get_b(0, MODULE, "groupShowMessage", 1) ? true : false;
- groupMessageLen = db_get_dw(0, MODULE, "groupMessageLen", 43);
+ showContacts = db_get_b(0, MODULENAME, "showContacts", 0) ? true : false;
+ showContactGroups = db_get_b(0, MODULENAME, "showContactGroups", 1) ? true : false;
+ noFindBorder = db_get_b(0, MODULENAME, "noFindBorder", 0) ? true : false;
+ groupNewOnTop = db_get_b(0, MODULENAME, "groupNewOnTop", 1) ? true : false;
+ groupShowEvents = db_get_b(0, MODULENAME, "groupShowEvents", 1) ? true : false;
+ groupShowTime = db_get_b(0, MODULENAME, "groupShowTime", 1) ? true : false;
+ groupShowName = db_get_b(0, MODULENAME, "groupShowName", 0) ? true : false;
+ groupShowMessage = db_get_b(0, MODULENAME, "groupShowMessage", 1) ? true : false;
+ groupMessageLen = db_get_dw(0, MODULENAME, "groupMessageLen", 43);
if (groupMessageLen < 5) groupMessageLen = 5;
- groupTime = db_get_dw(0, MODULE, "groupTime", 5);
+ groupTime = db_get_dw(0, MODULENAME, "groupTime", 5);
if (groupTime < 1) groupTime = 1;
- groupMessagesNumber = db_get_dw(0, MODULE, "groupMessagesNumber", 100);
+ groupMessagesNumber = db_get_dw(0, MODULENAME, "groupMessagesNumber", 100);
if (groupMessagesNumber < 1) groupMessagesNumber = 1;
- messagesNewOnTop = db_get_b(0, MODULE, "messagesNewOnTop", 0) ? true : false;
- messagesShowDate = db_get_b(0, MODULE, "messagesShowDate", 0) ? true : false;
- messagesShowSec = db_get_b(0, MODULE, "messagesShowSec", 0) ? true : false;
- messagesShowName = db_get_b(0, MODULE, "messagesShowName", 1) ? true : false;
- messagesShowEvents = db_get_b(0, MODULE, "messagesShowEvents", 0) ? true : false;
- messagesUseSmileys = db_get_b(0, MODULE, "messagesUseSmileys", 1) ? true : false;
- searchForInList = db_get_b(0, MODULE, "searchForInList", 1) ? true : false;
- searchForInMess = db_get_b(0, MODULE, "searchForInMess", 1) ? true : false;
- searchMatchCase = db_get_b(0, MODULE, "searchMatchCase", 0) ? true : false;
- searchMatchWhole = db_get_b(0, MODULE, "searchMatchWhole", 0) ? true : false;
- searchOnlyIn = db_get_b(0, MODULE, "searchOnlyIn", 0) ? true : false;
- searchOnlyOut = db_get_b(0, MODULE, "searchOnlyOut", 0) ? true : false;
- searchOnlyGroup = db_get_b(0, MODULE, "searchOnlyGroup", 0) ? true : false;
- searchAllContacts = db_get_b(0, MODULE, "searchAllContacts", 0) ? true : false;
- schedulerAlerts = db_get_b(0, MODULE, "schedulerAlerts", 1) ? true : false;
- schedulerHistoryAlerts = db_get_b(0, MODULE, "schedulerHistoryAlerts", 1) ? true : false;
-
- defFilter = db_get_b(0, MODULE, "defFilter", defFilter);
- int filtersCount = db_get_dw(0, MODULE, "customFiltersCount", 0);
+ messagesNewOnTop = db_get_b(0, MODULENAME, "messagesNewOnTop", 0) ? true : false;
+ messagesShowDate = db_get_b(0, MODULENAME, "messagesShowDate", 0) ? true : false;
+ messagesShowSec = db_get_b(0, MODULENAME, "messagesShowSec", 0) ? true : false;
+ messagesShowName = db_get_b(0, MODULENAME, "messagesShowName", 1) ? true : false;
+ messagesShowEvents = db_get_b(0, MODULENAME, "messagesShowEvents", 0) ? true : false;
+ messagesUseSmileys = db_get_b(0, MODULENAME, "messagesUseSmileys", 1) ? true : false;
+ searchForInList = db_get_b(0, MODULENAME, "searchForInList", 1) ? true : false;
+ searchForInMess = db_get_b(0, MODULENAME, "searchForInMess", 1) ? true : false;
+ searchMatchCase = db_get_b(0, MODULENAME, "searchMatchCase", 0) ? true : false;
+ searchMatchWhole = db_get_b(0, MODULENAME, "searchMatchWhole", 0) ? true : false;
+ searchOnlyIn = db_get_b(0, MODULENAME, "searchOnlyIn", 0) ? true : false;
+ searchOnlyOut = db_get_b(0, MODULENAME, "searchOnlyOut", 0) ? true : false;
+ searchOnlyGroup = db_get_b(0, MODULENAME, "searchOnlyGroup", 0) ? true : false;
+ searchAllContacts = db_get_b(0, MODULENAME, "searchAllContacts", 0) ? true : false;
+ schedulerAlerts = db_get_b(0, MODULENAME, "schedulerAlerts", 1) ? true : false;
+ schedulerHistoryAlerts = db_get_b(0, MODULENAME, "schedulerHistoryAlerts", 1) ? true : false;
+
+ defFilter = db_get_b(0, MODULENAME, "defFilter", defFilter);
+ int filtersCount = db_get_dw(0, MODULENAME, "customFiltersCount", 0);
for (int i = 0; i < filtersCount; ++i) {
char buf[256];
FilterOptions fo;
mir_snprintf(buf, "filterName_%d", i);
DBVARIANT nameV;
- if (!db_get_ws(0, MODULE, buf, &nameV)) {
+ if (!db_get_ws(0, MODULENAME, buf, &nameV)) {
fo.name = nameV.pwszVal;
db_free(&nameV);
}
else break;
mir_snprintf(buf, "filterInOut_%d", i);
- int inOut = db_get_b(0, MODULE, buf, 0);
+ int inOut = db_get_b(0, MODULENAME, buf, 0);
if (inOut == 1)
fo.onlyIncomming = true;
else if (inOut == 2)
fo.onlyOutgoing = true;
mir_snprintf(buf, "filterEvents_%d", i);
DBVARIANT eventsV;
- if (!db_get_s(0, MODULE, buf, &eventsV)) {
+ if (!db_get_s(0, MODULENAME, buf, &eventsV)) {
int k = 0;
char* id = eventsV.pszVal;
while (eventsV.pszVal[k]) {
@@ -349,7 +349,7 @@ void Options::Load(void)
defFilter = 0;
DBVARIANT defFilterStrV;
- if (!db_get_ws(0, MODULE, "defFilterStr", &defFilterStrV)) {
+ if (!db_get_ws(0, MODULENAME, "defFilterStr", &defFilterStrV)) {
std::wstring filterName = defFilterStrV.pwszVal;
for (int i = 0; i < (int)customFilters.size(); ++i) {
if (filterName == customFilters[i].name) {
@@ -361,43 +361,43 @@ void Options::Load(void)
}
}
- codepageTxt = db_get_dw(0, MODULE, "codepageTxt", CP_UTF8);
- codepageHtml1 = db_get_dw(0, MODULE, "codepageHtml1", CP_UTF8);
- codepageHtml2 = db_get_dw(0, MODULE, "codepageHtml2", CP_UTF8);
+ codepageTxt = db_get_dw(0, MODULENAME, "codepageTxt", CP_UTF8);
+ codepageHtml1 = db_get_dw(0, MODULENAME, "codepageHtml1", CP_UTF8);
+ codepageHtml2 = db_get_dw(0, MODULENAME, "codepageHtml2", CP_UTF8);
DBVARIANT encodingV;
- if (!db_get_ws(0, MODULE, "encodingTxt", &encodingV)) {
+ if (!db_get_ws(0, MODULENAME, "encodingTxt", &encodingV)) {
encodingTxt = encodingV.pwszVal;
db_free(&encodingV);
}
else encodingTxt = L"UTF-8";
- if (!db_get_ws(0, MODULE, "encodingHtml1", &encodingV)) {
+ if (!db_get_ws(0, MODULENAME, "encodingHtml1", &encodingV)) {
encodingHtml1 = encodingV.pwszVal;
db_free(&encodingV);
}
else encodingHtml1 = L"UTF-8";
- if (!db_get_ws(0, MODULE, "encodingHtml2", &encodingV)) {
+ if (!db_get_ws(0, MODULENAME, "encodingHtml2", &encodingV)) {
encodingHtml2 = encodingV.pwszVal;
db_free(&encodingV);
}
else encodingHtml2 = L"UTF-8";
- exportHtml1ShowDate = db_get_b(0, MODULE, "exportHtml1ShowDate", 1) ? true : false;
- exportHtml2ShowDate = db_get_b(0, MODULE, "exportHtml2ShowDate", 0) ? true : false;
- exportHtml2UseSmileys = db_get_b(0, MODULE, "exportHtml2UseSmileys", 1) ? true : false;
- if (!db_get_ws(0, MODULE, "extCssHtml2", &encodingV)) {
+ exportHtml1ShowDate = db_get_b(0, MODULENAME, "exportHtml1ShowDate", 1) ? true : false;
+ exportHtml2ShowDate = db_get_b(0, MODULENAME, "exportHtml2ShowDate", 0) ? true : false;
+ exportHtml2UseSmileys = db_get_b(0, MODULENAME, "exportHtml2UseSmileys", 1) ? true : false;
+ if (!db_get_ws(0, MODULENAME, "extCssHtml2", &encodingV)) {
extCssHtml2 = encodingV.pwszVal;
db_free(&encodingV);
}
else extCssHtml2 = L"";
- if (!db_get_ws(0, MODULE, "ftpLogPath", &encodingV)) {
+ if (!db_get_ws(0, MODULENAME, "ftpLogPath", &encodingV)) {
ftpLogPath = encodingV.pwszVal;
db_free(&encodingV);
}
- if (!db_get_ws(0, MODULE, "ftpExePath", &encodingV)) {
+ if (!db_get_ws(0, MODULENAME, "ftpExePath", &encodingV)) {
ftpExePath = encodingV.pwszVal;
db_free(&encodingV);
}
@@ -418,51 +418,51 @@ COLORREF Options::GetColor(Colors colorId)
void Options::Save()
{
- db_set_b(0, MODULE, "showContacts", showContacts ? 1 : 0);
- db_set_b(0, MODULE, "showContactGroups", showContactGroups ? 1 : 0);
- db_set_b(0, MODULE, "noFindBorder", noFindBorder ? 1 : 0);
- db_set_b(0, MODULE, "groupNewOnTop", groupNewOnTop ? 1 : 0);
- db_set_b(0, MODULE, "groupShowEvents", groupShowEvents ? 1 : 0);
- db_set_b(0, MODULE, "groupShowTime", groupShowTime ? 1 : 0);
- db_set_b(0, MODULE, "groupShowName", groupShowName ? 1 : 0);
- db_set_b(0, MODULE, "groupShowMessage", groupShowMessage ? 1 : 0);
+ db_set_b(0, MODULENAME, "showContacts", showContacts ? 1 : 0);
+ db_set_b(0, MODULENAME, "showContactGroups", showContactGroups ? 1 : 0);
+ db_set_b(0, MODULENAME, "noFindBorder", noFindBorder ? 1 : 0);
+ db_set_b(0, MODULENAME, "groupNewOnTop", groupNewOnTop ? 1 : 0);
+ db_set_b(0, MODULENAME, "groupShowEvents", groupShowEvents ? 1 : 0);
+ db_set_b(0, MODULENAME, "groupShowTime", groupShowTime ? 1 : 0);
+ db_set_b(0, MODULENAME, "groupShowName", groupShowName ? 1 : 0);
+ db_set_b(0, MODULENAME, "groupShowMessage", groupShowMessage ? 1 : 0);
if (groupMessageLen < 5)
groupMessageLen = 5;
- db_set_dw(0, MODULE, "groupMessageLen", groupMessageLen);
+ db_set_dw(0, MODULENAME, "groupMessageLen", groupMessageLen);
if (groupTime < 1)
groupTime = 1;
- db_set_dw(0, MODULE, "groupTime", groupTime);
+ db_set_dw(0, MODULENAME, "groupTime", groupTime);
if (groupMessagesNumber < 1)
groupMessagesNumber = 1;
- db_set_dw(0, MODULE, "groupMessagesNumber", groupMessagesNumber);
- db_set_b(0, MODULE, "messagesNewOnTop", messagesNewOnTop ? 1 : 0);
- db_set_b(0, MODULE, "messagesShowDate", messagesShowDate ? 1 : 0);
- db_set_b(0, MODULE, "messagesShowSec", messagesShowSec ? 1 : 0);
- db_set_b(0, MODULE, "messagesShowName", messagesShowName ? 1 : 0);
- db_set_b(0, MODULE, "messagesShowEvents", messagesShowEvents ? 1 : 0);
- db_set_b(0, MODULE, "messagesUseSmileys", messagesUseSmileys ? 1 : 0);
- db_set_b(0, MODULE, "searchForInList", searchForInList ? 1 : 0);
- db_set_b(0, MODULE, "searchForInMess", searchForInMess ? 1 : 0);
- db_set_b(0, MODULE, "searchMatchCase", searchMatchCase ? 1 : 0);
- db_set_b(0, MODULE, "searchMatchWhole", searchMatchWhole ? 1 : 0);
- db_set_b(0, MODULE, "searchOnlyIn", searchOnlyIn ? 1 : 0);
- db_set_b(0, MODULE, "searchOnlyOut", searchOnlyOut ? 1 : 0);
- db_set_b(0, MODULE, "searchOnlyGroup", searchOnlyGroup ? 1 : 0);
- db_set_b(0, MODULE, "searchAllContacts", searchAllContacts ? 1 : 0);
- db_set_b(0, MODULE, "schedulerAlerts", schedulerAlerts ? 1 : 0);
- db_set_b(0, MODULE, "schedulerHistoryAlerts", schedulerHistoryAlerts ? 1 : 0);
+ db_set_dw(0, MODULENAME, "groupMessagesNumber", groupMessagesNumber);
+ db_set_b(0, MODULENAME, "messagesNewOnTop", messagesNewOnTop ? 1 : 0);
+ db_set_b(0, MODULENAME, "messagesShowDate", messagesShowDate ? 1 : 0);
+ db_set_b(0, MODULENAME, "messagesShowSec", messagesShowSec ? 1 : 0);
+ db_set_b(0, MODULENAME, "messagesShowName", messagesShowName ? 1 : 0);
+ db_set_b(0, MODULENAME, "messagesShowEvents", messagesShowEvents ? 1 : 0);
+ db_set_b(0, MODULENAME, "messagesUseSmileys", messagesUseSmileys ? 1 : 0);
+ db_set_b(0, MODULENAME, "searchForInList", searchForInList ? 1 : 0);
+ db_set_b(0, MODULENAME, "searchForInMess", searchForInMess ? 1 : 0);
+ db_set_b(0, MODULENAME, "searchMatchCase", searchMatchCase ? 1 : 0);
+ db_set_b(0, MODULENAME, "searchMatchWhole", searchMatchWhole ? 1 : 0);
+ db_set_b(0, MODULENAME, "searchOnlyIn", searchOnlyIn ? 1 : 0);
+ db_set_b(0, MODULENAME, "searchOnlyOut", searchOnlyOut ? 1 : 0);
+ db_set_b(0, MODULENAME, "searchOnlyGroup", searchOnlyGroup ? 1 : 0);
+ db_set_b(0, MODULENAME, "searchAllContacts", searchAllContacts ? 1 : 0);
+ db_set_b(0, MODULENAME, "schedulerAlerts", schedulerAlerts ? 1 : 0);
+ db_set_b(0, MODULENAME, "schedulerHistoryAlerts", schedulerHistoryAlerts ? 1 : 0);
if (defFilter < 0 || defFilter - 2 >= (int)customFilters.size())
defFilter = 0;
- db_set_b(0, MODULE, "defFilter", defFilter < 2 ? defFilter : 2);
+ db_set_b(0, MODULENAME, "defFilter", defFilter < 2 ? defFilter : 2);
if (defFilter >= 2)
- db_set_ws(0, MODULE, "defFilterStr", customFilters[defFilter - 2].name.c_str());
- db_set_dw(0, MODULE, "customFiltersCount", (DWORD)customFilters.size());
+ db_set_ws(0, MODULENAME, "defFilterStr", customFilters[defFilter - 2].name.c_str());
+ db_set_dw(0, MODULENAME, "customFiltersCount", (DWORD)customFilters.size());
for (int i = 0; i < (int)customFilters.size(); ++i) {
char buf[256];
mir_snprintf(buf, "filterName_%d", i);
- db_set_ws(0, MODULE, buf, customFilters[i].name.c_str());
+ db_set_ws(0, MODULENAME, buf, customFilters[i].name.c_str());
mir_snprintf(buf, "filterInOut_%d", i);
- db_set_b(0, MODULE, buf, customFilters[i].onlyIncomming ? 1 : (customFilters[i].onlyOutgoing ? 2 : 0));
+ db_set_b(0, MODULENAME, buf, customFilters[i].onlyIncomming ? 1 : (customFilters[i].onlyOutgoing ? 2 : 0));
std::string events;
for (std::vector<int>::iterator it = customFilters[i].events.begin(); it != customFilters[i].events.end(); ++it) {
_itoa_s(*it, buf, 16);
@@ -471,24 +471,24 @@ void Options::Save()
}
mir_snprintf(buf, "filterEvents_%d", i);
- db_set_s(0, MODULE, buf, events.c_str());
+ db_set_s(0, MODULENAME, buf, events.c_str());
}
- db_set_dw(0, MODULE, "codepageTxt", codepageTxt);
- db_set_dw(0, MODULE, "codepageHtml1", codepageHtml1);
- db_set_dw(0, MODULE, "codepageHtml2", codepageHtml2);
- db_set_ws(0, MODULE, "encodingTxt", encodingTxt.c_str());
- db_set_ws(0, MODULE, "encodingHtml1", encodingHtml1.c_str());
- db_set_ws(0, MODULE, "encodingHtml2", encodingHtml2.c_str());
- db_set_b(0, MODULE, "exportHtml1ShowDate", exportHtml1ShowDate ? 1 : 0);
- db_set_b(0, MODULE, "exportHtml2ShowDate", exportHtml2ShowDate ? 1 : 0);
- db_set_b(0, MODULE, "exportHtml2UseSmileys", exportHtml2UseSmileys ? 1 : 0);
- db_set_ws(0, MODULE, "extCssHtml2", extCssHtml2.c_str());
- db_set_ws(0, MODULE, "ftpLogPath", ftpLogPath.c_str());
+ db_set_dw(0, MODULENAME, "codepageTxt", codepageTxt);
+ db_set_dw(0, MODULENAME, "codepageHtml1", codepageHtml1);
+ db_set_dw(0, MODULENAME, "codepageHtml2", codepageHtml2);
+ db_set_ws(0, MODULENAME, "encodingTxt", encodingTxt.c_str());
+ db_set_ws(0, MODULENAME, "encodingHtml1", encodingHtml1.c_str());
+ db_set_ws(0, MODULENAME, "encodingHtml2", encodingHtml2.c_str());
+ db_set_b(0, MODULENAME, "exportHtml1ShowDate", exportHtml1ShowDate ? 1 : 0);
+ db_set_b(0, MODULENAME, "exportHtml2ShowDate", exportHtml2ShowDate ? 1 : 0);
+ db_set_b(0, MODULENAME, "exportHtml2UseSmileys", exportHtml2UseSmileys ? 1 : 0);
+ db_set_ws(0, MODULENAME, "extCssHtml2", extCssHtml2.c_str());
+ db_set_ws(0, MODULENAME, "ftpLogPath", ftpLogPath.c_str());
if (ftpExePath != ftpExePathDef)
- db_set_ws(0, MODULE, "ftpExePath", ftpExePath.c_str());
+ db_set_ws(0, MODULENAME, "ftpExePath", ftpExePath.c_str());
else
- db_unset(0, MODULE, "ftpExePath");
+ db_unset(0, MODULENAME, "ftpExePath");
}
void Options::SaveTasks(std::list<TaskOptions>* tasks)
@@ -500,110 +500,110 @@ void Options::SaveTasks(std::list<TaskOptions>* tasks)
char buf[256];
for (std::list<TaskOptions>::iterator it = tasks->begin(); it != tasks->end(); ++it) {
mir_snprintf(buf, "Task_compress_%d", i);
- db_set_b(0, MODULE, buf, it->compress);
+ db_set_b(0, MODULENAME, buf, it->compress);
mir_snprintf(buf, "Task_useFtp_%d", i);
- db_set_b(0, MODULE, buf, it->useFtp);
+ db_set_b(0, MODULENAME, buf, it->useFtp);
mir_snprintf(buf, "Task_isSystem_%d", i);
- db_set_b(0, MODULE, buf, it->isSystem);
+ db_set_b(0, MODULENAME, buf, it->isSystem);
mir_snprintf(buf, "Task_active_%d", i);
- db_set_b(0, MODULE, buf, it->active);
+ db_set_b(0, MODULENAME, buf, it->active);
mir_snprintf(buf, "Task_exportImported_%d", i);
- db_set_b(0, MODULE, buf, it->exportImported);
+ db_set_b(0, MODULENAME, buf, it->exportImported);
mir_snprintf(buf, "Task_type_%d", i);
- db_set_b(0, MODULE, buf, it->type);
+ db_set_b(0, MODULENAME, buf, it->type);
mir_snprintf(buf, "Task_eventUnit_%d", i);
- db_set_b(0, MODULE, buf, it->eventUnit);
+ db_set_b(0, MODULENAME, buf, it->eventUnit);
mir_snprintf(buf, "Task_trigerType_%d", i);
- db_set_b(0, MODULE, buf, it->trigerType);
+ db_set_b(0, MODULENAME, buf, it->trigerType);
mir_snprintf(buf, "Task_exportType_%d", i);
- db_set_b(0, MODULE, buf, it->exportType);
+ db_set_b(0, MODULENAME, buf, it->exportType);
mir_snprintf(buf, "Task_importType_%d", i);
- db_set_b(0, MODULE, buf, it->importType);
+ db_set_b(0, MODULENAME, buf, it->importType);
mir_snprintf(buf, "Task_eventDeltaTime_%d", i);
- db_set_dw(0, MODULE, buf, it->eventDeltaTime);
+ db_set_dw(0, MODULENAME, buf, it->eventDeltaTime);
mir_snprintf(buf, "Task_filterId_%d", i);
- db_set_dw(0, MODULE, buf, it->filterId);
+ db_set_dw(0, MODULENAME, buf, it->filterId);
mir_snprintf(buf, "Task_dayTime_%d", i);
- db_set_dw(0, MODULE, buf, it->dayTime);
+ db_set_dw(0, MODULENAME, buf, it->dayTime);
mir_snprintf(buf, "Task_dayOfWeek_%d", i);
- db_set_dw(0, MODULE, buf, it->dayOfWeek);
+ db_set_dw(0, MODULENAME, buf, it->dayOfWeek);
mir_snprintf(buf, "Task_dayOfMonth_%d", i);
- db_set_dw(0, MODULE, buf, it->dayOfMonth);
+ db_set_dw(0, MODULENAME, buf, it->dayOfMonth);
mir_snprintf(buf, "Task_deltaTime_%d", i);
- db_set_dw(0, MODULE, buf, it->deltaTime);
+ db_set_dw(0, MODULENAME, buf, it->deltaTime);
mir_snprintf(buf, "Task_lastExport_low_%d", i);
- db_set_dw(0, MODULE, buf, (int)it->lastExport);
+ db_set_dw(0, MODULENAME, buf, (int)it->lastExport);
mir_snprintf(buf, "Task_lastExport_hi_%d", i);
- db_set_dw(0, MODULE, buf, ((unsigned long long int)it->lastExport) >> 32);
+ db_set_dw(0, MODULENAME, buf, ((unsigned long long int)it->lastExport) >> 32);
mir_snprintf(buf, "Task_ftpName_%d", i);
- db_set_ws(0, MODULE, buf, it->ftpName.c_str());
+ db_set_ws(0, MODULENAME, buf, it->ftpName.c_str());
mir_snprintf(buf, "Task_filterName_%d", i);
- db_set_ws(0, MODULE, buf, it->filterName.c_str());
+ db_set_ws(0, MODULENAME, buf, it->filterName.c_str());
mir_snprintf(buf, "Task_filePath_%d", i);
- db_set_ws(0, MODULE, buf, it->filePath.c_str());
+ db_set_ws(0, MODULENAME, buf, it->filePath.c_str());
mir_snprintf(buf, "Task_taskName_%d", i);
- db_set_ws(0, MODULE, buf, it->taskName.c_str());
+ db_set_ws(0, MODULENAME, buf, it->taskName.c_str());
mir_snprintf(buf, "Task_zipPassword_%d", i);
- db_set_s(0, MODULE, buf, it->zipPassword.c_str());
+ db_set_s(0, MODULENAME, buf, it->zipPassword.c_str());
mir_snprintf(buf, "IsInTask_%d", i);
for (auto &hContact : Contacts())
- db_unset(hContact, MODULE, buf);
+ db_unset(hContact, MODULENAME, buf);
for (size_t j = 0; j < it->contacts.size(); ++j)
- db_set_b(it->contacts[j], MODULE, buf, 1);
+ db_set_b(it->contacts[j], MODULENAME, buf, 1);
it->orderNr = i++;
taskOptions.push_back(*it);
}
- db_set_dw(0, MODULE, "Task_count", i);
+ db_set_dw(0, MODULENAME, "Task_count", i);
for (i = (int)tasks->size(); i < oldTaskNr; ++i) {
mir_snprintf(buf, "Task_compress_%d", i);
- db_unset(NULL, MODULE, buf);
+ db_unset(NULL, MODULENAME, buf);
mir_snprintf(buf, "Task_useFtp_%d", i);
- db_unset(NULL, MODULE, buf);
+ db_unset(NULL, MODULENAME, buf);
mir_snprintf(buf, "Task_isSystem_%d", i);
- db_unset(NULL, MODULE, buf);
+ db_unset(NULL, MODULENAME, buf);
mir_snprintf(buf, "Task_active_%d", i);
- db_unset(NULL, MODULE, buf);
+ db_unset(NULL, MODULENAME, buf);
mir_snprintf(buf, "Task_type_%d", i);
- db_unset(NULL, MODULE, buf);
+ db_unset(NULL, MODULENAME, buf);
mir_snprintf(buf, "Task_eventUnit_%d", i);
- db_unset(NULL, MODULE, buf);
+ db_unset(NULL, MODULENAME, buf);
mir_snprintf(buf, "Task_trigerType_%d", i);
- db_unset(NULL, MODULE, buf);
+ db_unset(NULL, MODULENAME, buf);
mir_snprintf(buf, "Task_exportType_%d", i);
- db_unset(NULL, MODULE, buf);
+ db_unset(NULL, MODULENAME, buf);
mir_snprintf(buf, "Task_eventDeltaTime_%d", i);
- db_unset(NULL, MODULE, buf);
+ db_unset(NULL, MODULENAME, buf);
mir_snprintf(buf, "Task_filterId_%d", i);
- db_unset(NULL, MODULE, buf);
+ db_unset(NULL, MODULENAME, buf);
mir_snprintf(buf, "Task_dayTime_%d", i);
- db_unset(NULL, MODULE, buf);
+ db_unset(NULL, MODULENAME, buf);
mir_snprintf(buf, "Task_dayOfWeek_%d", i);
- db_unset(NULL, MODULE, buf);
+ db_unset(NULL, MODULENAME, buf);
mir_snprintf(buf, "Task_dayOfMonth_%d", i);
- db_unset(NULL, MODULE, buf);
+ db_unset(NULL, MODULENAME, buf);
mir_snprintf(buf, "Task_deltaTime_%d", i);
- db_unset(NULL, MODULE, buf);
+ db_unset(NULL, MODULENAME, buf);
mir_snprintf(buf, "Task_lastExport_low_%d", i);
- db_unset(NULL, MODULE, buf);
+ db_unset(NULL, MODULENAME, buf);
mir_snprintf(buf, "Task_lastExport_hi_%d", i);
- db_unset(NULL, MODULE, buf);
+ db_unset(NULL, MODULENAME, buf);
mir_snprintf(buf, "Task_ftpName_%d", i);
- db_unset(NULL, MODULE, buf);
+ db_unset(NULL, MODULENAME, buf);
mir_snprintf(buf, "Task_filterName_%d", i);
- db_unset(NULL, MODULE, buf);
+ db_unset(NULL, MODULENAME, buf);
mir_snprintf(buf, "Task_filePath_%d", i);
- db_unset(NULL, MODULE, buf);
+ db_unset(NULL, MODULENAME, buf);
mir_snprintf(buf, "Task_taskName_%d", i);
- db_unset(NULL, MODULE, buf);
+ db_unset(NULL, MODULENAME, buf);
mir_snprintf(buf, "IsInTask_%d", i);
for (auto &hContact : Contacts())
- db_unset(hContact, MODULE, buf);
+ db_unset(hContact, MODULENAME, buf);
}
}
@@ -612,84 +612,84 @@ void Options::SaveTaskTime(TaskOptions& to)
int i = to.orderNr;
char buf[256];
mir_snprintf(buf, "Task_lastExport_low_%d", i);
- db_set_dw(0, MODULE, buf, (int)to.lastExport);
+ db_set_dw(0, MODULENAME, buf, (int)to.lastExport);
mir_snprintf(buf, "Task_lastExport_hi_%d", i);
- db_set_dw(0, MODULE, buf, ((unsigned long long int)to.lastExport) >> 32);
+ db_set_dw(0, MODULENAME, buf, ((unsigned long long int)to.lastExport) >> 32);
}
void Options::LoadTasks()
{
- int taskCount = db_get_dw(0, MODULE, "Task_count", 0);
+ int taskCount = db_get_dw(0, MODULENAME, "Task_count", 0);
char buf[256];
for (int i = 0; i < taskCount; ++i) {
TaskOptions to;
mir_snprintf(buf, "Task_compress_%d", i);
- to.compress = db_get_b(0, MODULE, buf, to.compress) != 0;
+ to.compress = db_get_b(0, MODULENAME, buf, to.compress) != 0;
mir_snprintf(buf, "Task_useFtp_%d", i);
- to.useFtp = db_get_b(0, MODULE, buf, to.useFtp) != 0;
+ to.useFtp = db_get_b(0, MODULENAME, buf, to.useFtp) != 0;
mir_snprintf(buf, "Task_isSystem_%d", i);
- to.isSystem = db_get_b(0, MODULE, buf, to.isSystem) != 0;
+ to.isSystem = db_get_b(0, MODULENAME, buf, to.isSystem) != 0;
mir_snprintf(buf, "Task_active_%d", i);
- to.active = db_get_b(0, MODULE, buf, to.active) != 0;
+ to.active = db_get_b(0, MODULENAME, buf, to.active) != 0;
mir_snprintf(buf, "Task_exportImported_%d", i);
- to.exportImported = db_get_b(0, MODULE, buf, to.exportImported) != 0;
+ to.exportImported = db_get_b(0, MODULENAME, buf, to.exportImported) != 0;
mir_snprintf(buf, "Task_type_%d", i);
- to.type = (TaskOptions::TaskType)db_get_b(0, MODULE, buf, to.type);
+ to.type = (TaskOptions::TaskType)db_get_b(0, MODULENAME, buf, to.type);
mir_snprintf(buf, "Task_eventUnit_%d", i);
- to.eventUnit = (TaskOptions::EventUnit)db_get_b(0, MODULE, buf, to.eventUnit);
+ to.eventUnit = (TaskOptions::EventUnit)db_get_b(0, MODULENAME, buf, to.eventUnit);
mir_snprintf(buf, "Task_trigerType_%d", i);
- to.trigerType = (TaskOptions::TrigerType)db_get_b(0, MODULE, buf, to.trigerType);
+ to.trigerType = (TaskOptions::TrigerType)db_get_b(0, MODULENAME, buf, to.trigerType);
mir_snprintf(buf, "Task_exportType_%d", i);
- to.exportType = (IExport::ExportType)db_get_b(0, MODULE, buf, to.exportType);
+ to.exportType = (IExport::ExportType)db_get_b(0, MODULENAME, buf, to.exportType);
mir_snprintf(buf, "Task_importType_%d", i);
- to.importType = (IImport::ImportType)db_get_b(0, MODULE, buf, to.importType);
+ to.importType = (IImport::ImportType)db_get_b(0, MODULENAME, buf, to.importType);
mir_snprintf(buf, "Task_eventDeltaTime_%d", i);
- to.eventDeltaTime = db_get_dw(0, MODULE, buf, to.eventDeltaTime);
+ to.eventDeltaTime = db_get_dw(0, MODULENAME, buf, to.eventDeltaTime);
mir_snprintf(buf, "Task_filterId_%d", i);
- to.filterId = db_get_dw(0, MODULE, buf, to.filterId);
+ to.filterId = db_get_dw(0, MODULENAME, buf, to.filterId);
mir_snprintf(buf, "Task_dayTime_%d", i);
- to.dayTime = db_get_dw(0, MODULE, buf, to.dayTime);
+ to.dayTime = db_get_dw(0, MODULENAME, buf, to.dayTime);
mir_snprintf(buf, "Task_dayOfWeek_%d", i);
- to.dayOfWeek = db_get_dw(0, MODULE, buf, to.dayOfWeek);
+ to.dayOfWeek = db_get_dw(0, MODULENAME, buf, to.dayOfWeek);
mir_snprintf(buf, "Task_dayOfMonth_%d", i);
- to.dayOfMonth = db_get_dw(0, MODULE, buf, to.dayOfMonth);
+ to.dayOfMonth = db_get_dw(0, MODULENAME, buf, to.dayOfMonth);
mir_snprintf(buf, "Task_deltaTime_%d", i);
- to.deltaTime = db_get_dw(0, MODULE, buf, to.deltaTime);
+ to.deltaTime = db_get_dw(0, MODULENAME, buf, to.deltaTime);
unsigned long long int le = to.lastExport;
mir_snprintf(buf, "Task_lastExport_low_%d", i);
- to.lastExport = db_get_dw(0, MODULE, buf, (int)le) & 0xffffffff;
+ to.lastExport = db_get_dw(0, MODULENAME, buf, (int)le) & 0xffffffff;
mir_snprintf(buf, "Task_lastExport_hi_%d", i);
- to.lastExport |= ((unsigned long long int)db_get_dw(0, MODULE, buf, le >> 32)) << 32;
+ to.lastExport |= ((unsigned long long int)db_get_dw(0, MODULENAME, buf, le >> 32)) << 32;
mir_snprintf(buf, "Task_ftpName_%d", i);
DBVARIANT var;
- if (!db_get_ws(0, MODULE, buf, &var)) {
+ if (!db_get_ws(0, MODULENAME, buf, &var)) {
to.ftpName = var.ptszVal;
db_free(&var);
}
mir_snprintf(buf, "Task_filterName_%d", i);
- if (!db_get_ws(0, MODULE, buf, &var)) {
+ if (!db_get_ws(0, MODULENAME, buf, &var)) {
to.filterName = var.ptszVal;
db_free(&var);
}
mir_snprintf(buf, "Task_filePath_%d", i);
- if (!db_get_ws(0, MODULE, buf, &var)) {
+ if (!db_get_ws(0, MODULENAME, buf, &var)) {
to.filePath = var.ptszVal;
db_free(&var);
}
mir_snprintf(buf, "Task_taskName_%d", i);
- if (!db_get_ws(0, MODULE, buf, &var)) {
+ if (!db_get_ws(0, MODULENAME, buf, &var)) {
to.taskName = var.ptszVal;
db_free(&var);
}
mir_snprintf(buf, "Task_zipPassword_%d", i);
- if (!db_get_s(0, MODULE, buf, &var)) {
+ if (!db_get_s(0, MODULENAME, buf, &var)) {
to.zipPassword = var.pszVal;
db_free(&var);
}
mir_snprintf(buf, "IsInTask_%d", i);
for (auto &hContact : Contacts())
- if (db_get_b(hContact, MODULE, buf, 0) == 1)
+ if (db_get_b(hContact, MODULENAME, buf, 0) == 1)
to.contacts.push_back(hContact);
to.orderNr = i;
diff --git a/plugins/BasicHistory/src/Scheduler.cpp b/plugins/BasicHistory/src/Scheduler.cpp
index f234d55275..26dfcb3fb2 100644
--- a/plugins/BasicHistory/src/Scheduler.cpp
+++ b/plugins/BasicHistory/src/Scheduler.cpp
@@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "HistoryWindow.h"
// Sorry for plain C implementation
-#define MODULE "BasicHistory"
+#define MODULENAME "BasicHistory"
extern HANDLE g_hMainThread;
bool bPopupsEnabled;
bool DoTask(TaskOptions& to);
@@ -75,7 +75,7 @@ void InitScheduler()
test.hIcon = Skin_LoadIcon(SKINICON_OTHER_HISTORY);
test.iSeconds = 10;
test.pwszDescription = TranslateT("History task");
- test.pszName = MODULE;
+ test.pszName = MODULENAME;
if (hPopupClass = Popup_RegisterClass(&test))
HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown);
@@ -1281,7 +1281,7 @@ void DoError(const TaskOptions& to, const std::wstring _error)
error += _error;
DBEVENTINFO dbei = {};
- dbei.szModule = MODULE;
+ dbei.szModule = MODULENAME;
dbei.flags = DBEF_UTF | DBEF_READ;
dbei.timestamp = time(0);
// For now I do not convert event data from string to blob, and event type must be message to handle it properly
@@ -1299,7 +1299,7 @@ void DoError(const TaskOptions& to, const std::wstring _error)
return;
if (ServiceExists(MS_POPUP_ADDPOPUPCLASS))
- ShowClassPopupT(MODULE, msg, (wchar_t*)_error.c_str());
+ ShowClassPopupT(MODULENAME, msg, (wchar_t*)_error.c_str());
else if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
POPUPDATAT ppd = { 0 };
ppd.lchIcon = Skin_LoadIcon(SKINICON_OTHER_HISTORY);
diff --git a/plugins/BasicHistory/src/stdafx.h b/plugins/BasicHistory/src/stdafx.h
index ef90fecf03..881e94fc82 100644
--- a/plugins/BasicHistory/src/stdafx.h
+++ b/plugins/BasicHistory/src/stdafx.h
@@ -90,11 +90,9 @@
HICON LoadIconEx(int iconId, bool big = false);
-#define MODULE "BasicHistory"
+#define MODULENAME "BasicHistory"
struct CMPlugin : public PLUGIN<CMPlugin>
{
- CMPlugin() :
- PLUGIN<CMPlugin>(MODULE)
- {}
+ CMPlugin();
}; \ No newline at end of file