diff options
Diffstat (limited to 'plugins')
22 files changed, 79 insertions, 141 deletions
diff --git a/plugins/AVS/src/main.cpp b/plugins/AVS/src/main.cpp index 70edca3ffb..4deb34af1c 100644 --- a/plugins/AVS/src/main.cpp +++ b/plugins/AVS/src/main.cpp @@ -2026,14 +2026,8 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) SetThreadPriority(hLoaderThread, THREAD_PRIORITY_IDLE);
// Folders plugin support
- if (ServiceExists(MS_FOLDERS_REGISTER_PATH))
- {
- hMyAvatarsFolder = (HANDLE) FoldersRegisterCustomPathT("Avatars", "My Avatars",
- MIRANDA_USERDATAT _T("\\Avatars"));
-
- hGlobalAvatarFolder = (HANDLE) FoldersRegisterCustomPathT("Avatars", "My Global Avatar Cache",
- MIRANDA_USERDATAT _T("\\Avatars"));
- }
+ hMyAvatarsFolder = FoldersRegisterCustomPathT("Avatars", "My Avatars", MIRANDA_USERDATAT _T("\\Avatars"));
+ hGlobalAvatarFolder = FoldersRegisterCustomPathT("Avatars", "My Global Avatar Cache", MIRANDA_USERDATAT _T("\\Avatars"));
g_AvatarHistoryAvail = ServiceExists(MS_AVATARHISTORY_ENABLED);
diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp index 7c07aacd51..a7698bca12 100644 --- a/plugins/AvatarHistory/src/AvatarHistory.cpp +++ b/plugins/AvatarHistory/src/AvatarHistory.cpp @@ -196,15 +196,15 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) {
mir_sntprintf(basedir, MAX_REGS(basedir), _T("%s\\Avatars History"), profilePath);
- hFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), LPGEN("Avatar History"),
+ hFolder = FoldersRegisterCustomPathT( LPGEN("Avatars"), LPGEN("Avatar History"),
PROFILE_PATHT _T("\\") CURRENT_PROFILET _T("\\Avatars History"));
+
InitPopups();
if (ServiceExists(MS_MC_GETPROTOCOLNAME))
metacontacts_proto = (char *) CallService(MS_MC_GETPROTOCOLNAME, 0, 0);
- if (DBGetContactSettingByte(NULL, MODULE_NAME, "LogToHistory", AVH_DEF_LOGTOHISTORY))
- {
+ if (DBGetContactSettingByte(NULL, MODULE_NAME, "LogToHistory", AVH_DEF_LOGTOHISTORY)) {
char *templates[] = { "Avatar change\nchanged his/her avatar", "Avatar removal\nremoved his/her avatar" };
HICON hIcon = createDefaultOverlayedIcon(FALSE);
HistoryEvents_RegisterWithTemplates(MODULE_NAME, "avatarchange", "Avatar change", EVENTTYPE_AVATAR_CHANGE, hIcon,
diff --git a/plugins/BASS_interface/src/Main.cpp b/plugins/BASS_interface/src/Main.cpp index e72a855339..d477ba81bb 100644 --- a/plugins/BASS_interface/src/Main.cpp +++ b/plugins/BASS_interface/src/Main.cpp @@ -555,24 +555,20 @@ int OnFoldersChanged(WPARAM, LPARAM) int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
{
- if (ServiceExists(MS_FOLDERS_REGISTER_PATH))
- {
- hBASSFolder = FoldersRegisterCustomPathT("Bass Interface", "Bass library", PLUGINS_PATHT _T("\\Bass"));
+ if (hBASSFolder = FoldersRegisterCustomPathT("Bass Interface", "Bass library", PLUGINS_PATHT _T("\\Bass"))) {
FoldersGetCustomPathT(hBASSFolder, CurrBassPath, MAX_PATH, _T(""));
_tcscat(CurrBassPath, _T("\\bass.dll"));
}
- else
- {
- DBVARIANT dbv = {0};
- if (db_get_ts(NULL, ModuleName, OPT_BASSPATH, &dbv))
- {
- TCHAR* tszFolder = Utils_ReplaceVarsT(_T("%miranda_path%\\plugins\\Bass\\bass.dll"));
- lstrcpyn(CurrBassPath, tszFolder, SIZEOF(CurrBassPath));
- mir_free(tszFolder);
+ else {
+ DBVARIANT dbv;
+ if ( db_get_ts(NULL, ModuleName, OPT_BASSPATH, &dbv)) {
+ lstrcpyn(CurrBassPath, VARST( _T("%miranda_path%\\plugins\\Bass\\bass.dll")), SIZEOF(CurrBassPath));
db_set_ts(NULL, ModuleName, OPT_BASSPATH, CurrBassPath);
}
- else lstrcpy(CurrBassPath, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ else {
+ lstrcpy(CurrBassPath, dbv.ptszVal);
+ DBFreeVariant(&dbv);
+ }
}
LoadBassLibrary(CurrBassPath);
diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp index 9aff808c1a..5af1c0b20a 100644 --- a/plugins/CrashDumper/src/crshdmp.cpp +++ b/plugins/CrashDumper/src/crshdmp.cpp @@ -236,7 +236,7 @@ static int ModulesLoaded(WPARAM, LPARAM) crs_a2t(vertxt, temp);
profname = Utils_ReplaceVarsT(_T("%miranda_profilename%.dat"));
- if (ServiceExists(MS_FOLDERS_REGISTER_PATH))
+ if ( ServiceExists(MS_FOLDERS_REGISTER_PATH))
profpath = mir_tstrdup( _T("%miranda_userdata%"));
else
profpath = Utils_ReplaceVarsT(_T("%miranda_userdata%"));
diff --git a/plugins/Db_autobackups/src/main.cpp b/plugins/Db_autobackups/src/main.cpp index 93865adbcd..d5c0116e75 100644 --- a/plugins/Db_autobackups/src/main.cpp +++ b/plugins/Db_autobackups/src/main.cpp @@ -6,8 +6,6 @@ TCHAR *profilePath; int hLangpack;
HANDLE hFolder;
-HANDLE hHooks[4];
-HANDLE hServices[3];
PLUGININFOEX pluginInfo={
sizeof(PLUGININFOEX),
@@ -42,12 +40,12 @@ static int FoldersGetBackupPath(WPARAM wParam, LPARAM lParam) return 0;
}
-static int FoldersInit(void)
+static void FoldersInit(void)
{
- hFolder = (HANDLE) FoldersRegisterCustomPathT("Database Backups", "Backup Folder", DIR SUB_DIR);
- hHooks[0] = HookEvent(ME_FOLDERS_PATH_CHANGED, FoldersGetBackupPath);
- FoldersGetBackupPath(0, 0);
- return 0;
+ if (hFolder = FoldersRegisterCustomPathT("Database Backups", "Backup Folder", DIR SUB_DIR)) {
+ HookEvent(ME_FOLDERS_PATH_CHANGED, FoldersGetBackupPath);
+ FoldersGetBackupPath(0, 0);
+ }
}
static void MenuInit(void)
@@ -85,16 +83,15 @@ static int ModulesLoad(WPARAM wParam, LPARAM lParam) Icon_Register(hInst, LPGEN("Database/Database Backups"), iconList, SIZEOF(iconList));
- if(ServiceExists(MS_FOLDERS_REGISTER_PATH))
- FoldersInit();
+ FoldersInit();
LoadOptions();
MenuInit();
// register trigger action for triggerplugin
- if(ServiceExists(MS_TRIGGER_REGISTERACTION))
+ if ( ServiceExists(MS_TRIGGER_REGISTERACTION))
TriggerActionInit();
- hHooks[1] = HookEvent(ME_OPT_INITIALISE, OptionsInit);
+ HookEvent(ME_OPT_INITIALISE, OptionsInit);
if(options.backup_types & BT_START)
mir_forkthread(BackupThread, NULL);
return 0;
@@ -117,12 +114,12 @@ void SysInit() mir_getLP(&pluginInfo);
OleInitialize(0);
- hServices[0] = CreateServiceFunction(MS_AB_BACKUP, ABService);
- hServices[1] = CreateServiceFunction(MS_AB_BACKUPTRGR, BackupServiceTrgr);
- hServices[2] = CreateServiceFunction(MS_AB_SAVEAS, DBSaveAs);
+ CreateServiceFunction(MS_AB_BACKUP, ABService);
+ CreateServiceFunction(MS_AB_BACKUPTRGR, BackupServiceTrgr);
+ CreateServiceFunction(MS_AB_SAVEAS, DBSaveAs);
- hHooks[2] = HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
- hHooks[3] = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoad);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
+ HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoad);
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
@@ -138,7 +135,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda extern "C" __declspec(dllexport) int Load(void)
{
-
SysInit();
return 0;
}
@@ -146,18 +142,6 @@ extern "C" __declspec(dllexport) int Load(void) extern "C" __declspec(dllexport) int Unload(void)
{
OleUninitialize();
-
- for (int i = 0; i < SIZEOF(hHooks); ++i)
- {
- if (hHooks[i])
- UnhookEvent(hHooks[i]);
- }
- for (int i = 0; i < SIZEOF(hServices); ++i)
- {
- if (hServices[i])
- DestroyServiceFunction(hServices[i]);
- }
-
return 0;
}
diff --git a/plugins/MirOTR/MirOTR/src/options.cpp b/plugins/MirOTR/MirOTR/src/options.cpp index b561ff9c21..39aa01d639 100644 --- a/plugins/MirOTR/MirOTR/src/options.cpp +++ b/plugins/MirOTR/MirOTR/src/options.cpp @@ -41,17 +41,16 @@ int FoldersChanged(WPARAM wParam, LPARAM lParam) { return 0;
}
-void LoadFilenames() {
- if(ServiceExists(MS_FOLDERS_REGISTER_PATH)) {
- hPATH_MIROTR = FoldersRegisterCustomPath(MODULENAME, "Private Data", DATA_DIRECTORY);
+void LoadFilenames()
+{
+ if (hPATH_MIROTR = FoldersRegisterCustomPath(MODULENAME, "Private Data", DATA_DIRECTORY)) {
HookEvent(ME_FOLDERS_PATH_CHANGED, FoldersChanged);
// get the path - above are only defaults - there may be a different value in the db
FoldersChanged(0, 0);
- } else {
- char *path = Utils_ReplaceVars(DATA_DIRECTORY);
- SetFilenames(path);
- mir_free(path);
+ }
+ else {
+ SetFilenames( VARS(DATA_DIRECTORY));
ReadPrivkeyFiles();
}
}
diff --git a/plugins/NewsAggregator/Src/Services.cpp b/plugins/NewsAggregator/Src/Services.cpp index c302abdff2..e742cdb803 100644 --- a/plugins/NewsAggregator/Src/Services.cpp +++ b/plugins/NewsAggregator/Src/Services.cpp @@ -51,17 +51,11 @@ int OnFoldersChanged(WPARAM, LPARAM) int NewsAggrInit(WPARAM wParam, LPARAM lParam)
{
- if (ServiceExists(MS_FOLDERS_REGISTER_PATH))
- {
- hNewsAggregatorFolder = FoldersRegisterCustomPathT("News Aggregator", "Avatars", MIRANDA_USERDATAT _T("\\Avatars\\")_T(DEFAULT_AVATARS_FOLDER));
+ hNewsAggregatorFolder = FoldersRegisterCustomPathT("News Aggregator", "Avatars", MIRANDA_USERDATAT _T("\\Avatars\\")_T(DEFAULT_AVATARS_FOLDER));
+ if (hNewsAggregatorFolder)
FoldersGetCustomPathT(hNewsAggregatorFolder, tszRoot, MAX_PATH, _T(""));
- }
else
- {
- TCHAR* tszFolder = Utils_ReplaceVarsT(_T("%miranda_userdata%\\"_T(DEFAULT_AVATARS_FOLDER)));
- lstrcpyn(tszRoot, tszFolder, SIZEOF(tszRoot));
- mir_free(tszFolder);
- }
+ lstrcpyn(tszRoot, VARST( _T("%miranda_userdata%\\"_T(DEFAULT_AVATARS_FOLDER))), SIZEOF(tszRoot));
HANDLE hContact = db_find_first();
while (hContact != NULL)
diff --git a/plugins/PackUpdater/Src/PackUpdater.cpp b/plugins/PackUpdater/Src/PackUpdater.cpp index 7ab4ab7e50..1dde3c429f 100644 --- a/plugins/PackUpdater/Src/PackUpdater.cpp +++ b/plugins/PackUpdater/Src/PackUpdater.cpp @@ -56,11 +56,11 @@ extern "C" __declspec(dllexport) int Load(void) TCHAR* tszFolder = Utils_ReplaceVarsT(_T("%miranda_userdata%\\"DEFAULT_UPDATES_FOLDER));
lstrcpyn(tszRoot, tszFolder, SIZEOF(tszRoot));
- if (ServiceExists(MS_FOLDERS_REGISTER_PATH))
- {
- hPackUpdaterFolder = FoldersRegisterCustomPathT(MODULEA, "Pack Updater", MIRANDA_USERDATAT _T("\\")DEFAULT_UPDATES_FOLDER);
+
+ hPackUpdaterFolder = FoldersRegisterCustomPathT(MODULEA, "Pack Updater", MIRANDA_USERDATAT _T("\\")DEFAULT_UPDATES_FOLDER);
+ if (hPackUpdaterFolder)
FoldersGetCustomPathT(hPackUpdaterFolder, tszRoot, MAX_PATH, _T(""));
- }
+
mir_free(tszFolder);
LoadOptions();
InitPopupList();
diff --git a/plugins/PluginUpdater/src/PluginUpdater.cpp b/plugins/PluginUpdater/src/PluginUpdater.cpp index 3ee3dabaae..383773cade 100644 --- a/plugins/PluginUpdater/src/PluginUpdater.cpp +++ b/plugins/PluginUpdater/src/PluginUpdater.cpp @@ -85,15 +85,11 @@ extern "C" __declspec(dllexport) int Load(void) {
mir_getLP(&pluginInfoEx);
#endif
- if (ServiceExists(MS_FOLDERS_REGISTER_PATH))
- hPluginUpdaterFolder = FoldersRegisterCustomPathT(MODULEA, "Plugin Updater", MIRANDA_PATHT _T("\\")DEFAULT_UPDATES_FOLDER);
-
+ hPluginUpdaterFolder = FoldersRegisterCustomPathT(MODULEA, "Plugin Updater", MIRANDA_PATHT _T("\\")DEFAULT_UPDATES_FOLDER);
if (hPluginUpdaterFolder)
OnFoldersChanged(0, 0);
- else {
- mir_ptr<TCHAR> tszFolder( Utils_ReplaceVarsT(_T("%miranda_path%\\"DEFAULT_UPDATES_FOLDER)));
- lstrcpyn(tszRoot, tszFolder, SIZEOF(tszRoot));
- }
+ else
+ lstrcpyn(tszRoot, VARST( _T("%miranda_path%\\"DEFAULT_UPDATES_FOLDER)), SIZEOF(tszRoot));
DWORD dwLen = GetTempPath( SIZEOF(tszTempPath), tszTempPath);
if (tszTempPath[dwLen-1] == '\\')
diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index f8bf8c57fa..2c5aec0cb0 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -160,12 +160,11 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam) Sent_NetLog("onModuleLoaded begin");
#endif
- if ( ServiceExists(MS_FOLDERS_GET_PATH))
- g_hFolders = FoldersRegisterCustomPathT(szModuleName, "Icons", _T(MIRANDA_PATH"\\icons"));
+ g_hFolders = FoldersRegisterCustomPathT(szModuleName, "Icons", _T(MIRANDA_PATH"\\icons"));
- InitIcons();
- GetFlags();
- ModuleLoad(0, 0);
+ InitIcons();
+ GetFlags();
+ ModuleLoad(0, 0);
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("rsa_init");
diff --git a/plugins/SendScreenshotPlus/src/Main.cpp b/plugins/SendScreenshotPlus/src/Main.cpp index 4cb19a1e5b..ec9dbc30f9 100644 --- a/plugins/SendScreenshotPlus/src/Main.cpp +++ b/plugins/SendScreenshotPlus/src/Main.cpp @@ -134,10 +134,8 @@ int hook_ModulesLoaded(WPARAM, LPARAM) { }
// Folders plugin support
- if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) {
- hFolderScreenshot = FoldersRegisterCustomPathT("SendSS", "Screenshots",
+ hFolderScreenshot = FoldersRegisterCustomPathT("SendSS", "Screenshots",
_T(PROFILE_PATH)_T("\\")_T(CURRENT_PROFILE)_T("\\Screenshots"));
- }
return 0;
}
diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp index ca228d8ee2..5ac7acfc59 100644 --- a/plugins/SmileyAdd/src/download.cpp +++ b/plugins/SmileyAdd/src/download.cpp @@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. extern HANDLE hEvent1;
HANDLE hNetlibUser;
-static HANDLE hFolder, hFolderHook;
+static HANDLE hFolder;
struct QueueElem
{
@@ -227,11 +227,10 @@ int FolderChanged(WPARAM, LPARAM) void GetSmileyCacheFolder(void)
{
- if (ServiceExists(MS_FOLDERS_REGISTER_PATH))
- {
- hFolder = FoldersRegisterCustomPathT("SmileyAdd", "Smiley Cache", MIRANDA_USERDATAT _T("\\SmileyCache"));
+ hFolder = FoldersRegisterCustomPathT("SmileyAdd", "Smiley Cache", MIRANDA_USERDATAT _T("\\SmileyCache"));
+ if (hFolder) {
FoldersGetCustomPathT(hFolder, cachepath, MAX_PATH, _T(""));
- hFolderHook = HookEvent(ME_FOLDERS_PATH_CHANGED, FolderChanged);
+ HookEvent(ME_FOLDERS_PATH_CHANGED, FolderChanged);
}
else
{
@@ -256,7 +255,6 @@ void DownloadInit(void) void DownloadClose(void)
{
- UnhookEvent(hFolderHook);
CloseHandle(g_hDlMutex);
Netlib_CloseHandle(hNetlibUser);
}
diff --git a/plugins/SpellChecker/src/spellchecker.cpp b/plugins/SpellChecker/src/spellchecker.cpp index c6ec132a74..2b554dfe69 100644 --- a/plugins/SpellChecker/src/spellchecker.cpp +++ b/plugins/SpellChecker/src/spellchecker.cpp @@ -119,27 +119,23 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) CallService("DBEditorpp/RegisterSingleModule", (WPARAM) MODULE_NAME, 0); // Folders plugin support - if ( ServiceExists(MS_FOLDERS_REGISTER_PATH)) { - hDictionariesFolder = FoldersRegisterCustomPathT(LPGEN("Spell Checker"), LPGEN("Dictionaries"), DICTIONARIES_FOLDER); - + if (hDictionariesFolder = FoldersRegisterCustomPathT(LPGEN("Spell Checker"), LPGEN("Dictionaries"), DICTIONARIES_FOLDER)) { dictionariesFolder = (TCHAR *) mir_alloc(sizeof(TCHAR) * MAX_PATH); FoldersGetCustomPathT(hDictionariesFolder, dictionariesFolder, MAX_PATH, _T(".")); + } + else dictionariesFolder = Utils_ReplaceVarsT(DICTIONARIES_FOLDER); - hCustomDictionariesFolder = FoldersRegisterCustomPathT(LPGEN("Spell Checker"), LPGEN("Custom Dictionaries"), CUSTOM_DICTIONARIES_FOLDER); - + if (hCustomDictionariesFolder = FoldersRegisterCustomPathT(LPGEN("Spell Checker"), LPGEN("Custom Dictionaries"), CUSTOM_DICTIONARIES_FOLDER)) { customDictionariesFolder = (TCHAR *) mir_alloc(sizeof(TCHAR) * MAX_PATH); FoldersGetCustomPathT(hCustomDictionariesFolder, customDictionariesFolder, MAX_PATH, _T(".")); + } + else customDictionariesFolder = Utils_ReplaceVarsT(CUSTOM_DICTIONARIES_FOLDER); - hFlagsDllFolder = FoldersRegisterCustomPathT(LPGEN("Spell Checker"), LPGEN("Flags DLL"), FLAGS_DLL_FOLDER); - + if (hFlagsDllFolder = FoldersRegisterCustomPathT(LPGEN("Spell Checker"), LPGEN("Flags DLL"), FLAGS_DLL_FOLDER)) { flagsDllFolder = (TCHAR *) mir_alloc(sizeof(TCHAR) * MAX_PATH); FoldersGetCustomPathT(hFlagsDllFolder, flagsDllFolder, MAX_PATH, _T(".")); } - else { - dictionariesFolder = Utils_ReplaceVarsT(DICTIONARIES_FOLDER); - customDictionariesFolder = Utils_ReplaceVarsT(CUSTOM_DICTIONARIES_FOLDER); - flagsDllFolder = Utils_ReplaceVarsT(FLAGS_DLL_FOLDER); - } + else flagsDllFolder = Utils_ReplaceVarsT(FLAGS_DLL_FOLDER); InitOptions(); diff --git a/plugins/StopSpamMod/src/init.cpp b/plugins/StopSpamMod/src/init.cpp index 8e3f1fca46..63665337f9 100755 --- a/plugins/StopSpamMod/src/init.cpp +++ b/plugins/StopSpamMod/src/init.cpp @@ -129,11 +129,9 @@ static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam) void CleanThread();
if(gbDelAllTempory || gbDelExcluded)
boost::thread *thr = new boost::thread(&CleanThread);
+
// Folders plugin support
- if (ServiceExists(MS_FOLDERS_REGISTER_PATH))
- {
- hStopSpamLogDirH = (HANDLE) FoldersRegisterCustomPath("StopSpam", "StopSpam Logs", PROFILE_PATH "\\" CURRENT_PROFILE "\\StopSpamLog");
- }
+ hStopSpamLogDirH = FoldersRegisterCustomPath("StopSpam", "StopSpam Logs", PROFILE_PATH "\\" CURRENT_PROFILE "\\StopSpamLog");
return 0;
}
diff --git a/plugins/TabSRMM/src/include/mim.h b/plugins/TabSRMM/src/include/mim.h index c971cb7fdf..30d89406e6 100644 --- a/plugins/TabSRMM/src/include/mim.h +++ b/plugins/TabSRMM/src/include/mim.h @@ -159,7 +159,6 @@ public: const TCHAR* getSkinPath() const { return(m_szSkinsPath); }
const TCHAR* getSavedAvatarPath() const { return(m_szSavedAvatarsPath); }
const TCHAR* getChatLogPath() const { return(m_szChatLogsPath); }
- const bool haveFoldersPlugin() const { return(m_haveFolders); }
const TCHAR* getUserDir();
void configureCustomFolders();
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index f491210554..809a7b0a56 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -318,17 +318,13 @@ int CMimAPI::FoldersPathChanged(WPARAM wParam, LPARAM lParam) void CMimAPI::configureCustomFolders()
{
- m_haveFolders = false;
- if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) {
- m_hDataPath = (HANDLE)FoldersRegisterCustomPathT("TabSRMM", "Data path", const_cast<TCHAR *>(getDataPath()));
- m_hSkinsPath = (HANDLE)FoldersRegisterCustomPathT("TabSRMM", "Skins root", const_cast<TCHAR *>(getSkinPath()));
- m_hAvatarsPath = (HANDLE)FoldersRegisterCustomPathT("TabSRMM", "Saved Avatars", const_cast<TCHAR *>(getSavedAvatarPath()));
- m_hChatLogsPath = (HANDLE)FoldersRegisterCustomPathT("TabSRMM", "Group chat logs root", const_cast<TCHAR *>(getChatLogPath()));
+ m_hDataPath = FoldersRegisterCustomPathT("TabSRMM", "Data path", const_cast<TCHAR *>(getDataPath()));
+ m_hSkinsPath = FoldersRegisterCustomPathT("TabSRMM", "Skins root", const_cast<TCHAR *>(getSkinPath()));
+ m_hAvatarsPath = FoldersRegisterCustomPathT("TabSRMM", "Saved Avatars", const_cast<TCHAR *>(getSavedAvatarPath()));
+ m_hChatLogsPath = FoldersRegisterCustomPathT("TabSRMM", "Group chat logs root", const_cast<TCHAR *>(getChatLogPath()));
+
+ if (m_hDataPath)
CGlobals::m_event_FoldersChanged = HookEvent(ME_FOLDERS_PATH_CHANGED, CMimAPI::FoldersPathChanged);
- m_haveFolders = true;
- }
- else
- m_hDataPath = m_hSkinsPath = m_hAvatarsPath = m_hChatLogsPath = 0;
foldersPathChanged();
}
@@ -381,15 +377,12 @@ INT_PTR CMimAPI::foldersPathChanged() const TCHAR* CMimAPI::getUserDir()
{
if (m_userDir[0] == 0) {
- wchar_t* userdata;
- if (ServiceExists(MS_FOLDERS_REGISTER_PATH))
- userdata = L"%%miranda_userdata%%";
+ if ( ServiceExists(MS_FOLDERS_REGISTER_PATH))
+ lstrcpyn(m_userDir, L"%%miranda_userdata%%", SIZEOF(m_userDir));
else
- userdata = ::Utils_ReplaceVarsT(L"%miranda_userdata%");
- mir_sntprintf(m_userDir, MAX_PATH, userdata);
+ lstrcpyn(m_userDir, VARST( _T("%miranda_userdata%")), SIZEOF(m_userDir));
+
Utils::ensureTralingBackslash(m_userDir);
- if (!ServiceExists(MS_FOLDERS_REGISTER_PATH))
- mir_free(userdata);
}
return(m_userDir);
}
diff --git a/plugins/VersionInfo/src/CVersionInfo.cpp b/plugins/VersionInfo/src/CVersionInfo.cpp index 1604babb81..e26a6dc233 100644 --- a/plugins/VersionInfo/src/CVersionInfo.cpp +++ b/plugins/VersionInfo/src/CVersionInfo.cpp @@ -1113,7 +1113,7 @@ std::tstring CVersionInfo::GetInformationsAsString(int bDisableForumStyle) { void CVersionInfo::PrintInformationsToFile(const TCHAR *info)
{
TCHAR buffer[MAX_PATH], outputFileName[MAX_PATH];
- if (bFoldersAvailable) {
+ if (hOutputLocation) {
FoldersGetCustomPathT(hOutputLocation, buffer, SIZEOF(buffer), _T("%miranda_path%"));
_tcscat(buffer, _T("\\VersionInfo.txt"));
}
diff --git a/plugins/VersionInfo/src/common.h b/plugins/VersionInfo/src/common.h index 20d48e5f3b..cbbf057daa 100644 --- a/plugins/VersionInfo/src/common.h +++ b/plugins/VersionInfo/src/common.h @@ -82,7 +82,6 @@ extern HICON hiVIIcon; extern DWORD EnglishLocale;
//for folders support
-extern BOOL bFoldersAvailable;
extern HANDLE hOutputLocation;
//services.cpp
diff --git a/plugins/VersionInfo/src/dlgHandlers.cpp b/plugins/VersionInfo/src/dlgHandlers.cpp index a1a81e6a51..733a4cd3dc 100644 --- a/plugins/VersionInfo/src/dlgHandlers.cpp +++ b/plugins/VersionInfo/src/dlgHandlers.cpp @@ -264,7 +264,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) else
RelativePathToAbsolute( _T("VersionInfo.txt"), notFound, SIZEOF(notFound));
- if (bFoldersAvailable)
+ if (hOutputLocation)
_tcscpy(buffer, TranslateT("Customize using folders plugin"));
else
_tcsncpy(buffer, notFound, SIZEOF(notFound));
@@ -345,7 +345,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) EnableWindow(GetDlgItem(hWnd, IDC_SHOWINTASKBAR), IsDlgButtonChecked(hWnd, IDC_TODIALOGBOX) ? TRUE : FALSE); //only enable for to dialog box
EnableWindow(GetDlgItem(hWnd, IDC_DISABLEDTOO), IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? FALSE : TRUE); //if forum style disable show disabled plugins
EnableWindow(GetDlgItem(hWnd, IDC_CLIPBOARDALSO), IsDlgButtonChecked(hWnd, IDC_TOCLIPBOARD) ? FALSE : TRUE); //don't enable always clipboard if we're printing to clipboard
- EnableWindow(GetDlgItem(hWnd, IDC_FILENAME), ((IsDlgButtonChecked(hWnd, IDC_TOFILE)) && (!bFoldersAvailable)) ? TRUE : FALSE);
+ EnableWindow(GetDlgItem(hWnd, IDC_FILENAME), ((IsDlgButtonChecked(hWnd, IDC_TOFILE)) && (!hOutputLocation)) ? TRUE : FALSE);
EnableUploadSettings(hWnd, IsDlgButtonChecked(hWnd, IDC_TOUPLOAD) ? TRUE : FALSE);
{
OSVERSIONINFO osvi = { 0 };
@@ -378,7 +378,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) EnableWindow(GetDlgItem(hWnd, IDC_SIZECOMBOBOX), IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? TRUE : FALSE); //forum style only
EnableWindow(GetDlgItem(hWnd, IDC_BOLDVERSION), IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? TRUE : FALSE); //forum style only
EnableWindow(GetDlgItem(hWnd, IDC_BOLDCOMBOBOX), (IsDlgButtonChecked(hWnd, IDC_BOLDVERSION) & IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE)) ? TRUE : FALSE); //both forum style and bold version checked
- EnableWindow(GetDlgItem(hWnd, IDC_FILENAME), ((IsDlgButtonChecked(hWnd, IDC_TOFILE)) && (!bFoldersAvailable)) ? TRUE : FALSE);
+ EnableWindow(GetDlgItem(hWnd, IDC_FILENAME), ((IsDlgButtonChecked(hWnd, IDC_TOFILE)) && (!hOutputLocation)) ? TRUE : FALSE);
EnableWindow(GetDlgItem(hWnd, IDC_SHOWINTASKBAR), IsDlgButtonChecked(hWnd, IDC_TODIALOGBOX) ? TRUE : FALSE); //only enable for to dialog box
EnableWindow(GetDlgItem(hWnd, IDC_DISABLEDTOO), IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? FALSE : TRUE); //if forum style disable show disabled plugins
EnableWindow(GetDlgItem(hWnd, IDC_CLIPBOARDALSO), IsDlgButtonChecked(hWnd, IDC_TOCLIPBOARD) ? FALSE : TRUE); //don't enable always clipboard if we're printing to clipboard
@@ -461,7 +461,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) DBWriteContactSettingByte(NULL, ModuleName, "ShowUUIDs", IsDlgButtonChecked(hWnd, IDC_SHOWUUIDS) ? TRUE : FALSE);
DBWriteContactSettingByte(NULL, ModuleName, "ShowInstalledLanguages", IsDlgButtonChecked(hWnd, IDC_SHOWINSTALLEDLANGUAGES) ? TRUE : FALSE);
- if (!bFoldersAvailable) {
+ if (!hOutputLocation) {
TCHAR filePath[MAX_PATH], fileName[MAX_PATH];
GetDlgItemText(hWnd, IDC_FILENAME, fileName, MAX_PATH);
AbsolutePathToRelative(fileName, filePath, SIZEOF(filePath));
diff --git a/plugins/VersionInfo/src/hooked_events.cpp b/plugins/VersionInfo/src/hooked_events.cpp index fb28978377..44c24ec9ef 100644 --- a/plugins/VersionInfo/src/hooked_events.cpp +++ b/plugins/VersionInfo/src/hooked_events.cpp @@ -49,8 +49,6 @@ int UnhookEvents() int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
{
-
- bFoldersAvailable = ServiceExists(MS_FOLDERS_REGISTER_PATH);
hOutputLocation = FoldersRegisterCustomPathT("VersionInfo", "Output folder", _T("%miranda_path%"));
GetStringFromDatabase("UUIDCharMark", _T(DEF_UUID_CHARMARK), PLUGIN_UUID_MARK, cPLUGIN_UUID_MARK);
diff --git a/plugins/VersionInfo/src/main.cpp b/plugins/VersionInfo/src/main.cpp index 5068fceece..7a5810917d 100644 --- a/plugins/VersionInfo/src/main.cpp +++ b/plugins/VersionInfo/src/main.cpp @@ -30,7 +30,6 @@ HICON hiVIIcon; DWORD EnglishLocale;
-BOOL bFoldersAvailable = FALSE;
HANDLE hOutputLocation = NULL; //for folders plugin
void * (* MirandaMalloc)(size_t);
diff --git a/plugins/YAMN/src/main.cpp b/plugins/YAMN/src/main.cpp index 07a6ce0e85..96344c2f80 100644 --- a/plugins/YAMN/src/main.cpp +++ b/plugins/YAMN/src/main.cpp @@ -226,10 +226,8 @@ int SystemModulesLoaded(WPARAM, LPARAM) CheckMenuItems();
- if (ServiceExists(MS_FOLDERS_GET_PATH)) {
- hAccountFolder = FoldersRegisterCustomPathT(YAMN_DBMODULE, YAMN_DBMODULE" Account Folder", UserDirectory);
+ if (hAccountFolder = FoldersRegisterCustomPathT(YAMN_DBMODULE, YAMN_DBMODULE" Account Folder", UserDirectory))
FoldersGetCustomPathT(hAccountFolder, UserDirectory, MAX_PATH, UserDirectory);
- }
RegisterPOP3Plugin(0, 0);
return 0;
|