summaryrefslogtreecommitdiff
path: root/plugins/PluginUpdater/src
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2014-05-29 17:59:46 +0000
committerRobert Pösel <robyer@seznam.cz>2014-05-29 17:59:46 +0000
commitab941675529590a76c5874ebc550b14c9ad1dbd7 (patch)
tree5c870464f4630b6e53c5a21dc44a498c29ac3a3d /plugins/PluginUpdater/src
parent6e8d781bdf90ac8cd5913af7e04bf6af1e42adbe (diff)
Plugin Updater: Fix balloon's message and check for disabled YAPP
git-svn-id: http://svn.miranda-ng.org/main/trunk@9361 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/PluginUpdater/src')
-rw-r--r--plugins/PluginUpdater/src/DlgUpdate.cpp46
-rw-r--r--plugins/PluginUpdater/src/Notifications.cpp90
2 files changed, 64 insertions, 72 deletions
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp
index 83ac440829..a2057d5713 100644
--- a/plugins/PluginUpdater/src/DlgUpdate.cpp
+++ b/plugins/PluginUpdater/src/DlgUpdate.cpp
@@ -445,28 +445,9 @@ static void DlgUpdateSilent(void *lParam)
db_set_b(NULL, MODNAME, "NeedRestart", 1);
TCHAR tszTitle[100];
- mir_sntprintf(tszTitle, SIZEOF(tszTitle), TranslateT("%d component(s) was updated"), UpdateFiles.getCount());
-
- if (!ServiceExists(MS_POPUP_ADDPOPUPT) || !db_get_b(NULL, "Popup", "ModuleIsEnabled", 1)) {
- TCHAR tszText[200];
- mir_sntprintf(tszText, SIZEOF(tszText), _T("%s\n\n%s"), TranslateT("You need to restart your Miranda to apply installed updates."), TranslateT("Would you like to restart it now?"));
+ mir_sntprintf(tszTitle, SIZEOF(tszTitle), TranslateT("%d component(s) was updated"), UpdateFiles.getCount());
- if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) {
- MIRANDASYSTRAYNOTIFY err;
- err.szProto = MODULEA;
- err.cbSize = sizeof(err);
- err.dwInfoFlags = NIIF_INTERN_UNICODE | NIIF_INFO;
- err.tszInfoTitle = tszTitle;
- err.tszInfo = tszText;
- err.uTimeout = 60000;
-
- if (CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM)&err) != 0) {
- // Error, let's try to show MessageBox as last way to inform user about successful update
- if (MessageBox(NULL, tszText, tszTitle, MB_ICONINFORMATION | MB_YESNO) == IDYES)
- CallFunctionAsync(RestartMe, 0);
- }
- }
- } else {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && (db_get_b(NULL, "Popup", "ModuleIsEnabled", 0) || db_get_b(NULL, "YAPP", "Enabled", 0))) {
POPUPDATAT_V2 pd = { 0 };
pd.cbSize = sizeof(pd);
pd.lchContact = NULL;
@@ -479,6 +460,29 @@ static void DlgUpdateSilent(void *lParam)
lstrcpyn(pd.lptzContactName, tszTitle, MAX_CONTACTNAME);
CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&pd, APF_NEWDATA);
+ } else {
+ bool notified = false;
+
+ if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) {
+ MIRANDASYSTRAYNOTIFY err;
+ err.szProto = MODULEA;
+ err.cbSize = sizeof(err);
+ err.dwInfoFlags = NIIF_INTERN_UNICODE | NIIF_INFO;
+ err.tszInfoTitle = tszTitle;
+ err.tszInfo = TranslateT("You need to restart your Miranda to apply installed updates.");
+ err.uTimeout = 30000;
+
+ notified = !CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM)&err);
+ }
+
+ if (!notified) {
+ // Error, let's try to show MessageBox as last way to inform user about successful update
+ TCHAR tszText[200];
+ mir_sntprintf(tszText, SIZEOF(tszText), _T("%s\n\n%s"), TranslateT("You need to restart your Miranda to apply installed updates."), TranslateT("Would you like to restart it now?"));
+
+ if (MessageBox(NULL, tszText, tszTitle, MB_ICONINFORMATION | MB_YESNO) == IDYES)
+ CallFunctionAsync(RestartMe, 0);
+ }
}
}
}
diff --git a/plugins/PluginUpdater/src/Notifications.cpp b/plugins/PluginUpdater/src/Notifications.cpp
index 2bbde5976e..a982b32508 100644
--- a/plugins/PluginUpdater/src/Notifications.cpp
+++ b/plugins/PluginUpdater/src/Notifications.cpp
@@ -114,10 +114,47 @@ static void MakePopupAction(POPUPACTION &pa, int id)
void ShowPopup(HWND hDlg, LPCTSTR ptszTitle, LPCTSTR ptszText, int Number, int ActType, bool NoMessageBox)
{
- if (!ServiceExists(MS_POPUP_ADDPOPUPT) || !db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) ) {
- if(NoMessageBox){
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && (db_get_b(NULL, "Popup", "ModuleIsEnabled", 0) || db_get_b(NULL, "YAPP", "Enabled", 0))) {
+ LPMSGPOPUPDATA pmpd = (LPMSGPOPUPDATA)mir_alloc(sizeof(MSGPOPUPDATA));
+ if (!pmpd)
return;
+
+ POPUPDATAT_V2 pd = { 0 };
+ pd.cbSize = sizeof(pd);
+ pd.lchContact = NULL; //(HANDLE)wParam;
+ pd.lchIcon = LoadSkinnedIcon(PopupsList[Number].Icon);
+ pd.PluginWindowProc = (Number == 0 && ActType != 0) ? PopupDlgProc : PopupDlgProc2;
+ pd.PluginData = pmpd;
+ pd.iSeconds = (Number == 0) ? -1 : PopupOptions.Timeout;
+ pd.hNotification = NULL;
+ pd.lpActions = pmpd->pa;
+
+ lstrcpyn(pd.lptzText, TranslateTS(ptszText), MAX_SECONDLINE);
+ lstrcpyn(pd.lptzContactName, TranslateTS(ptszTitle), MAX_CONTACTNAME);
+
+ switch (PopupOptions.DefColors) {
+ case byCOLOR_WINDOWS:
+ pd.colorBack = GetSysColor(COLOR_BTNFACE);
+ pd.colorText = GetSysColor(COLOR_WINDOWTEXT);
+ break;
+ case byCOLOR_OWN:
+ pd.colorBack = PopupsList[Number].colorBack;
+ pd.colorText = PopupsList[Number].colorText;
+ break;
+ case byCOLOR_POPUP:
+ pd.colorBack = pd.colorText = 0;
+ break;
+ }
+
+ pmpd->hDialog = hDlg;
+
+ if (ActType == 1) {
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDYES);
+ MakePopupAction(pmpd->pa[pd.actionCount++], IDNO);
}
+
+ CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&pd, APF_NEWDATA);
+ } else if (!NoMessageBox) {
char setting[100];
mir_snprintf(setting, SIZEOF(setting), "Popups%dM", Number);
if (db_get_b(NULL, MODNAME, setting, DEFAULT_MESSAGE_ENABLED)) {
@@ -131,56 +168,7 @@ void ShowPopup(HWND hDlg, LPCTSTR ptszTitle, LPCTSTR ptszText, int Number, int A
}
MessageBox(hDlg, TranslateTS(ptszText), TranslateTS(ptszTitle), iMsgType);
}
- return;
}
-
- LPMSGPOPUPDATA pmpd = (LPMSGPOPUPDATA)mir_alloc(sizeof(MSGPOPUPDATA));
- if (!pmpd)
- return;
-
- POPUPDATAT_V2 pd = { 0 };
- pd.cbSize = sizeof(pd);
- pd.lchContact = NULL; //(HANDLE)wParam;
- pd.lchIcon = LoadSkinnedIcon(PopupsList[Number].Icon);
- lstrcpyn(pd.lptzText, TranslateTS(ptszText), MAX_SECONDLINE);
- lstrcpyn(pd.lptzContactName, TranslateTS(ptszTitle), MAX_CONTACTNAME);
- switch (PopupOptions.DefColors) {
- case byCOLOR_WINDOWS:
- pd.colorBack = GetSysColor(COLOR_BTNFACE);
- pd.colorText = GetSysColor(COLOR_WINDOWTEXT);
- break;
- case byCOLOR_OWN:
- pd.colorBack = PopupsList[Number].colorBack;
- pd.colorText = PopupsList[Number].colorText;
- break;
- case byCOLOR_POPUP:
- pd.colorBack = pd.colorText = 0;
- break;
- }
- if (Number == 0 && ActType != 0)
- pd.PluginWindowProc = PopupDlgProc;
- else
- pd.PluginWindowProc = PopupDlgProc2;
- pd.PluginData = pmpd;
- if (Number == 0)
- pd.iSeconds = -1;
- else
- pd.iSeconds = PopupOptions.Timeout;
- pd.hNotification = NULL;
- pd.lpActions = pmpd->pa;
-
- pmpd->hDialog = hDlg;
- switch (ActType) {
- case 0:
- break;
-
- case 1:
- MakePopupAction(pmpd->pa[pd.actionCount++], IDYES);
- MakePopupAction(pmpd->pa[pd.actionCount++], IDNO);
- break;
- }
-
- CallService(MS_POPUP_ADDPOPUPT, (WPARAM) &pd, APF_NEWDATA);
}
INT_PTR CALLBACK DlgDownload(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)