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