diff options
-rw-r--r-- | plugins/Db_autobackups/src/main.cpp | 113 |
1 files changed, 55 insertions, 58 deletions
diff --git a/plugins/Db_autobackups/src/main.cpp b/plugins/Db_autobackups/src/main.cpp index 0c50ade1fc..446cd371ea 100644 --- a/plugins/Db_autobackups/src/main.cpp +++ b/plugins/Db_autobackups/src/main.cpp @@ -19,72 +19,19 @@ PLUGININFOEX pluginInfo = { { 0x81c220a6, 0x226, 0x4ad6, { 0xbf, 0xca, 0x21, 0x7b, 0x17, 0xa1, 0x60, 0x53 } }
};
-int ModulesLoad(WPARAM, LPARAM);
-int PreShutdown(WPARAM, LPARAM);
-
-
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID)
{
g_hInstance = hInstance;
return TRUE;
}
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
-{
- return &pluginInfo;
-}
-
-extern "C" __declspec(dllexport) int Load(void)
-{
- mir_getLP(&pluginInfo);
-
- HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
- HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoad);
-
- Icon_Register(g_hInstance, LPGEN("Database") "/" LPGEN("Database backups"), iconList, _countof(iconList));
-
- CreateServiceFunction(MS_AB_BACKUP, ABService);
- CreateServiceFunction(MS_AB_SAVEAS, DBSaveAs);
-
- CMenuItem mi;
- mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Database"), 500100000);
-
- mi.name.a = LPGEN("Backup profile");
- mi.pszService = MS_AB_BACKUP;
- mi.hIcolibItem = iconList[0].hIcolib;
- mi.position = 500100000;
- Menu_AddMainMenuItem(&mi);
-
- mi.name.a = LPGEN("Save profile as...");
- mi.pszService = MS_AB_SAVEAS;
- mi.hIcolibItem = iconList[1].hIcolib;
- mi.position = 500100001;
- Menu_AddMainMenuItem(&mi);
-
- HookEvent(ME_OPT_INITIALISE, OptionsInit);
- LoadOptions();
-
- return 0;
-}
-
-extern "C" __declspec(dllexport) int Unload(void)
-{
- return 0;
-}
-
-
-
-static int FoldersGetBackupPath(WPARAM, LPARAM)
-{
- FoldersGetCustomPathT(hFolder, options.folder, _countof(options.folder), DIR SUB_DIR);
- return 0;
-}
-INT_PTR ABService(WPARAM, LPARAM)
+static INT_PTR ABService(WPARAM, LPARAM)
{
BackupStart(NULL);
return 0;
}
-INT_PTR DBSaveAs(WPARAM, LPARAM)
+
+static INT_PTR DBSaveAs(WPARAM, LPARAM)
{
TCHAR fname_buff[MAX_PATH], tszFilter[200];
OPENFILENAME ofn = { 0 };
@@ -108,7 +55,13 @@ INT_PTR DBSaveAs(WPARAM, LPARAM) return 0;
}
-int ModulesLoad(WPARAM, LPARAM)
+static int FoldersGetBackupPath(WPARAM, LPARAM)
+{
+ FoldersGetCustomPathT(hFolder, options.folder, _countof(options.folder), DIR SUB_DIR);
+ return 0;
+}
+
+static int ModulesLoad(WPARAM, LPARAM)
{
profilePath = Utils_ReplaceVarsT(_T("%miranda_userdata%"));
@@ -124,7 +77,7 @@ int ModulesLoad(WPARAM, LPARAM) // can't do this on unload, since other plugins will be have already been unloaded, but their hooks
// for setting changed event not cleared. the backup on exit function will write to the db, calling those hooks.
-int PreShutdown(WPARAM, LPARAM)
+static int PreShutdown(WPARAM, LPARAM)
{
if (options.backup_types & BT_EXIT) {
options.disable_popups = 1; // Don't try to show popups on exit
@@ -133,3 +86,47 @@ int PreShutdown(WPARAM, LPARAM) return 0;
}
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
+{
+ return &pluginInfo;
+}
+
+extern "C" __declspec(dllexport) int Load(void)
+{
+ mir_getLP(&pluginInfo);
+
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
+ HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoad);
+
+ Icon_Register(g_hInstance, LPGEN("Database") "/" LPGEN("Database backups"), iconList, _countof(iconList));
+
+ CreateServiceFunction(MS_AB_BACKUP, ABService);
+ CreateServiceFunction(MS_AB_SAVEAS, DBSaveAs);
+
+ CMenuItem mi;
+ mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Database"), 500100000);
+
+ mi.name.a = LPGEN("Backup profile");
+ mi.pszService = MS_AB_BACKUP;
+ mi.hIcolibItem = iconList[0].hIcolib;
+ mi.position = 500100000;
+ Menu_AddMainMenuItem(&mi);
+
+ mi.name.a = LPGEN("Save profile as...");
+ mi.pszService = MS_AB_SAVEAS;
+ mi.hIcolibItem = iconList[1].hIcolib;
+ mi.position = 500100001;
+ Menu_AddMainMenuItem(&mi);
+
+ HookEvent(ME_OPT_INITIALISE, OptionsInit);
+ LoadOptions();
+
+ return 0;
+}
+
+extern "C" __declspec(dllexport) int Unload(void)
+{
+ return 0;
+}
+
+
|