source: trunk/gsdl/src/recpt/pingaction.cpp@ 919

Last change on this file since 919 was 760, checked in by sjboddie, 24 years ago

changes to arguments of many functions

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1/**********************************************************************
2 *
3 * pingaction.cpp --
4 * Copyright (C) 1999 The New Zealand Digital Library Project
5 *
6 * A component of the Greenstone digital library software
7 * from the New Zealand Digital Library Project at the
8 * University of Waikato, New Zealand.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 * $Id: pingaction.cpp 760 1999-11-01 21:56:32Z sjboddie $
25 *
26 *********************************************************************/
27
28/*
29 $Log$
30 Revision 1.5 1999/11/01 21:56:32 sjboddie
31 changes to arguments of many functions
32
33 Revision 1.4 1999/09/07 04:56:57 sjboddie
34 added GPL notice
35
36 Revision 1.3 1999/07/30 02:24:45 sjboddie
37 added collectinfo argument to some functions
38
39 Revision 1.2 1999/02/25 21:58:59 rjmcnab
40
41 Merged sources.
42
43 Revision 1.1 1999/02/21 22:35:20 rjmcnab
44
45 Initial revision.
46
47 */
48
49
50#include "pingaction.h"
51
52pingaction::pingaction () {
53 // this action uses cgi variable "a"
54 cgiarginfo arg_ainfo;
55 arg_ainfo.shortname = "a";
56 arg_ainfo.longname = "action";
57 arg_ainfo.multiplechar = true;
58 arg_ainfo.defaultstatus = cgiarginfo::weak;
59 arg_ainfo.argdefault = "ping";
60 arg_ainfo.savedarginfo = cgiarginfo::must;
61
62 argsinfo.addarginfo (NULL, arg_ainfo);
63
64}
65
66void pingaction::get_cgihead_info (cgiargsclass &/*args*/, recptprotolistclass * /*protos*/,
67 response_t &response, text_t &response_data,
68 ostream &/*logout*/) {
69 response = content;
70 response_data = "text/html";
71}
72
73
74bool pingaction::do_action (cgiargsclass &args, recptprotolistclass *protos,
75 browsermapclass * /*browsers*/, displayclass &/*disp*/,
76 outconvertclass &outconvert, ostream &textout,
77 ostream &logout) {
78 bool wassuccess = false;
79 comerror_t err;
80
81 recptproto *collectproto = protos->getrecptproto (args["c"], logout);
82 if (!args["c"].empty() && (collectproto != NULL)) {
83 collectproto->ping (args["c"], wassuccess, err, logout);
84 if (err != noError) wassuccess = false; // a communication error
85 }
86
87 textout << outconvert
88 << "<html>\n"
89 << "<head>\n"
90 << "<title>Ping</title>\n"
91 << "</head>\n"
92 << "<body>\n"
93 << "Ping for \"" << args["c"] << "\" ";
94
95 if (wassuccess) {
96 textout << outconvert << " succeeded.\n";
97 } else {
98 textout << outconvert << " did not succeed.\n";
99 }
100
101 textout << outconvert
102 << "</body>\n"
103 << "</html>\n";
104
105 return true;
106};
Note: See TracBrowser for help on using the repository browser.