]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/commands/cmd_info.cpp
Fix MySQL crash on module unload with empty query queue
[user/henk/code/inspircd.git] / src / commands / cmd_info.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
6  * See: http://wiki.inspircd.org/Credits
7  *
8  * This program is free but copyrighted software; see
9  *            the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 #include "inspircd.h"
15
16 /** Handle /INFO. These command handlers can be reloaded by the core,
17  * and handle basic RFC1459 commands. Commands within modules work
18  * the same way, however, they can be fully unloaded, where these
19  * may not.
20  */
21 class CommandInfo : public Command
22 {
23  public:
24         /** Constructor for info.
25          */
26         CommandInfo ( Module* parent) : Command(parent,"INFO") { syntax = "[<servermask>]"; }
27         /** Handle command.
28          * @param parameters The parameters to the comamnd
29          * @param pcnt The number of parameters passed to teh command
30          * @param user The user issuing the command
31          * @return A value from CmdResult to indicate command success or failure.
32          */
33         CmdResult Handle(const std::vector<std::string>& parameters, User *user);
34         RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
35         {
36                 if (parameters.size() > 0)
37                         return ROUTE_UNICAST(parameters[0]);
38                 return ROUTE_LOCALONLY;
39         }
40 };
41
42 static const char* const lines[] = {
43         "                   -/\\- \2InspIRCd\2 -\\/-",
44         "                 November 2002 - Present",
45         " ",
46         "\2Core Developers\2:",
47         "    Craig Edwards,          Brain,     <brain@inspircd.org>",
48         "    Craig McLure,           Craig,     <craig@inspircd.org>",
49         "    Robin Burchell,         w00t,      <w00t@inspircd.org>",
50         "    Oliver Lupton,          Om,        <om@inspircd.org>",
51         "    John Brooks,            Special,   <special@inspircd.org>",
52         "    Dennis Friis,           peavey,    <peavey@inspircd.org>",
53         "    Thomas Stagner,         aquanight, <aquanight@inspircd.org>",
54         "    Uli Schlachter,         psychon,   <psychon@inspircd.org>",
55         "    Matt Smith,             dz,        <dz@inspircd.org>",
56         "    Daniel De Graaf,        danieldg,  <danieldg@inspircd.org>",
57         " ",
58         "\2Regular Contributors\2:",
59         "    Majic          MacGyver        Namegduf       Ankit",
60         "    Phoenix        Taros",
61         " ",
62         "\2Other Contributors\2:",
63         "   dmb             Zaba            skenmy         GreenReaper",
64         "   Dan             Jason           satmd          owine",
65         "   Adremelech      John2           jilles         HiroP",
66         "   eggy            Bricker         AnMaster       djGrrr",
67         "   nenolod         Quension        praetorian     pippijn",
68         " ",
69         "\2Former Contributors\2:",
70         "   CC              jamie           typobox43      Burlex (win32)",
71         "   Stskeeps        ThaPrince       BuildSmart     Thunderhacker",
72         "   Skip            LeaChim",
73         " ",
74         "\2Thanks To\2:",
75         "   searchirc.com   irc-junkie.org  Brik",
76         " ",
77         " Best experienced with: \2An IRC client\2",
78         NULL
79 };
80
81 /** Handle /INFO
82  */
83 CmdResult CommandInfo::Handle (const std::vector<std::string>& parameters, User *user)
84 {
85         if (parameters.size() > 0 && parameters[0] != ServerInstance->Config->ServerName)
86                 return CMD_SUCCESS;
87
88         int i=0;
89         while (lines[i])
90                 user->SendText(":%s %03d %s :%s", ServerInstance->Config->ServerName.c_str(), RPL_INFO, user->nick.c_str(), lines[i++]);
91         FOREACH_MOD(I_OnInfo,OnInfo(user));
92         user->SendText(":%s %03d %s :End of /INFO list", ServerInstance->Config->ServerName.c_str(), RPL_ENDOFINFO, user->nick.c_str());
93         return CMD_SUCCESS;
94 }
95
96 COMMAND_INIT(CommandInfo)