summaryrefslogtreecommitdiff
path: root/src/mir_app
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 /src/mir_app
parentc5bf7d6123dd1c3b82ccb8fdb1b068077e9d56d4 (diff)
CMPlugin to receive a reference to PLUGININFOEX
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/src/CMPluginBase.cpp5
-rw-r--r--src/mir_app/src/ei_groupIcon.cpp12
-rw-r--r--src/mir_app/src/ei_icolibIcon.cpp12
-rw-r--r--src/mir_app/src/ei_options.cpp12
-rw-r--r--src/mir_app/src/ei_services.cpp12
-rw-r--r--src/mir_app/src/extraicons.h2
-rw-r--r--src/mir_app/src/mir_app.def3
-rw-r--r--src/mir_app/src/mir_app64.def3
-rw-r--r--src/mir_app/src/miranda.cpp18
-rw-r--r--src/mir_app/src/netlibhttp.cpp1
-rw-r--r--src/mir_app/src/pluginopts.cpp2
-rw-r--r--src/mir_app/src/srmm_toolbar.cpp32
-rw-r--r--src/mir_app/src/stdafx.h5
13 files changed, 66 insertions, 53 deletions
diff --git a/src/mir_app/src/CMPluginBase.cpp b/src/mir_app/src/CMPluginBase.cpp
index fd7174a1bb..a5b18e2938 100644
--- a/src/mir_app/src/CMPluginBase.cpp
+++ b/src/mir_app/src/CMPluginBase.cpp
@@ -68,8 +68,9 @@ MIR_APP_DLL(CMPluginBase&) GetPluginByInstance(HINSTANCE hInst)
/////////////////////////////////////////////////////////////////////////////////////////
-CMPluginBase::CMPluginBase(const char *moduleName) :
- m_szModuleName(moduleName)
+CMPluginBase::CMPluginBase(const char *moduleName, const PLUGININFOEX &pInfo) :
+ m_szModuleName(moduleName),
+ m_pInfo(pInfo)
{
if (m_hInst != nullptr)
pluginListAddr.insert(this);
diff --git a/src/mir_app/src/ei_groupIcon.cpp b/src/mir_app/src/ei_groupIcon.cpp
index b46ce97dcc..7bc068c32e 100644
--- a/src/mir_app/src/ei_groupIcon.cpp
+++ b/src/mir_app/src/ei_groupIcon.cpp
@@ -27,7 +27,7 @@ ExtraIconGroup::ExtraIconGroup(const char *_name) :
ExtraIcon(_name), m_setValidExtraIcon(false), m_insideApply(false),
m_items(1)
{
- db_set_resident(MODULE_NAME, _name);
+ db_set_resident(EI_MODULE_NAME, _name);
}
ExtraIconGroup::~ExtraIconGroup()
@@ -71,7 +71,7 @@ void ExtraIconGroup::applyIcon(MCONTACT hContact)
m_insideApply = false;
- db_set_dw(hContact, MODULE_NAME, m_szName, m_setValidExtraIcon ? m_items[i]->getID() : 0);
+ db_set_dw(hContact, EI_MODULE_NAME, m_szName, m_setValidExtraIcon ? m_items[i]->getID() : 0);
}
int ExtraIconGroup::getPosition() const
@@ -92,7 +92,7 @@ void ExtraIconGroup::setSlot(int slot)
ExtraIcon * ExtraIconGroup::getCurrentItem(MCONTACT hContact) const
{
- int id = (int)db_get_dw(hContact, MODULE_NAME, m_szName, 0);
+ int id = (int)db_get_dw(hContact, EI_MODULE_NAME, m_szName, 0);
if (id < 1)
return nullptr;
@@ -164,11 +164,11 @@ int ExtraIconGroup::internalSetIcon(int id, MCONTACT hContact, HANDLE value, boo
if (storePos < currentPos) {
if (m_setValidExtraIcon)
- db_set_dw(hContact, MODULE_NAME, m_szName, m_items[storePos]->getID());
+ db_set_dw(hContact, EI_MODULE_NAME, m_szName, m_items[storePos]->getID());
}
else if (storePos == currentPos) {
if (!m_setValidExtraIcon) {
- db_set_dw(hContact, MODULE_NAME, m_szName, 0);
+ db_set_dw(hContact, EI_MODULE_NAME, m_szName, 0);
m_insideApply = true;
@@ -181,7 +181,7 @@ int ExtraIconGroup::internalSetIcon(int id, MCONTACT hContact, HANDLE value, boo
m_insideApply = false;
if (m_setValidExtraIcon && storePos < m_items.getCount())
- db_set_dw(hContact, MODULE_NAME, m_szName, m_items[storePos]->getID());
+ db_set_dw(hContact, EI_MODULE_NAME, m_szName, m_items[storePos]->getID());
}
}
diff --git a/src/mir_app/src/ei_icolibIcon.cpp b/src/mir_app/src/ei_icolibIcon.cpp
index 44cd0ab8b1..31b6e0ef49 100644
--- a/src/mir_app/src/ei_icolibIcon.cpp
+++ b/src/mir_app/src/ei_icolibIcon.cpp
@@ -29,7 +29,7 @@ Boston, MA 02111-1307, USA.
IcolibExtraIcon::IcolibExtraIcon(int _id, const char *_name, const wchar_t *_description, const char *_descIcon, MIRANDAHOOKPARAM _OnClick, LPARAM _param) :
BaseExtraIcon(_id, _name, _description, _descIcon, _OnClick, _param)
{
- db_set_resident(MODULE_NAME, _name);
+ db_set_resident(EI_MODULE_NAME, _name);
}
IcolibExtraIcon::~IcolibExtraIcon()
@@ -52,7 +52,7 @@ void IcolibExtraIcon::applyIcon(MCONTACT hContact)
HANDLE hImage = INVALID_HANDLE_VALUE;
- ptrA szIconName(db_get_sa(hContact, MODULE_NAME, m_szName));
+ ptrA szIconName(db_get_sa(hContact, EI_MODULE_NAME, m_szName));
if (!IsEmpty(szIconName))
hImage = GetIcon(szIconName);
@@ -68,7 +68,7 @@ int IcolibExtraIcon::setIcon(int id, MCONTACT hContact, HANDLE hIcoLib)
hIcoLib = nullptr;
if (isEnabled()) {
- ptrA szIconName(db_get_sa(hContact, MODULE_NAME, m_szName));
+ ptrA szIconName(db_get_sa(hContact, EI_MODULE_NAME, m_szName));
if (!IsEmpty(szIconName))
RemoveIcon(szIconName);
}
@@ -92,7 +92,7 @@ int IcolibExtraIcon::setIconByName(int id, MCONTACT hContact, const char *icon)
icon = nullptr;
if (isEnabled()) {
- ptrA szIconName(db_get_sa(hContact, MODULE_NAME, m_szName));
+ ptrA szIconName(db_get_sa(hContact, EI_MODULE_NAME, m_szName));
if (!IsEmpty(szIconName))
RemoveIcon(szIconName);
}
@@ -112,7 +112,7 @@ void IcolibExtraIcon::storeIcon(MCONTACT hContact, void *icon)
const char *icolibName = (const char *)icon;
if (IsEmpty(icolibName))
- db_unset(hContact, MODULE_NAME, m_szName);
+ db_unset(hContact, EI_MODULE_NAME, m_szName);
else
- db_set_s(hContact, MODULE_NAME, m_szName, icolibName);
+ db_set_s(hContact, EI_MODULE_NAME, m_szName, icolibName);
}
diff --git a/src/mir_app/src/ei_options.cpp b/src/mir_app/src/ei_options.cpp
index c21f37b4cf..35babf713b 100644
--- a/src/mir_app/src/ei_options.cpp
+++ b/src/mir_app/src/ei_options.cpp
@@ -360,26 +360,26 @@ public:
for (auto &extra : registeredExtraIcons) {
char setting[512];
mir_snprintf(setting, "Position_%s", extra->getName());
- db_set_w(0, MODULE_NAME, setting, extra->getPosition());
+ db_set_w(0, EI_MODULE_NAME, setting, extra->getPosition());
mir_snprintf(setting, "Slot_%s", extra->getName());
- db_set_w(0, MODULE_NAME, setting, extra->getSlot());
+ db_set_w(0, EI_MODULE_NAME, setting, extra->getSlot());
}
- db_delete_module(0, MODULE_NAME "Groups");
- db_set_w(0, MODULE_NAME "Groups", "Count", groups.getCount());
+ db_delete_module(0, EI_MODULE_NAME "Groups");
+ db_set_w(0, EI_MODULE_NAME "Groups", "Count", groups.getCount());
for (int k = 0; k < groups.getCount(); k++) {
ExtraIconGroup *group = groups[k];
char setting[512];
mir_snprintf(setting, "%d_count", k);
- db_set_w(0, MODULE_NAME "Groups", setting, (WORD)group->m_items.getCount());
+ db_set_w(0, EI_MODULE_NAME "Groups", setting, (WORD)group->m_items.getCount());
for (int j = 0; j < group->m_items.getCount(); j++) {
BaseExtraIcon *extra = group->m_items[j];
mir_snprintf(setting, "%d_%d", k, j);
- db_set_s(0, MODULE_NAME "Groups", setting, extra->getName());
+ db_set_s(0, EI_MODULE_NAME "Groups", setting, extra->getName());
}
}
diff --git a/src/mir_app/src/ei_services.cpp b/src/mir_app/src/ei_services.cpp
index d1a7b7e395..11aa883910 100644
--- a/src/mir_app/src/ei_services.cpp
+++ b/src/mir_app/src/ei_services.cpp
@@ -121,11 +121,11 @@ BaseExtraIcon* GetExtraIconByName(const char *name)
static void LoadGroups(LIST<ExtraIconGroup> &groups)
{
- int count = db_get_w(0, MODULE_NAME "Groups", "Count", 0);
+ int count = db_get_w(0, EI_MODULE_NAME "Groups", "Count", 0);
for (int i = 0; i < count; i++) {
char setting[512];
mir_snprintf(setting, "%d_count", i);
- unsigned int items = db_get_w(0, MODULE_NAME "Groups", setting, 0);
+ unsigned int items = db_get_w(0, EI_MODULE_NAME "Groups", setting, 0);
if (items < 1)
continue;
@@ -134,7 +134,7 @@ static void LoadGroups(LIST<ExtraIconGroup> &groups)
for (unsigned int j = 0; j < items; j++) {
mir_snprintf(setting, "%d_%d", i, j);
- ptrA szIconName(db_get_sa(0, MODULE_NAME "Groups", setting));
+ ptrA szIconName(db_get_sa(0, EI_MODULE_NAME "Groups", setting));
if (IsEmpty(szIconName))
continue;
@@ -322,15 +322,15 @@ static void EI_PostCreate(BaseExtraIcon *extra, const char *name, int flags)
{
char setting[512];
mir_snprintf(setting, "Position_%s", name);
- extra->setPosition(db_get_w(0, MODULE_NAME, setting, 1000));
+ extra->setPosition(db_get_w(0, EI_MODULE_NAME, setting, 1000));
mir_snprintf(setting, "Slot_%s", name);
- int slot = db_get_w(0, MODULE_NAME, setting, -100);
+ int slot = db_get_w(0, EI_MODULE_NAME, setting, -100);
if (slot == EMPTY_EXTRA_ICON)
slot = -1;
else if (slot == -100) {
if (flags & EIF_DISABLED_BY_DEFAULT) {
- db_set_w(0, MODULE_NAME, setting, EMPTY_EXTRA_ICON);
+ db_set_w(0, EI_MODULE_NAME, setting, EMPTY_EXTRA_ICON);
slot = -1;
}
else slot = 1;
diff --git a/src/mir_app/src/extraicons.h b/src/mir_app/src/extraicons.h
index fd896b3516..6df8be8b7d 100644
--- a/src/mir_app/src/extraicons.h
+++ b/src/mir_app/src/extraicons.h
@@ -22,7 +22,7 @@ Boston, MA 02111-1307, USA.
#ifndef __EXTRAICONS_H__
# define __EXTRAICONS_H__
-#define MODULE_NAME "ExtraIcons"
+#define EI_MODULE_NAME "ExtraIcons"
// Global Variables
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 51440ad771..7a3868195a 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -483,9 +483,8 @@ GetDatabasePlugin @508
SetServiceModePlugin @510
Proto_CreateAccount @511
Proto_GetAverageStatus @512
-??0CMPluginBase@@IAE@PBD@Z @513 NONAME
+??0CMPluginBase@@IAE@PBDABUPLUGININFOEX@@@Z @513 NONAME
??1CMPluginBase@@IAE@XZ @514 NONAME
-??4CMPluginBase@@QAEAAV0@ABV0@@Z @515 NONAME
?debugLogA@CMPluginBase@@QAAXPBDZZ @516 NONAME
?debugLogW@CMPluginBase@@QAAXPB_WZZ @517 NONAME
?delSetting@CMPluginBase@@QAEHIPBD@Z @518 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index 2073ce5374..5e8ddd4069 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -483,9 +483,8 @@ GetDatabasePlugin @508
SetServiceModePlugin @510
Proto_CreateAccount @511
Proto_GetAverageStatus @512
-??0CMPluginBase@@IEAA@PEBD@Z @513 NONAME
+??0CMPluginBase@@IEAA@PEBDAEBUPLUGININFOEX@@@Z @513 NONAME
??1CMPluginBase@@IEAA@XZ @514 NONAME
-??4CMPluginBase@@QEAAAEAV0@AEBV0@@Z @515 NONAME
?debugLogA@CMPluginBase@@QEAAXPEBDZZ @516 NONAME
?debugLogW@CMPluginBase@@QEAAXPEB_WZZ @517 NONAME
?delSetting@CMPluginBase@@QEAA_JIPEBD@Z @518 NONAME
diff --git a/src/mir_app/src/miranda.cpp b/src/mir_app/src/miranda.cpp
index bf212c1c76..bcd2949b45 100644
--- a/src/mir_app/src/miranda.cpp
+++ b/src/mir_app/src/miranda.cpp
@@ -59,6 +59,24 @@ int &hLangpack(g_plugin.m_hLang);
/////////////////////////////////////////////////////////////////////////////////////////
+static PLUGININFOEX pluginInfoEx = {
+ sizeof(PLUGININFOEX),
+ "Miranda NG",
+ MIRANDA_VERSION_DWORD,
+ "",
+ "Miranda NG team",
+ LEGAL_COPYRIGHT,
+ "https://miranda-ng.org",
+ UNICODE_AWARE,
+ MIID_LAST
+};
+
+CMPlugin::CMPlugin() :
+ PLUGIN<CMPlugin>(nullptr, pluginInfoEx)
+{}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
struct MWaitableObject
{
MWaitableObject(MWaitableStub pFunc, HANDLE hEvent) :
diff --git a/src/mir_app/src/netlibhttp.cpp b/src/mir_app/src/netlibhttp.cpp
index e011421e53..3e65391eb0 100644
--- a/src/mir_app/src/netlibhttp.cpp
+++ b/src/mir_app/src/netlibhttp.cpp
@@ -25,7 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
#include "../libs/zlib/src/zlib.h"
#include "netlib.h"
-#include "m_version.h"
#define HTTPRECVHEADERSTIMEOUT 30000 //in ms
#define HTTPRECVDATATIMEOUT 20000
diff --git a/src/mir_app/src/pluginopts.cpp b/src/mir_app/src/pluginopts.cpp
index a6d6209276..4ae83a6145 100644
--- a/src/mir_app/src/pluginopts.cpp
+++ b/src/mir_app/src/pluginopts.cpp
@@ -24,8 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
-#include <m_version.h>
-
#include "chat.h"
#include "plugins.h"
diff --git a/src/mir_app/src/srmm_toolbar.cpp b/src/mir_app/src/srmm_toolbar.cpp
index 8a66992b52..103c1e4020 100644
--- a/src/mir_app/src/srmm_toolbar.cpp
+++ b/src/mir_app/src/srmm_toolbar.cpp
@@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "chat.h"
#include "skin.h"
-#define MODULENAME "SRMM_Toolbar"
+#define EI_MODULE_NAME "SRMM_Toolbar"
#define DPISCALEY_S(argY) ((int)((double)(argY) * g_DPIscaleY))
#define DPISCALEX_S(argX) ((int)((double)(argX) * g_DPIscaleX))
@@ -127,7 +127,7 @@ MIR_APP_DLL(HANDLE) Srmm_AddButton(const BBButton *bbdi, int _hLang)
mir_snprintf(SettingName, "%s_%d", cbd->m_pszModuleName, cbd->m_dwButtonID);
DBVARIANT dbv = { 0 };
- if (!db_get_s(0, MODULENAME, SettingName, &dbv)) {
+ if (!db_get_s(0, EI_MODULE_NAME, SettingName, &dbv)) {
// modulename_buttonID, position_inIM_inCHAT_isLSide_isRSide_CanBeHidden
char *token = strtok(dbv.pszVal, "_");
cbd->m_dwPosition = (DWORD)atoi(token);
@@ -451,9 +451,9 @@ static void CB_WriteButtonSettings(MCONTACT hContact, CustomButtonData *cbd)
mir_snprintf(SettingName, "%s_%d", cbd->m_pszModuleName, cbd->m_dwButtonID);
mir_snprintf(SettingParameter, "%d_%u_%u_%u_%u_%u", cbd->m_dwPosition, cbd->m_bIMButton, cbd->m_bChatButton, 0, cbd->m_bRSided, cbd->m_bCanBeHidden);
if (!(cbd->m_opFlags & BBSF_NTBDESTRUCT))
- db_set_s(hContact, MODULENAME, SettingName, SettingParameter);
+ db_set_s(hContact, EI_MODULE_NAME, SettingName, SettingParameter);
else
- db_unset(hContact, MODULENAME, SettingName);
+ db_unset(hContact, EI_MODULE_NAME, SettingName);
}
#define MIDDLE_SEPARATOR L">-------M-------<"
@@ -540,7 +540,7 @@ class CSrmmToolbarOptions : public CDlgBase
qsort(arButtonsList.getArray(), arButtonsList.getCount(), sizeof(void*), sstSortButtons);
}
- db_set_dw(0, MODULENAME, "SeparatorsCount", loc_sepcout);
+ db_set_dw(0, EI_MODULE_NAME, "SeparatorsCount", loc_sepcout);
dwSepCount = loc_sepcout;
}
@@ -629,7 +629,7 @@ public:
m_btnHidden.Disable();
m_gap.SetRange(10);
- m_gap.SetPosition(db_get_b(0, MODULENAME, "ButtonsBarGap", 1));
+ m_gap.SetPosition(db_get_b(0, EI_MODULE_NAME, "ButtonsBarGap", 1));
}
virtual void OnDestroy() override
@@ -645,9 +645,9 @@ public:
CB_ReInitCustomButtons();
WORD newGap = m_gap.GetPosition();
- if (newGap != db_get_b(0, MODULENAME, "ButtonsBarGap", 1)) {
+ if (newGap != db_get_b(0, EI_MODULE_NAME, "ButtonsBarGap", 1)) {
WindowList_BroadcastAsync(g_hWindowList, WM_SIZE, 0, 0);
- db_set_b(0, MODULENAME, "ButtonsBarGap", newGap);
+ db_set_b(0, EI_MODULE_NAME, "ButtonsBarGap", newGap);
}
BuildMenuObjectsTree();
@@ -660,12 +660,12 @@ public:
virtual void OnReset() override
{
CB_ReInitCustomButtons();
- dwSepCount = db_get_dw(0, MODULENAME, "SeparatorsCount", 0);
+ dwSepCount = db_get_dw(0, EI_MODULE_NAME, "SeparatorsCount", 0);
}
void btnResetClicked(void*)
{
- db_delete_module(0, MODULENAME);
+ db_delete_module(0, EI_MODULE_NAME);
Srmm_ResetToolbar();
qsort(arButtonsList.getArray(), arButtonsList.getCount(), sizeof(void*), sstSortButtons);
@@ -813,8 +813,8 @@ static void CALLBACK SrmmLoadToolbar()
static int ConvertToolbarData(const char *szSetting, void*)
{
DBVARIANT dbv;
- if (!db_get(0, "Tab" MODULENAME, szSetting, &dbv)) {
- db_set(0, MODULENAME, szSetting, &dbv);
+ if (!db_get(0, "Tab" EI_MODULE_NAME, szSetting, &dbv)) {
+ db_set(0, EI_MODULE_NAME, szSetting, &dbv);
db_free(&dbv);
}
return 0;
@@ -837,12 +837,12 @@ void LoadSrmmToolbarModule()
ReleaseDC(nullptr, hScrnDC);
// old data? convert them
- if (db_get_dw(0, "Tab" MODULENAME, "SeparatorsCount", -1) != -1) {
- db_enum_settings(0, ConvertToolbarData, "Tab" MODULENAME, nullptr);
- db_delete_module(0, "Tab" MODULENAME);
+ if (db_get_dw(0, "Tab" EI_MODULE_NAME, "SeparatorsCount", -1) != -1) {
+ db_enum_settings(0, ConvertToolbarData, "Tab" EI_MODULE_NAME, nullptr);
+ db_delete_module(0, "Tab" EI_MODULE_NAME);
}
- dwSepCount = db_get_dw(0, MODULENAME, "SeparatorsCount", 0);
+ dwSepCount = db_get_dw(0, EI_MODULE_NAME, "SeparatorsCount", 0);
CB_RegisterSeparators();
}
diff --git a/src/mir_app/src/stdafx.h b/src/mir_app/src/stdafx.h
index e6c82f8609..5622b60d72 100644
--- a/src/mir_app/src/stdafx.h
+++ b/src/mir_app/src/stdafx.h
@@ -93,6 +93,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <m_gui.h>
#include <m_srmm_int.h>
#include <m_imgsrvc.h>
+#include <m_version.h>
#include "miranda.h"
@@ -107,7 +108,5 @@ typedef struct GlobalLogSettingsBase GlobalLogSettings;
struct CMPlugin : public PLUGIN<CMPlugin>
{
- CMPlugin() :
- PLUGIN<CMPlugin>(nullptr)
- {}
+ CMPlugin();
};