]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_maphide.cpp
Remove InspIRCd* parameters and fields
[user/henk/code/inspircd.git] / src / modules / m_maphide.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2009 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 /* $ModDesc: Hide /MAP and /LINKS in the same form as ircu (mostly useless) */
17
18 class ModuleMapHide : public Module
19 {
20         std::string url;
21  public:
22         ModuleMapHide()
23                         {
24                 ServerInstance->Modules->Attach(I_OnPreCommand, this);
25                 ServerInstance->Modules->Attach(I_OnRehash, this);
26                 OnRehash(NULL);
27         }
28
29         void OnRehash(User* user)
30         {
31                 ConfigReader MyConf;
32                 url = MyConf.ReadValue("security", "maphide", 0);
33         }
34
35         ModResult OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
36         {
37                 if (!IS_OPER(user) && !url.empty() && (command == "MAP" || command == "LINKS"))
38                 {
39                         user->WriteServ("NOTICE %s :/%s has been disabled; visit %s", user->nick.c_str(), command.c_str(), url.c_str());
40                         return MOD_RES_DENY;
41                 }
42                 else
43                         return MOD_RES_PASSTHRU;
44         }
45
46         virtual ~ModuleMapHide()
47         {
48         }
49
50         virtual Version GetVersion()
51         {
52                 return Version("Hide /MAP and /LINKS in the same form as ircu (mostly useless)", VF_VENDOR, API_VERSION);
53         }
54 };
55
56 MODULE_INIT(ModuleMapHide)
57