diff options
author | George Hazan <george.hazan@gmail.com> | 2014-01-21 20:04:48 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-01-21 20:04:48 +0000 |
commit | d154673f93ad95197bce8cadb995daa5bc39f5d8 (patch) | |
tree | 191522aa88f9f845a9c27b1ddb86116b87033c4b /src/modules/plugins | |
parent | be50a70bfd8b3f3daf0c3351fdce6e2fea515bd7 (diff) |
minor code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@7820 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/plugins')
-rw-r--r-- | src/modules/plugins/dll_sniffer.cpp | 18 | ||||
-rw-r--r-- | src/modules/plugins/newplugins.cpp | 78 | ||||
-rw-r--r-- | src/modules/plugins/pluginopts.cpp | 88 |
3 files changed, 92 insertions, 92 deletions
diff --git a/src/modules/plugins/dll_sniffer.cpp b/src/modules/plugins/dll_sniffer.cpp index b3345a39c8..7e16df10aa 100644 --- a/src/modules/plugins/dll_sniffer.cpp +++ b/src/modules/plugins/dll_sniffer.cpp @@ -48,11 +48,11 @@ MUUID* GetPluginInterfaces(const TCHAR* ptszFileName, bool& bIsPlugin) __try {
__try {
- if ( !hMap )
+ if (!hMap )
__leave;
DWORD dwHSize = 0, filesize = GetFileSize( hFile, &dwHSize );
- if ( !filesize || filesize == INVALID_FILE_SIZE || dwHSize)
+ if (!filesize || filesize == INVALID_FILE_SIZE || dwHSize)
__leave;
if ( filesize < sizeof(IMAGE_DOS_HEADER) + sizeof(IMAGE_NT_HEADERS) )
@@ -75,7 +75,7 @@ MUUID* GetPluginInterfaces(const TCHAR* ptszFileName, bool& bIsPlugin) __leave;
int nSections = pINTH->FileHeader.NumberOfSections;
- if ( !nSections )
+ if (!nSections )
__leave;
INT_PTR base;
@@ -103,7 +103,7 @@ MUUID* GetPluginInterfaces(const TCHAR* ptszFileName, bool& bIsPlugin) BYTE* pImage = ptr + pIDH->e_lfanew + pINTH->FileHeader.SizeOfOptionalHeader + sizeof(IMAGE_NT_HEADERS) - sizeof(IMAGE_OPTIONAL_HEADER);
IMAGE_SECTION_HEADER *pExp = getSectionByRVA((IMAGE_SECTION_HEADER *)pImage, nSections, pIDD);
- if ( !pExp) __leave;
+ if (!pExp) __leave;
BYTE *pSecStart = ptr + pExp->PointerToRawData - pExp->VirtualAddress;
IMAGE_EXPORT_DIRECTORY *pED = (PIMAGE_EXPORT_DIRECTORY)&pSecStart[expvaddr];
@@ -115,18 +115,18 @@ MUUID* GetPluginInterfaces(const TCHAR* ptszFileName, bool& bIsPlugin) bool bHasLoad = false, bHasUnload = false, bHasInfo = false, bHasMuuids = false;
for (size_t i=0; i < pED->NumberOfNames; i++, ptrRVA++, ptrOrdRVA++) {
char *szName = (char*)&pSecStart[*ptrRVA];
- if ( !lstrcmpA(szName, "Load"))
+ if (!lstrcmpA(szName, "Load"))
bHasLoad = true;
- if ( !lstrcmpA(szName, "MirandaPluginInfoEx"))
+ if (!lstrcmpA(szName, "MirandaPluginInfoEx"))
bHasInfo = true;
- else if ( !lstrcmpA(szName, "Unload"))
+ else if (!lstrcmpA(szName, "Unload"))
bHasUnload = true;
- else if ( !lstrcmpA(szName, "MirandaInterfaces")) {
+ else if (!lstrcmpA(szName, "MirandaInterfaces")) {
bHasMuuids = true;
pIds = (MUUID*)&pSecStart[ ptrFuncList[*ptrOrdRVA]];
}
// old plugin, skip it
- else if ( !lstrcmpA(szName, "MirandaPluginInterfaces"))
+ else if (!lstrcmpA(szName, "MirandaPluginInterfaces"))
__leave;
}
diff --git a/src/modules/plugins/newplugins.cpp b/src/modules/plugins/newplugins.cpp index 07a29d6db4..6be0b7976e 100644 --- a/src/modules/plugins/newplugins.cpp +++ b/src/modules/plugins/newplugins.cpp @@ -137,11 +137,11 @@ int getDefaultPluginIdx(const MUUID& muuid) int LoadStdPlugins()
{
- for (int i=0; i < SIZEOF(pluginDefault); i++) {
- if ( pluginDefault[i].pImpl )
+ for (int i = 0; i < SIZEOF(pluginDefault); i++) {
+ if (pluginDefault[i].pImpl)
continue;
- if ( !LoadCorePlugin(pluginDefault[i])) {
+ if (!LoadCorePlugin(pluginDefault[i])) {
TCHAR tszBuf[512];
mir_sntprintf(tszBuf, SIZEOF(tszBuf), TranslateT("Core plugin '%s' cannot be loaded or missing. Miranda will exit now"), pluginDefault[i].stdplugname);
MessageBox(NULL, tszBuf, TranslateT("Fatal error"), MB_OK | MB_ICONSTOP);
@@ -188,7 +188,7 @@ int GetPluginFakeId(const MUUID &uuid, int hLangpack) {
for (int i=0; i < pluginList.getCount(); i++) {
pluginEntry *p = pluginList[i];
- if ( !p->bpi.hInst)
+ if (!p->bpi.hInst)
continue;
if ( equalUUID(p->bpi.pluginInfo->uuid, uuid))
@@ -226,7 +226,7 @@ static int checkPI(BASIC_PLUGIN_INFO* bpi, PLUGININFOEX* pi) if (bpi->InfoEx == NULL || pi->cbSize != sizeof(PLUGININFOEX))
return FALSE;
- if ( !validInterfaceList(bpi->Interfaces) || isPluginBanned(pi->uuid))
+ if (!validInterfaceList(bpi->Interfaces) || isPluginBanned(pi->uuid))
return FALSE;
if (pi->shortName == NULL || pi->description == NULL || pi->author == NULL ||
@@ -250,22 +250,16 @@ int checkAPI(TCHAR* plugin, BASIC_PLUGIN_INFO* bpi, DWORD mirandaVersion, int ch bpi->InfoEx = (Miranda_Plugin_InfoEx) GetProcAddress(h, "MirandaPluginInfoEx");
// if they were present
- if ( !bpi->Load || !bpi->Unload || !bpi->InfoEx) {
+ if (!bpi->Load || !bpi->Unload || !bpi->InfoEx) {
LBL_Error:
FreeLibrary(h);
return 0;
}
bpi->Interfaces = (MUUID*) GetProcAddress(h, "MirandaInterfaces");
- if ( !bpi->Interfaces) {
- typedef MUUID * (__cdecl * Miranda_Plugin_Interfaces) (void);
- Miranda_Plugin_Interfaces pFunc = (Miranda_Plugin_Interfaces) GetProcAddress(h, "MirandaPluginInterfaces");
- if (pFunc)
- bpi->Interfaces = pFunc();
- }
PLUGININFOEX* pi = bpi->InfoEx(mirandaVersion);
- if ( !checkPI(bpi, pi))
+ if (!checkPI(bpi, pi))
goto LBL_Error;
bpi->pluginInfo = pi;
@@ -344,11 +338,11 @@ int Plugin_UnloadDyn(pluginEntry *p) Plugin_Uninit(p);
- // load default plugins instead of the unloaded one
- if ( !(p->pclass & PCLASS_CORE))
+ // mark default plugins to be loaded
+ if (!(p->pclass & PCLASS_CORE))
for (int i=0; i < SIZEOF(pluginDefault); i++)
if (pluginDefault[i].pImpl == p)
- LoadCorePlugin( pluginDefault[i] );
+ pluginDefault[i].pImpl = NULL;
return TRUE;
}
@@ -380,7 +374,7 @@ void enumPlugins(SCAN_PLUGINS_CALLBACK cb, WPARAM wParam, LPARAM lParam) HANDLE hFind = FindFirstFile(search, &ffd);
if (hFind != INVALID_HANDLE_VALUE) {
do {
- if ( !(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && valid_library_name(ffd.cFileName))
+ if (!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && valid_library_name(ffd.cFileName))
cb(&ffd, exe, wParam, lParam);
}
while (FindNextFile(hFind, &ffd));
@@ -403,7 +397,7 @@ pluginEntry* OpenPlugin(TCHAR *tszFileName, TCHAR *dir, TCHAR *path) // map dll into the memory and check its exports
bool bIsPlugin = false;
mir_ptr<MUUID> pIds( GetPluginInterfaces(tszFullPath, bIsPlugin));
- if ( !bIsPlugin) {
+ if (!bIsPlugin) {
p->pclass |= PCLASS_FAILED; // piece of shit
return p;
}
@@ -486,14 +480,14 @@ bool TryLoadPlugin(pluginEntry *p, bool bDynamic) *slice = 0;
CharLower(p->pluginname);
- if ( !(p->pclass & (PCLASS_LOADED | PCLASS_DB | PCLASS_CLIST))) {
- if ( !bDynamic && !isPluginOnWhiteList(p->pluginname))
+ if (!(p->pclass & (PCLASS_LOADED | PCLASS_DB | PCLASS_CLIST))) {
+ if (!bDynamic && !isPluginOnWhiteList(p->pluginname))
return false;
- if ( !(p->pclass & PCLASS_BASICAPI)) {
+ if (!(p->pclass & PCLASS_BASICAPI)) {
BASIC_PLUGIN_INFO bpi;
mir_sntprintf(slice, &exe[SIZEOF(exe)] - slice, _T("\\%s\\%s"), (p->pclass & PCLASS_CORE) ? _T("Core") : _T("Plugins"), p->pluginname);
- if ( !checkAPI(exe, &bpi, mirandaVersion, CHECKAPI_NONE)) {
+ if (!checkAPI(exe, &bpi, mirandaVersion, CHECKAPI_NONE)) {
p->pclass |= PCLASS_FAILED;
return false;
}
@@ -513,10 +507,8 @@ bool TryLoadPlugin(pluginEntry *p, bool bDynamic) }
// we're loading new implementation dynamically, let the old one die
- if ( !(p->pclass & PCLASS_CORE)) {
+ if (!(p->pclass & PCLASS_CORE))
Plugin_UnloadDyn(pluginDefault[idx].pImpl);
- pluginDefault[idx].pImpl = NULL;
- }
}
}
}
@@ -529,7 +521,7 @@ bool TryLoadPlugin(pluginEntry *p, bool bDynamic) if (p->bpi.Interfaces) {
MUUID *piface = p->bpi.Interfaces;
for (int i=0; !equalUUID(miid_last, piface[i]); i++) {
- int idx = getDefaultPluginIdx( piface[i] );
+ int idx = getDefaultPluginIdx(piface[i]);
if (idx != -1)
pluginDefault[idx].pImpl = p;
}
@@ -559,7 +551,7 @@ LBL_Error: pPlug->pclass |= PCLASS_CORE;
- if ( !TryLoadPlugin(pPlug, true))
+ if (!TryLoadPlugin(pPlug, true))
goto LBL_Error;
if (bModulesLoadedFired) {
@@ -601,7 +593,7 @@ static pluginEntry* getCListModule(TCHAR *exe, TCHAR *slice) pluginEntry *p = clistPlugins[i];
mir_sntprintf(slice, &exe[MAX_PATH] - slice, _T("\\Plugins\\%s"), p->pluginname);
CharLower(p->pluginname);
- if ( !isPluginOnWhiteList(p->pluginname))
+ if (!isPluginOnWhiteList(p->pluginname))
continue;
if ( loadClistModule(exe, p))
@@ -622,7 +614,7 @@ int UnloadPlugin(TCHAR* buf, int bufLen) {
for (int i = pluginList.getCount()-1; i >= 0; i--) {
pluginEntry *p = pluginList[i];
- if ( !_tcsicmp(p->pluginname, buf)) {
+ if (!_tcsicmp(p->pluginname, buf)) {
GetModuleFileName(p->bpi.hInst, buf, bufLen);
Plugin_Uninit(p);
return TRUE;
@@ -643,7 +635,7 @@ void SetServiceModePlugin(pluginEntry *p) static int LaunchServicePlugin(pluginEntry *p)
{
// plugin load failed - terminating Miranda
- if ( !( p->pclass & PCLASS_LOADED)) {
+ if (!(p->pclass & PCLASS_LOADED)) {
if (p->bpi.Load() != ERROR_SUCCESS) {
Plugin_Uninit(p);
return SERVICE_FAILED;
@@ -669,7 +661,7 @@ int LoadDefaultServiceModePlugin() size_t cbLen = _tcslen(param);
for (int i=0; i < servicePlugins.getCount(); i++) {
pluginEntry *p = servicePlugins[i];
- if ( !_tcsnicmp(p->pluginname, param, cbLen)) {
+ if (!_tcsnicmp(p->pluginname, param, cbLen)) {
int res = LaunchServicePlugin(p);
if (res == SERVICE_ONLYDB) // load it later
serviceModePlugin = p;
@@ -687,13 +679,13 @@ int LoadServiceModePlugin() void EnsureCheckerLoaded(bool bEnable)
{
- for (int i=0; i < pluginList.getCount(); i++) {
+ for (int i = 0; i < pluginList.getCount(); i++) {
pluginEntry *p = pluginList[i];
- if ( _tcsicmp(p->pluginname, _T("dbchecker.dll")))
+ if (_tcsicmp(p->pluginname, _T("dbchecker.dll")))
continue;
if (bEnable) {
- if ( !(p->pclass & PCLASS_LOADED)) {
+ if (!(p->pclass & PCLASS_LOADED)) {
if (p->bpi.Load() != ERROR_SUCCESS)
Plugin_Uninit(p);
else {
@@ -714,9 +706,9 @@ void EnsureCheckerLoaded(bool bEnable) void UnloadNewPlugins(void)
{
// unload everything but the special db/clist plugins
- for (int i = pluginList.getCount()-1; i >= 0; i--) {
+ for (int i = pluginList.getCount() - 1; i >= 0; i--) {
pluginEntry *p = pluginList[i];
- if ( !(p->pclass & PCLASS_LAST) && (p->pclass & PCLASS_OK))
+ if (!(p->pclass & PCLASS_LAST) && (p->pclass & PCLASS_OK))
Plugin_Uninit(p);
}
}
@@ -735,11 +727,11 @@ int LoadNewPluginsModule(void) if (slice) *slice = 0;
// remember some useful options
- askAboutIgnoredPlugins = (UINT) GetPrivateProfileInt(_T("PluginLoader"), _T("AskAboutIgnoredPlugins"), 0, mirandabootini);
+ askAboutIgnoredPlugins = (UINT)GetPrivateProfileInt(_T("PluginLoader"), _T("AskAboutIgnoredPlugins"), 0, mirandabootini);
// if Crash Dumper is present, load it to provide Crash Reports
if (pluginList_crshdmp != NULL && isPluginOnWhiteList(pluginList_crshdmp->pluginname))
- if ( !TryLoadPlugin(pluginList_crshdmp, false))
+ if (!TryLoadPlugin(pluginList_crshdmp, false))
Plugin_Uninit(pluginList_crshdmp);
// if freeimage is present, load it to provide the basic core functions
@@ -770,13 +762,13 @@ int LoadNewPluginsModule(void) }
/* enable and disable as needed */
- for (i=0; i < clistPlugins.getCount(); i++)
+ for (i = 0; i < clistPlugins.getCount(); i++)
SetPluginOnWhiteList(clistPlugins[i]->pluginname, clist != clistPlugins[i] ? 0 : 1);
/* now loop thru and load all the other plugins, do this in one pass */
- for (i=0; i < pluginList.getCount(); i++) {
+ for (i = 0; i < pluginList.getCount(); i++) {
pluginEntry *p = pluginList[i];
- if ( !TryLoadPlugin(p, false)) {
+ if (!TryLoadPlugin(p, false)) {
Plugin_Uninit(p);
i--;
}
@@ -793,7 +785,7 @@ int LoadNewPluginsModule(void) static BOOL scanPluginsDir(WIN32_FIND_DATA *fd, TCHAR *path, WPARAM, LPARAM)
{
pluginEntry *p = OpenPlugin(fd->cFileName, _T("Plugins"), path);
- if ( !(p->pclass & PCLASS_FAILED)) {
+ if (!(p->pclass & PCLASS_FAILED)) {
if (pluginList_freeimg == NULL && lstrcmpi(fd->cFileName, _T("advaimg.dll")) == 0)
pluginList_freeimg = p;
@@ -842,7 +834,7 @@ void UnloadDatabase(void) void UnloadNewPluginsModule(void)
{
- if ( !bModuleInitialized)
+ if (!bModuleInitialized)
return;
UnloadPluginOptions();
diff --git a/src/modules/plugins/pluginopts.cpp b/src/modules/plugins/pluginopts.cpp index a79c532074..7512dc2e4e 100644 --- a/src/modules/plugins/pluginopts.cpp +++ b/src/modules/plugins/pluginopts.cpp @@ -68,7 +68,7 @@ static BOOL dialogListPlugins(WIN32_FIND_DATA *fd, TCHAR *path, WPARAM, LPARAM l if (checkAPI(buf, &pi, MIRANDA_VERSION_CORE, CHECKAPI_NONE) == 0)
return TRUE;
- PluginListItemData* dat = (PluginListItemData*)mir_alloc(sizeof(PluginListItemData));
+ PluginListItemData *dat = (PluginListItemData*)mir_alloc(sizeof(PluginListItemData));
dat->hInst = hInst;
dat->flags = pi.pluginInfo->flags;
@@ -163,7 +163,7 @@ static void RemoveAllItems(HWND hwnd) lvi.mask = LVIF_PARAM;
lvi.iItem = 0;
while (ListView_GetItem(hwnd, &lvi)) {
- PluginListItemData* dat = (PluginListItemData*)lvi.lParam;
+ PluginListItemData *dat = (PluginListItemData*)lvi.lParam;
mir_free(dat->author);
mir_free(dat->authorEmail);
mir_free(dat->copyright);
@@ -186,7 +186,7 @@ LBL_Error: return false;
}
- if ( !TryLoadPlugin(pPlug, true))
+ if (!TryLoadPlugin(pPlug, true))
goto LBL_Error;
if (CallPluginEventHook(pPlug->bpi.hInst, hModulesLoadedEvent, 0, 0) != 0)
@@ -201,7 +201,7 @@ static bool UnloadPluginDynamically(PluginListItemData *dat) {
pluginEntry *p = pluginList.find((pluginEntry*)dat->fileName);
if (p) {
- if ( !Plugin_UnloadDyn(p))
+ if (!Plugin_UnloadDyn(p))
return false;
dat->hInst = NULL;
@@ -270,17 +270,18 @@ static LRESULT CALLBACK PluginListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LP lvi.mask = LVIF_IMAGE;
PluginListItemData *dat = (PluginListItemData*)lvi.lParam;
if (lvi.iImage == 3) {
- if ( LoadPluginDynamically(dat)) {
+ if (LoadPluginDynamically(dat)) {
lvi.iImage = 2;
ListView_SetItem(hwnd, &lvi);
}
}
else if (lvi.iImage == 2) {
- if ( UnloadPluginDynamically(dat)) {
+ if (UnloadPluginDynamically(dat)) {
lvi.iImage = 3;
ListView_SetItem(hwnd, &lvi);
}
}
+ LoadStdPlugins();
}
return mir_callNextSubclass(hwnd, PluginListWndProc, msg, wParam, lParam);
@@ -355,7 +356,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar ListView_SetColumnWidth(hwndList, 2, 110);
w = 110;
}
- int max = w < 110 ? 189+110-w:189;
+ int max = w < 110 ? 189 + 110 - w : 189;
ListView_SetColumnWidth(hwndList, 3, LVSCW_AUTOSIZE); // short name
w = ListView_GetColumnWidth(hwndList, 3);
if (w > max)
@@ -367,7 +368,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar case WM_NOTIFY:
if (lParam) {
- NMLISTVIEW *hdr = (NMLISTVIEW *) lParam;
+ NMLISTVIEW *hdr = (NMLISTVIEW *)lParam;
if (hdr->hdr.code == LVN_ITEMCHANGED && IsWindowVisible(hdr->hdr.hwndFrom)) {
if (hdr->uOldState != 0 && (hdr->uNewState == 0x1000 || hdr->uNewState == 0x2000)) {
HWND hwndList = GetDlgItem(hwndDlg, IDC_PLUGLIST);
@@ -375,7 +376,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar LVITEM it;
it.mask = LVIF_PARAM | LVIF_STATE;
it.iItem = hdr->iItem;
- if ( !ListView_GetItem(hwndList, &it))
+ if (!ListView_GetItem(hwndList, &it))
break;
PluginListItemData *dat = (PluginListItemData*)it.lParam;
@@ -392,11 +393,11 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar LVITEM dt;
dt.mask = LVIF_PARAM;
dt.iItem = iRow;
- if ( !ListView_GetItem(hwndList, &dt))
+ if (!ListView_GetItem(hwndList, &dt))
continue;
PluginListItemData* dat2 = (PluginListItemData*)dt.lParam;
- if ( !(dat2->stdPlugin & dat->stdPlugin)) // mask differs
+ if (!(dat2->stdPlugin & dat->stdPlugin)) // mask differs
continue;
// the lParam is unset, so when the check is unset the clist block doesnt trigger
@@ -407,7 +408,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar }
if (bOldMode)
- ShowWindow( GetDlgItem(hwndDlg, IDC_RESTART), TRUE); // this here only in "ghazan mode"
+ ShowWindow(GetDlgItem(hwndDlg, IDC_RESTART), TRUE); // this here only in "ghazan mode"
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
}
@@ -423,30 +424,32 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar PluginListItemData* dat = (PluginListItemData*)lvi.lParam;
ListView_GetItemText(hwndList, hdr->iItem, 1, buf, SIZEOF(buf));
- SetWindowText( GetDlgItem(hwndDlg, IDC_PLUGININFOFRAME), sel ? buf : _T(""));
+ SetWindowText(GetDlgItem(hwndDlg, IDC_PLUGININFOFRAME), sel ? buf : _T(""));
- ptrT tszAuthor( latin2t(sel ? dat->author : NULL));
- SetWindowText( GetDlgItem(hwndDlg, IDC_PLUGINAUTHOR), tszAuthor);
+ ptrT tszAuthor(latin2t(sel ? dat->author : NULL));
+ SetWindowText(GetDlgItem(hwndDlg, IDC_PLUGINAUTHOR), tszAuthor);
- ptrT tszEmail( latin2t(sel ? dat->authorEmail : NULL));
- SetWindowText( GetDlgItem(hwndDlg, IDC_PLUGINEMAIL), tszEmail);
+ ptrT tszEmail(latin2t(sel ? dat->authorEmail : NULL));
+ SetWindowText(GetDlgItem(hwndDlg, IDC_PLUGINEMAIL), tszEmail);
- ptrT p( Langpack_PcharToTchar(dat->description));
- SetWindowText( GetDlgItem(hwndDlg, IDC_PLUGINLONGINFO), sel ? (TCHAR*)p : _T(""));
+ ptrT p(Langpack_PcharToTchar(dat->description));
+ SetWindowText(GetDlgItem(hwndDlg, IDC_PLUGINLONGINFO), sel ? (TCHAR*)p : _T(""));
- ptrT tszCopyright( latin2t(sel ? dat->copyright : NULL));
- SetWindowText( GetDlgItem(hwndDlg, IDC_PLUGINCPYR), tszCopyright);
+ ptrT tszCopyright(latin2t(sel ? dat->copyright : NULL));
+ SetWindowText(GetDlgItem(hwndDlg, IDC_PLUGINCPYR), tszCopyright);
- ptrT tszUrl( latin2t(sel ? dat->homepage : NULL));
- SetWindowText( GetDlgItem(hwndDlg, IDC_PLUGINURL), tszUrl);
+ ptrT tszUrl(latin2t(sel ? dat->homepage : NULL));
+ SetWindowText(GetDlgItem(hwndDlg, IDC_PLUGINURL), tszUrl);
- if ( !equalUUID(miid_last, dat->uuid)) {
+ if (!equalUUID(miid_last, dat->uuid)) {
char szUID[128];
uuidToString(dat->uuid, szUID, sizeof(szUID));
- SetWindowTextA( GetDlgItem(hwndDlg, IDC_PLUGINPID), sel ? szUID : "");
+ SetWindowTextA(GetDlgItem(hwndDlg, IDC_PLUGINPID), sel ? szUID : "");
}
- else SetWindowText( GetDlgItem(hwndDlg, IDC_PLUGINPID), sel ? TranslateT("<none>") : _T(""));
- } } }
+ else SetWindowText(GetDlgItem(hwndDlg, IDC_PLUGINPID), sel ? TranslateT("<none>") : _T(""));
+ }
+ }
+ }
if (hdr->hdr.code == PSN_APPLY) {
bool needRestart = false;
@@ -461,7 +464,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar SetPluginOnWhiteList(buf, (iState & 0x2000) ? 1 : 0);
if (!bOldMode && iState != 0x3000) {
- LVITEM lvi = {0};
+ LVITEM lvi = { 0 };
lvi.mask = LVIF_IMAGE | LVIF_PARAM;
lvi.stateMask = -1;
lvi.iItem = iRow;
@@ -476,18 +479,21 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar if (lvi.iImage == 3 && LoadPluginDynamically(dat)) {
lvi.iImage = 2;
ListView_SetItem(hwndList, &lvi);
- } else {
+ }
+ else {
bufLen += mir_sntprintf(bufRestart + bufLen, SIZEOF(bufRestart) - bufLen, _T(" - %s\n"), buf);
needRestart = true;
}
}
- } else {
+ }
+ else {
// disabling plugin
if (lvi.iImage == 2 || lvi.iImage == 4) {
if (lvi.iImage == 2 && UnloadPluginDynamically(dat)) {
lvi.iImage = 3;
ListView_SetItem(hwndList, &lvi);
- } else {
+ }
+ else {
bufLen += mir_sntprintf(bufRestart + bufLen, SIZEOF(bufRestart) - bufLen, _T(" - %s\n"), buf);
needRestart = true;
}
@@ -498,7 +504,9 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar iRow = ListView_GetNextItem(hwndList, iRow, LVNI_ALL);
}
- ShowWindow( GetDlgItem(hwndDlg, IDC_RESTART), needRestart);
+ LoadStdPlugins();
+
+ ShowWindow(GetDlgItem(hwndDlg, IDC_RESTART), needRestart);
if (needRestart) {
mir_sntprintf(bufRestart + bufLen, SIZEOF(bufRestart) - bufLen, _T("\n%s"), TranslateT("Do you want to restart it now?"));
if (MessageBox(NULL, bufRestart, _T("Miranda NG"), MB_ICONWARNING | MB_YESNO) == IDYES)
@@ -511,25 +519,25 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar case WM_COMMAND:
if (HIWORD(wParam) == STN_CLICKED) {
switch (LOWORD(wParam)) {
+ case IDC_GETMOREPLUGINS:
+ CallService(MS_UTILS_OPENURL, 0, (LPARAM) "http://miranda-ng.org/downloads/");
+ break;
+
case IDC_PLUGINEMAIL:
case IDC_PLUGINURL:
- {
char buf[512];
char *p = &buf[7];
lstrcpyA(buf, "mailto:");
- if (GetWindowTextA( GetDlgItem(hwndDlg, LOWORD(wParam)), p, SIZEOF(buf) - 7))
- CallService(MS_UTILS_OPENURL, 0, (LPARAM) (LOWORD(wParam) == IDC_PLUGINEMAIL ? buf : p));
+ if (GetWindowTextA(GetDlgItem(hwndDlg, LOWORD(wParam)), p, SIZEOF(buf) - 7))
+ CallService(MS_UTILS_OPENURL, 0, (LPARAM)(LOWORD(wParam) == IDC_PLUGINEMAIL ? buf : p));
break;
}
- case IDC_GETMOREPLUGINS:
- CallService(MS_UTILS_OPENURL, 0, (LPARAM) "http://miranda-ng.org/downloads/");
- break;
- } }
+ }
break;
case WM_DESTROY:
arPluginList.destroy();
- RemoveAllItems( GetDlgItem(hwndDlg, IDC_PLUGLIST));
+ RemoveAllItems(GetDlgItem(hwndDlg, IDC_PLUGLIST));
break;
}
return FALSE;
|