diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/stduserinfo/src/stdafx.h | 2 | ||||
-rw-r--r-- | src/mir_app/src/IcoLib.h | 1 | ||||
-rw-r--r-- | src/mir_app/src/icolib.cpp | 23 | ||||
-rw-r--r-- | src/mir_app/src/proto_accs.cpp | 34 | ||||
-rw-r--r-- | src/mir_app/src/skin2opts.cpp | 5 |
5 files changed, 33 insertions, 32 deletions
diff --git a/src/core/stduserinfo/src/stdafx.h b/src/core/stduserinfo/src/stdafx.h index ca5412f200..83358ce12f 100644 --- a/src/core/stduserinfo/src/stdafx.h +++ b/src/core/stduserinfo/src/stdafx.h @@ -70,7 +70,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "resource.h"
#include "utils.h"
-#define MODULENAME "UserInfo"
+#define MODULENAME LPGEN("UserInfo")
struct CMPlugin : public PLUGIN<CMPlugin>
{
diff --git a/src/mir_app/src/IcoLib.h b/src/mir_app/src/IcoLib.h index 4ab70b263e..73369b88a8 100644 --- a/src/mir_app/src/IcoLib.h +++ b/src/mir_app/src/IcoLib.h @@ -36,6 +36,7 @@ struct SectionItem : public MZeroedObject {
ptrW name;
int flags, maxOrder, ref_count;
+ HPLUGIN pPlugin;
};
struct IconSourceFile
diff --git a/src/mir_app/src/icolib.cpp b/src/mir_app/src/icolib.cpp index fb174f428f..fc4cf444ba 100644 --- a/src/mir_app/src/icolib.cpp +++ b/src/mir_app/src/icolib.cpp @@ -393,24 +393,21 @@ int IconSourceItem::release() /////////////////////////////////////////////////////////////////////////////////////////
// Service functions
-static SectionItem* IcoLib_AddSection(wchar_t *sectionName, BOOL create_new)
+static SectionItem *IcoLib_AddSection(wchar_t *sectionName, HPLUGIN pPlugin)
{
if (!sectionName)
return nullptr;
int indx;
- if ((indx = sectionList.getIndex((SectionItem*)§ionName)) != -1)
+ if ((indx = sectionList.getIndex((SectionItem *)§ionName)) != -1)
return sectionList[indx];
- if (create_new) {
- SectionItem *newItem = new SectionItem();
- newItem->name = mir_wstrdup(sectionName);
- sectionList.insert(newItem);
- bNeedRebuild = TRUE;
- return newItem;
- }
-
- return nullptr;
+ SectionItem *newItem = new SectionItem();
+ newItem->name = mir_wstrdup(sectionName);
+ newItem->pPlugin = pPlugin;
+ sectionList.insert(newItem);
+ bNeedRebuild = TRUE;
+ return newItem;
}
static void IcoLib_RemoveSection(SectionItem *section)
@@ -493,11 +490,11 @@ MIR_APP_DLL(HANDLE) IcoLib_AddIcon(const SKINICONDESC *sid, HPLUGIN pPlugin) item->name = mir_strdup(sid->pszName);
if (sid->flags & SIDF_UNICODE) {
item->description = mir_wstrdup(sid->description.w);
- item->section = IcoLib_AddSection(sid->section.w, TRUE);
+ item->section = IcoLib_AddSection(sid->section.w, pPlugin);
}
else {
item->description = mir_a2u(sid->description.a);
- item->section = IcoLib_AddSection(_A2T(sid->section.a), TRUE);
+ item->section = IcoLib_AddSection(_A2T(sid->section.a), pPlugin);
}
if (item->section) {
diff --git a/src/mir_app/src/proto_accs.cpp b/src/mir_app/src/proto_accs.cpp index a6a52bca6e..af56d61399 100644 --- a/src/mir_app/src/proto_accs.cpp +++ b/src/mir_app/src/proto_accs.cpp @@ -26,6 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "clc.h"
+#define PROTO_MODULE LPGEN("Protocols")
+
bool CheckProtocolOrder(void);
void BuildProtoMenus();
@@ -62,13 +64,13 @@ static int EnumDbModules(const char *szModuleName, void*) void LoadDbAccounts(void)
{
- int ver = db_get_dw(0, "Protocols", "PrVer", -1);
- int count = db_get_dw(0, "Protocols", "ProtoCount", 0);
+ int ver = db_get_dw(0, PROTO_MODULE, "PrVer", -1);
+ int count = db_get_dw(0, PROTO_MODULE, "ProtoCount", 0);
for (int i = 0; i < count; i++) {
char buf[10];
_itoa(i, buf, 10);
- ptrA szModuleName(db_get_sa(0, "Protocols", buf));
+ ptrA szModuleName(db_get_sa(0, PROTO_MODULE, buf));
if (szModuleName == nullptr)
continue;
@@ -79,20 +81,20 @@ void LoadDbAccounts(void) }
_itoa(OFFSET_VISIBLE + i, buf, 10);
- pa->bIsVisible = db_get_dw(0, "Protocols", buf, 1) != 0;
+ pa->bIsVisible = db_get_dw(0, PROTO_MODULE, buf, 1) != 0;
_itoa(OFFSET_PROTOPOS + i, buf, 10);
- pa->iOrder = db_get_dw(0, "Protocols", buf, 1);
+ pa->iOrder = db_get_dw(0, PROTO_MODULE, buf, 1);
if (ver >= 4) {
_itoa(OFFSET_NAME + i, buf, 10);
- pa->tszAccountName = db_get_wsa(0, "Protocols", buf);
+ pa->tszAccountName = db_get_wsa(0, PROTO_MODULE, buf);
_itoa(OFFSET_ENABLED + i, buf, 10);
- pa->bIsEnabled = db_get_dw(0, "Protocols", buf, 1) != 0;
+ pa->bIsEnabled = db_get_dw(0, PROTO_MODULE, buf, 1) != 0;
if (!pa->bIsEnabled && !mir_strcmp(pa->szModuleName, META_PROTO)) {
pa->bIsEnabled = true;
- db_set_dw(0, "Protocols", buf, 1);
+ db_set_dw(0, PROTO_MODULE, buf, 1);
}
pa->szProtoName = db_get_sa(0, szModuleName, "AM_BaseProto");
}
@@ -121,7 +123,7 @@ void LoadDbAccounts(void) void WriteDbAccounts()
{
// enum all old settings to delete
- db_delete_module(0, "Protocols");
+ db_delete_module(0, PROTO_MODULE);
// write new data
for (int i = 0; i < g_arAccounts.getCount(); i++) {
@@ -129,23 +131,23 @@ void WriteDbAccounts() char buf[20];
_itoa(i, buf, 10);
- db_set_s(0, "Protocols", buf, pa->szModuleName);
+ db_set_s(0, PROTO_MODULE, buf, pa->szModuleName);
_itoa(OFFSET_PROTOPOS + i, buf, 10);
- db_set_dw(0, "Protocols", buf, pa->iOrder);
+ db_set_dw(0, PROTO_MODULE, buf, pa->iOrder);
_itoa(OFFSET_VISIBLE + i, buf, 10);
- db_set_dw(0, "Protocols", buf, pa->bIsVisible);
+ db_set_dw(0, PROTO_MODULE, buf, pa->bIsVisible);
_itoa(OFFSET_ENABLED + i, buf, 10);
- db_set_dw(0, "Protocols", buf, pa->bIsEnabled);
+ db_set_dw(0, PROTO_MODULE, buf, pa->bIsEnabled);
_itoa(OFFSET_NAME + i, buf, 10);
- db_set_ws(0, "Protocols", buf, pa->tszAccountName);
+ db_set_ws(0, PROTO_MODULE, buf, pa->tszAccountName);
}
- db_set_dw(0, "Protocols", "ProtoCount", g_arAccounts.getCount());
- db_set_dw(0, "Protocols", "PrVer", 4);
+ db_set_dw(0, PROTO_MODULE, "ProtoCount", g_arAccounts.getCount());
+ db_set_dw(0, PROTO_MODULE, "PrVer", 4);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/mir_app/src/skin2opts.cpp b/src/mir_app/src/skin2opts.cpp index 101b0e7ba7..538984541c 100644 --- a/src/mir_app/src/skin2opts.cpp +++ b/src/mir_app/src/skin2opts.cpp @@ -375,11 +375,12 @@ class CIcoLibOptsDlg : public CDlgBase m_categoryList.DeleteAllItems();
for (int indx = 0; indx < sectionList.getCount(); indx++) {
+ auto *pSection = sectionList[indx];
int sectionLevel = 0;
HTREEITEM hSection = nullptr;
wchar_t itemName[1024];
- mir_wstrcpy(itemName, sectionList[indx]->name);
+ mir_wstrncpy(itemName, pSection->name, _countof(itemName));
wchar_t *sectionName = itemName;
while (sectionName) {
@@ -392,7 +393,7 @@ class CIcoLibOptsDlg : public CDlgBase *sectionName = 0;
}
- pItemName = TranslateW(pItemName);
+ pItemName = TranslateW_LP(pItemName, pSection->pPlugin);
hItem = FindNamedTreeItemAt(hSection, pItemName);
if (!sectionName || !hItem) {
if (!hItem) {
|