]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/cmd_modules.cpp
Changed m_messageflood to use PreMessage and PreNotice, because it may kick the user
[user/henk/code/inspircd.git] / src / cmd_modules.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
6  * See: http://www.inspircd.org/wiki/index.php/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 #include "configreader.h"
16 #include "users.h"
17 #include "modules.h"
18 #include "wildcard.h"
19 #include "commands/cmd_modules.h"
20
21 char* itab[] = {
22         "OnUserConnect", "OnUserQuit", "OnUserDisconnect", "OnUserJoin", "OnUserPart", "OnRehash", "OnServerRaw",
23         "OnUserPreJoin", "OnUserPreKick", "OnUserKick", "OnOper", "OnInfo", "OnWhois", "OnUserPreInvite",
24         "OnUserInvite", "OnUserPreMessage", "OnUserPreNotice", "OnUserPreNick", "OnUserMessage", "OnUserNotice", "OnMode",
25         "OnGetServerDescription", "OnSyncUser", "OnSyncChannel", "OnSyncChannelMetaData", "OnSyncUserMetaData",
26         "OnDecodeMetaData", "ProtoSendMode", "ProtoSendMetaData", "OnWallops", "OnChangeHost", "OnChangeName", "OnAddGLine",
27         "OnAddZLine", "OnAddQLine", "OnAddKLine", "OnAddELine", "OnDelGLine", "OnDelZLine", "OnDelKLine", "OnDelELine", "OnDelQLine",
28         "OnCleanup", "OnUserPostNick", "OnAccessCheck", "On005Numeric", "OnKill", "OnRemoteKill", "OnLoadModule", "OnUnloadModule",
29         "OnBackgroundTimer", "OnSendList", "OnPreCommand", "OnCheckReady", "OnUserRegister", "OnCheckInvite",
30         "OnCheckKey", "OnCheckLimit", "OnCheckBan", "OnStats", "OnChangeLocalUserHost", "OnChangeLocalUserGecos", "OnLocalTopicChange",
31         "OnPostLocalTopicChange", "OnEvent", "OnRequest", "OnOperCompre", "OnGlobalOper", "OnPostConnect", "OnAddBan", "OnDelBan",
32         "OnRawSocketAccept", "OnRawSocketClose", "OnRawSocketWrite", "OnRawSocketRead", "OnChangeLocalUserGECOS", "OnUserRegister",
33         "OnOperCompare", "OnChannelDelete", "OnPostOper", "OnSyncOtherMetaData", "OnSetAway", "OnCancelAway", "OnNamesList",
34         "OnPostCommand", "OnPostJoin", "OnWhoisLine", "OnBuildExemptList", "OnRawSocketConnect", "OnGarbageCollect", NULL
35 };
36
37 extern "C" DllExport command_t* init_command(InspIRCd* Instance)
38 {
39         return new cmd_modules(Instance);
40 }
41
42 /** Handle /MODULES
43  */
44 CmdResult cmd_modules::Handle (const char** parameters, int pcnt, userrec *user)
45 {
46         for (unsigned int i = 0; i < ServerInstance->Config->module_names.size(); i++)
47         {
48                 Version V = ServerInstance->modules[i]->GetVersion();
49                 char modulename[MAXBUF];
50                 char flagstate[MAXBUF];
51                 *flagstate = 0;
52                 if (V.Flags & VF_STATIC)
53                         strlcat(flagstate,", static",MAXBUF);
54                 if (V.Flags & VF_VENDOR)
55                         strlcat(flagstate,", vendor",MAXBUF);
56                 if (V.Flags & VF_COMMON)
57                         strlcat(flagstate,", common",MAXBUF);
58                 if (V.Flags & VF_SERVICEPROVIDER)
59                         strlcat(flagstate,", service provider",MAXBUF);
60                 if (!flagstate[0])
61                         strcpy(flagstate,"  <no flags>");
62                 strlcpy(modulename,ServerInstance->Config->module_names[i].c_str(),256);
63                 if (IS_OPER(user))
64                 {
65                         user->WriteServ("900 %s :0x%08lx %d.%d.%d.%d %s (%s)",user->nick,ServerInstance->modules[i],V.Major,V.Minor,V.Revision,V.Build,ServerConfig::CleanFilename(modulename),flagstate+2);
66                 }
67                 else
68                 {
69                         user->WriteServ("900 %s :%s",user->nick,ServerConfig::CleanFilename(modulename));
70                 }
71         }
72         user->WriteServ("901 %s :End of MODULES list",user->nick);
73
74         return CMD_SUCCESS;
75 }