2001-01-26 16:38:23 +00:00
|
|
|
// This file may be redistributed and modified only under the terms of
|
2001-03-16 11:38:14 +00:00
|
|
|
// the GNU General Public License (See COPYING for details).
|
2001-04-16 16:26:44 +00:00
|
|
|
// Copyright (C) 2000,2001 Alistair Riddoch
|
2001-01-26 16:38:23 +00:00
|
|
|
|
2000-08-13 20:36:18 +00:00
|
|
|
#include <Atlas/Message/Object.h>
|
|
|
|
|
#include <Atlas/Objects/Root.h>
|
2000-08-19 16:42:18 +00:00
|
|
|
#include <Atlas/Objects/Operation/Login.h>
|
2000-08-13 20:36:18 +00:00
|
|
|
|
2001-04-10 19:05:14 +00:00
|
|
|
#include "ServerRouting_methods.h"
|
2001-02-28 12:03:02 +00:00
|
|
|
#include "CommServer.h"
|
2001-04-16 16:26:44 +00:00
|
|
|
#include "Account.h"
|
2000-08-13 20:36:18 +00:00
|
|
|
|
2000-11-10 00:57:34 +00:00
|
|
|
#include <common/persistance.h>
|
|
|
|
|
|
2001-04-16 16:26:44 +00:00
|
|
|
using Atlas::Message::Object;
|
2000-08-13 20:36:18 +00:00
|
|
|
|
2001-04-11 14:34:15 +00:00
|
|
|
ServerRouting::ServerRouting(CommServer & server, const string & name) :
|
2001-04-16 16:26:44 +00:00
|
|
|
commServer(server), svrName(name), world(*new WorldRouter(*this))
|
2000-08-13 20:36:18 +00:00
|
|
|
{
|
2000-08-27 18:00:38 +00:00
|
|
|
fullid = name;
|
2001-04-11 14:34:15 +00:00
|
|
|
idDict[fullid] = this;
|
2001-04-16 16:26:44 +00:00
|
|
|
Account * adm = Persistance::load_admin_account();
|
|
|
|
|
addObject(adm);
|
|
|
|
|
adm->world=&world;
|
2000-08-13 20:36:18 +00:00
|
|
|
}
|
2001-02-19 18:50:53 +00:00
|
|
|
|
2001-04-11 14:34:15 +00:00
|
|
|
ServerRouting::~ServerRouting()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2001-04-12 11:13:06 +00:00
|
|
|
void ServerRouting::addToObject(Object & obj) const
|
2001-02-19 18:50:53 +00:00
|
|
|
{
|
2001-04-12 11:13:06 +00:00
|
|
|
Object::MapType & omap = obj.AsMap();
|
2001-02-19 18:50:53 +00:00
|
|
|
omap["server"] = "cyphesis";
|
2001-04-11 14:34:15 +00:00
|
|
|
omap["ruleset"] = svrName;
|
2001-02-26 14:41:10 +00:00
|
|
|
Object::ListType plist(1, "server");
|
|
|
|
|
omap["parents"] = plist;
|
2001-04-11 14:34:15 +00:00
|
|
|
omap["clients"] = commServer.numClients();
|
2001-04-16 16:26:44 +00:00
|
|
|
omap["uptime"] = world.upTime();
|
2001-03-15 11:41:34 +00:00
|
|
|
if (Persistance::restricted) {
|
|
|
|
|
omap["restricted"] = "true";
|
|
|
|
|
}
|
2001-02-26 14:41:10 +00:00
|
|
|
|
2001-02-19 18:50:53 +00:00
|
|
|
// We could add all sorts of stats here, but I don't know exactly what yet.
|
|
|
|
|
}
|