diff --git a/client/client_state.h b/client/client_state.h
index 5fa1ac1708..ee0e1aaa46 100644
--- a/client/client_state.h
+++ b/client/client_state.h
@@ -238,7 +238,7 @@ struct CLIENT_STATE {
// --------------- acct_setup.cpp:
PROJECT_INIT project_init;
PROJECT_ATTACH project_attach;
- void new_version_check();
+ void new_version_check(bool force = false);
void all_projects_list_check();
double new_version_check_time;
double all_projects_list_check_time;
diff --git a/client/current_version.cpp b/client/current_version.cpp
index 2a7519ac3a..7231666897 100644
--- a/client/current_version.cpp
+++ b/client/current_version.cpp
@@ -87,15 +87,15 @@ static void show_newer_version_msg(const char* new_vers) {
if (cc_config.client_new_version_text.empty()) {
msg_printf_notice(0, true,
"http://boinc.berkeley.edu/manager_links.php?target=notice&controlid=download",
- "%s (%s) %s",
- _("A new version of BOINC is available."),
+ "%s (%s). %s",
+ _("A new version of BOINC is available"),
new_vers,
cc_config.client_download_url.c_str(),
_("Download")
);
} else {
msg_printf_notice(0, true, NULL,
- "%s (%s) %s",
+ "%s (%s). %s",
cc_config.client_new_version_text.c_str(),
new_vers,
cc_config.client_download_url.c_str(),
@@ -140,8 +140,8 @@ void newer_version_startup_check() {
#define NEW_VERSION_CHECK_PERIOD (14*86400)
-void CLIENT_STATE::new_version_check() {
- if ((new_version_check_time == 0) ||
+void CLIENT_STATE::new_version_check(bool force) {
+ if (force || (new_version_check_time == 0) ||
(now - new_version_check_time > NEW_VERSION_CHECK_PERIOD)) {
// get_current_version_op.handle_reply()
// updates new_version_check_time
diff --git a/client/gui_rpc_server_ops.cpp b/client/gui_rpc_server_ops.cpp
index ef1d04b520..599b54b576 100644
--- a/client/gui_rpc_server_ops.cpp
+++ b/client/gui_rpc_server_ops.cpp
@@ -1000,6 +1000,8 @@ static void handle_acct_mgr_rpc_poll(GUI_RPC_CONN& grc) {
}
static void handle_get_newer_version(GUI_RPC_CONN& grc) {
+ gstate.new_version_check(true);
+
grc.mfout.printf(
"%s\n"
"%s\n",
diff --git a/clientgui/AdvancedFrame.cpp b/clientgui/AdvancedFrame.cpp
index f4adb299db..15445ec3bc 100644
--- a/clientgui/AdvancedFrame.cpp
+++ b/clientgui/AdvancedFrame.cpp
@@ -196,6 +196,7 @@ BEGIN_EVENT_TABLE (CAdvancedFrame, CBOINCBaseFrame)
EVT_MENU(ID_HELPBOINCMANAGER, CAdvancedFrame::OnHelpBOINC)
EVT_MENU(ID_HELPBOINCWEBSITE, CAdvancedFrame::OnHelpBOINC)
EVT_MENU(wxID_ABOUT, CAdvancedFrame::OnHelpAbout)
+ EVT_MENU(ID_CHECK_VERSION, CAdvancedFrame::OnCheckVersion)
EVT_HELP(wxID_ANY, CAdvancedFrame::OnHelp)
// Custom Events & Timers
EVT_FRAME_CONNECT(CAdvancedFrame::OnConnect)
@@ -686,6 +687,21 @@ bool CAdvancedFrame::CreateMenu() {
);
menuHelp->AppendSeparator();
+ strMenuName.Printf(
+ _("Check for new %s version"),
+ pSkinAdvanced->GetApplicationShortName().c_str()
+ );
+ strMenuDescription.Printf(
+ _("Check for new %s version"),
+ pSkinAdvanced->GetApplicationShortName().c_str()
+ );
+ menuHelp->Append(
+ ID_CHECK_VERSION,
+ strMenuName,
+ strMenuDescription
+ );
+ menuHelp->AppendSeparator();
+
strMenuName.Printf(
_("&About %s..."),
pSkinAdvanced->GetApplicationName().c_str()
@@ -1666,6 +1682,13 @@ void CAdvancedFrame::OnHelpAbout(wxCommandEvent& WXUNUSED(event)) {
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnHelpAbout - Function End"));
}
+void CAdvancedFrame::OnCheckVersion(wxCommandEvent& WXUNUSED(event)) {
+ wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnCheckVersion - Function Begin"));
+
+ wxGetApp().GetDocument()->CheckForVersionUpdate(true);
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnCheckVersion - Function End"));
+}
void CAdvancedFrame::OnRefreshView(CFrameEvent& WXUNUSED(event)) {
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::OnRefreshView - Function Begin"));
diff --git a/clientgui/AdvancedFrame.h b/clientgui/AdvancedFrame.h
index 4ddfc6076d..0d848e7d8d 100644
--- a/clientgui/AdvancedFrame.h
+++ b/clientgui/AdvancedFrame.h
@@ -88,6 +88,7 @@ public:
void OnHelp( wxHelpEvent& event );
void OnHelpBOINC( wxCommandEvent& event );
void OnHelpAbout( wxCommandEvent& event );
+ void OnCheckVersion( wxCommandEvent& event );
void OnRefreshState( wxTimerEvent& event );
void OnFrameRender( wxTimerEvent& event );
diff --git a/clientgui/Events.h b/clientgui/Events.h
index 760b3e74b8..8ceddc6541 100644
--- a/clientgui/Events.h
+++ b/clientgui/Events.h
@@ -95,6 +95,7 @@
#define ID_HELPBOINC 6035 // Locked: Used by manager_links.php
#define ID_HELPBOINCWEBSITE 6024 // Locked: Used by manager_links.php
#define ID_HELPBOINCMANAGER 6025 // Locked: Used by manager_links.php
+#define ID_CHECK_VERSION 6026
//#define wxID_ABOUT
// Views
diff --git a/clientgui/MainDocument.cpp b/clientgui/MainDocument.cpp
index 3483b9169d..8845d05b4f 100644
--- a/clientgui/MainDocument.cpp
+++ b/clientgui/MainDocument.cpp
@@ -37,6 +37,7 @@
#include "BOINCTaskBar.h"
#include "DlgEventLog.h"
#include "Events.h"
+#include "SkinManager.h"
#ifndef _WIN32
#include
@@ -164,6 +165,7 @@ void CNetworkConnection::Poll() {
if (!retval) {
wxLogTrace(wxT("Function Status"), wxT("CNetworkConnection::Poll - Connection Success"));
SetStateSuccess(m_strNewComputerName, m_strNewComputerPassword);
+ m_pDocument->CheckForVersionUpdate();
} else if (ERR_AUTHENTICATOR == retval) {
wxLogTrace(wxT("Function Status"), wxT("CNetworkConnection::Poll - RPC Authorization - ERR_AUTHENTICATOR"));
SetStateErrorAuthentication();
@@ -1278,6 +1280,31 @@ bool CMainDocument::IsUserAuthorized() {
return true;
}
+void CMainDocument::CheckForVersionUpdate(bool showMessage) {
+ std::string version, url;
+ wxString message, title;
+ title.Printf(_("Version Update"));
+ wxString applicationName = wxGetApp().GetSkinManager()->GetAdvanced()->GetApplicationName();
+ if (IsConnected()) {
+ rpc.get_newer_version(version, url);
+
+ if (!showMessage)
+ return;
+
+ if (!version.empty() && !url.empty()) {
+ message.Printf("%s: %s", _("A new version of BOINC is available for downloading here"), url);
+ }
+ else {
+ message.Printf("%s", _("No new version available for downloading"), url);
+ }
+ }
+ else {
+ message.Printf("%s is not connected to the client", applicationName);
+ }
+ if (showMessage) {
+ wxGetApp().SafeMessageBox(message, title);
+ }
+}
int CMainDocument::CachedProjectStatusUpdate(bool bForce) {
int i = 0;
diff --git a/clientgui/MainDocument.h b/clientgui/MainDocument.h
index 90c10b5d9d..92f96c01f2 100644
--- a/clientgui/MainDocument.h
+++ b/clientgui/MainDocument.h
@@ -167,6 +167,8 @@ public:
bool IsUserAuthorized();
+ void CheckForVersionUpdate(bool showMessage = false);
+
CNetworkConnection* m_pNetworkConnection;
CBOINCClientManager* m_pClientManager;
AsyncRPC rpc;
diff --git a/clientgui/sg_BoincSimpleFrame.cpp b/clientgui/sg_BoincSimpleFrame.cpp
index 29c38408fc..75fdf43bb9 100644
--- a/clientgui/sg_BoincSimpleFrame.cpp
+++ b/clientgui/sg_BoincSimpleFrame.cpp
@@ -84,6 +84,7 @@ BEGIN_EVENT_TABLE(CSimpleFrame, CBOINCBaseFrame)
EVT_MENU(ID_HELPBOINCMANAGER, CSimpleFrame::OnHelpBOINC)
EVT_MENU(ID_HELPBOINCWEBSITE, CSimpleFrame::OnHelpBOINC)
EVT_MENU(wxID_ABOUT, CSimpleFrame::OnHelpAbout)
+ EVT_MENU(ID_CHECK_VERSION, CSimpleFrame::OnCheckVersion)
EVT_MENU(ID_EVENTLOG, CSimpleFrame::OnEventLog)
EVT_MOVE(CSimpleFrame::OnMove)
#ifdef __WXMAC__
@@ -258,6 +259,21 @@ CSimpleFrame::CSimpleFrame(wxString title, wxIconBundle* icons, wxPoint position
);
menuHelp->AppendSeparator();
+ strMenuName.Printf(
+ _("Check for new %s version"),
+ pSkinAdvanced->GetApplicationShortName().c_str()
+ );
+ strMenuDescription.Printf(
+ _("Check for new %s version"),
+ pSkinAdvanced->GetApplicationShortName().c_str()
+ );
+ menuHelp->Append(
+ ID_CHECK_VERSION,
+ strMenuName,
+ strMenuDescription
+ );
+ menuHelp->AppendSeparator();
+
strMenuName.Printf(
_("&About %s..."),
pSkinAdvanced->GetApplicationName().c_str()
@@ -611,6 +627,14 @@ void CSimpleFrame::OnHelpAbout(wxCommandEvent& /*event*/) {
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnHelpAbout - Function End"));
}
+void CSimpleFrame::OnCheckVersion(wxCommandEvent& WXUNUSED(event)) {
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnCheckVersion - Function Begin"));
+
+ wxGetApp().GetDocument()->CheckForVersionUpdate(true);
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnCheckVersion - Function End"));
+}
+
void CSimpleFrame::OnHelp(wxHelpEvent& event) {
wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnHelp - Function Begin"));
diff --git a/clientgui/sg_BoincSimpleFrame.h b/clientgui/sg_BoincSimpleFrame.h
index cf08e4de46..6d767d7b2f 100644
--- a/clientgui/sg_BoincSimpleFrame.h
+++ b/clientgui/sg_BoincSimpleFrame.h
@@ -114,6 +114,7 @@ public:
void OnHelp( wxHelpEvent& event );
void OnHelpBOINC( wxCommandEvent& event );
void OnHelpAbout( wxCommandEvent& event );
+ void OnCheckVersion( wxCommandEvent& event );
void OnProjectsAttachToProject(wxCommandEvent& event);
diff --git a/lib/gui_rpc_client_ops.cpp b/lib/gui_rpc_client_ops.cpp
index 6d6f63ad5e..ccd452ffe7 100644
--- a/lib/gui_rpc_client_ops.cpp
+++ b/lib/gui_rpc_client_ops.cpp
@@ -2372,14 +2372,19 @@ int RPC_CLIENT::get_newer_version(std::string& version, std::string& version_dow
RPC rpc(this);
version = "";
+ version_download_url = "";
+
retval = rpc.do_rpc("\n");
if (!retval) {
while (rpc.fin.fgets(buf, 256)) {
+ if (!version.empty() && !version_download_url.empty()) {
+ break;
+ }
if (parse_str(buf, "", version)) {
- return ERR_XML_PARSE;
+ continue;
}
if (parse_str(buf, "", version_download_url)) {
- return ERR_XML_PARSE;
+ continue;
}
}
}