diff options
author | George Hazan <ghazan@miranda.im> | 2018-05-20 15:08:48 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-05-20 15:08:48 +0300 |
commit | 8a74e7495ce5ad39de4f5c25121a84d35df90c36 (patch) | |
tree | 03e5b4870f09a3163306740c2eebee47bc15b042 /plugins/Spamotron/src/spamotron.cpp | |
parent | c5bf7d6123dd1c3b82ccb8fdb1b068077e9d56d4 (diff) |
CMPlugin to receive a reference to PLUGININFOEX
Diffstat (limited to 'plugins/Spamotron/src/spamotron.cpp')
-rw-r--r-- | plugins/Spamotron/src/spamotron.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/plugins/Spamotron/src/spamotron.cpp b/plugins/Spamotron/src/spamotron.cpp index b6c3936f9f..82589c92c8 100644 --- a/plugins/Spamotron/src/spamotron.cpp +++ b/plugins/Spamotron/src/spamotron.cpp @@ -8,7 +8,7 @@ CMPlugin g_plugin; /////////////////////////////////////////////////////////////////////////////////////////
-PLUGININFOEX pluginInfo = {
+PLUGININFOEX pluginInfoEx = {
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
@@ -21,9 +21,13 @@ PLUGININFOEX pluginInfo = { {0x14331048, 0x5a73, 0x4fdb, {0xb9, 0x09, 0x2d, 0x7e, 0x18, 0x25, 0xa0, 0x12}}
};
+CMPlugin::CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
+{}
+
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
- return &pluginInfo;
+ return &pluginInfoEx;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -235,7 +239,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) DBVARIANT _dbv;
wchar_t AuthEventModule[100];
char* szAuthEventModule;
- if (db_get(hContact, PLUGIN_NAME, "AuthEvent", &_dbv) == 0) {
+ if (db_get(hContact, MODULENAME, "AuthEvent", &_dbv) == 0) {
DBEVENTINFO *_dbei = (DBEVENTINFO *)malloc(sizeof(DBEVENTINFO));
if (_dbei != nullptr) {
memcpy(&_dbei->cbBlob, _dbv.pbVal, sizeof(DWORD));
@@ -247,9 +251,9 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) _dbei->flags = 0;
_dbei->pBlob = _dbv.pbVal + sizeof(DWORD);
db_event_add(hContact,_dbei);
- db_unset(hContact, PLUGIN_NAME, "AuthEvent");
- db_unset(hContact, PLUGIN_NAME, "AuthEventPending");
- db_unset(hContact, PLUGIN_NAME, "AuthEventModule");
+ db_unset(hContact, MODULENAME, "AuthEvent");
+ db_unset(hContact, MODULENAME, "AuthEventPending");
+ db_unset(hContact, MODULENAME, "AuthEventModule");
mir_free(szAuthEventModule);
free(_dbei);
}
@@ -441,7 +445,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) if (eventdata != nullptr && dbei->cbBlob > 0) {
memcpy(eventdata, &dbei->cbBlob, sizeof(DWORD));
memcpy(eventdata + sizeof(DWORD), dbei->pBlob, dbei->cbBlob);
- db_set_blob(hContact, PLUGIN_NAME, "AuthEvent", eventdata, sizeof(DWORD) + dbei->cbBlob);
+ db_set_blob(hContact, MODULENAME, "AuthEvent", eventdata, sizeof(DWORD) + dbei->cbBlob);
_setCOptS(hContact, "AuthEventModule", dbei->szModule);
_setCOptB(hContact, "AuthEventPending", TRUE);
free(eventdata);
@@ -454,7 +458,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) PBYTE eventdata = (PBYTE)malloc(dbei_size);
PBYTE pos = eventdata;
if (eventdata != nullptr && dbei->cbBlob > 0) {
- if (db_get(hContact, PLUGIN_NAME, "LastMsgEvents", &_dbv) == 0) {
+ if (db_get(hContact, MODULENAME, "LastMsgEvents", &_dbv) == 0) {
eventdata = (PBYTE)realloc(eventdata, dbei_size + _dbv.cpbVal);
pos = eventdata;
memcpy(eventdata, _dbv.pbVal, _dbv.cpbVal);
@@ -467,7 +471,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) memcpy(pos + sizeof(WORD) + sizeof(DWORD) * 2, dbei->szModule, mir_strlen(dbei->szModule) + 1);
memcpy(pos + sizeof(WORD) + sizeof(DWORD) * 2 + mir_strlen(dbei->szModule) + 1, &dbei->cbBlob, sizeof(DWORD));
memcpy(pos + sizeof(WORD) + sizeof(DWORD) * 3 + mir_strlen(dbei->szModule) + 1, dbei->pBlob, dbei->cbBlob);
- db_set_blob(hContact, PLUGIN_NAME, "LastMsgEvents", eventdata, (pos - eventdata) + dbei_size);
+ db_set_blob(hContact, MODULENAME, "LastMsgEvents", eventdata, (pos - eventdata) + dbei_size);
free(eventdata);
}
@@ -505,7 +509,7 @@ void RemoveNotOnListSettings() extern "C" __declspec(dllexport) int Load()
{
- mir_getLP(&pluginInfo);
+ mir_getLP(&pluginInfoEx);
srand((unsigned)time(0));
bayesdb = nullptr;
|