From 711430b081f6596db349243b3712cdbd4eba12af Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 22 Dec 2009 17:11:59 +0000 Subject: [PATCH] - more notice stuff svn path=/trunk/boinc/; revision=20011 --- client/app.cpp | 2 -- client/cs_notice.cpp | 83 +++++++++++++++++++++++++------------------- 2 files changed, 48 insertions(+), 37 deletions(-) diff --git a/client/app.cpp b/client/app.cpp index abc4d46885..7f5882e449 100644 --- a/client/app.cpp +++ b/client/app.cpp @@ -533,7 +533,6 @@ int ACTIVE_TASK::write(MIOFILE& fout) { " %d\n" " %d\n" " %d\n" - " %d\n" " %f\n" " %f\n" " %f\n" @@ -547,7 +546,6 @@ int ACTIVE_TASK::write(MIOFILE& fout) { task_state(), app_version->version_num, slot, - pid, checkpoint_cpu_time, checkpoint_elapsed_time, fraction_done, diff --git a/client/cs_notice.cpp b/client/cs_notice.cpp index 83c90cb316..b8dc7f58e5 100644 --- a/client/cs_notice.cpp +++ b/client/cs_notice.cpp @@ -23,6 +23,7 @@ #include "filesys.h" #include "client_state.h" +#include "client_msgs.h" #include "file_names.h" #include "cs_notice.h" @@ -111,9 +112,15 @@ void RSS_FEED::read_feed_file() { int RSS_FEED::parse_desc(XML_PARSER& xp) { char tag[256]; bool is_tag; + strcpy(url, ""); + poll_interval = 0; while (!xp.get(tag, sizeof(tag), is_tag)) { if (!is_tag) continue; - if (!strcmp(tag, "/notice_feed")) return 0; + if (!strcmp(tag, "/notice_feed")) { + if (!poll_interval) return ERR_XML_PARSE; + if (!strlen(url)) return ERR_XML_PARSE; + return 0; + } if (xp.parse_str(tag, "url", url, sizeof(url))) continue; if (xp.parse_double(tag, "poll_interval", poll_interval)) continue; } @@ -229,7 +236,13 @@ int parse_notice_feeds(MIOFILE& fin, vector& feeds) { if (!strcmp(tag, "notice_feed")) { RSS_FEED rf; retval = rf.parse_desc(xp); - if (!retval) { + if (retval) { + if (log_flags.sched_op_debug) { + msg_printf(0, MSG_INFO, + "[sched_op_debug] error in element" + ); + } + } else { feeds.push_back(rf); } } @@ -355,39 +368,39 @@ void handle_sr_feeds(vector& feeds, PROJECT* p) { #ifdef _WIN32 // compensate for lameness -static int month_index(char* x) { - if (strstr(x, "Jan")) return 0; - if (strstr(x, "Feb")) return 1; - if (strstr(x, "Mar")) return 2; - if (strstr(x, "Apr")) return 3; - if (strstr(x, "May")) return 4; - if (strstr(x, "Jun")) return 5; - if (strstr(x, "Jul")) return 6; - if (strstr(x, "Aug")) return 7; - if (strstr(x, "Sep")) return 8; - if (strstr(x, "Oct")) return 9; - if (strstr(x, "Nov")) return 10; - if (strstr(x, "Dev")) return 11; - return 0; -} - -static int parse_rss_time(char* buf) { - char day_name[64], month_name[64]; - int day_num, year, h, m, s; - int n = sscanf(buf, "%s %d %s %d %d:%d:%d", - day_name, &day_num, month_name, &year, &h, &m, &s - ); - printf("n: %d\n", n); - - struct tm tm; - tm.tm_sec = s; - tm.tm_min = m; - tm.tm_hour = h; - tm.tm_mday = day_num; - tm.tm_mon = month_index(month_name); - tm.tm_year = year-1900; - tm.tm_wday = 0; - tm.tm_yday = 0; +static int month_index(char* x) { + if (strstr(x, "Jan")) return 0; + if (strstr(x, "Feb")) return 1; + if (strstr(x, "Mar")) return 2; + if (strstr(x, "Apr")) return 3; + if (strstr(x, "May")) return 4; + if (strstr(x, "Jun")) return 5; + if (strstr(x, "Jul")) return 6; + if (strstr(x, "Aug")) return 7; + if (strstr(x, "Sep")) return 8; + if (strstr(x, "Oct")) return 9; + if (strstr(x, "Nov")) return 10; + if (strstr(x, "Dev")) return 11; + return 0; +} + +static int parse_rss_time(char* buf) { + char day_name[64], month_name[64]; + int day_num, year, h, m, s; + int n = sscanf(buf, "%s %d %s %d %d:%d:%d", + day_name, &day_num, month_name, &year, &h, &m, &s + ); + printf("n: %d\n", n); + + struct tm tm; + tm.tm_sec = s; + tm.tm_min = m; + tm.tm_hour = h; + tm.tm_mday = day_num; + tm.tm_mon = month_index(month_name); + tm.tm_year = year-1900; + tm.tm_wday = 0; + tm.tm_yday = 0; tm.tm_isdst = 0; int t = mktime(&tm);