X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_httpd_config.cpp;h=8333d9f9cabf13e12693824eeeade8964c9e3007;hb=ad47ea662698e72ff8f79b03512b1e7fe81bdf53;hp=f79f0c2a4a1f0cb7e4496b7987aaa02806990eeb;hpb=9d4004e8d477232c143830508a7a6e41fd2d31b7;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_httpd_config.cpp b/src/modules/m_httpd_config.cpp index f79f0c2a4..8333d9f9c 100644 --- a/src/modules/m_httpd_config.cpp +++ b/src/modules/m_httpd_config.cpp @@ -1,28 +1,35 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ +/* + * InspIRCd -- Internet Relay Chat Daemon * - * InspIRCd: (C) 2002-2010 InspIRCd Development Team - * See: http://wiki.inspircd.org/Credits + * Copyright (C) 2009-2010 Daniel De Graaf + * Copyright (C) 2008 Craig Edwards * - * This program is free but copyrighted software; see - * the file COPYING for details. + * 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 + * License as published by the Free Software Foundation, version 2. * - * --------------------------------------------------- + * This program 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 General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ + #include "inspircd.h" -#include "httpd.h" +#include "modules/httpd.h" #include "protocol.h" -/* $ModDesc: Provides statistics over HTTP via m_httpd.so */ - class ModuleHttpConfig : public Module { + HTTPdAPI API; + public: - ModuleHttpConfig() { - Implementation eventlist[] = { I_OnEvent }; - ServerInstance->Modules->Attach(eventlist, this, 1); + ModuleHttpConfig() + : API(this) + { } std::string Sanitize(const std::string &str) @@ -59,13 +66,13 @@ class ModuleHttpConfig : public Module return ret; } - void OnEvent(Event& event) + void OnEvent(Event& event) CXX11_OVERRIDE { std::stringstream data(""); if (event.id == "httpd_url") { - ServerInstance->Logs->Log("m_http_stats", DEBUG,"Handling httpd event"); + ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Handling httpd event"); HTTPRequest* http = (HTTPRequest*)&event; if ((http->GetURI() == "/config") || (http->GetURI() == "/config/")) @@ -87,20 +94,16 @@ class ModuleHttpConfig : public Module data << ""; /* Send the document back to m_httpd */ HTTPDocumentResponse response(this, *http, &data, 200); - response.headers.SetHeader("X-Powered-By", "m_httpd_config.so"); + response.headers.SetHeader("X-Powered-By", MODNAME); response.headers.SetHeader("Content-Type", "text/html"); - response.Send(); + API->SendResponse(response); } } } - virtual ~ModuleHttpConfig() - { - } - - virtual Version GetVersion() + Version GetVersion() CXX11_OVERRIDE { - return Version("Provides configuration over HTTP via m_httpd.so", VF_VENDOR); + return Version("Allows for the server configuration to be viewed over HTTP via m_httpd.so", VF_VENDOR); } };