*** empty log message ***

svn path=/trunk/boinc/; revision=12272
This commit is contained in:
Rom Walton 2007-03-27 17:42:45 +00:00
parent b0822ac3bf
commit 8c0bdc5bda
16 changed files with 350 additions and 94 deletions

View File

@ -2823,3 +2823,27 @@ David 24 Mar 2007
html/ops/
index.php
manage_user.php
Rom 27 Mar 2007
- MGR: Extend browser cookie detection framework so that additional
browsers can be used.
- MGR: Checkin Frank's latest changes to the Advanced Preferences
dialog.
clientgui/
DlgAdvPreferences.cpp, .h
Makefile.am
stdwx.h
WizardAttachProject.cpp
clientlib/win/
AuthenticatorDetection.cpp, .h (Removed)
lib/
boinc_win.h
browser.C, .h (Added)
browser_firefox.C (Added)
browser_ie.C (Added - Windows Only)
win_build/
boinc_dll.vcproj
boinc_dll_2003.vcproj
boincmgr_curl.vcproj
boincmgr_curl_2003.vcproj

View File

@ -145,7 +145,7 @@ bool CDlgAdvPreferences::SaveState() {
bool CDlgAdvPreferences::RestoreState() {
wxString strBaseConfigLocation = wxString(wxT("/DlgAdvPreferences/"));
wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
int iTemp,iTemp1;
int p,w,h;
wxASSERT(pConfig);
@ -153,15 +153,32 @@ bool CDlgAdvPreferences::RestoreState() {
pConfig->SetPath(strBaseConfigLocation);
pConfig->Read(wxT("CurrentPage"), &iTemp,0);
m_Notebook->SetSelection(iTemp);
pConfig->Read(wxT("Width"), &iTemp,-1);
pConfig->Read(wxT("Height"), &iTemp1,-1);
this->SetSize(iTemp,iTemp1);
pConfig->Read(wxT("CurrentPage"), &p,0);
m_Notebook->SetSelection(p);
pConfig->Read(wxT("Width"), &w,-1);
pConfig->Read(wxT("Height"), &h,-1);
this->SetSize(w,h);
return true;
}
// convert a Timestring HH:MM into a double
double CDlgAdvPreferences::TimeStringToDouble(wxString timeStr) {
double hour;
double minutes;
timeStr.SubString(0,timeStr.First(':')).ToDouble(&hour);
timeStr.SubString(timeStr.First(':')+1,timeStr.Length()).ToDouble(&minutes);
minutes = minutes/60.0;
return hour + minutes;
}
// convert a double into a timestring HH:MM
wxString CDlgAdvPreferences::DoubleToTimeString(double dt) {
int hour = (int)dt;
int minutes = (int)(60.0 * (dt - hour));
return wxString::Format(wxT("%02d:%02d"),hour,minutes);
}
/* read preferences from core client and initialize control values */
void CDlgAdvPreferences::ReadPreferenceSettings() {
m_bInInit=true;//prevent dialog handlers from doing anything
@ -180,11 +197,30 @@ void CDlgAdvPreferences::ReadPreferenceSettings() {
// ######### proc usage page
// do work between
m_rbtProcEveryDay->SetValue(true);
buffer.Printf(wxT("%02d:00"),(int)prefs.time_prefs.start_hour);
*m_txtProcEveryDayStart << buffer;
buffer.Printf(wxT("%02d:00"),(int)prefs.time_prefs.end_hour);
*m_txtProcEveryDayStop << buffer;
m_rbtProcEveryDay->SetValue(true);
*m_txtProcEveryDayStart << DoubleToTimeString(prefs.time_prefs.start_hour);
*m_txtProcEveryDayStop << DoubleToTimeString(prefs.time_prefs.end_hour);
//special day times
if(prefs.week_prefs.present) {
bool isRestricted=false;
wxCheckBox* aChks[] = {m_chkProcSunday,m_chkProcMonday,m_chkProcTuesday,m_chkProcWednesday,m_chkProcThursday,m_chkProcFriday,m_chkProcSaturday};
wxTextCtrl* aTxts[] = {m_txtProcSunday,m_txtProcMonday,m_txtProcTuesday,m_txtProcWednesday,m_txtProcThursday,m_txtProcFriday,m_txtProcSaturday};
for(int i=0; i< 7;i++) {
if(prefs.week_prefs.days[i].present &&
prefs.week_prefs.days[i].time_prefs.start_hour != prefs.week_prefs.days[i].time_prefs.end_hour) {
aChks[prefs.week_prefs.days[i].day_of_week]->SetValue(true);
wxString timeStr = DoubleToTimeString(prefs.week_prefs.days[i].time_prefs.start_hour) +
wxT("-") + DoubleToTimeString(prefs.week_prefs.days[i].time_prefs.end_hour);
aTxts[i]->SetValue(timeStr);
isRestricted=true;
}
}
if(isRestricted) {
m_rbtProcSpecialTimes->SetValue(true);
}
}
// on batteries
m_chkProcOnBatteries->SetValue(prefs.run_on_batteries);
// in use
@ -205,10 +241,27 @@ void CDlgAdvPreferences::ReadPreferenceSettings() {
// ######### net usage page
// use network between
m_rbtNetEveryDay->SetValue(true);
buffer.Printf(wxT("%02d:00"),(int)prefs.time_prefs.net_start_hour);
*m_txtNetEveryDayStart << buffer;
buffer.Printf(wxT("%02d:00"),(int)prefs.time_prefs.net_end_hour);
*m_txtNetEveryDayStop << buffer;
*m_txtNetEveryDayStart << DoubleToTimeString(prefs.time_prefs.net_start_hour);
*m_txtNetEveryDayStop << DoubleToTimeString(prefs.time_prefs.net_end_hour);
//special day times
if(prefs.week_prefs.present) {
bool isRestricted = false;
wxCheckBox* aChks[] = {m_chkNetSunday,m_chkNetMonday,m_chkNetTuesday,m_chkNetWednesday,m_chkNetThursday,m_chkNetFriday,m_chkNetSaturday};
wxTextCtrl* aTxts[] = {m_txtNetSunday,m_txtNetMonday,m_txtNetTuesday,m_txtNetWednesday,m_txtNetThursday,m_txtNetFriday,m_txtNetSaturday};
for(int i=0; i< 7;i++) {
if(prefs.week_prefs.days[i].present &&
prefs.week_prefs.days[i].time_prefs.net_start_hour != prefs.week_prefs.days[i].time_prefs.net_end_hour) {
aChks[prefs.week_prefs.days[i].day_of_week]->SetValue(true);
wxString timeStr = DoubleToTimeString(prefs.week_prefs.days[i].time_prefs.net_start_hour) +
wxT("-") + DoubleToTimeString(prefs.week_prefs.days[i].time_prefs.net_end_hour);
aTxts[i]->SetValue(timeStr);
isRestricted = true;
}
}
if(isRestricted) {
m_rbtNetSpecialTimes->SetValue(true);
}
}
// connection interval
buffer.Printf(wxT("%01.4f"),prefs.work_buf_min_days);
*m_txtNetConnectInterval << buffer;
@ -260,6 +313,12 @@ bool CDlgAdvPreferences::SavePreferencesSettings() {
long tl;
mask.clear();
//clear special times settings
prefs.week_prefs.present=false;
for(int i=0; i< 7;i++) {
prefs.week_prefs.days[i].present=false;
prefs.week_prefs.days[i].time_prefs.clear();
}
//proc page
prefs.run_on_batteries=m_chkProcOnBatteries->GetValue();
mask.run_on_batteries=true;
@ -273,18 +332,32 @@ bool CDlgAdvPreferences::SavePreferencesSettings() {
mask.idle_time_to_run=true;
}
//
if(m_txtProcEveryDayStart->IsEnabled()) {
m_txtProcEveryDayStart->GetValue().ToLong(&tl);
prefs.time_prefs.start_hour=tl;
if(m_txtProcEveryDayStart->IsEnabled()) {
prefs.time_prefs.start_hour=TimeStringToDouble(m_txtProcEveryDayStart->GetValue());
mask.start_hour = true;
}
//
if(m_txtProcEveryDayStop->IsEnabled()) {
m_txtProcEveryDayStop->GetValue().ToLong(&tl);
prefs.time_prefs.end_hour=tl;
prefs.time_prefs.end_hour=TimeStringToDouble(m_txtProcEveryDayStop->GetValue());
mask.end_hour = true;
}
//
if(m_rbtProcSpecialTimes->GetValue()) {
prefs.week_prefs.present=true;
wxCheckBox* aChks[] = {m_chkProcSunday,m_chkProcMonday,m_chkProcTuesday,m_chkProcWednesday,m_chkProcThursday,m_chkProcFriday,m_chkProcSaturday};
wxTextCtrl* aTxts[] = {m_txtProcSunday,m_txtProcMonday,m_txtProcTuesday,m_txtProcWednesday,m_txtProcThursday,m_txtProcFriday,m_txtProcSaturday};
for(int i=0; i< 7;i++) {
if(aChks[i]->GetValue()) {
prefs.week_prefs.days[i].day_of_week =i;
prefs.week_prefs.days[i].present =true;
wxString timeStr = aTxts[i]->GetValue();
wxString startStr = timeStr.SubString(0,timeStr.First('-'));
wxString endStr = timeStr.SubString(timeStr.First('-')+1,timeStr.Length());
prefs.week_prefs.days[i].time_prefs.start_hour = TimeStringToDouble(startStr);
prefs.week_prefs.days[i].time_prefs.end_hour = TimeStringToDouble(endStr);
}
}
}
m_txtProcSwitchEvery->GetValue().ToDouble(&td);
prefs.cpu_scheduling_period_minutes=td;
mask.cpu_scheduling_period_minutes=true;
@ -321,16 +394,30 @@ bool CDlgAdvPreferences::SavePreferencesSettings() {
mask.hangup_if_dialed=true;
//
if(m_txtNetEveryDayStart->IsEnabled()) {
m_txtNetEveryDayStart->GetValue().ToLong(&tl);
prefs.time_prefs.net_start_hour=tl;
prefs.time_prefs.net_start_hour=TimeStringToDouble(m_txtNetEveryDayStart->GetValue());
mask.net_start_hour = true;
}
//
if(m_txtNetEveryDayStop->IsEnabled()) {
m_txtNetEveryDayStop->GetValue().ToLong(&tl);
prefs.time_prefs.net_end_hour=tl;
if(m_txtNetEveryDayStop->IsEnabled()) {
prefs.time_prefs.net_end_hour=TimeStringToDouble(m_txtNetEveryDayStop->GetValue());
mask.net_end_hour = true;
}
if(m_rbtNetSpecialTimes->GetValue()) {
prefs.week_prefs.present=true;
wxCheckBox* aChks[] = {m_chkNetSunday,m_chkNetMonday,m_chkNetTuesday,m_chkNetWednesday,m_chkNetThursday,m_chkNetFriday,m_chkNetSaturday};
wxTextCtrl* aTxts[] = {m_txtNetSunday,m_txtNetMonday,m_txtNetTuesday,m_txtNetWednesday,m_txtNetThursday,m_txtNetFriday,m_txtNetSaturday};
for(int i=0; i< 7;i++) {
if(aChks[i]->GetValue()) {
prefs.week_prefs.days[i].day_of_week =i;
prefs.week_prefs.days[i].present =true;
wxString timeStr = aTxts[i]->GetValue();
wxString startStr = timeStr.SubString(0,timeStr.First('-'));
wxString endStr = timeStr.SubString(timeStr.First('-')+1,timeStr.Length());
prefs.week_prefs.days[i].time_prefs.net_start_hour = TimeStringToDouble(startStr);
prefs.week_prefs.days[i].time_prefs.net_end_hour = TimeStringToDouble(endStr);
}
}
}
//disk usage
m_txtDiskMaxSpace->GetValue().ToDouble(&td);
prefs.disk_max_used_gb=td;
@ -593,9 +680,10 @@ bool CDlgAdvPreferences::IsValidTimeIntervalValue(const wxString& value) {
wxDateTime dtStart,dtStop;
dtStart.ParseFormat(start,wxT("%H:%M"));
dtStop.ParseFormat(stop,wxT("%H:%M"));
if(dtStart>=dtStop) {
//
/*if(dtStart>=dtStop) {
return false;
}
}*/
return true;
}
@ -657,4 +745,5 @@ bool CDlgAdvPreferences::ConfirmClear() {
_("Confirmation"),wxCENTER | wxICON_QUESTION | wxYES_NO | wxNO_DEFAULT,this);
return res==wxYES;
}
}

View File

@ -51,6 +51,8 @@ class CDlgAdvPreferences : public CDlgAdvPreferencesBase {
void ShowErrorMessage(wxTextCtrl* errorCtrl);
bool EnsureTabPageVisible(wxTextCtrl* txtCtrl);
bool ConfirmClear();
wxString DoubleToTimeString(double dt);
double TimeStringToDouble(wxString timeStr);
public:
CDlgAdvPreferences(wxWindow* parent=NULL);//to act as standard constructor set a default value
virtual ~CDlgAdvPreferences();
@ -69,3 +71,4 @@ private:
};
#endif // _DLGADVPREFERENCES_H_

View File

@ -97,6 +97,8 @@ boinc_gui_SOURCES = \
WizardAccountManager.cpp \
WizardAttachProject.cpp \
wizardex.cpp \
../lib/browser.C \
../lib/browser_firefox.C \
$(mac_sources)
EXTRA_DIST = *.h \
@ -105,8 +107,8 @@ EXTRA_DIST = *.h \
../lib/error_numbers.h \
locale $(mac_headers)
boinc_gui_CPPFLAGS = $(AM_CPPFLAGS) $(WX_CPPFLAGS) $(CLIENTGUIFLAGS) -I../wizards
boinc_gui_CXXFLAGS = $(AM_CXXFLAGS) $(WX_CXXFLAGS) $(CLIENTGUIFLAGS) -I../wizards
boinc_gui_CPPFLAGS = $(AM_CPPFLAGS) $(WX_CPPFLAGS) $(CLIENTGUIFLAGS)
boinc_gui_CXXFLAGS = $(AM_CXXFLAGS) $(WX_CXXFLAGS) $(CLIENTGUIFLAGS)
boinc_gui_LDADD = -L../lib -lboinc $(CLIENTGUILIBS)
all-local: client_gui-bin

View File

@ -31,6 +31,7 @@
#include "wizardex.h"
#include "error_numbers.h"
#include "hyperlink.h"
#include "browser.h"
#include "BOINCGUIApp.h"
#include "SkinManager.h"
#include "MainDocument.h"
@ -277,27 +278,21 @@ bool CWizardAttachProject::Run( wxString& WXUNUSED(strName), wxString& strURL, b
m_bCredentialsCached = bCredentialsCached;
}
#ifdef __WXMSW__
// If credentials are not cached, then we should try one last place to look up the
// authenticator. Some projects will set a "Setup" cookie off of their URL with a
// pretty short timeout. Lets take a crack at detecting it.
//
// Only Internet Explorer is supported at this time.
//
if (!bCredentialsCached) {
TCHAR szAuthenticator[512];
DWORD dwSize = sizeof(szAuthenticator)/sizeof(TCHAR);
std::string url = strURL.mb_str();
std::string authenticator;
if (DetectSetupAuthenticator(strURL.mbc_str(), szAuthenticator, &dwSize)) {
if (detect_setup_authenticator(url, authenticator)) {
m_bCredentialsDetected = true;
close_when_completed = true;
m_AccountKeyPage->m_strAccountKey = szAuthenticator;
m_AccountKeyPage->m_strAccountKey = wxString(authenticator.c_str(), wxConvUTF8);
}
}
#endif
if ( strURL.Length() && (bCredentialsCached || m_bCredentialsDetected) && m_ProjectProcessingPage) {
return RunWizard(m_ProjectProcessingPage);
} else if (strURL.Length() && !bCredentialsCached && m_ProjectPropertiesPage) {

View File

@ -134,6 +134,7 @@
#include <share.h>
#include <ole2.h>
#include <oleauto.h>
#include <wininet.h>
#if wxUSE_ACCESSIBILITY
#include <oleacc.h>

View File

@ -105,7 +105,6 @@
#include <commctrl.h>
#include <raserror.h>
//#include <mmsystem.h>
#include <dbghelp.h>
#include <tlhelp32.h>

52
lib/browser.C Normal file
View File

@ -0,0 +1,52 @@
// Berkeley Open Infrastructure for Network Computing
// http://boinc.berkeley.edu
// Copyright (C) 2005 University of California
//
// This is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation;
// either version 2.1 of the License, or (at your option) any later version.
//
// This software 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 Lesser General Public License for more details.
//
// To view the GNU Lesser General Public License visit
// http://www.gnu.org/copyleft/lesser.html
// or write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#if defined(_WIN32) && !defined(__STDWX_H__) && !defined(_BOINC_WIN_) && !defined(_AFX_STDAFX_H_)
#include "boinc_win.h"
#endif
#ifndef _WIN32
#include <string>
#endif
#include "browser.h"
//
// Some projects perfer to use there web sites as the primary means of setting up
// there user accounts, so walk through the various browsers looking up the
// project cookies until the projects 'Setup' cookie is found.
//
// Give preference to the default platform specific browers first before going
// to the platform independant browsers since most people don't switch from
// the default.
//
bool detect_setup_authenticator(std::string& project_url, std::string& authenticator) {
#ifdef _WIN32
if (detect_setup_authenticator_ie(project_url, authenticator)) {
return true;
}
#endif
if (detect_setup_authenticator_firefox(project_url, authenticator)) {
return true;
}
return false;
}

View File

@ -17,6 +17,22 @@
// or write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#pragma once
#ifndef _BROWSER_
#define _BROWSER_
EXTERN_C __declspec(dllexport) BOOL DetectSetupAuthenticator(LPCTSTR szProjectURL, LPTSTR szAuthenticator, LPDWORD lpdwSize);
//
// The BOINC client now supports the ability to lookup a users
// authenticator during automatic attachments via a browser
// cookie.
//
bool detect_setup_authenticator(std::string& project_url, std::string& authenticator);
// These functions are browser specific functions
//
#ifdef _WIN32
bool detect_setup_authenticator_ie(std::string& project_url, std::string& authenticator);
#endif
bool detect_setup_authenticator_firefox(std::string& project_url, std::string& authenticator);
#endif

40
lib/browser_firefox.C Normal file
View File

@ -0,0 +1,40 @@
// Berkeley Open Infrastructure for Network Computing
// http://boinc.berkeley.edu
// Copyright (C) 2005 University of California
//
// This is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation;
// either version 2.1 of the License, or (at your option) any later version.
//
// This software 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 Lesser General Public License for more details.
//
// To view the GNU Lesser General Public License visit
// http://www.gnu.org/copyleft/lesser.html
// or write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#if defined(_WIN32) && !defined(__STDWX_H__) && !defined(_BOINC_WIN_) && !defined(_AFX_STDAFX_H_)
#include "boinc_win.h"
#endif
#include "browser.h"
/**
* Detect what authenticator to use from the current users cookie cache.
*
* A project will assign an authenticator from some web based signup system as part
* of their HTTP cookie, from there we can query Internet Explorer and get the
* authenticator and use it during the attach to project wizard execution.
*
* Internet Explorer is the only browser supported at present.
**/
bool detect_setup_authenticator_firefox(std::string& project_url, std::string& authenticator) {
return false;
}

View File

@ -18,49 +18,48 @@
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "stdafx.h"
#include "win_util.h"
#if defined(_WIN32) && !defined(__STDWX_H__) && !defined(_BOINC_WIN_) && !defined(_AFX_STDAFX_H_)
#include "boinc_win.h"
#endif
#include "browser.h"
/**
* Detect what authenticator to use from the current users cookie cache.
*
* A project will assign an authenticator from some web based signup system as part
* of their HTTP cookie, from there we can query Internet Explorer and get the
* authenticator and use it during the attach to project wizard execution.
*
* Internet Explorer is the only browser supported at present.
**/
EXTERN_C __declspec(dllexport) BOOL DetectSetupAuthenticator(LPCTSTR szProjectURL, LPTSTR szAuthenticator, LPDWORD lpdwSize)
//
// Detect the 'Setup' cookie in Internet Explorer by using the InternetGetCookie API.
//
// This is a Windows only browser.
//
bool detect_setup_authenticator_ie(std::string& project_url, std::string& authenticator)
{
BOOL bReturnValue = FALSE;
bool bReturnValue = FALSE;
BOOL bValidates = TRUE;
TCHAR szCookieBuffer[2048];
LPTSTR pszCookieFragment = NULL;
DWORD dwSize = sizeof(szCookieBuffer)/sizeof(TCHAR);
tstring strCookieFragment;
tstring strCookieName;
tstring strCookieValue;
char szCookieBuffer[2048];
char* pszCookieFragment = NULL;
DWORD dwSize = sizeof(szCookieBuffer)/sizeof(char);
std::string strCookieFragment;
std::string strCookieName;
std::string strCookieValue;
size_t uiDelimeterLocation;
bReturnValue = InternetGetCookie(szProjectURL, NULL, szCookieBuffer, &dwSize);
bReturnValue = InternetGetCookie(project_url.c_str(), NULL, szCookieBuffer, &dwSize) == TRUE;
if (bReturnValue)
{
// Format of cookie buffer:
// 'cookie1=value1; cookie2=value2; cookie3=value3;
//
pszCookieFragment = _tcstok(szCookieBuffer, _T("; "));
pszCookieFragment = strtok(szCookieBuffer, "; ");
while(pszCookieFragment)
{
// Convert to a std::string so we can go to town
strCookieFragment = pszCookieFragment;
// Extract the name & value
uiDelimeterLocation = strCookieFragment.find(_T("="), 0);
uiDelimeterLocation = strCookieFragment.find("=", 0);
strCookieName = strCookieFragment.substr(0, uiDelimeterLocation);
strCookieValue = strCookieFragment.substr(uiDelimeterLocation + 1);
if (tstring(_T("Setup")) == strCookieName)
if (std::string("Setup") == strCookieName)
{
// Perform some basic validation of the suspect authenticator
//
@ -71,7 +70,7 @@ EXTERN_C __declspec(dllexport) BOOL DetectSetupAuthenticator(LPCTSTR szProjectUR
}
// If the string contains non alpha numeric characters it is invalid.
tstring::iterator it = strCookieValue.begin();
std::string::iterator it = strCookieValue.begin();
while (it != strCookieValue.end()) {
if (!_istalpha(*it) && !_istdigit(*it)) {
bValidates = FALSE;
@ -79,25 +78,18 @@ EXTERN_C __declspec(dllexport) BOOL DetectSetupAuthenticator(LPCTSTR szProjectUR
it++;
}
// If validation failed, null out the Authenticator field just in case
// If validation failed, null out the authenticator just in case
// somebody tries to use it, otherwise copy in the real deal.
if (!bValidates) {
_tcsncpy(szAuthenticator, _T(""), *lpdwSize);
*lpdwSize = 0;
authenticator = "";
} else {
_tcsncpy(szAuthenticator, strCookieValue.c_str(), *lpdwSize);
*lpdwSize = (DWORD)_tcslen(szAuthenticator);
authenticator = strCookieValue;
}
}
pszCookieFragment = _tcstok(NULL, _T("; "));
pszCookieFragment = strtok(NULL, "; ");
}
}
else
{
fprintf(stderr, _T("DetectSetupAuthenticator() - InternetGetCookieEx Failed. GetLastError = '%d'"), GetLastError());
}
return bReturnValue;
}

View File

@ -120,7 +120,9 @@ void GLOBAL_PREFS::defaults() {
max_bytes_sec_down = 0;
cpu_usage_limit = 100;
week_prefs.present = false;
for(int i=0;i<7;i++) {
week_prefs.days[i].time_prefs.clear();
}
// don't initialize source_project, source_scheduler,
// mod_time, host_specific here
// since they are outside of <venue> elements,
@ -208,7 +210,7 @@ int DAY_PREFS::parse(XML_PARSER& xp) {
while (!xp.get(tag, sizeof(tag), is_tag)) {
if (!is_tag) continue;
if (!strcmp(tag, "/day_prefs")) {
if (day_of_week < 0 || day_of_week) return ERR_XML_PARSE;
if (day_of_week < 0 || day_of_week > 6) return ERR_XML_PARSE;
return 0;
} else if (xp.parse_int(tag, "day_of_week", day_of_week)) {
} else if (xp.parse_double(tag, "start_hour", time_prefs.start_hour)) {
@ -558,9 +560,32 @@ int GLOBAL_PREFS::write_subset(MIOFILE& f, GLOBAL_PREFS_MASK& mask) {
if (mask.cpu_usage_limit) {
f.printf(" <cpu_usage_limit>%f</cpu_usage_limit>\n", cpu_usage_limit);
}
if (week_prefs.present) {
for(int i=0; i< 7;i++) {
DAY_PREFS dp = week_prefs.days[i];
//write only when needed
if(dp.present &&
(dp.time_prefs.start_hour != dp.time_prefs.end_hour ||
dp.time_prefs.net_start_hour != dp.time_prefs.net_end_hour)) {
f.printf(" <day_prefs>\n");
f.printf(" <day_of_week>%d</day_of_week>\n",dp.day_of_week);
if(dp.time_prefs.start_hour != dp.time_prefs.end_hour) {
f.printf(" <start_hour>%.02f</start_hour>\n",dp.time_prefs.start_hour);
f.printf(" <end_hour>%.02f</end_hour>\n",dp.time_prefs.end_hour);
}
if(dp.time_prefs.net_start_hour != dp.time_prefs.net_end_hour) {
f.printf(" <net_start_hour>%.02f</net_start_hour>\n",dp.time_prefs.net_start_hour);
f.printf(" <net_end_hour>%.02f</net_end_hour>\n",dp.time_prefs.net_end_hour);
}
f.printf(" </day_prefs>\n");
}
}
}
f.printf("</global_preferences>\n");
return 0;
}
const char *BOINC_RCSID_3fb442bb02 = "$Id$";

View File

@ -222,10 +222,6 @@
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\clientlib\win\AuthenticatorDetection.cpp"
>
</File>
<File
RelativePath="..\clientlib\win\boinc_dll.cpp"
>
@ -292,10 +288,6 @@
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\clientlib\win\AuthenticatorDetection.h"
>
</File>
<File
RelativePath="..\clientlib\win\boinc_dll.h"
>

View File

@ -157,9 +157,6 @@
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath="..\clientlib\win\AuthenticatorDetection.cpp">
</File>
<File
RelativePath="..\clientlib\win\boinc_dll.cpp">
</File>
@ -210,9 +207,6 @@
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath="..\clientlib\win\AuthenticatorDetection.h">
</File>
<File
RelativePath="..\clientlib\win\boinc_dll.h">
</File>

View File

@ -656,6 +656,22 @@
RelativePath="..\lib\app_ipc.h"
>
</File>
<File
RelativePath="..\lib\browser.C"
>
</File>
<File
RelativePath="..\lib\browser.h"
>
</File>
<File
RelativePath="..\lib\browser_firefox.C"
>
</File>
<File
RelativePath="..\lib\browser_ie.C"
>
</File>
<File
RelativePath="..\lib\diagnostics.C"
>
@ -868,6 +884,10 @@
RelativePath="..\lib\str_util.C"
>
</File>
<File
RelativePath="..\lib\str_util.h"
>
</File>
<File
RelativePath="..\lib\util.C"
>

View File

@ -505,6 +505,18 @@
<File
RelativePath="..\lib\app_ipc.h">
</File>
<File
RelativePath="..\lib\browser.C">
</File>
<File
RelativePath="..\lib\browser.h">
</File>
<File
RelativePath="..\lib\browser_firefox.C">
</File>
<File
RelativePath="..\lib\browser_ie.C">
</File>
<File
RelativePath="..\lib\diagnostics.C">
<FileConfiguration