diff options
Diffstat (limited to 'Plugins/qupdater')
-rw-r--r-- | Plugins/qupdater/commons.h | 84 | ||||
-rw-r--r-- | Plugins/qupdater/options.cpp | 195 | ||||
-rw-r--r-- | Plugins/qupdater/options.h | 58 | ||||
-rw-r--r-- | Plugins/qupdater/qupdater.cpp | 177 | ||||
-rw-r--r-- | Plugins/qupdater/qupdater.dsp | 145 | ||||
-rw-r--r-- | Plugins/qupdater/qupdater.dsw | 29 | ||||
-rw-r--r-- | Plugins/qupdater/resource.h | 21 | ||||
-rw-r--r-- | Plugins/qupdater/resource.rc | 113 | ||||
-rw-r--r-- | Plugins/qupdater/sdk/m_updater.h | 146 |
9 files changed, 968 insertions, 0 deletions
diff --git a/Plugins/qupdater/commons.h b/Plugins/qupdater/commons.h new file mode 100644 index 0000000..e296f00 --- /dev/null +++ b/Plugins/qupdater/commons.h @@ -0,0 +1,84 @@ +/*
+Copyright (C) 2005 Ricardo Pescuma Domenecci
+
+This is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this file; see the file license.txt. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+*/
+
+
+#ifndef __COMMONS_H__
+# define __COMMONS_H__
+
+
+#include <windows.h>
+#include <commctrl.h>
+#include <tchar.h>
+#include <stdio.h>
+#include <time.h>
+
+
+// Disable "...truncated to '255' characters in the debug information" warnings
+#pragma warning(disable: 4786)
+
+#include <vector>
+using namespace std;
+
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+// Miranda headers
+#include <newpluginapi.h>
+#include <m_system.h>
+#include <m_langpack.h>
+#include <m_database.h>
+#include <m_options.h>
+#include <m_utils.h>
+#include <m_updater.h>
+
+#include "../utils/mir_memory.h"
+#include "../utils/mir_options.h"
+
+#include "resource.h"
+#include "options.h"
+
+
+#define MODULE_NAME "QUpdater"
+
+
+// Global Variables
+extern HINSTANCE hInst;
+extern PLUGINLINK *pluginLink;
+
+
+#define MAX_REGS(_A_) ( sizeof(_A_) / sizeof(_A_[0]) )
+
+
+extern vector<Update> plugins;
+
+void DumpFile();
+
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __COMMONS_H__
diff --git a/Plugins/qupdater/options.cpp b/Plugins/qupdater/options.cpp new file mode 100644 index 0000000..e26185c --- /dev/null +++ b/Plugins/qupdater/options.cpp @@ -0,0 +1,195 @@ +/*
+Copyright (C) 2006 Ricardo Pescuma Domenecci
+
+This is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this file; see the file license.txt. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+*/
+
+
+#include "commons.h"
+
+
+
+// Prototypes /////////////////////////////////////////////////////////////////////////////////////
+
+HANDLE hOptHook = NULL;
+
+Options opts;
+
+
+static BOOL CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
+
+
+static OptPageControl optionsControls[] = {
+ { &opts.csv_file, CONTROL_TEXT, IDC_CSV, "CSVFile", (DWORD) _T("plugins.csv") },
+ { &opts.dump_on_startup, CONTROL_CHECKBOX, IDC_DUMP_STARTUP, "DumpOnStart", FALSE }
+};
+
+
+
+// Functions //////////////////////////////////////////////////////////////////////////////////////
+
+
+int InitOptionsCallback(WPARAM wParam,LPARAM lParam)
+{
+ OPTIONSDIALOGPAGE odp;
+
+ ZeroMemory(&odp,sizeof(odp));
+ odp.cbSize=sizeof(odp);
+ odp.position=0;
+ odp.hInstance=hInst;
+ odp.ptszGroup = TranslateT("Services");
+ odp.ptszTitle = TranslateT("Q Updater");
+ odp.pfnDlgProc = OptionsDlgProc;
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
+ odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR | ODPF_EXPERTONLY;
+ CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp);
+
+ return 0;
+}
+
+
+void InitOptions()
+{
+ LoadOptions();
+
+ hOptHook = HookEvent(ME_OPT_INITIALISE, InitOptionsCallback);
+}
+
+
+void DeInitOptions()
+{
+ UnhookEvent(hOptHook);
+}
+
+
+void LoadOptions()
+{
+ LoadOpts(optionsControls, MAX_REGS(optionsControls), MODULE_NAME);
+}
+
+
+void ListView_SetItemTextA( HWND hwndLV, int i, int iSubItem, char* pszText )
+{
+ LV_ITEMA _ms_lvi;
+ _ms_lvi.iSubItem = iSubItem;
+ _ms_lvi.pszText = pszText;
+ SendMessageA( hwndLV, LVM_SETITEMTEXTA, i, (LPARAM)&_ms_lvi);
+}
+
+
+static BOOL CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ switch (msg)
+ {
+ case WM_INITDIALOG:
+ {
+ TranslateDialogDefault(hwndDlg);
+
+ HWND hwndList = GetDlgItem(hwndDlg,IDC_PLUGINS);
+
+ LVCOLUMN col = {0};
+ col.mask = LVCF_TEXT | LVCF_WIDTH;
+ col.pszText=TranslateT("Plugin Name");
+ col.cx=100;
+ ListView_InsertColumn(hwndList,0,&col);
+
+ col.pszText=TranslateT("Version");
+ col.cx=60;
+ ListView_InsertColumn(hwndList,1,&col);
+
+
+ col.pszText=TranslateT("Version URL");
+ col.cx=200;
+ ListView_InsertColumn(hwndList,2,&col);
+
+ col.pszText=TranslateT("Version Prefix");
+ col.cx=100;
+ ListView_InsertColumn(hwndList,3,&col);
+
+ col.pszText=TranslateT("Update URL");
+ col.cx=200;
+ ListView_InsertColumn(hwndList,4,&col);
+
+
+ col.pszText=TranslateT("Beta Version URL");
+ col.cx=200;
+ ListView_InsertColumn(hwndList,5,&col);
+
+ col.pszText=TranslateT("Beta Version Prefix");
+ col.cx=100;
+ ListView_InsertColumn(hwndList,6,&col);
+
+ col.pszText=TranslateT("Beta Update URL");
+ col.cx=200;
+ ListView_InsertColumn(hwndList,7,&col);
+
+
+ col.pszText=TranslateT("Beta Changelog URL");
+ ListView_InsertColumn(hwndList,8,&col);
+
+ // XXX: Won't work on windows 95 without IE3+ or 4.70
+ ListView_SetExtendedListViewStyleEx(hwndList, 0, LVS_EX_FULLROWSELECT );
+
+ for(int i = 0; i < plugins.size(); i++)
+ {
+ LVITEMA it = {0};
+ it.mask = LVIF_TEXT;
+ it.pszText = plugins[i].szComponentName;
+ int iRow = SendMessageA( hwndList, LVM_INSERTITEMA, 0, (LPARAM)&it );
+ if (plugins[i].pbVersion != NULL)
+ ListView_SetItemTextA(hwndList, iRow, 1, (char *) plugins[i].pbVersion);
+
+ if (plugins[i].szVersionURL != NULL)
+ ListView_SetItemTextA(hwndList, iRow, 2, plugins[i].szVersionURL);
+ if (plugins[i].pbVersionPrefix != NULL)
+ ListView_SetItemTextA(hwndList, iRow, 3, (char *) plugins[i].pbVersionPrefix);
+ if (plugins[i].szUpdateURL != NULL)
+ {
+ if (strcmp(plugins[i].szUpdateURL, UPDATER_AUTOREGISTER) == 0)
+ ListView_SetItemTextA(hwndList, iRow, 4, "<From FL XML>");
+ else
+ ListView_SetItemTextA(hwndList, iRow, 4, plugins[i].szUpdateURL);
+ }
+
+ if (plugins[i].szBetaVersionURL != NULL)
+ ListView_SetItemTextA(hwndList, iRow, 5, plugins[i].szBetaVersionURL);
+ if (plugins[i].pbBetaVersionPrefix != NULL)
+ ListView_SetItemTextA(hwndList, iRow, 6, (char *) plugins[i].pbBetaVersionPrefix);
+ if (plugins[i].szBetaUpdateURL != NULL)
+ ListView_SetItemTextA(hwndList, iRow, 7, plugins[i].szBetaUpdateURL);
+
+ if (plugins[i].szBetaChangelogURL != NULL)
+ ListView_SetItemTextA(hwndList, iRow, 8, plugins[i].szBetaChangelogURL);
+ }
+
+ // sort out the headers
+ ListView_SetColumnWidth(hwndList, 0, LVSCW_AUTOSIZE);
+
+ break;
+ }
+
+ case WM_COMMAND:
+ {
+ if (LOWORD(wParam) == IDC_DUMP)
+ DumpFile();
+
+ break;
+ }
+ }
+
+ return SaveOptsDlgProc(optionsControls, MAX_REGS(optionsControls), MODULE_NAME, hwndDlg, msg, wParam, lParam);
+}
+
diff --git a/Plugins/qupdater/options.h b/Plugins/qupdater/options.h new file mode 100644 index 0000000..5712246 --- /dev/null +++ b/Plugins/qupdater/options.h @@ -0,0 +1,58 @@ +/*
+Copyright (C) 2006 Ricardo Pescuma Domenecci
+
+This is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this file; see the file license.txt. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+*/
+
+
+#ifndef __OPTIONS_H__
+# define __OPTIONS_H__
+
+
+#include <windows.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+struct Options {
+ TCHAR csv_file[10];
+ BOOL dump_on_startup;
+};
+
+extern Options opts;
+
+
+// Initializations needed by options
+void InitOptions();
+
+// Deinitializations needed by options
+void DeInitOptions();
+
+
+// Loads the options from DB
+// It don't need to be called, except in some rare cases
+void LoadOptions();
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __OPTIONS_H__
diff --git a/Plugins/qupdater/qupdater.cpp b/Plugins/qupdater/qupdater.cpp new file mode 100644 index 0000000..b772e70 --- /dev/null +++ b/Plugins/qupdater/qupdater.cpp @@ -0,0 +1,177 @@ +/*
+Copyright (C) 2006 Ricardo Pescuma Domenecci
+
+This is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this file; see the file license.txt. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+*/
+
+
+#include "commons.h"
+
+
+// Prototypes ///////////////////////////////////////////////////////////////////////////
+
+
+PLUGININFO pluginInfo = {
+ sizeof(PLUGININFO),
+ "Q Updater",
+ PLUGIN_MAKE_VERSION(0,0,0,1),
+ "Simulates updater API to gather plugin info to use at Q search site",
+ "Ricardo Pescuma Domenecci",
+ "",
+ "© 2007 Ricardo Pescuma Domenecci",
+ "http://q.mirandaim.ru",
+ 0, //not transient
+ 0 //doesn't replace anything built-in
+};
+
+
+HINSTANCE hInst;
+PLUGINLINK *pluginLink;
+
+HANDLE hModulesLoaded = NULL;
+
+int ModulesLoaded(WPARAM wParam, LPARAM lParam);
+int UpdateRegister(WPARAM wParam, LPARAM lParam);
+
+vector<Update> plugins;
+
+
+// Functions ////////////////////////////////////////////////////////////////////////////
+
+
+extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+{
+ hInst = hinstDLL;
+ return TRUE;
+}
+
+
+extern "C" __declspec(dllexport) PLUGININFO* MirandaPluginInfo(DWORD mirandaVersion)
+{
+ return &pluginInfo;
+}
+
+
+extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
+{
+ pluginLink = link;
+
+ init_mir_malloc();
+ InitOptions();
+
+ CreateServiceFunction(MS_UPDATE_REGISTER, UpdateRegister);
+
+ // hooks
+ hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
+
+ return 0;
+}
+
+extern "C" int __declspec(dllexport) Unload(void)
+{
+ DeInitOptions();
+ UnhookEvent(hModulesLoaded);
+ return 0;
+}
+
+
+// Called when all the modules are loaded
+int ModulesLoaded(WPARAM wParam, LPARAM lParam)
+{
+ // add our modules to the KnownModules list
+ CallService("DBEditorpp/RegisterSingleModule", (WPARAM) MODULE_NAME, 0);
+
+ return 0;
+}
+
+
+// Called when all the modules are loaded
+int UpdateRegister(WPARAM wParam, LPARAM lParam)
+{
+ Update *in = (Update *) lParam;
+ if (in == NULL) // Some plugins don't respect this: || in->cbSize < sizeof(Update))
+ return NULL;
+
+ Update updt = {0};
+ updt.szComponentName = mir_strdup(in->szComponentName);
+ updt.szVersionURL = mir_strdup(in->szVersionURL);
+ updt.pbVersionPrefix = (BYTE *) mir_strdup((char *) in->pbVersionPrefix);
+ updt.szUpdateURL = mir_strdup(in->szUpdateURL);
+
+ updt.szBetaVersionURL = mir_strdup(in->szBetaVersionURL);
+ updt.pbBetaVersionPrefix = (BYTE *) mir_strdup((char *) in->pbBetaVersionPrefix);
+ updt.szBetaUpdateURL = mir_strdup(in->szBetaUpdateURL);
+
+ updt.pbVersion = (BYTE *) mir_strdup((char *) in->pbVersion);
+
+ if (in->cbSize >= sizeof(Update))
+ updt.szBetaChangelogURL = mir_strdup(in->szBetaChangelogURL);
+
+ plugins.insert(plugins.begin(), updt);
+
+ if (opts.dump_on_startup)
+ DumpFile();
+
+ return 0;
+}
+
+void DumpFile()
+{
+ FILE *arq = fopen(opts.csv_file, "w");
+ if (arq == NULL)
+ return;
+
+ for(int i = 0; i < plugins.size(); i++)
+ {
+ fprintf(arq, "\"");
+ fprintf(arq, plugins[i].szComponentName);
+ fprintf(arq, "\",\"");
+ if (plugins[i].pbVersion != NULL)
+ fprintf(arq, (char *) plugins[i].pbVersion);
+ fprintf(arq, "\",\"");
+
+ if (plugins[i].szVersionURL != NULL)
+ fprintf(arq, plugins[i].szVersionURL);
+ fprintf(arq, "\",\"");
+ if (plugins[i].pbVersionPrefix != NULL)
+ fprintf(arq, (char *) plugins[i].pbVersionPrefix);
+ fprintf(arq, "\",\"");
+ if (plugins[i].szUpdateURL != NULL)
+ {
+ if (strcmp(plugins[i].szUpdateURL, UPDATER_AUTOREGISTER) == 0)
+ fprintf(arq, "<From FL XML>");
+ else
+ fprintf(arq, plugins[i].szUpdateURL);
+ }
+ fprintf(arq, "\",\"");
+
+ if (plugins[i].szBetaVersionURL != NULL)
+ fprintf(arq, plugins[i].szBetaVersionURL);
+ fprintf(arq, "\",\"");
+ if (plugins[i].pbBetaVersionPrefix != NULL)
+ fprintf(arq, (char *) plugins[i].pbBetaVersionPrefix);
+ fprintf(arq, "\",\"");
+ if (plugins[i].szBetaUpdateURL != NULL)
+ fprintf(arq, plugins[i].szBetaUpdateURL);
+ fprintf(arq, "\",\"");
+
+ if (plugins[i].szBetaChangelogURL != NULL)
+ fprintf(arq, plugins[i].szBetaChangelogURL);
+ fprintf(arq, "\"\n");
+ }
+
+ fclose(arq);
+}
\ No newline at end of file diff --git a/Plugins/qupdater/qupdater.dsp b/Plugins/qupdater/qupdater.dsp new file mode 100644 index 0000000..c9c4ae0 --- /dev/null +++ b/Plugins/qupdater/qupdater.dsp @@ -0,0 +1,145 @@ +# Microsoft Developer Studio Project File - Name="qupdater" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=qupdater - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "qupdater.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "qupdater.mak" CFG="qupdater - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "qupdater - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "qupdater - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "qupdater - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /GX /O1 /YX /FD /c
+# SUBTRACT BASE CPP /Fr
+# ADD CPP /nologo /G4 /MT /W3 /O2 /Ob0 /I "../../include" /I "sdk" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Fr /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x417 /d "NDEBUG"
+# ADD RSC /l 0x417 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 user32.lib shell32.lib wininet.lib gdi32.lib /nologo /base:"0x67100000" /dll /machine:I386 /filealign:0x200
+# SUBTRACT BASE LINK32 /pdb:none /map
+# ADD LINK32 kernel32.lib user32.lib /nologo /base:"0x3EC20000" /dll /map /machine:I386 /out:"..\..\bin\release\Plugins\qupdater.dll" /filealign:0x200 /ALIGN:4096 /ignore:4108
+# SUBTRACT LINK32 /profile /pdb:none
+
+!ELSEIF "$(CFG)" == "qupdater - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /G4 /MT /W3 /GX /O2 /Ob0 /I "../../include" /FR /YX /FD /c
+# ADD CPP /nologo /G4 /MTd /W3 /GX /ZI /Od /I "../../include" /I "sdk" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x417 /d "NDEBUG"
+# ADD RSC /l 0x417 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"..\..bin\release\Plugins\qupdater.dll" /filealign:0x200 /ALIGN:4096 /ignore:4108
+# SUBTRACT BASE LINK32 /profile /pdb:none
+# ADD LINK32 kernel32.lib user32.lib /nologo /base:"0x3EC20000" /dll /incremental:yes /debug /machine:I386 /out:"..\..\bin\debug unicode\Plugins\qupdater.dll" /filealign:0x200 /ALIGN:4096 /ignore:4108
+# SUBTRACT LINK32 /profile /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "qupdater - Win32 Release"
+# Name "qupdater - Win32 Debug"
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\commons.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\utils\mir_memory.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\utils\mir_options.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\options.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\resource.rc
+# End Source File
+# End Group
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\utils\mir_memory.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\utils\mir_options.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\options.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\qupdater.cpp
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/Plugins/qupdater/qupdater.dsw b/Plugins/qupdater/qupdater.dsw new file mode 100644 index 0000000..4380739 --- /dev/null +++ b/Plugins/qupdater/qupdater.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "qupdater"=".\qupdater.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/Plugins/qupdater/resource.h b/Plugins/qupdater/resource.h new file mode 100644 index 0000000..fad98da --- /dev/null +++ b/Plugins/qupdater/resource.h @@ -0,0 +1,21 @@ +//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by resource.rc
+//
+#define IDD_OPTIONS 102
+#define IDC_EDIT1 1000
+#define IDC_CSV 1000
+#define IDC_DUMP 1001
+#define IDC_PLUGINS 1002
+#define IDC_DUMP_STARTUP 1003
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1004
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/Plugins/qupdater/resource.rc b/Plugins/qupdater/resource.rc new file mode 100644 index 0000000..9a1e3f6 --- /dev/null +++ b/Plugins/qupdater/resource.rc @@ -0,0 +1,113 @@ +//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_OPTIONS DIALOGEX 0, 0, 275, 228
+STYLE DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg"
+BEGIN
+ GROUPBOX " Output File ",IDC_STATIC,1,0,274,68
+ LTEXT "CSV File:",IDC_STATIC,11,16,51,10
+ EDITTEXT IDC_CSV,65,14,202,13,ES_AUTOHSCROLL
+ PUSHBUTTON "Dump Now",IDC_DUMP,203,50,64,13
+ GROUPBOX "Plugins ",IDC_STATIC,1,72,274,148
+ CONTROL "List1",IDC_PLUGINS,"SysListView32",LVS_REPORT |
+ LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,84,261,129
+ CONTROL "Dump on miranda start",IDC_DUMP_STARTUP,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,10,34,257,9
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO DISCARDABLE
+BEGIN
+ IDD_OPTIONS, DIALOG
+ BEGIN
+ BOTTOMMARGIN, 210
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Portuguese (Brazil) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_PTB)
+#ifdef _WIN32
+LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // Portuguese (Brazil) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/Plugins/qupdater/sdk/m_updater.h b/Plugins/qupdater/sdk/m_updater.h new file mode 100644 index 0000000..371b743 --- /dev/null +++ b/Plugins/qupdater/sdk/m_updater.h @@ -0,0 +1,146 @@ +#ifndef _M_UPDATER_H
+#define _M_UPDATER_H
+
+// NOTES:
+// - For langpack updates, include a string of the following format in the langpack text file:
+// ";FLID: <file listing name> <version>"
+// version must be four numbers seperated by '.', in the range 0-255 inclusive
+// - Updater will disable plugins that are downloaded but were not active prior to the update (this is so that, if an archive contains e.g. ansi and
+// unicode versions, the correct plugin will be the only one active after the new version is installed)...so if you add a support plugin, you may need
+// to install an ini file to make the plugin activate when miranda restarts after the update
+// - Updater will replace all dlls that have the same internal shortName as a downloaded update dll (this is so that msn1.dll and msn2.dll, for example,
+// will both be updated) - so if you have a unicode and a non-unicode version of a plugin in your archive, you should make the internal names different (which will break automatic
+// updates from the file listing if there is only one file listing entry for both versions, unless you use the 'MS_UPDATE_REGISTER' service below)
+// - Updater will install all files in the root of the archive into the plugins folder, except for langpack files that contain the FLID string which go into the root folder (same
+// folder as miranda32.exe)...all folders in the archive will also be copied to miranda's root folder, and their contents transferred into the new folders. The only exception is a
+// special folder called 'root_files' - if there is a folder by that name in the archive, it's contents will also be copied into miranda's root folder - this is intended to be used
+// to install additional dlls etc that a plugin may require)
+
+// if you set Update.szUpdateURL to the following value when registering, as well as setting your beta site and version data,
+// Updater will ignore szVersionURL and pbVersionPrefix, and attempt to find the file listing URL's from the backend XML data.
+// for this to work, the plugin name in pluginInfo.shortName must match the file listing exactly (except for case)
+#define UPDATER_AUTOREGISTER "UpdaterAUTOREGISTER"
+// Updater will also use the backend xml data if you provide URL's that reference the miranda file listing for updates (so you can use that method
+// if e.g. your plugin shortName does not match the file listing) - it will grab the file listing id from the end of these URLs
+
+typedef struct Update_tag {
+ int cbSize;
+ char *szComponentName; // component name as it will appear in the UI (will be translated before displaying)
+
+ char *szVersionURL; // URL where the current version can be found (NULL to disable)
+ BYTE *pbVersionPrefix; // bytes occuring in VersionURL before the version, used to locate the version information within the URL data
+ // (note that this URL could point at a binary file - dunno why, but it could :)
+ int cpbVersionPrefix; // number of bytes pointed to by pbVersionPrefix
+ char *szUpdateURL; // URL where dll/zip is located
+ // set to UPDATER_AUTOREGISTER if you want Updater to find the file listing URLs (ensure plugin shortName matches file listing!)
+
+ char *szBetaVersionURL; // URL where the beta version can be found (NULL to disable betas)
+ BYTE *pbBetaVersionPrefix; // bytes occuring in VersionURL before the version, used to locate the version information within the URL data
+ int cpbBetaVersionPrefix; // number of bytes pointed to by pbVersionPrefix
+ char *szBetaUpdateURL; // URL where dll/zip is located
+
+ BYTE *pbVersion; // bytes of current version, used for comparison with those in VersionURL
+ int cpbVersion; // number of bytes pointed to by pbVersion
+
+ char *szBetaChangelogURL; // url for displaying changelog for beta versions
+} Update;
+
+// register a comonent with Updater
+//
+// wparam = 0
+// lparam = (LPARAM)&Update
+#define MS_UPDATE_REGISTER "Update/Register"
+
+// utility functions to create a version string from a DWORD or from pluginInfo
+// point buf at a buffer at least 16 chars wide - but note the version string returned may be shorter
+//
+__inline static char *CreateVersionString(DWORD version, char *buf) {
+ mir_snprintf(buf, 16, "%d.%d.%d.%d", (version >> 24) & 0xFF, (version >> 16) & 0xFF, (version >> 8) & 0xFF, version & 0xFF);
+ return buf;
+}
+
+__inline static char *CreateVersionStringPlugin(PLUGININFO *pluginInfo, char *buf) {
+ return CreateVersionString(pluginInfo->version, buf);
+}
+
+
+// register the 'easy' way - use this method if you have no beta URL and the plugin is on the miranda file listing
+// NOTE: the plugin version string on the file listing must be the string version of the version in pluginInfo (i.e. 0.0.0.1,
+// four numbers between 0 and 255 inclusivem, so no letters, brackets, etc.)
+//
+// wParam = (int)fileID - this is the file ID from the file listing (i.e. the number at the end of the download link)
+// lParam = (PLUGININFO*)&pluginInfo
+#define MS_UPDATE_REGISTERFL "Update/RegisterFL"
+
+// this function can be used to 'unregister' components - useful for plugins that register non-plugin/langpack components and
+// may need to change those components on the fly
+// lParam = (char *)szComponentName
+#define MS_UPDATE_UNREGISTER "Update/Unregister"
+
+// this event is fired when the startup process is complete, but NOT if a restart is imminent
+// it is designed for status managment plugins to use as a trigger for beggining their own startup process
+// wParam = lParam = 0 (unused)
+// (added in version 0.1.6.0)
+#define ME_UPDATE_STARTUPDONE "Update/StartupDone"
+
+// this service can be used to enable/disable Updater's global status control
+// it can be called from the StartupDone event handler
+// wParam = (BOOL)enable
+// lParam = 0
+// (added in version 0.1.6.0)
+#define MS_UPDATE_ENABLESTATUSCONTROL "Update/EnableStatusControl"
+
+// An description of usage of the above service and event:
+// Say you are a status control plugin that normally sets protocol or global statuses in your ModulesLoaded event handler.
+// In order to make yourself 'Updater compatible', you would move the status control code from ModulesLoaded to another function,
+// say DoStartup. Then, in ModulesLoaded you would check for the existence of the MS_UPDATE_ENABLESTATUSCONTROL service.
+// If it does not exist, call DoStartup. If it does exist, hook the ME_UPDATE_STARTUPDONE event and call DoStartup from there. You may
+// also wish to call MS_UPDATE_ENABLESTATUSCONTROL with wParam == FALSE at this time, to disable Updater's own status control feature.
+
+// this service can be used to determine whether updates are possible for a component with the given name
+// wParam = 0
+// lParam = (char *)szComponentName
+// returns TRUE if updates are supported, FALSE otherwise
+#define MS_UPDATE_ISUPDATESUPPORTED "Update/IsUpdateSupported"
+
+#endif
+
+
+/////////////// Usage Example ///////////////
+
+#ifdef EXAMPLE_CODE
+
+// you need to #include "m_updater.h" and HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded) in your Load function...
+
+int OnModulesLoaded(WPARAM wParam, LPARAM lParam) {
+
+ Update update = {0}; // for c you'd use memset or ZeroMemory...
+ char szVersion[16];
+
+ update.cbSize = sizeof(Update);
+
+ update.szComponentName = pluginInfo.shortName;
+ update.pbVersion = (BYTE *)CreateVersionString(&pluginInfo, szVersion);
+ update.cpbVersion = strlen((char *)update.pbVersion);
+
+ // these are the three lines that matter - the archive, the page containing the version string, and the text (or data)
+ // before the version that we use to locate it on the page
+ // (note that if the update URL and the version URL point to standard file listing entries, the backend xml
+ // data will be used to check for updates rather than the actual web page - this is not true for beta urls)
+ update.szUpdateURL = "http://scottellis.com.au:81/test/updater.zip";
+ update.szVersionURL = "http://scottellis.com.au:81/test/updater_test.html";
+ update.pbVersionPrefix = (BYTE *)"Updater version ";
+
+ update.cpbVersionPrefix = strlen((char *)update.pbVersionPrefix);
+
+ // do the same for the beta versions of the above struct members if you wish to allow beta updates from another URL
+
+ CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update);
+
+ // Alternatively, to register a plugin with e.g. file ID 2254 on the file listing...
+ // CallService(MS_UPDATE_REGISTERFL, (WPARAM)2254, (LPARAM)&pluginInfo);
+
+ return 0;
+}
+
+#endif
|