]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/commands/cmd_info.cpp
6e5f2a90996ee45527ae45826e38b9f962a965dd
[user/henk/code/inspircd.git] / src / commands / cmd_info.cpp
1 /*
2  * InspIRCd -- Internet Relay Chat Daemon
3  *
4  *   Copyright (C) 2011 Jackmcbarn <jackmcbarn@jackmcbarn.no-ip.org>
5  *   Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
6  *   Copyright (C) 2007-2008 Robin Burchell <robin+git@viroteck.net>
7  *   Copyright (C) 2008 Thomas Stagner <aquanight@inspircd.org>
8  *
9  * This file is part of InspIRCd.  InspIRCd is free software: you can
10  * redistribute it and/or modify it under the terms of the GNU General Public
11  * License as published by the Free Software Foundation, version 2.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20  */
21
22
23 #include "inspircd.h"
24
25 /** Handle /INFO. These command handlers can be reloaded by the core,
26  * and handle basic RFC1459 commands. Commands within modules work
27  * the same way, however, they can be fully unloaded, where these
28  * may not.
29  */
30 class CommandInfo : public Command
31 {
32  public:
33         /** Constructor for info.
34          */
35         CommandInfo ( Module* parent) : Command(parent,"INFO") { syntax = "[<servermask>]"; }
36         /** Handle command.
37          * @param parameters The parameters to the comamnd
38          * @param pcnt The number of parameters passed to teh command
39          * @param user The user issuing the command
40          * @return A value from CmdResult to indicate command success or failure.
41          */
42         CmdResult Handle(const std::vector<std::string>& parameters, User *user);
43         RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
44         {
45                 if (parameters.size() > 0)
46                         return ROUTE_UNICAST(parameters[0]);
47                 return ROUTE_LOCALONLY;
48         }
49 };
50
51 static const char* const lines[] = {
52         "                   -/\\- \2InspIRCd\2 -\\/-",
53         "                 November 2002 - Present",
54         " ",
55         "\2Core Developers\2:",
56         "    Craig Edwards,          Brain,      <brain@inspircd.org>",
57         "    Craig McLure,           Craig,      <craig@inspircd.org>",
58         "    Robin Burchell,         w00t,       <w00t@inspircd.org>",
59         "    Oliver Lupton,          Om,         <om@inspircd.org>",
60         "    John Brooks,            Special,    <special@inspircd.org>",
61         "    Dennis Friis,           peavey,     <peavey@inspircd.org>",
62         "    Thomas Stagner,         aquanight,  <aquanight@inspircd.org>",
63         "    Uli Schlachter,         psychon,    <psychon@inspircd.org>",
64         "    Matt Smith,             dz,         <dz@inspircd.org>",
65         "    Daniel De Graaf,        danieldg,   <danieldg@inspircd.org>",
66         "                            jackmcbarn, <jackmcbarn@inspircd.org>",
67         "    Attila Molnar,          Attila,     <attilamolnar@hush.com>",
68         " ",
69         "\2Regular Contributors\2:",
70         "    Adam           SaberUK",
71         " ",
72         "\2Other Contributors\2:",
73         "    ChrisTX        Shawn           Shutter",
74         " ",
75         "\2Former Contributors\2:",
76         "   dmb             Zaba            skenmy         GreenReaper",
77         "   Dan             Jason           satmd          owine",
78         "   Adremelech      John2           jilles         HiroP",
79         "   eggy            Bricker         AnMaster       djGrrr",
80         "   nenolod         Quension        praetorian     pippijn",
81         "   CC              jamie           typobox43      Burlex (win32)",
82         "   Stskeeps        ThaPrince       BuildSmart     Thunderhacker",
83         "   Skip            LeaChim         Majic          MacGyver",
84         "   Namegduf        Ankit           Phoenix        Taros",
85         " ",
86         "\2Thanks To\2:",
87         "   searchirc.com   irc-junkie.org  Brik           fraggeln",
88         " ",
89         " Best experienced with: \2An IRC client\2",
90         NULL
91 };
92
93 /** Handle /INFO
94  */
95 CmdResult CommandInfo::Handle (const std::vector<std::string>& parameters, User *user)
96 {
97         if (parameters.size() > 0 && parameters[0] != ServerInstance->Config->ServerName)
98                 return CMD_SUCCESS;
99
100         int i=0;
101         while (lines[i])
102                 user->SendText(":%s %03d %s :%s", ServerInstance->Config->ServerName.c_str(), RPL_INFO, user->nick.c_str(), lines[i++]);
103         FOREACH_MOD(I_OnInfo,OnInfo(user));
104         user->SendText(":%s %03d %s :End of /INFO list", ServerInstance->Config->ServerName.c_str(), RPL_ENDOFINFO, user->nick.c_str());
105         return CMD_SUCCESS;
106 }
107
108 COMMAND_INIT(CommandInfo)