- boinccmd: add --get_notices option

svn path=/trunk/boinc/; revision=20089
This commit is contained in:
David Anderson 2010-01-07 04:55:11 +00:00
parent 2ac1ae43cf
commit 0388c6d7e0
3 changed files with 86 additions and 58 deletions

View File

@ -162,3 +162,9 @@ Charlie 6 Jan 2010
client/
cs_notice.cpp
David 6 Jan 2010
- boinccmd: add --get_notices option
client/
boinc_cmd.cpp

View File

@ -70,6 +70,7 @@ Commands:\n\
--get_proxy_settings\n\
--get_messages [ seqno ] show messages > seqno\n\
--get_message_count show largest message seqno\n\
--get_notices [ seqno ] show notices > seqno\n\
--get_host_info\n\
--version, -V show core client version\n\
--result url result_name op job operation\n\
@ -138,6 +139,7 @@ int main(int argc, char** argv) {
RPC_CLIENT rpc;
int i, retval, port=0;
MESSAGES messages;
NOTICES notices;
char passwd_buf[256], hostname_buf[256], *hostname=0;
char* passwd = passwd_buf, *p;
@ -391,6 +393,26 @@ int main(int argc, char** argv) {
);
}
}
} else if (!strcmp(cmd, "--get_notices")) {
int seqno;
if (i == argc) {
seqno = 0;
} else {
seqno = atoi(next_arg(argc, argv, i));
}
retval = rpc.get_notices(seqno, notices);
if (!retval) {
unsigned int j;
for (j=0; j<notices.notices.size(); j++) {
NOTICE& n = *notices.notices[j];
strip_whitespace(n.description);
printf("%d: (%s) %s\n",
n.seqno,
time_to_string(n.create_time),
n.description.c_str()
);
}
}
} else if (!strcmp(cmd, "--get_host_info")) {
HOST_INFO hi;
retval = rpc.get_host_info(hi);

View File

@ -1,58 +1,58 @@
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2009 University of California
//
// BOINC 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 3 of the License, or (at your option) any later version.
//
// BOINC 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.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
#ifndef __NOTICE_H__
#define __NOTICE_H__
#include <string>
#include "parse.h"
// represents a notice delivered from client to GUI
class NOTICE {
public:
int seqno;
char title[256];
std::string description;
double create_time;
double arrival_time; // when item arrived at client
bool is_private;
char category[64];
// assigned by RSS source. Reserved values:
// "client": generated by client
// "server": scheduler RPC message
char link[256];
// URL where original message can be seen, if any
char project_name[64];
// if notice is associated with a project
// the following fields used in client only (not reported to GUI)
char guid[256];
char feed_url[256];
// URL of RSS feed, or blank
NOTICE();
~NOTICE();
int parse(XML_PARSER&);
int parse_rss(XML_PARSER&);
void write(MIOFILE&, bool for_gui);
void clear();
};
#endif
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2009 University of California
//
// BOINC 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 3 of the License, or (at your option) any later version.
//
// BOINC 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.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
#ifndef __NOTICE_H__
#define __NOTICE_H__
#include <string>
#include "parse.h"
// represents a notice delivered from client to GUI
class NOTICE {
public:
int seqno;
char title[256];
std::string description;
double create_time;
double arrival_time; // when item arrived at client
bool is_private;
char category[64];
// assigned by RSS source. Reserved values:
// "client": generated by client
// "server": scheduler RPC message
char link[256];
// URL where original message can be seen, if any
char project_name[64];
// if notice is associated with a project
// the following fields used in client only (not reported to GUI)
char guid[256];
char feed_url[256];
// URL of RSS feed, or blank
NOTICE();
~NOTICE();
int parse(XML_PARSER&);
int parse_rss(XML_PARSER&);
void write(MIOFILE&, bool for_gui);
void clear();
};
#endif