summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2015-07-27 21:22:22 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2015-07-27 21:22:22 +0000
commite9cc7df74e68a216bd45afaa370202ed0f2fb9b7 (patch)
treee583904c76cc0fb27ab55c53c6aff05ae66a9b32 /plugins
parentdde3a69d7716d12e00d827fc9b94705bbe3eb8f2 (diff)
PluginUpdater:
- compilation fixes for IM_Updater git-svn-id: http://svn.miranda-ng.org/main/trunk@14740 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/PluginUpdater/src/Compat/compat.cpp8
-rw-r--r--plugins/PluginUpdater/src/Compat/compat.h77
-rw-r--r--plugins/PluginUpdater/src/Notifications.cpp4
-rw-r--r--plugins/PluginUpdater/src/Options.cpp40
-rw-r--r--plugins/PluginUpdater/src/Utils.cpp19
5 files changed, 63 insertions, 85 deletions
diff --git a/plugins/PluginUpdater/src/Compat/compat.cpp b/plugins/PluginUpdater/src/Compat/compat.cpp
index ede6b2212b..35533ffd6a 100644
--- a/plugins/PluginUpdater/src/Compat/compat.cpp
+++ b/plugins/PluginUpdater/src/Compat/compat.cpp
@@ -26,6 +26,8 @@ MM_INTERFACE mmi;
LIST_INTERFACE li;
MD5_INTERFACE md5i;
UTF8_INTERFACE utfi;
+PlugOptions opts;
+POPUP_OPTIONS PopupOptions = {0};
static const MUUID interfaces[] = {MIID_UPDATER, MIID_LAST};
@@ -132,6 +134,10 @@ void InitIcoLib()
sid.pszName = iconList[i].szIconName;
sid.pszDescription = iconList[i].szDescr;
sid.iDefaultIndex = -iconList[i].IconID;
- Skin_AddIcon(&sid);
+ IcoLib_AddIcon(&sid);
}
}
+
+TCHAR *GetDefaultUrl() {
+ return mir_tstrdup(_T("http://miranda-ng.org/distr/deprecated/0.94.9/x%platform%"));
+}
diff --git a/plugins/PluginUpdater/src/Compat/compat.h b/plugins/PluginUpdater/src/Compat/compat.h
index fe05af3f60..e4f15f53d8 100644
--- a/plugins/PluginUpdater/src/Compat/compat.h
+++ b/plugins/PluginUpdater/src/Compat/compat.h
@@ -91,15 +91,6 @@ static iconList[] =
{ "plg_list", LPGEN("Component list"), IDI_PLGLIST }
};
-__forceinline INT_PTR Options_Open(OPENOPTIONSDIALOG *ood)
-{
- return CallService("Opt/OpenOptions", 0, (LPARAM)ood);
-}
-
-__forceinline INT_PTR Options_AddPage(WPARAM wParam, OPTIONSDIALOGPAGE *odp)
-{
- return CallService("Opt/AddPage", wParam, (LPARAM)odp);
-}
char *bin2hex(const void *pData, size_t len, char *dest);
char *rtrim(char *str);
@@ -109,70 +100,48 @@ void InitIcoLib();
#define NEWTSTR_ALLOCA(A) (A == NULL)?NULL:_tcscpy((TCHAR*)alloca((_tcslen(A)+1) *sizeof(TCHAR)), A)
-__forceinline HANDLE Skin_AddIcon(SKINICONDESC *si)
-{ return (HANDLE)CallService("Skin2/Icons/AddIcon", 0, (LPARAM)si);
+__forceinline INT_PTR Options_Open(OPENOPTIONSDIALOG *ood) {
+ return CallService(MS_OPT_OPENOPTIONS, 0, (LPARAM)ood);
}
-__forceinline HICON Skin_GetIconByHandle(HANDLE hIcolibIcon, int size=0)
-{ return (HICON)CallService(MS_SKIN2_GETICONBYHANDLE, size, (LPARAM)hIcolibIcon);
+__forceinline INT_PTR Options_AddPage(WPARAM wParam, OPTIONSDIALOGPAGE *odp) {
+ return CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)odp);
}
-__forceinline HANDLE Skin_GetIconHandle(const char *szIconName)
-{ return (HANDLE)CallService(MS_SKIN2_GETICONHANDLE, 0, (LPARAM)szIconName);
+__forceinline HANDLE IcoLib_AddIcon(SKINICONDESC *si) {
+ return (HANDLE)CallService(MS_SKIN2_ADDICON, 0, (LPARAM)si);
}
-__forceinline HICON Skin_GetIcon(const char *szIconName, int size=0)
-{ return (HICON)CallService(MS_SKIN2_GETICON, size, (LPARAM)szIconName);
+__forceinline HICON IcoLib_GetIconByHandle(HANDLE hIcolibIcon, int size=0) {
+ return (HICON)CallService(MS_SKIN2_GETICONBYHANDLE, size, (LPARAM)hIcolibIcon);
}
-__forceinline void Skin_ReleaseIcon(const char* szIconName)
-{ CallService(MS_SKIN2_RELEASEICON, 0, (LPARAM)szIconName);
+__forceinline HANDLE IcoLib_GetIconHandle(const char *szIconName) {
+ return (HANDLE)CallService(MS_SKIN2_GETICONHANDLE, 0, (LPARAM)szIconName);
}
-__forceinline void Skin_ReleaseIcon(HICON hIcon)
-{ CallService(MS_SKIN2_RELEASEICON, (WPARAM)hIcon, 0);
+__forceinline HICON IcoLib_GetIcon(const char *szIconName, int size=0) {
+ return (HICON)CallService(MS_SKIN2_GETICON, size, (LPARAM)szIconName);
}
-__forceinline HGENMENU Menu_AddMainMenuItem(CLISTMENUITEM *mi)
-{ return (HGENMENU)CallService("CList/AddMainMenuItem", 0, (LPARAM)mi);
+__forceinline void IcoLib_ReleaseIcon(const char* szIconName) {
+ CallService(MS_SKIN2_RELEASEICON, 0, (LPARAM)szIconName);
}
-__forceinline INT_PTR Hotkey_Register(HOTKEYDESC *hk)
-{ return CallService("CoreHotkeys/Register", 0, (LPARAM)hk);
+__forceinline void IcoLib_ReleaseIcon(HICON hIcon) {
+ CallService(MS_SKIN2_RELEASEICON, (WPARAM)hIcon, 0);
}
-__forceinline INT_PTR CreateDirectoryTreeT(const TCHAR *ptszPath)
-{ return CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)ptszPath);
+__forceinline HGENMENU Menu_AddMainMenuItem(CLISTMENUITEM *mi) {
+ return (HGENMENU)CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM)mi);
}
-#define _qtoupper(_c) (((_c) >= 'a' && (_c) <= 'z')?((_c)-('a'+'A')):(_c))
-
-
-
-template <size_t _Size>
-inline int mir_snprintf(char(&buffer)[_Size], const char* fmt, ...)
-{
- va_list args;
- va_start(args, fmt);
- return mir_vsnprintf(buffer, _Size, fmt, args);
+__forceinline INT_PTR Hotkey_Register(HOTKEYDESC *hk) {
+ return CallService(MS_HOTKEY_REGISTER, 0, (LPARAM)hk);
}
-template <size_t _Size>
-inline int mir_snwprintf(wchar_t(&buffer)[_Size], const wchar_t* fmt, ...)
-{
- va_list args;
- va_start(args, fmt);
- return mir_vsnwprintf(buffer, _Size, fmt, args);
-}
-
-template <size_t _Size>
-inline int mir_vsnprintf(char(&buffer)[_Size], const char* fmt, va_list va)
-{
- return mir_vsnprintf(buffer, _Size, fmt, va);
+__forceinline INT_PTR CreateDirectoryTreeT(const TCHAR *ptszPath)
+{ return CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)ptszPath);
}
-template <size_t _Size>
-inline int mir_vsnwprintf(wchar_t(&buffer)[_Size], const wchar_t* fmt, va_list va)
-{
- return mir_vsnwprintf(buffer, _Size, fmt, va);
-}
+#define _qtoupper(_c) (((_c) >= 'a' && (_c) <= 'z')?((_c)-('a'+'A')):(_c))
diff --git a/plugins/PluginUpdater/src/Notifications.cpp b/plugins/PluginUpdater/src/Notifications.cpp
index 65cebbc854..de54bb43e5 100644
--- a/plugins/PluginUpdater/src/Notifications.cpp
+++ b/plugins/PluginUpdater/src/Notifications.cpp
@@ -97,7 +97,11 @@ void ShowPopup(LPCTSTR ptszTitle, LPCTSTR ptszText, int Number)
{
if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1)) {
char setting[100];
+#if MIRANDA_VER < 0x0A00
+ mir_snprintf(setting, sizeof(setting), "Popups%d", Number);
+#else
mir_snprintf(setting, "Popups%d", Number);
+#endif
if (db_get_b(NULL, MODNAME, setting, DEFAULT_POPUP_ENABLED)) {
POPUPDATAT pd = { 0 };
pd.lchContact = NULL;
diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp
index f9b6933265..235b214244 100644
--- a/plugins/PluginUpdater/src/Options.cpp
+++ b/plugins/PluginUpdater/src/Options.cpp
@@ -22,22 +22,6 @@ Boston, MA 02111-1307, USA.
PlugOptions opts;
POPUP_OPTIONS PopupOptions = {0};
-void LoadOptions()
-{
- PopupOptions.DefColors = db_get_b(NULL, MODNAME, "DefColors", DEFAULT_COLORS);
- PopupOptions.LeftClickAction= db_get_b(NULL, MODNAME, "LeftClickAction", DEFAULT_POPUP_LCLICK);
- PopupOptions.RightClickAction = db_get_b(NULL, MODNAME, "RightClickAction", DEFAULT_POPUP_RCLICK);
- PopupOptions.Timeout = db_get_dw(NULL, MODNAME, "Timeout", DEFAULT_TIMEOUT_VALUE);
-
- opts.bUpdateOnStartup = db_get_b(NULL, MODNAME, "UpdateOnStartup", DEFAULT_UPDATEONSTARTUP);
- opts.bOnlyOnceADay = db_get_b(NULL, MODNAME, "OnlyOnceADay", DEFAULT_ONLYONCEADAY);
- opts.bUpdateOnPeriod = db_get_b(NULL, MODNAME, "UpdateOnPeriod", DEFAULT_UPDATEONPERIOD);
- opts.Period = db_get_dw(NULL, MODNAME, "Period", DEFAULT_PERIOD);
- opts.bPeriodMeasure = db_get_b(NULL, MODNAME, "PeriodMeasure", DEFAULT_PERIODMEASURE);
- opts.bForceRedownload = db_get_b(NULL, MODNAME, DB_SETTING_REDOWNLOAD, 0);
- opts.bSilentMode = db_get_b(NULL, MODNAME, "SilentMode", 0);
-}
-
int GetUpdateMode()
{
int UpdateMode = db_get_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, -1);
@@ -64,9 +48,6 @@ int GetUpdateMode()
TCHAR* GetDefaultUrl()
{
-#if MIRANDA_VER < 0x0A00
- return mir_tstrdup(_T("http://miranda-ng.org/distr/deprecated/0.94.9/x%platform%"));
-#else
switch (GetUpdateMode()) {
case UPDATE_MODE_STABLE:
return mir_tstrdup(_T(DEFAULT_UPDATE_URL));
@@ -77,22 +58,24 @@ TCHAR* GetDefaultUrl()
default:
return db_get_tsa(NULL, MODNAME, DB_SETTING_UPDATE_URL);
}
-#endif
}
INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
case WM_INITDIALOG:
- {
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_UPDATEONSTARTUP, opts.bUpdateOnStartup ? BST_CHECKED : BST_UNCHECKED);
+ if (opts.bUpdateOnStartup) {
+ CheckDlgButton(hwndDlg, IDC_UPDATEONSTARTUP, BST_CHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ONLYONCEADAY), TRUE);
+ }
CheckDlgButton(hwndDlg, IDC_ONLYONCEADAY, opts.bOnlyOnceADay ? BST_CHECKED : BST_UNCHECKED);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ONLYONCEADAY), opts.bUpdateOnStartup);
- CheckDlgButton(hwndDlg, IDC_UPDATEONPERIOD, opts.bUpdateOnPeriod ? BST_CHECKED : BST_UNCHECKED);
- EnableWindow(GetDlgItem(hwndDlg, IDC_PERIOD), opts.bUpdateOnPeriod);
- EnableWindow(GetDlgItem(hwndDlg, IDC_PERIODSPIN), opts.bUpdateOnPeriod);
- EnableWindow(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), opts.bUpdateOnPeriod);
+ if (opts.bUpdateOnPeriod) {
+ CheckDlgButton(hwndDlg, IDC_UPDATEONPERIOD, BST_CHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PERIOD), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PERIODSPIN), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), TRUE);
+ }
CheckDlgButton(hwndDlg, IDC_SILENTMODE, opts.bSilentMode ? BST_CHECKED : BST_UNCHECKED);
if (db_get_b(NULL, MODNAME, DB_SETTING_NEED_RESTART, 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_NEEDRESTARTLABEL), SW_SHOW);
@@ -137,14 +120,13 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
url = GetDefaultUrl();
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, url);
}
- }
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_UPDATEONSTARTUP:
EnableWindow(GetDlgItem(hwndDlg, IDC_ONLYONCEADAY), IsDlgButtonChecked(hwndDlg, IDC_UPDATEONSTARTUP));
-
+ // fall through
case IDC_SILENTMODE:
case IDC_ONLYONCEADAY:
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp
index 36e46ceb43..4149ba1620 100644
--- a/plugins/PluginUpdater/src/Utils.cpp
+++ b/plugins/PluginUpdater/src/Utils.cpp
@@ -22,6 +22,22 @@ Boston, MA 02111-1307, USA.
HANDLE hNetlibUser = NULL, hPipe = NULL;
/////////////////////////////////////////////////////////////////////////////////////
+void LoadOptions()
+{
+ PopupOptions.DefColors = db_get_b(NULL, MODNAME, "DefColors", DEFAULT_COLORS);
+ PopupOptions.LeftClickAction= db_get_b(NULL, MODNAME, "LeftClickAction", DEFAULT_POPUP_LCLICK);
+ PopupOptions.RightClickAction = db_get_b(NULL, MODNAME, "RightClickAction", DEFAULT_POPUP_RCLICK);
+ PopupOptions.Timeout = db_get_dw(NULL, MODNAME, "Timeout", DEFAULT_TIMEOUT_VALUE);
+
+ opts.bUpdateOnStartup = db_get_b(NULL, MODNAME, "UpdateOnStartup", DEFAULT_UPDATEONSTARTUP);
+ opts.bOnlyOnceADay = db_get_b(NULL, MODNAME, "OnlyOnceADay", DEFAULT_ONLYONCEADAY);
+ opts.bUpdateOnPeriod = db_get_b(NULL, MODNAME, "UpdateOnPeriod", DEFAULT_UPDATEONPERIOD);
+ opts.Period = db_get_dw(NULL, MODNAME, "Period", DEFAULT_PERIOD);
+ opts.bPeriodMeasure = db_get_b(NULL, MODNAME, "PeriodMeasure", DEFAULT_PERIODMEASURE);
+ opts.bForceRedownload = db_get_b(NULL, MODNAME, DB_SETTING_REDOWNLOAD, 0);
+ opts.bSilentMode = db_get_b(NULL, MODNAME, "SilentMode", 0);
+}
+
#if MIRANDA_VER >= 0x0A00
IconItemT iconList[] =
{
@@ -121,6 +137,7 @@ bool ParseHashes(const TCHAR *ptszUrl, ptrT &baseUrl, SERVLIST &arHashes)
vars[0].value.t = _T("32");
#endif
vars[1].key.t = vars[1].value.t = 0;
+ baseUrl = Utils_ReplaceVarsT(ptszUrl, 0, vars);
#else
vars[0].lptzKey = _T("platform");
#ifdef _WIN64
@@ -129,8 +146,8 @@ bool ParseHashes(const TCHAR *ptszUrl, ptrT &baseUrl, SERVLIST &arHashes)
vars[0].lptzValue = _T("32");
#endif
vars[1].lptzKey = vars[1].lptzValue = 0;
+ baseUrl = (TCHAR*)CallService(MS_UTILS_REPLACEVARS, (WPARAM)ptszUrl, (LPARAM)&vars);
#endif
- baseUrl = Utils_ReplaceVarsT(ptszUrl, 0, vars);
// Download version info
FILEURL pFileUrl;