]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/commands/cmd_map.cpp
Allow <connect motd> to select an alternate MOTD file to display
[user/henk/code/inspircd.git] / src / commands / cmd_map.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 class CommandMap : public Command
17 {
18  public:
19         /** Constructor for map.
20          */
21         CommandMap ( Module* parent) : Command(parent,"MAP",0,0) { Penalty=2; }
22         /** Handle command.
23          * @param parameters The parameters to the comamnd
24          * @param pcnt The number of parameters passed to teh command
25          * @param user The user issuing the command
26          * @return A value from CmdResult to indicate command success or failure.
27          */
28         CmdResult Handle(const std::vector<std::string>& parameters, User *user);
29 };
30
31 /** Handle /MAP
32  */
33 CmdResult CommandMap::Handle (const std::vector<std::string>&, User *user)
34 {
35         // as with /LUSERS this does nothing without a linking
36         // module to override its behaviour and display something
37         // better.
38
39         if (IS_OPER(user))
40         {
41                 user->WriteNumeric(006, "%s :%s [%s]", user->nick.c_str(), ServerInstance->Config->ServerName.c_str(), ServerInstance->Config->GetSID().c_str());
42                 user->WriteNumeric(007, "%s :End of /MAP", user->nick.c_str());
43                 return CMD_SUCCESS;
44         }
45         user->WriteNumeric(006, "%s :%s",user->nick.c_str(),ServerInstance->Config->ServerName.c_str());
46         user->WriteNumeric(007, "%s :End of /MAP",user->nick.c_str());
47
48         return CMD_SUCCESS;
49 }
50
51 COMMAND_INIT(CommandMap)