X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_httpd_stats.cpp;h=1e9f4ef4b92f6d8a33809b5b70d4778b6cfed8e1;hb=e2b0f3dc9ef4d56c71d7abda13e6139ca092e387;hp=3be8ec9703562225257e496016a01a5a81d964ac;hpb=87b1461e2a4710a38b32186c2582da9fe9bb3804;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 3be8ec970..1e9f4ef4b 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -1,11 +1,19 @@ /* * InspIRCd -- Internet Relay Chat Daemon * + * Copyright (C) 2019 linuxdaemon + * Copyright (C) 2018 Matt Schatz + * Copyright (C) 2016 Johanna A + * Copyright (C) 2013-2016 Attila Molnar + * Copyright (C) 2013, 2017, 2019-2020 Sadie Powell + * Copyright (C) 2012 Robby + * Copyright (C) 2009 Uli Schlachter * Copyright (C) 2009 Daniel De Graaf - * Copyright (C) 2007-2008 Robin Burchell + * Copyright (C) 2008-2009 Robin Burchell * Copyright (C) 2008 Pippijn van Steenhoven - * Copyright (C) 2006-2008 Craig Edwards + * Copyright (C) 2007 John Brooks * Copyright (C) 2007 Dennis Friis + * Copyright (C) 2006-2008, 2010 Craig Edwards * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public @@ -86,7 +94,7 @@ namespace Stats for (Extensible::ExtensibleStore::const_iterator i = ext->GetExtList().begin(); i != ext->GetExtList().end(); i++) { ExtensionItem* item = i->first; - std::string value = item->serialize(FORMAT_USER, ext, i->second); + std::string value = item->ToHuman(ext, i->second); if (!value.empty()) data << "name << "\">" << Sanitize(value) << ""; else if (!item->name.empty()) @@ -415,32 +423,27 @@ class ModuleHttpStats : public Module, public HTTPRequestEventListener ModResult HandleRequest(HTTPRequest* http) { - std::string path = http->GetPath(); - - if (path != "/stats" && path.substr(0, 7) != "/stats/") + if (http->GetPath() != "/stats") return MOD_RES_PASSTHRU; - if (path[path.size() - 1] == '/') - path.erase(path.size() - 1, 1); - - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Handling httpd event"); + ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Handling HTTP request for %s", http->GetPath().c_str()); bool found = true; std::stringstream data; data << ""; - if (path == "/stats") + if (http->GetPath() == "/stats") { data << Stats::ServerInfo << Stats::General << Stats::XLines << Stats::Modules << Stats::Channels << Stats::Users << Stats::Servers << Stats::Commands; } - else if (path == "/stats/general") + else if (http->GetPath() == "/stats/general") { data << Stats::General; } - else if (path == "/stats/users") + else if (http->GetPath() == "/stats/users") { if (enableparams) Stats::ListUsers(data, http->GetParsedURI().query_params); @@ -477,7 +480,7 @@ class ModuleHttpStats : public Module, public HTTPRequestEventListener Version GetVersion() CXX11_OVERRIDE { - return Version("Provides statistics over HTTP via m_httpd", VF_VENDOR); + return Version("Provides XML-serialised statistics about the server, channels, and users over HTTP via the /stats path.", VF_VENDOR); } };