diff options
-rw-r--r-- | bin10/lib/mir_core.lib | bin | 28382 -> 28294 bytes | |||
-rw-r--r-- | include/m_core.h | 8 | ||||
-rw-r--r-- | plugins/Mir_core/langpack.cpp | 36 | ||||
-rw-r--r-- | plugins/Mir_core/memory.cpp | 4 | ||||
-rw-r--r-- | plugins/Mir_core/mir_core.def | 14 | ||||
-rw-r--r-- | plugins/Mir_core/miranda.h | 8 | ||||
-rw-r--r-- | plugins/Mir_core/utf.cpp | 4 | ||||
-rw-r--r-- | protocols/JabberG/jabber.cpp | 5 | ||||
-rw-r--r-- | src/core/miranda.h | 8 | ||||
-rw-r--r-- | src/core/modules.cpp | 2 | ||||
-rw-r--r-- | src/modules/button/button.cpp | 2 | ||||
-rw-r--r-- | src/modules/clist/genmenuopt.cpp | 2 | ||||
-rw-r--r-- | src/modules/database/dbini.cpp | 2 | ||||
-rw-r--r-- | src/modules/database/profilemanager.cpp | 6 | ||||
-rw-r--r-- | src/modules/fonts/FontService.cpp | 2 | ||||
-rw-r--r-- | src/modules/langpack/lpservices.cpp | 10 | ||||
-rw-r--r-- | src/modules/options/filter.h | 2 | ||||
-rw-r--r-- | src/modules/options/options.cpp | 16 | ||||
-rw-r--r-- | src/modules/plugins/newplugins.cpp | 97 | ||||
-rw-r--r-- | src/modules/plugins/pluginopts.cpp | 2 | ||||
-rw-r--r-- | src/modules/userinfo/userinfo.cpp | 4 |
21 files changed, 124 insertions, 110 deletions
diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib Binary files differindex 51fe241cf0..f9f2d7d584 100644 --- a/bin10/lib/mir_core.lib +++ b/bin10/lib/mir_core.lib diff --git a/include/m_core.h b/include/m_core.h index b40dcfad30..732e60af2b 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -178,10 +178,10 @@ MIR_CORE_DLL(pfnExceptionFilter) SetExceptionFilter(pfnExceptionFilter pMirandaE extern int hLangpack;
-MIR_CORE_DLL(void) LangPackDropUnusedItems(void);
-MIR_CORE_DLL(int) LangPackGetDefaultCodePage( void );
-MIR_CORE_DLL(int) LangPackGetDefaultLocale(void);
-MIR_CORE_DLL(TCHAR*) LangPackPcharToTchar(const char* pszStr);
+MIR_CORE_DLL(void) Langpack_SortDuplicates(void);
+MIR_CORE_DLL(int) Langpack_GetDefaultCodePage( void );
+MIR_CORE_DLL(int) Langpack_GetDefaultLocale(void);
+MIR_CORE_DLL(TCHAR*) Langpack_PcharToTchar(const char* pszStr);
MIR_CORE_DLL(int) LoadLangPackModule(void);
MIR_CORE_DLL(int) LoadLangPack(const TCHAR *szLangPack);
diff --git a/plugins/Mir_core/langpack.cpp b/plugins/Mir_core/langpack.cpp index eb3b4619b5..9aa2f6694c 100644 --- a/plugins/Mir_core/langpack.cpp +++ b/plugins/Mir_core/langpack.cpp @@ -423,24 +423,24 @@ static char *LangPackTranslateString(LangPackMuuid* pUuid, const char *szEnglish return W ? (char *)entry->wlocal : entry->local;
}
-MIR_CORE_DLL(int) LangPackGetDefaultCodePage()
+MIR_CORE_DLL(int) Langpack_GetDefaultCodePage()
{
return langPack.defaultANSICp;
}
-MIR_CORE_DLL(int) LangPackGetDefaultLocale()
+MIR_CORE_DLL(int) Langpack_GetDefaultLocale()
{
return (langPack.localeID == 0) ? LOCALE_USER_DEFAULT : langPack.localeID;
}
-MIR_CORE_DLL(TCHAR*) LangPackPcharToTchar(const char* pszStr)
+MIR_CORE_DLL(TCHAR*) Langpack_PcharToTchar(const char* pszStr)
{
if (pszStr == NULL)
return NULL;
{ int len = (int)strlen(pszStr);
TCHAR* result = (TCHAR*)alloca((len+1)*sizeof(TCHAR));
- MultiByteToWideChar(LangPackGetDefaultCodePage(), 0, pszStr, -1, result, len);
+ MultiByteToWideChar(Langpack_GetDefaultCodePage(), 0, pszStr, -1, result, len);
result[len] = 0;
return mir_wstrdup(TranslateW(result));
}
@@ -450,17 +450,17 @@ MIR_CORE_DLL(TCHAR*) LangPackPcharToTchar(const char* pszStr) MIR_CORE_DLL(char*) TranslateA_LP(const char* str, int hLangpack)
{
- return (char*)LangPackTranslateString(LangPackLookupUuid(hLangpack), str, FALSE);
+ return (char*)LangPackTranslateString(Langpack_LookupUuid(hLangpack), str, FALSE);
}
MIR_CORE_DLL(WCHAR*) TranslateW_LP(const WCHAR* str, int hLangpack)
{
- return (WCHAR*)LangPackTranslateString(LangPackLookupUuid(hLangpack), (LPCSTR)str, TRUE);
+ return (WCHAR*)LangPackTranslateString(Langpack_LookupUuid(hLangpack), (LPCSTR)str, TRUE);
}
MIR_CORE_DLL(void) TranslateMenu_LP(HMENU hMenu, int hLangpack)
{
- LangPackMuuid* uuid = LangPackLookupUuid(hLangpack);
+ LangPackMuuid* uuid = Langpack_LookupUuid(hLangpack);
MENUITEMINFO mii;
mii.cbSize = MENUITEMINFO_V4_SIZE;
@@ -505,7 +505,7 @@ static BOOL CALLBACK TranslateDialogEnumProc(HWND hwnd, LPARAM lParam) TCHAR szClass[32];
int id = GetDlgCtrlID(hwnd);
- LangPackMuuid* uuid = LangPackLookupUuid(hLangpack);
+ LangPackMuuid* uuid = Langpack_LookupUuid(hLangpack);
GetClassName(hwnd, szClass, SIZEOF(szClass));
if ( !lstrcmpi(szClass, _T("static")) || !lstrcmpi(szClass, _T("hyperlink")) || !lstrcmpi(szClass, _T("button")) || !lstrcmpi(szClass, _T("MButtonClass")) || !lstrcmpi(szClass, _T("MHeaderbarCtrl")))
@@ -519,19 +519,29 @@ static BOOL CALLBACK TranslateDialogEnumProc(HWND hwnd, LPARAM lParam) MIR_CORE_DLL(void) TranslateDialog_LP(HWND hDlg, int hLangpack)
{
- TranslateWindow(LangPackLookupUuid(hLangpack), hDlg);
+ TranslateWindow( Langpack_LookupUuid(hLangpack), hDlg);
EnumChildWindows(hDlg, TranslateDialogEnumProc, hLangpack);
}
/////////////////////////////////////////////////////////////////////////////////////////
-MIR_CORE_DLL(LangPackMuuid*) LangPackLookupUuid(WPARAM wParam)
+MIR_CORE_DLL(LangPackMuuid*) Langpack_LookupUuid(WPARAM wParam)
{
int idx = (wParam >> 16) & 0xFFFF;
return (idx > 0 && idx <= lMuuids.getCount()) ? lMuuids[ idx-1 ] : NULL;
}
-MIR_CORE_DLL(int) LangPackMarkPluginLoaded(PLUGININFOEX* pInfo)
+MIR_CORE_DLL(int) Langpack_GetPluginHandle(PLUGININFOEX* pInfo)
+{
+ LangPackMuuid tmp; tmp.muuid = pInfo->uuid;
+ int idx = lMuuids.getIndex(&tmp);
+ if (idx == -1)
+ return 0;
+
+ return (idx+1) << 16;
+}
+
+MIR_CORE_DLL(int) Langpack_MarkPluginLoaded(PLUGININFOEX* pInfo)
{
LangPackMuuid tmp; tmp.muuid = pInfo->uuid;
int idx = lMuuids.getIndex(&tmp);
@@ -542,7 +552,7 @@ MIR_CORE_DLL(int) LangPackMarkPluginLoaded(PLUGININFOEX* pInfo) return (idx+1) << 16;
}
-MIR_CORE_DLL(void) LangPackDropUnusedItems(void)
+MIR_CORE_DLL(void) Langpack_SortDuplicates(void)
{
if (langPack.entryCount == 0)
return;
@@ -636,5 +646,5 @@ MIR_CORE_DLL(void) ReloadLangpack(TCHAR *pszStr) UnloadLangPackModule();
LoadLangPack(pszStr);
- LangPackDropUnusedItems();
+ Langpack_SortDuplicates();
}
diff --git a/plugins/Mir_core/memory.cpp b/plugins/Mir_core/memory.cpp index a14d9fd3ad..0ecddc6717 100644 --- a/plugins/Mir_core/memory.cpp +++ b/plugins/Mir_core/memory.cpp @@ -252,7 +252,7 @@ MIR_CORE_DLL(wchar_t*) mir_a2u_cp(const char* src, int codepage) MIR_CORE_DLL(wchar_t*) mir_a2u(const char* src)
{
- return mir_a2u_cp(src, LangPackGetDefaultCodePage());
+ return mir_a2u_cp(src, Langpack_GetDefaultCodePage());
}
/******************************************************************************/
@@ -276,5 +276,5 @@ MIR_CORE_DLL(char*) mir_u2a_cp(const wchar_t* src, int codepage) MIR_CORE_DLL(char*) mir_u2a(const wchar_t* src)
{
- return mir_u2a_cp(src, LangPackGetDefaultCodePage());
+ return mir_u2a_cp(src, Langpack_GetDefaultCodePage());
}
diff --git a/plugins/Mir_core/mir_core.def b/plugins/Mir_core/mir_core.def index 6411108a72..b985fa7efb 100644 --- a/plugins/Mir_core/mir_core.def +++ b/plugins/Mir_core/mir_core.def @@ -3,8 +3,8 @@ LIBRARY mir_core EXPORTS
CallContactService @1
CallProtoService @2
-LangPackLookupUuid @3 NONAME
-LangPackMarkPluginLoaded @4 NONAME
+Langpack_LookupUuid @3
+Langpack_MarkPluginLoaded @4
CallFunctionAsync @5
CallPluginEventHook @7
CallService @8
@@ -32,10 +32,10 @@ KillModuleServices @29 KillObjectEventHooks @30
KillObjectServices @31
KillObjectThreads @32
-LangPackDropUnusedItems @33
-LangPackGetDefaultCodePage @34
-LangPackGetDefaultLocale @35
-LangPackPcharToTchar @36
+Langpack_SortDuplicates @33
+Langpack_GetDefaultCodePage @34
+Langpack_GetDefaultLocale @35
+Langpack_PcharToTchar @36
List_Copy @37
List_Create @38
List_Destroy @39
@@ -124,4 +124,4 @@ db_set_w @121 db_set_ws @122
UnloadCoreModule @123
Thread_SetName @124
-
+Langpack_GetPluginHandle @125
diff --git a/plugins/Mir_core/miranda.h b/plugins/Mir_core/miranda.h index 71c0804fd1..ed3f4a5b75 100644 --- a/plugins/Mir_core/miranda.h +++ b/plugins/Mir_core/miranda.h @@ -30,9 +30,13 @@ struct LangPackMuuid PLUGININFOEX* pInfo;
};
-MIR_CORE_DLL(int) LangPackMarkPluginLoaded(PLUGININFOEX* pInfo);
+extern "C"
+{
+ MIR_CORE_DLL(int) Langpack_GetPluginHandle(PLUGININFOEX* pInfo);
+ MIR_CORE_DLL(int) Langpack_MarkPluginLoaded(PLUGININFOEX* pInfo);
+};
-MIR_CORE_DLL(LangPackMuuid*) LangPackLookupUuid(WPARAM wParam);
+MIR_CORE_DLL(LangPackMuuid*) Langpack_LookupUuid(WPARAM wParam);
void UnloadLangPackModule(void);
diff --git a/plugins/Mir_core/utf.cpp b/plugins/Mir_core/utf.cpp index 5ec6042758..ddf2d1ca9f 100644 --- a/plugins/Mir_core/utf.cpp +++ b/plugins/Mir_core/utf.cpp @@ -305,7 +305,7 @@ MIR_CORE_DLL(char*) Utf8DecodeCP(char* str, int codepage, wchar_t** ucs2) MIR_CORE_DLL(char*) Utf8Decode(char* str, wchar_t** ucs2)
{
- return Utf8DecodeCP(str, LangPackGetDefaultCodePage(), ucs2);
+ return Utf8DecodeCP(str, Langpack_GetDefaultCodePage(), ucs2);
}
MIR_CORE_DLL(wchar_t*) Utf8DecodeW(const char* str)
@@ -379,7 +379,7 @@ MIR_CORE_DLL(char*) Utf8EncodeCP(const char* src, int codepage) MIR_CORE_DLL(char*) Utf8Encode(const char* src)
{
- return Utf8EncodeCP(src, LangPackGetDefaultCodePage());
+ return Utf8EncodeCP(src, Langpack_GetDefaultCodePage());
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/JabberG/jabber.cpp b/protocols/JabberG/jabber.cpp index 71ac8b153b..33674a3a9e 100644 --- a/protocols/JabberG/jabber.cpp +++ b/protocols/JabberG/jabber.cpp @@ -76,7 +76,6 @@ HANDLE hModulesLoaded, hModulesLoadedTB; HANDLE hExtraActivity = NULL;
HANDLE hExtraMood = NULL;
-
void JabberUserInfoInit(void);
int bSecureIM;
@@ -219,10 +218,8 @@ static int jabberProtoUninit( CJabberProto* ppro ) return 0;
}
-extern "C" int __declspec( dllexport ) Load( )
+extern "C" int __declspec( dllexport ) Load()
{
-
-
// set the memory, lists & utf8 managers
mir_getXI( &xi );
mir_getTMI( &tmi );
diff --git a/src/core/miranda.h b/src/core/miranda.h index 7dfba64a66..8b7d5769db 100644 --- a/src/core/miranda.h +++ b/src/core/miranda.h @@ -247,3 +247,11 @@ public: #define StrConvTu(x) x
#define StrConvA(x) StrConvAT(x)
#define StrConvU(x) x
+
+///////////////////////////////////////////////////////////////////////////////
+
+extern "C"
+{
+ MIR_CORE_DLL(int) Langpack_GetPluginHandle(PLUGININFOEX* pInfo);
+ MIR_CORE_DLL(int) Langpack_MarkPluginLoaded(PLUGININFOEX* pInfo);
+};
diff --git a/src/core/modules.cpp b/src/core/modules.cpp index 68a718bc11..d1636a09a0 100644 --- a/src/core/modules.cpp +++ b/src/core/modules.cpp @@ -136,7 +136,7 @@ int LoadDefaultModules(void) if ( LoadAddContactModule()) return 1;
if ( LoadNewPluginsModule()) return 1; // will call Load(void) on everything, clist will load first
- LangPackDropUnusedItems();
+ Langpack_SortDuplicates();
if ( LoadAccountsModule()) return 1;
diff --git a/src/modules/button/button.cpp b/src/modules/button/button.cpp index 2f7fce43f4..75c4148980 100644 --- a/src/modules/button/button.cpp +++ b/src/modules/button/button.cpp @@ -509,7 +509,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L if (lParam & BATF_UNICODE)
ti.lpszText = mir_wstrdup(TranslateW((WCHAR*)wParam));
else
- ti.lpszText = LangPackPcharToTchar((char*)wParam);
+ ti.lpszText = Langpack_PcharToTchar((char*)wParam);
if (bct->pAccPropServices) {
wchar_t *tmpstr = mir_t2u(ti.lpszText);
bct->pAccPropServices->SetHwndPropStr(bct->hwnd, OBJID_CLIENT,
diff --git a/src/modules/clist/genmenuopt.cpp b/src/modules/clist/genmenuopt.cpp index c2ecc3f18b..4ec48d0e20 100644 --- a/src/modules/clist/genmenuopt.cpp +++ b/src/modules/clist/genmenuopt.cpp @@ -145,7 +145,7 @@ static int BuildMenuObjectsTree(HWND hwndDlg) continue;
tvis.item.lParam = (LPARAM)g_menus[i]->id;
- tvis.item.pszText = LangPackPcharToTchar(g_menus[i]->Name);
+ tvis.item.pszText = Langpack_PcharToTchar(g_menus[i]->Name);
tvis.item.iImage = tvis.item.iSelectedImage = TRUE;
TreeView_InsertItem(hTree, &tvis);
mir_free(tvis.item.pszText);
diff --git a/src/modules/database/dbini.cpp b/src/modules/database/dbini.cpp index af15390857..70c1f965af 100644 --- a/src/modules/database/dbini.cpp +++ b/src/modules/database/dbini.cpp @@ -326,7 +326,7 @@ static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsaf break;
case 'e':
case 'E':
- ConvertBackslashes(szValue+1, LangPackGetDefaultCodePage());
+ ConvertBackslashes(szValue+1, Langpack_GetDefaultCodePage());
case 's':
case 'S':
DBWriteContactSettingString(NULL, szSection, szName, szValue+1);
diff --git a/src/modules/database/profilemanager.cpp b/src/modules/database/profilemanager.cpp index 898fc323d6..32e515efbe 100644 --- a/src/modules/database/profilemanager.cpp +++ b/src/modules/database/profilemanager.cpp @@ -123,7 +123,7 @@ static int FindDbProviders(const char*, DATABASELINK * dblink, LPARAM lParam) if (dblink->getFriendlyName(szName, SIZEOF(szName), 1) == 0) {
// add to combo box
- TCHAR* p = LangPackPcharToTchar(szName);
+ TCHAR* p = Langpack_PcharToTchar(szName);
LRESULT index = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM)p);
mir_free(p);
SendMessage(hwndCombo, CB_SETITEMDATA, index, (LPARAM)dblink);
@@ -607,7 +607,7 @@ static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, SendMessage(hwndCombo, CB_SETITEMDATA, index, (LPARAM)-1);
SendMessage(hwndCombo, CB_SETCURSEL, 0, 0);
while (list[i]) {
- TCHAR *str = LangPackPcharToTchar(list[i]);
+ TCHAR *str = Langpack_PcharToTchar(list[i]);
index = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM)str);
mir_free(str);
SendMessage(hwndCombo, CB_SETITEMDATA, index, (LPARAM)i);
@@ -780,7 +780,7 @@ static int AddProfileManagerPage(struct DetailsPageInit * opi, OPTIONSDIALOGPAGE p->hInstance = odp->hInstance;
p->pfnDlgProc = odp->pfnDlgProc;
p->position = odp->position;
- p->ptszTitle = LangPackPcharToTchar(odp->pszTitle);
+ p->ptszTitle = Langpack_PcharToTchar(odp->pszTitle);
p->pszGroup = NULL;
p->groupPosition = odp->groupPosition;
p->hGroupIcon = odp->hGroupIcon;
diff --git a/src/modules/fonts/FontService.cpp b/src/modules/fonts/FontService.cpp index 2f1ff567b1..26bbcfcfe2 100644 --- a/src/modules/fonts/FontService.cpp +++ b/src/modules/fonts/FontService.cpp @@ -67,7 +67,7 @@ static int OnPreShutdown(WPARAM, LPARAM) int LoadFontserviceModule(void)
{
- code_page = LangPackGetDefaultCodePage();
+ code_page = Langpack_GetDefaultCodePage();
CreateServiceFunction("Font/Register", RegisterFont);
CreateServiceFunction("Font/RegisterW", RegisterFontW);
diff --git a/src/modules/langpack/lpservices.cpp b/src/modules/langpack/lpservices.cpp index e828a85c6a..b7ae5ef563 100644 --- a/src/modules/langpack/lpservices.cpp +++ b/src/modules/langpack/lpservices.cpp @@ -22,8 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "..\..\core\commonheaders.h"
-MIR_CORE_DLL(int) LangPackMarkPluginLoaded(PLUGININFOEX* pInfo);
-
/////////////////////////////////////////////////////////////////////////////////////////
static INT_PTR srvTranslateString(WPARAM wParam, LPARAM lParam)
@@ -45,7 +43,7 @@ static INT_PTR srvTranslateMenu(WPARAM wParam, LPARAM lParam) static INT_PTR srvRegisterLP(WPARAM wParam, LPARAM lParam)
{
- *(int*)wParam = LangPackMarkPluginLoaded((PLUGININFOEX*)lParam);
+ *(int*)wParam = Langpack_MarkPluginLoaded((PLUGININFOEX*)lParam);
return 0;
}
@@ -53,14 +51,14 @@ static INT_PTR srvRegisterLP(WPARAM wParam, LPARAM lParam) static INT_PTR srvGetDefaultCodePage(WPARAM, LPARAM)
{
- return LangPackGetDefaultCodePage();
+ return Langpack_GetDefaultCodePage();
}
/////////////////////////////////////////////////////////////////////////////////////////
static INT_PTR srvGetDefaultLocale(WPARAM, LPARAM)
{
- return LangPackGetDefaultLocale();
+ return Langpack_GetDefaultLocale();
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -73,7 +71,7 @@ static INT_PTR srvPcharToTchar(WPARAM wParam, LPARAM lParam) int len = (int)strlen(pszStr);
TCHAR* result = (TCHAR*)alloca((len+1)*sizeof(TCHAR));
- MultiByteToWideChar(LangPackGetDefaultCodePage(), 0, pszStr, -1, result, len);
+ MultiByteToWideChar(Langpack_GetDefaultCodePage(), 0, pszStr, -1, result, len);
result[len] = 0;
return (INT_PTR)mir_wstrdup( TranslateW_LP(result, wParam));
}
diff --git a/src/modules/options/filter.h b/src/modules/options/filter.h index ced8845b95..6bf38d17d5 100644 --- a/src/modules/options/filter.h +++ b/src/modules/options/filter.h @@ -38,7 +38,7 @@ void GetDialogStrings(int enableKeywordFiltering, const PageHash key, TCHAR *plu _inline TCHAR * _tcslwr_locale(TCHAR * buf)
{
- LCMapString(LangPackGetDefaultLocale() , LCMAP_LOWERCASE, buf, (int)_tcslen(buf), buf, (int)_tcslen(buf));
+ LCMapString(Langpack_GetDefaultLocale() , LCMAP_LOWERCASE, buf, (int)_tcslen(buf), buf, (int)_tcslen(buf));
return buf;
}
diff --git a/src/modules/options/options.cpp b/src/modules/options/options.cpp index 9310c6c5d9..e049105253 100644 --- a/src/modules/options/options.cpp +++ b/src/modules/options/options.cpp @@ -720,11 +720,11 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L DBFreeVariant(&dbv);
}
}
- else lastGroup = LangPackPcharToTchar(ood->pszGroup);
+ else lastGroup = Langpack_PcharToTchar(ood->pszGroup);
}
else {
- lastPage = LangPackPcharToTchar(ood->pszPage);
- lastGroup = (ood->pszGroup == NULL) ? NULL : LangPackPcharToTchar(ood->pszGroup);
+ lastPage = Langpack_PcharToTchar(ood->pszPage);
+ lastGroup = (ood->pszGroup == NULL) ? NULL : Langpack_PcharToTchar(ood->pszGroup);
}
if (ood->pszTab == NULL) {
@@ -733,7 +733,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L DBFreeVariant(&dbv);
}
}
- else lastTab = LangPackPcharToTchar(ood->pszTab);
+ else lastTab = Langpack_PcharToTchar(ood->pszTab);
OPTIONSDIALOGPAGE *odp = (OPTIONSDIALOGPAGE*)psh->ppsp;
for (size_t i = 0; i < psh->nPages; i++, odp++) {
@@ -1401,10 +1401,10 @@ static void OpenOptionsNow(const char *pszGroup, const char *pszPage, const char ShowWindow(hwndOptions, SW_RESTORE);
SetForegroundWindow(hwndOptions);
if (pszPage != NULL) {
- TCHAR *ptszPage = LangPackPcharToTchar(pszPage);
+ TCHAR *ptszPage = Langpack_PcharToTchar(pszPage);
HTREEITEM hItem = NULL;
if (pszGroup != NULL) {
- TCHAR *ptszGroup = LangPackPcharToTchar(pszGroup);
+ TCHAR *ptszGroup = Langpack_PcharToTchar(pszGroup);
hItem = FindNamedTreeItemAtRoot(GetDlgItem(hwndOptions, IDC_PAGETREE), ptszGroup);
if (hItem != NULL) {
hItem = FindNamedTreeItemAtChildren(GetDlgItem(hwndOptions, IDC_PAGETREE), hItem, ptszPage);
@@ -1511,7 +1511,7 @@ static INT_PTR AddOptionsPage(WPARAM wParam, LPARAM lParam) if (odp->flags & ODPF_UNICODE)
dst->ptszGroup = mir_wstrdup(odp->ptszGroup);
else {
- dst->ptszGroup = LangPackPcharToTchar(odp->pszGroup);
+ dst->ptszGroup = Langpack_PcharToTchar(odp->pszGroup);
dst->flags |= ODPF_UNICODE;
}
}
@@ -1520,7 +1520,7 @@ static INT_PTR AddOptionsPage(WPARAM wParam, LPARAM lParam) if (odp->flags & ODPF_UNICODE)
dst->ptszTab = mir_wstrdup(odp->ptszTab);
else {
- dst->ptszTab = LangPackPcharToTchar(odp->pszTab);
+ dst->ptszTab = Langpack_PcharToTchar(odp->pszTab);
dst->flags |= ODPF_UNICODE;
}
}
diff --git a/src/modules/plugins/newplugins.cpp b/src/modules/plugins/newplugins.cpp index 035b2e4c63..493c40bf10 100644 --- a/src/modules/plugins/newplugins.cpp +++ b/src/modules/plugins/newplugins.cpp @@ -266,6 +266,33 @@ LBL_Ok: goto LBL_Error;
}
+// perform any API related tasks to freeing
+void Plugin_Uninit(pluginEntry* p, bool bDynamic)
+{
+ if (bDynamic && p->bpi.hInst)
+ CallPluginEventHook(p->bpi.hInst, hOkToExitEvent, 0, 0);
+
+ // if it was an installed database plugin, call its unload
+ if (p->pclass & PCLASS_DB)
+ p->bpi.dblink->Unload(p->pclass & PCLASS_OK);
+
+ // if the basic API check had passed, call Unload if Load(void) was ever called
+ if (p->pclass & PCLASS_LOADED)
+ p->bpi.Unload();
+
+ // release the library
+ if (p->bpi.hInst != NULL) {
+ // we need to kill all resources which belong to that DLL before calling FreeLibrary
+ KillModuleEventHooks(p->bpi.hInst);
+ KillModuleServices(p->bpi.hInst);
+
+ FreeLibrary(p->bpi.hInst);
+ ZeroMemory(&p->bpi, sizeof(p->bpi));
+ }
+ UnregisterModule(p->bpi.hInst);
+ pluginList.remove(p);
+}
+
// returns true if the given file is <anything>.dll exactly
static int valid_library_name(TCHAR *name)
{
@@ -313,33 +340,6 @@ static int validguess_servicemode_name(TCHAR * name) return rc;
}
-// perform any API related tasks to freeing
-void Plugin_Uninit(pluginEntry* p, bool bDynamic)
-{
- if (bDynamic && p->bpi.hInst)
- CallPluginEventHook(p->bpi.hInst, hOkToExitEvent, 0, 0);
-
- // if it was an installed database plugin, call its unload
- if (p->pclass & PCLASS_DB)
- p->bpi.dblink->Unload(p->pclass & PCLASS_OK);
-
- // if the basic API check had passed, call Unload if Load(void) was ever called
- if (p->pclass & PCLASS_LOADED)
- p->bpi.Unload();
-
- // release the library
- if (p->bpi.hInst != NULL) {
- // we need to kill all resources which belong to that DLL before calling FreeLibrary
- KillModuleEventHooks(p->bpi.hInst);
- KillModuleServices(p->bpi.hInst);
-
- FreeLibrary(p->bpi.hInst);
- ZeroMemory(&p->bpi, sizeof(p->bpi));
- }
- UnregisterModule(p->bpi.hInst);
- pluginList.remove(p);
-}
-
void enumPlugins(SCAN_PLUGINS_CALLBACK cb, WPARAM wParam, LPARAM lParam)
{
// get miranda's exe path
@@ -393,12 +393,11 @@ static INT_PTR PluginsEnum(WPARAM, LPARAM lParam) pluginEntry* OpenPlugin(TCHAR* tszFileName, TCHAR* path)
{
- int isdb = validguess_db_name(tszFileName);
BASIC_PLUGIN_INFO bpi;
pluginEntry* p = (pluginEntry*)HeapAlloc(hPluginListHeap, HEAP_NO_SERIALIZE | HEAP_ZERO_MEMORY, sizeof(pluginEntry));
_tcsncpy(p->pluginname, tszFileName, SIZEOF(p->pluginname));
// plugin name suggests its a db module, load it right now
- if (isdb) {
+ if ( validguess_db_name(tszFileName)) {
TCHAR buf[MAX_PATH];
mir_sntprintf(buf, SIZEOF(buf), _T("%s\\Plugins\\%s"), path, tszFileName);
if (checkAPI(buf, &bpi, mirandaVersion, CHECKAPI_DB)) {
@@ -414,13 +413,13 @@ pluginEntry* OpenPlugin(TCHAR* tszFileName, TCHAR* path) // didn't have basic APIs or DB exports - failed.
p->pclass |= PCLASS_FAILED;
}
- else if (validguess_clist_name(tszFileName)) {
+ else if ( validguess_clist_name(tszFileName)) {
// keep a note of this plugin for later
if (pluginListUI != NULL) p->nextclass=pluginListUI;
pluginListUI=p;
p->pclass |= PCLASS_CLIST;
}
- else if (validguess_servicemode_name(tszFileName)) {
+ else if ( validguess_servicemode_name(tszFileName)) {
TCHAR buf[MAX_PATH];
mir_sntprintf(buf, SIZEOF(buf), _T("%s\\Plugins\\%s"), path, tszFileName);
if (checkAPI(buf, &bpi, mirandaVersion, CHECKAPI_NONE)) {
@@ -538,33 +537,31 @@ bool TryLoadPlugin(pluginEntry *p, bool bDynamic) static pluginEntry* getCListModule(TCHAR * exe, TCHAR * slice, int useWhiteList)
{
- pluginEntry * p = pluginListUI;
- BASIC_PLUGIN_INFO bpi;
- while (p != NULL) {
+ for (pluginEntry *p = pluginListUI; p != NULL; p = p->nextclass) {
mir_sntprintf(slice, &exe[MAX_PATH] - slice, _T("\\Plugins\\%s"), p->pluginname);
CharLower(p->pluginname);
- if (useWhiteList ? isPluginOnWhiteList(p->pluginname) : 1) {
- if (checkAPI(exe, &bpi, mirandaVersion, CHECKAPI_CLIST)) {
+ if (useWhiteList && !isPluginOnWhiteList(p->pluginname))
+ continue;
+
+ BASIC_PLUGIN_INFO bpi;
+ if (checkAPI(exe, &bpi, mirandaVersion, CHECKAPI_CLIST)) {
+ p->bpi = bpi;
+ p->pclass |= PCLASS_LAST | PCLASS_OK | PCLASS_BASICAPI;
+ RegisterModule(p->bpi.hInst);
+ if (bpi.clistlink() == 0) {
p->bpi = bpi;
- p->pclass |= PCLASS_LAST | PCLASS_OK | PCLASS_BASICAPI;
- RegisterModule(p->bpi.hInst);
- if (bpi.clistlink() == 0) {
- p->bpi = bpi;
- p->pclass |= PCLASS_LOADED;
- return p;
- }
- else Plugin_Uninit(p);
- } //if
- } //if
- p = p->nextclass;
+ p->pclass |= PCLASS_LOADED;
+ return p;
+ }
+ Plugin_Uninit(p);
+ }
}
return NULL;
}
int UnloadPlugin(TCHAR* buf, int bufLen)
{
- int i;
- for (i = pluginList.getCount()-1; i >= 0; i--) {
+ for (int i = pluginList.getCount()-1; i >= 0; i--) {
pluginEntry* p = pluginList[i];
if ( !_tcsicmp(p->pluginname, buf)) {
GetModuleFileName(p->bpi.hInst, buf, bufLen);
@@ -690,7 +687,7 @@ int LoadNewPluginsModule(void) // first load the clist cos alot of plugins need that to be present at Load(void)
for (useWhiteList = 1; useWhiteList >= 0 && clist == NULL; useWhiteList--)
- clist=getCListModule(exe, slice, useWhiteList);
+ clist = getCListModule(exe, slice, useWhiteList);
/* the loop above will try and get one clist DLL to work, if all fail then just bail now */
if (clist == NULL) {
// result = 0, no clist_* can be found
diff --git a/src/modules/plugins/pluginopts.cpp b/src/modules/plugins/pluginopts.cpp index 58d5b23128..69034567f3 100644 --- a/src/modules/plugins/pluginopts.cpp +++ b/src/modules/plugins/pluginopts.cpp @@ -358,7 +358,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar SetWindowTextA(GetDlgItem(hwndDlg, IDC_PLUGINAUTHOR), sel ? dat->author : "");
SetWindowTextA(GetDlgItem(hwndDlg, IDC_PLUGINEMAIL), sel ? dat->authorEmail : "");
{
- TCHAR* p = LangPackPcharToTchar(dat->description);
+ TCHAR* p = Langpack_PcharToTchar(dat->description);
SetWindowText(GetDlgItem(hwndDlg, IDC_PLUGINLONGINFO), sel ? p : _T(""));
mir_free(p);
}
diff --git a/src/modules/userinfo/userinfo.cpp b/src/modules/userinfo/userinfo.cpp index c636534b19..237c1bdee5 100644 --- a/src/modules/userinfo/userinfo.cpp +++ b/src/modules/userinfo/userinfo.cpp @@ -142,8 +142,8 @@ static INT_PTR AddDetailsPage(WPARAM wParam, LPARAM lParam) if (odp->flags & ODPF_DONTTRANSLATE)
dst->ptszTitle = (odp->pszTitle == 0) ? NULL : mir_a2t(odp->pszTitle);
else
- dst->ptszTitle = (odp->pszTitle == 0) ? NULL : LangPackPcharToTchar(odp->pszTitle);
- dst->ptszTab = ( !(odp->flags & ODPF_USERINFOTAB) || !odp->pszTab) ? NULL : LangPackPcharToTchar(odp->pszTab);
+ dst->ptszTitle = (odp->pszTitle == 0) ? NULL : Langpack_PcharToTchar(odp->pszTitle);
+ dst->ptszTab = ( !(odp->flags & ODPF_USERINFOTAB) || !odp->pszTab) ? NULL : Langpack_PcharToTchar(odp->pszTab);
}
dst->pszGroup = NULL;
|