- internal change: rename MSG_USER_ERROR to MSG_USER_ALERT

svn path=/trunk/boinc/; revision=20027
This commit is contained in:
David Anderson 2009-12-23 18:02:40 +00:00
parent 36b04b6279
commit 735e2b0448
22 changed files with 85 additions and 78 deletions

View File

@ -10682,3 +10682,9 @@ David 23 Dec 2009
lib/
notice.cpp,h
parse.cpp
David 23 Dec 2009
- internal change: rename MSG_USER_ERROR to MSG_USER_ALERT
client/, clientgui/, lib/
various files

View File

@ -366,14 +366,14 @@ void ACCT_MGR_OP::handle_reply(int http_op_retval) {
// email addresses
//
if (error_str.size()) {
msg_printf(NULL, MSG_USER_ERROR,
msg_printf(NULL, MSG_USER_ALERT,
"Account manager error: %d %s", error_num, error_str.c_str()
);
if (!error_num) {
error_num = ERR_XML_PARSE;
}
} else if (error_num) {
msg_printf(NULL, MSG_USER_ERROR,
msg_printf(NULL, MSG_USER_ALERT,
"Account manager error: %s", boincerror(error_num)
);
}

View File

@ -249,13 +249,13 @@ void GET_CURRENT_VERSION_OP::handle_reply(int http_op_retval) {
while (fgets(buf, 256, f)) {
if (match_tag(buf, "<version>")) {
if (parse_version(f, new_version)) {
msg_printf(0, MSG_USER_ERROR,
"A new version of BOINC (%s) is available for your computer",
msg_printf(0, MSG_USER_ALERT,
"A new version of BOINC (%s) is available",
new_version
);
msg_printf(0, MSG_USER_ERROR,
"Visit %s to get it.",
msg_printf(0, MSG_USER_ALERT,
"Visit %s to download it",
config.client_download_url.c_str()
);
gstate.newer_version = string(new_version);

View File

@ -850,7 +850,7 @@ void ACTIVE_TASK_SET::report_overdue() {
atp = active_tasks[i];
double diff = (gstate.now - atp->result->report_deadline)/86400;
if (diff > 0) {
msg_printf(atp->result->project, MSG_USER_ERROR,
msg_printf(atp->result->project, MSG_USER_ALERT,
"Task %s is %.2f days overdue; you may not get credit for it. Consider aborting it.", atp->result->name, diff
);
}

View File

@ -128,7 +128,7 @@ char* next_arg(int argc, char** argv, int& i) {
const char* prio_name(int prio) {
switch (prio) {
case MSG_INFO: return "low";
case MSG_USER_ERROR: return "medium";
case MSG_USER_ALERT: return "medium";
case MSG_INTERNAL_ERROR: return "high";
}
return "unknown";

View File

@ -90,7 +90,7 @@ void show_error(int retval) {
const char* prio_name(int prio) {
switch (prio) {
case MSG_INFO: return "low";
case MSG_USER_ERROR: return "medium";
case MSG_USER_ALERT: return "medium";
case MSG_INTERNAL_ERROR: return "high";
}
return "unknown";

View File

@ -212,7 +212,7 @@ int CLIENT_STATE::init() {
);
if (core_client_version.prerelease) {
msg_printf(NULL, MSG_USER_ERROR,
msg_printf(NULL, MSG_USER_ALERT,
"This a development version of BOINC and may not function properly"
);
}
@ -327,9 +327,8 @@ int CLIENT_STATE::init() {
//
retval = write_state_file();
if (retval) {
msg_printf(NULL, MSG_USER_ERROR, "Couldn't write state file");
msg_printf(NULL, MSG_USER_ERROR,
"Make sure directory permissions are set correctly"
msg_printf(NULL, MSG_USER_ALERT,
"Couldn't write state file; make sure directory permissions are set correctly"
);
cant_write_state_file = true;
}

View File

@ -438,21 +438,21 @@ int CLIENT_STATE::add_project(
strip_whitespace(canonical_master_url);
canonicalize_master_url(canonical_master_url);
if (!valid_master_url(canonical_master_url)) {
msg_printf(0, MSG_USER_ERROR, "Invalid URL: %s", canonical_master_url);
msg_printf(0, MSG_USER_ALERT, "Invalid URL: %s", canonical_master_url);
return ERR_INVALID_URL;
}
safe_strcpy(auth, _auth);
strip_whitespace(auth);
if (!strlen(auth)) {
msg_printf(0, MSG_USER_ERROR, "Missing account key");
msg_printf(0, MSG_USER_ALERT, "Missing account key");
return ERR_AUTHENTICATOR;
}
// check if we're already attached to this project
//
if (lookup_project(canonical_master_url)) {
msg_printf(0, MSG_USER_ERROR, "Already attached to %s", canonical_master_url);
msg_printf(0, MSG_USER_ALERT, "Already attached to %s", canonical_master_url);
return ERR_ALREADY_ATTACHED;
}

View File

@ -265,7 +265,7 @@ void CLIENT_STATE::parse_env_vars() {
env_var_proxy_info.http_server_port = purl.port;
break;
default:
msg_printf(0, MSG_USER_ERROR,
msg_printf(0, MSG_USER_ALERT,
"The HTTP_PROXY environment variable must specify an HTTP proxy"
);
}
@ -326,7 +326,7 @@ void CLIENT_STATE::do_cmdline_actions() {
msg_printf(project, MSG_INFO, "detaching from %s\n", detach_project_url);
detach_project(project);
} else {
msg_printf(NULL, MSG_USER_ERROR, "project %s not found\n", detach_project_url);
msg_printf(NULL, MSG_USER_ALERT, "project %s not found\n", detach_project_url);
}
exit(0);
}
@ -338,7 +338,7 @@ void CLIENT_STATE::do_cmdline_actions() {
reset_project(project, false);
msg_printf(project, MSG_INFO, "Project %s has been reset", reset_project_url);
} else {
msg_printf(NULL, MSG_USER_ERROR, "project %s not found\n", reset_project_url);
msg_printf(NULL, MSG_USER_ALERT, "project %s not found\n", reset_project_url);
}
exit(0);
}
@ -349,7 +349,7 @@ void CLIENT_STATE::do_cmdline_actions() {
if (project) {
project->sched_rpc_pending = RPC_REASON_USER_REQ;
} else {
msg_printf(NULL, MSG_USER_ERROR, "project %s not found\n", update_prefs_url);
msg_printf(NULL, MSG_USER_ALERT, "project %s not found\n", update_prefs_url);
}
}

View File

@ -21,7 +21,7 @@
// Code related to "notices", which come from
// 1) RSS feeds specified by projects
// 2) Scheduler replies (high-priority messages)
// 3) the client (MSG_USER_ERROR messages)
// 3) the client (MSG_USER_ALERT messages)
//
// Classes:
//

View File

@ -480,11 +480,9 @@ int CLIENT_STATE::handle_scheduler_reply(PROJECT* project, char* scheduler_url)
downcase_string(url1);
downcase_string(url2);
if (url1 != url2) {
msg_printf(project, MSG_USER_ERROR,
"You used the wrong URL for this project"
);
msg_printf(project, MSG_USER_ERROR,
"The correct URL is %s", sr.master_url
msg_printf(project, MSG_USER_ALERT,
"You used the wrong URL for this project; the correct URL is %s",
sr.master_url
);
p2 = lookup_project(sr.master_url);
if (p2) {
@ -522,11 +520,11 @@ int CLIENT_STATE::handle_scheduler_reply(PROJECT* project, char* scheduler_url)
}
}
if (dup_name) {
msg_printf(project, MSG_USER_ERROR,
msg_printf(project, MSG_USER_ALERT,
"Already attached to a project named %s (possibly with wrong URL)",
project->project_name
);
msg_printf(project, MSG_USER_ERROR,
msg_printf(project, MSG_USER_ALERT,
"Consider detaching this project, then trying again"
);
}
@ -536,7 +534,7 @@ int CLIENT_STATE::handle_scheduler_reply(PROJECT* project, char* scheduler_url)
for (i=0; i<sr.messages.size(); i++) {
USER_MESSAGE& um = sr.messages[i];
sprintf(buf, "Message from server: %s", um.message.c_str());
int prio = (!strcmp(um.priority.c_str(), "high"))?MSG_USER_ERROR:MSG_INFO;
int prio = (!strcmp(um.priority.c_str(), "high"))?MSG_USER_ALERT:MSG_INFO;
show_message(project, buf, prio);
}

View File

@ -559,14 +559,14 @@ int CLIENT_STATE::write_state_file() {
if (retval) {
if ((attempt == MAX_STATE_FILE_WRITE_ATTEMPTS) || log_flags.statefile_debug) {
#ifdef _WIN32
msg_printf(0, MSG_USER_ERROR,
msg_printf(0, MSG_USER_ALERT,
"Can't delete previous state file; %s",
windows_error_string(win_error_msg, sizeof(win_error_msg))
);
#else
msg_printf(0, MSG_USER_ERROR,
"Can't delete previous state file; error %d: %s",
errno, strerror(errno)
msg_printf(0, MSG_USER_ALERT,
"Can't delete previous state file: %s",
strerror(errno)
);
#endif
}
@ -578,14 +578,14 @@ int CLIENT_STATE::write_state_file() {
if (retval) {
if ((attempt == MAX_STATE_FILE_WRITE_ATTEMPTS) || log_flags.statefile_debug) {
#ifdef _WIN32
msg_printf(0, MSG_USER_ERROR,
msg_printf(0, MSG_USER_ALERT,
"Can't rename current state file to previous state file; %s",
windows_error_string(win_error_msg, sizeof(win_error_msg))
);
#else
msg_printf(0, MSG_USER_ERROR,
"rename current state file to previous state file returned error %d: %s",
errno, strerror(errno)
msg_printf(0, MSG_USER_ALERT,
"Can't rename current state file to previous state file: %s",
strerror(errno)
);
#endif
}
@ -604,17 +604,17 @@ int CLIENT_STATE::write_state_file() {
if ((attempt == MAX_STATE_FILE_WRITE_ATTEMPTS) || log_flags.statefile_debug) {
#ifdef _WIN32
if (retval == ERROR_ACCESS_DENIED) {
msg_printf(0, MSG_USER_ERROR,
"Can't rename state file; access denied; check file and directory permissions"
msg_printf(0, MSG_USER_ALERT,
"Can't rename state file; access denied. Check file and directory permissions"
);
} else {
msg_printf(0, MSG_USER_ERROR,
msg_printf(0, MSG_USER_ALERT,
"Can't rename state file; %s",
windows_error_string(win_error_msg, sizeof(win_error_msg))
);
}
#elif defined (__APPLE__)
msg_printf(0, MSG_USER_ERROR,
msg_printf(0, MSG_USER_ALERT,
"Can't rename %s to %s; check file and directory permissions\n"
"rename returned error %d: %s",
STATE_FILE_NEXT, STATE_FILE_NAME, errno, strerror(errno)
@ -623,7 +623,7 @@ int CLIENT_STATE::write_state_file() {
system("ls -al /Library/Application\\ Support/BOINC\\ Data/client*.*");
}
#else
msg_printf(0, MSG_USER_ERROR,
msg_printf(0, MSG_USER_ALERT,
"Can't rename %s to %s; check file and directory permissions",
STATE_FILE_NEXT, STATE_FILE_NAME
);
@ -759,8 +759,9 @@ void CLIENT_STATE::check_anonymous() {
// flag as anonymous even if can't parse file
retval = parse_app_info(p, f);
if (retval) {
msg_printf(p, MSG_USER_ERROR,
"parse error in app_info.xml; check XML syntax"
msg_printf(p, MSG_USER_ALERT,
"Failed to parse app_info.xml for %s; check XML syntax",
p->project_name
);
}
fclose(f);
@ -784,8 +785,9 @@ int CLIENT_STATE::parse_app_info(PROJECT* p, FILE* in) {
continue;
}
if (fip->urls.size()) {
msg_printf(p, MSG_USER_ERROR,
"Can't specify URLs in app_info.xml"
msg_printf(p, MSG_USER_ALERT,
"Can't specify URLs in app_info.xml for %s",
p->project_name
);
delete fip;
continue;
@ -829,8 +831,9 @@ int CLIENT_STATE::parse_app_info(PROJECT* p, FILE* in) {
continue;
}
if (log_flags.unparsed_xml) {
msg_printf(p, MSG_USER_ERROR,
"Unparsed line in app_info.xml: %s", buf
msg_printf(p, MSG_USER_ALERT,
"Unparsed line in app_info.xml for %s: %s",
p->project_name, buf
);
}
}

View File

@ -180,7 +180,7 @@ int GUI_RPC_CONN_SET::get_allowed_hosts() {
if (!(buf[0] =='#' || buf[0] == ';') && strlen(buf) > 0 ) {
retval = resolve_hostname(buf, ipaddr);
if (retval) {
msg_printf(0, MSG_USER_ERROR,
msg_printf(0, MSG_USER_ALERT,
"Can't resolve hostname %s in %s",
buf, REMOTEHOST_FILE_NAME
);
@ -297,13 +297,13 @@ static void show_connect_error(in_addr ia) {
last_time = gstate.now;
}
msg_printf(
NULL, MSG_USER_ERROR,
NULL, MSG_USER_ALERT,
"GUI RPC request from non-allowed address %s",
inet_ntoa(ia)
);
if (count > 1) {
msg_printf(
NULL, MSG_USER_ERROR,
NULL, MSG_USER_ALERT,
"%d connections rejected in last 10 minutes",
count
);

View File

@ -263,7 +263,7 @@ static void handle_project_op(char* buf, MIOFILE& fout, const char* op) {
gstate.request_work_fetch("project resumed by user");
} else if (!strcmp(op, "detach")) {
if (p->attached_via_acct_mgr) {
msg_printf(p, MSG_USER_ERROR,
msg_printf(p, MSG_USER_ALERT,
"This project must be detached using the account manager web site."
);
fout.printf("<error>must detach using account manager</error>");

View File

@ -371,8 +371,8 @@ static void parse_meminfo_linux(HOST_INFO& host) {
double x;
FILE* f = fopen("/proc/meminfo", "r");
if (!f) {
msg_printf(NULL, MSG_USER_ERROR,
"Can't open /proc/meminfo - defaulting to 1 GB."
msg_printf(NULL, MSG_USER_ALERT,
"Can't open /proc/meminfo to get memory size - defaulting to 1 GB."
);
host.m_nbytes = GIGA;
host.m_swap = GIGA;
@ -409,7 +409,9 @@ static void parse_cpuinfo_linux(HOST_INFO& host) {
FILE* f = fopen("/proc/cpuinfo", "r");
if (!f) {
msg_printf(NULL, MSG_USER_ERROR, "Can't open /proc/cpuinfo.");
msg_printf(NULL, MSG_USER_ALERT,
"Can't open /proc/cpuinfo to get CPU info"
);
strcpy(host.p_model, "unknown");
strcpy(host.p_vendor, "unknown");
return;
@ -1281,7 +1283,7 @@ bool HOST_INFO::users_idle(
gEventHandle = NXOpenEventStatus();
if (!gEventHandle) {
if (TickCount() > (120*60)) { // If system has been up for more than 2 minutes
msg_printf(NULL, MSG_USER_ERROR,
msg_printf(NULL, MSG_USER_ALERT,
"User idle detection is disabled: initialization failed."
);
error_posted = true;
@ -1293,7 +1295,7 @@ bool HOST_INFO::users_idle(
if (gEventHandle) {
kernResult = IOHIDGetParameter( gEventHandle, CFSTR(EVSIOIDLE), sizeof(UInt64), &params, &rcnt );
if ( kernResult != kIOReturnSuccess ) {
msg_printf(NULL, MSG_USER_ERROR,
msg_printf(NULL, MSG_USER_ALERT,
"User idle time measurement failed because IOHIDGetParameter failed."
);
error_posted = true;
@ -1308,7 +1310,7 @@ bool HOST_INFO::users_idle(
if ( (!service) || (kernResult != KERN_SUCCESS) ) {
// When the system first starts up, allow time for HIDSystem to be available if needed
if (TickCount() > (120*60)) { // If system has been up for more than 2 minutes
msg_printf(NULL, MSG_USER_ERROR,
msg_printf(NULL, MSG_USER_ALERT,
"Could not connect to HIDSystem: user idle detection is disabled."
);
error_posted = true;

View File

@ -64,7 +64,7 @@ int LOG_FLAGS::parse(XML_PARSER& xp) {
while (!xp.get(tag, sizeof(tag), is_tag)) {
if (!is_tag) {
msg_printf(NULL, MSG_USER_ERROR,
msg_printf(NULL, MSG_USER_ALERT,
"Unexpected text %s in %s", tag, CONFIG_FILE
);
continue;
@ -105,7 +105,7 @@ int LOG_FLAGS::parse(XML_PARSER& xp) {
if (xp.parse_bool(tag, "work_fetch_debug", work_fetch_debug)) continue;
if (xp.parse_bool(tag, "notice_debug", notice_debug)) continue;
msg_printf(NULL, MSG_USER_ERROR, "Unrecognized tag in %s: <%s>\n",
msg_printf(NULL, MSG_USER_ALERT, "Unrecognized tag in %s: <%s>\n",
CONFIG_FILE, tag
);
xp.skip_unexpected(tag, true, "LOG_FLAGS::parse");
@ -274,7 +274,7 @@ int CONFIG::parse_options(XML_PARSER& xp) {
while (!xp.get(tag, sizeof(tag), is_tag)) {
if (!is_tag) {
msg_printf(NULL, MSG_USER_ERROR,
msg_printf(NULL, MSG_USER_ALERT,
"Unexpected text %s in %s", tag, CONFIG_FILE
);
continue;
@ -373,7 +373,7 @@ int CONFIG::parse_options(XML_PARSER& xp) {
continue;
}
msg_printf(NULL, MSG_USER_ERROR, "Unrecognized tag in %s: <%s>\n",
msg_printf(NULL, MSG_USER_ALERT, "Unrecognized tag in %s: <%s>\n",
CONFIG_FILE, tag
);
xp.skip_unexpected(tag, true, "CONFIG::parse_options");
@ -389,12 +389,12 @@ int CONFIG::parse(FILE* f) {
mf.init_file(f);
if (!xp.parse_start("cc_config")) {
msg_printf(NULL, MSG_USER_ERROR, "Missing start tag in %s", CONFIG_FILE);
msg_printf(NULL, MSG_USER_ALERT, "Missing start tag in %s", CONFIG_FILE);
return ERR_XML_PARSE;
}
while (!xp.get(tag, sizeof(tag), is_tag)) {
if (!is_tag) {
msg_printf(NULL, MSG_USER_ERROR,
msg_printf(NULL, MSG_USER_ALERT,
"Unexpected text %s in %s", tag, CONFIG_FILE
);
continue;
@ -408,12 +408,12 @@ int CONFIG::parse(FILE* f) {
parse_options(xp);
continue;
}
msg_printf(NULL, MSG_USER_ERROR, "Unparsed tag in %s: <%s>\n",
msg_printf(NULL, MSG_USER_ALERT, "Unparsed tag in %s: <%s>\n",
CONFIG_FILE, tag
);
xp.skip_unexpected(tag, true, "CONFIG.parse");
}
msg_printf(NULL, MSG_USER_ERROR, "Missing end tag in %s", CONFIG_FILE);
msg_printf(NULL, MSG_USER_ALERT, "Missing end tag in %s", CONFIG_FILE);
return ERR_XML_PARSE;
}

View File

@ -222,7 +222,7 @@ int LOOKUP_WEBSITE_OP::do_rpc(string& url) {
working_proxy_info.need_autodetect_proxy_settings = true;
working_proxy_info.have_autodetect_proxy_settings = false;
msg_printf(0, MSG_USER_ERROR,
msg_printf(0, MSG_USER_ALERT,
"BOINC can't access Internet - check network connection or proxy configuration."
);
} else {
@ -242,7 +242,7 @@ void LOOKUP_WEBSITE_OP::handle_reply(int http_op_retval) {
if (http_op_retval) {
net_status.need_physical_connection = true;
net_status.last_comm_time = 0;
msg_printf(0, MSG_USER_ERROR,
msg_printf(0, MSG_USER_ALERT,
"BOINC can't access Internet - check network connection or proxy configuration."
);
} else {

View File

@ -646,7 +646,7 @@ wxListItemAttr* CDlgEventLog::OnListGetItemAttr(long item) const {
if (message) {
switch(message->priority) {
case MSG_USER_ERROR:
case MSG_USER_ALERT:
pAttribute = m_pMessageErrorAttr;
break;
default:

View File

@ -445,7 +445,7 @@ wxListItemAttr* CViewMessages::OnListGetItemAttr(long item) const {
if (message) {
switch(message->priority) {
case MSG_USER_ERROR:
case MSG_USER_ALERT:
pAttribute = item % 2 ? m_pMessageErrorGrayAttr : m_pMessageErrorAttr;
break;
default:

View File

@ -571,7 +571,7 @@ wxListItemAttr* CPanelMessages::OnListGetItemAttr(long item) const {
if (message) {
switch(message->priority) {
case MSG_USER_ERROR:
case MSG_USER_ALERT:
pAttribute = m_pMessageErrorAttr;
break;
default:

View File

@ -742,7 +742,7 @@ void CProjectsComponent::OnMessageCheck(wxTimerEvent& WXUNUSED(event)) {
for(size_t i=lastMessageId; i < pDoc->messages.messages.size(); i++) {
lastMessageId = i+1;
message = pDoc->message((unsigned int) i);
if ( message != NULL && message->priority == MSG_USER_ERROR ) {
if ( message != NULL && message->priority == MSG_USER_ALERT ) {
receivedErrorMessage = true;
checkForMessagesTimer->Stop();
break;

View File

@ -85,18 +85,17 @@
//
#define MSG_INFO 1
// write to stdout
// GUI: write to msg window
#define MSG_USER_ERROR 2
// Conditions that require user intervention;
// text should be user-friendly.
// GUI: show in event log
#define MSG_USER_ALERT 2
// Conditions that require user intervention.
// Text should be user-friendly.
// write to stdout
// GUI: write to msg window in bold or red
// GUI: show in event log in bold or red; show in notices tab
#define MSG_INTERNAL_ERROR 3
// Conditions that indicate a problem or bug with BOINC itself,
// or with a BOINC project or account manager.
// treat same as MSG_INFO, but prepend with [error]
// bitmap defs for task_suspend_reason, network_suspend_reason
// Note: doesn't need to be a bitmap, but keep for compatibility
//