#include <NServer.h>
Inheritance diagram for LServer:

Public Member Functions | |
| LServer (const char *spooldir) | |
| virtual | ~LServer () |
| virtual ActiveDB * | active () |
| News retrieval function. | |
| virtual GroupInfo * | groupinfo (const char *name) |
| virtual Newsgroup * | getgroup (const char *name) |
| virtual int | post (Article *article) |
Protected Member Functions | |
| LServer () | |
| void | init (const char *spooldir) |
Protected Attributes | |
| char | _SpoolDirectory [MAXPATHLEN] |
| ArtSpooler * | pSpool |
Definition at line 145 of file NServer.h.
|
|
Definition at line 150 of file NServer.h. References _SpoolDirectory, and pSpool.
00150 :NServer(), pSpool(0) { 00151 _SpoolDirectory[0] = '\0'; 00152 } void init(const char *spooldir); |
|
|
Construct an LServer class
Definition at line 94 of file NServer.cc. References init(), slog, and VERB.
|
|
|
Definition at line 101 of file NServer.cc. References Logger::p(), pSpool, slog, and VERB.
|
|
|
News retrieval function.
Implements NServer. Reimplemented in CServer. Definition at line 131 of file NServer.cc.
00132 {
00133 return _ActiveDB;
00134 }
|
|
|
Return the newsgroup with name >name<. If the newsgroup does not exist, NULL will be returned.
Implements NServer. Reimplemented in CServer. Definition at line 154 of file NServer.cc. References _SpoolDirectory, ERROR_LOCATION, ActiveDB::hasgroup(), slog, and VERB.
00155 {
00156 VERB(slog.
00157 p(Logger::Debug) << "LServer::getgroup(" << name << ")\n");
00158 if (!_ActiveDB->hasgroup(name))
00159 throw NoSuchGroupError("no such group", ERROR_LOCATION);
00160 return new NVNewsgroup(_OverviewFormat, _SpoolDirectory, name);
00161 }
|
|
|
Implements NServer. Reimplemented in CServer. Definition at line 136 of file NServer.cc. References ASSERT, ERROR_LOCATION, ActiveDB::get(), slog, and VERB. Referenced by CServer::groupinfo().
00137 {
00138 VERB(slog.
00139 p(Logger::Debug) << "LServer::groupinfo(" << name << ")\n");
00140 static GroupInfo agroup;
00141
00142 ASSERT(if (strlen(name) > 512) {
00143 throw
00144 AssertionError
00145 ("LServer::groupinfo: name of newsgroup too long\n",
00146 ERROR_LOCATION);}
00147 );
00148
00149 if (_ActiveDB->get(name, &agroup) < 0)
00150 throw NoSuchGroupError("no such group", ERROR_LOCATION);
00151 return &agroup;
00152 }
|
|
|
Definition at line 109 of file NServer.cc. References _SpoolDirectory, ASSERT, ERROR_LOCATION, MAXGROUPNAMELEN, pSpool, slog, and VERB. Referenced by CServer::CServer(), and LServer().
00110 {
00111 VERB(slog.
00112 p(Logger::Debug) << "LServer::init(" << spooldir << ")\n");
00113
00114 ASSERT(if
00115 (strlen(spooldir) >
00116 sizeof(_SpoolDirectory) - MAXGROUPNAMELEN - 16) {
00117 throw
00118 AssertionError
00119 ("name of spooldirectory too long. longest groupname+spooldirlength does not fit into maxpathlen",
00120 ERROR_LOCATION);}
00121 );
00122 strcpy(_SpoolDirectory, spooldir);
00123 pSpool = new ArtSpooler(spooldir);
00124
00125 if (!_OverviewFormat)
00126 _OverviewFormat = new OverviewFmt();
00127 if (!_ActiveDB)
00128 _ActiveDB = NULL;
00129 }
|
|
|
Post an article to the news server.
Implements NServer. Reimplemented in CServer. Definition at line 163 of file NServer.cc.
00164 {
00165 // TRACE(ctrace << "LServer::post(Article*)\n");
00166 // char fn[1024];
00167 // fstream fs;
00168 // int qnbr;
00169
00170 // sprintf(fn,".outgoing/.qnbr");
00171 // fs.open(fn,ios::in|ios::out);
00172 // fs >> qnbr;
00173 // if(!fs.good()) {
00174 // qnbr=0;
00175 // fs.clear();
00176 // }
00177 // fs.seekp(0,ios::beg);
00178 // fs << qnbr+1 << endl;
00179 // if(!fs.good()) {
00180 // DEBUG(cdbg << "Failure on .outgoing/.qnbr\n");
00181 // }
00182 // fs.close();
00183
00184 // DEBUG(cdbg << "LServer: qnbr=" << qnbr << endl << article << endl);
00185
00186 // sprintf(fn,".outgoing/a%d",qnbr);
00187 // fs.open(fn,ios::out);
00188 // fs.unsetf(ios::skipws);
00189 // fs << article;
00190 // fs.close();
00191 return -1;
00192 }
|
|
|
Definition at line 147 of file NServer.h. Referenced by getgroup(), init(), and LServer(). |
|
|
Definition at line 148 of file NServer.h. Referenced by init(), LServer(), and ~LServer(). |
1.3.6-20040222