Skip to content

Commit

Permalink
Merge pull request #5678 from BOINC/dpa_log_tag
Browse files Browse the repository at this point in the history
  • Loading branch information
AenBleidd authored Jul 6, 2024
2 parents d1fc269 + 8a68fc1 commit 126d81d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 22 deletions.
30 changes: 21 additions & 9 deletions client/client_msgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,8 @@ void show_message(
//
diagnostics_cycle_logs();

strlcpy(message, msg, sizeof(message));

// trim trailing \n's
//
while (strlen(message) && message[strlen(message)-1] == '\n') {
message[strlen(message)-1] = 0;
}
safe_strcpy(message, msg);
strip_whitespace(message);

// add a message
//
Expand All @@ -84,9 +79,22 @@ void show_message(
default:
strlcpy(event_msg, message, sizeof(event_msg));
}

// The event log doesn't display HTML, so strip tags
// The only case of this is
// A new version of BOINC is available (8.0.2). <a href=https://boinc.berkeley.edu/download.php>Download</a>
// so do it in a crude way.
//
if (is_html) {
char *q = strchr(event_msg, '<');
if (q) {
*q = 0;
strip_whitespace(event_msg);
}
}
message_descs.insert(p, priority, (int)t, event_msg);

// add a notice
// add a notice if needed
//
switch (priority) {
case MSG_USER_ALERT:
Expand Down Expand Up @@ -151,7 +159,11 @@ void msg_printf(PROJ_AM *p, int priority, const char *fmt, ...) {
show_message(p, buf, priority, true, 0);
}

void msg_printf_notice(PROJ_AM *p, bool is_html, const char* link, const char *fmt, ...) {
void msg_printf_notice(
PROJ_AM *p,
bool is_html, // msg has HTML tags; don't XML-escape it
const char* link, const char *fmt, ...
) {
char buf[8192]; // output can be much longer than format
va_list ap;

Expand Down
26 changes: 13 additions & 13 deletions client/current_version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@ static bool parse_version(FILE* f, char* new_version, int len) {
if (xp.match_tag("/version")) {
#ifdef __APPLE__
return (same_platform
&& newer_version_exists
&& min_macos_OK
&& max_macos_OK
);
&& newer_version_exists
&& min_macos_OK
&& max_macos_OK
);
#else
return (same_platform && newer_version_exists);
#endif
Expand All @@ -215,11 +215,11 @@ static bool parse_version(FILE* f, char* new_version, int len) {
}
if (xp.parse_str("version_num", buf2, sizeof(buf2))) {
newer_version_exists = is_version_newer(
buf2,
gstate.core_client_version.major,
gstate.core_client_version.minor,
gstate.core_client_version.release
);
buf2,
gstate.core_client_version.major,
gstate.core_client_version.minor,
gstate.core_client_version.release
);
strlcpy(new_version, buf2, len);
}
#ifdef __APPLE__
Expand Down Expand Up @@ -307,10 +307,10 @@ void newer_version_startup_check() {

if (!gstate.newer_version.empty()) {
if (is_version_newer(gstate.newer_version.c_str(),
gstate.core_client_version.major,
gstate.core_client_version.minor,
gstate.core_client_version.release)
) {
gstate.core_client_version.major,
gstate.core_client_version.minor,
gstate.core_client_version.release)
) {
show_newer_version_msg(gstate.newer_version.c_str());
} else {
gstate.newer_version = "";
Expand Down

0 comments on commit 126d81d

Please sign in to comment.