1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
23 #include "inspircd_config.h"
25 #include "configreader.h"
30 #include "helperfuncs.h"
32 #include "commands/cmd_modules.h"
34 extern ServerConfig* Config;
36 extern std::vector<Module*> modules;
37 extern std::vector<ircd_module*> factory;
40 "OnUserConnect", "OnUserQuit", "OnUserDisconnect", "OnUserJoin", "OnUserPart", "OnRehash", "OnServerRaw",
41 "OnExtendedMode", "OnUserPreJoin", "OnUserPreKick", "OnUserKick", "OnOper", "OnInfo", "OnWhois", "OnUserPreInvite",
42 "OnUserInvite", "OnUserPreMessage", "OnUserPreNotice", "OnUserPreNick", "OnUserMessage", "OnUserNotice", "OnMode",
43 "OnGetServerDescription", "OnSyncUser", "OnSyncChannel", "OnSyncChannelMetaData", "OnSyncUserMetaData",
44 "OnDecodeMetaData", "ProtoSendMode", "ProtoSendMetaData", "OnWallops", "OnChangeHost", "OnChangeName", "OnAddGLine",
45 "OnAddZLine", "OnAddQLine", "OnAddKLine", "OnAddELine", "OnDelGLine", "OnDelZLine", "OnDelKLine", "OnDelELine", "OnDelQLine",
46 "OnCleanup", "OnUserPostNick", "OnAccessCheck", "On005Numeric", "OnKill", "OnRemoteKill", "OnLoadModule", "OnUnloadModule",
47 "OnBackgroundTimer", "OnSendList", "OnPreCommand", "OnCheckReady", "OnUserRrgister", "OnRawMode", "OnCheckInvite",
48 "OnCheckKey", "OnCheckLimit", "OnCheckBan", "OnStats", "OnChangeLocalUserHost", "OnChangeLocalUserGecos", "OnLocalTopicChange",
49 "OnPostLocalTopicChange", "OnEvent", "OnRequest", "OnOperCompre", "OnGlobalOper", "OnGlobalConnect", "OnAddBan", "OnDelBan",
50 "OnRawSocketAccept", "OnRawSocketClose", "OnRawSocketWrite", "OnRawSocketRead", "OnChangeLocalUserGECOS", "OnUserRegister",
51 "OnOperCompare", "OnChannelDelete", "OnPostOper", "OnSyncOtherMetaData", "OnSetAway", "OnCancelAway", NULL
54 void cmd_modules::Handle (const char** parameters, int pcnt, userrec *user)
56 for (unsigned int i = 0; i < Config->module_names.size(); i++)
58 Version V = modules[i]->GetVersion();
59 char modulename[MAXBUF];
60 char flagstate[MAXBUF];
62 if (V.Flags & VF_STATIC)
63 strlcat(flagstate,", static",MAXBUF);
64 if (V.Flags & VF_VENDOR)
65 strlcat(flagstate,", vendor",MAXBUF);
66 if (V.Flags & VF_COMMON)
67 strlcat(flagstate,", common",MAXBUF);
68 if (V.Flags & VF_SERVICEPROVIDER)
69 strlcat(flagstate,", service provider",MAXBUF);
71 strcpy(flagstate," <no flags>");
72 strlcpy(modulename,Config->module_names[i].c_str(),256);
75 if ((pcnt >= 2) && (!strcasecmp(parameters[0],"debug")))
77 if (match(Config->module_names[i].c_str(),parameters[1]))
79 WriteServ(user->fd,"900 %s :0x%08lx %d.%d.%d.%d %s (%s)",user->nick,modules[i],V.Major,V.Minor,V.Revision,V.Build,CleanFilename(modulename),flagstate+2);
80 for (int it = 0; itab[it];)
85 for (int v = 0; v < 4; v++)
89 if (Config->implement_lists[i][it])
91 snprintf(data,MAXBUF,"%s=>%c ",itab[it],(Config->implement_lists[i][it] ? '1' : '0'));
92 strncat(dlist,data,MAXBUF);
98 WriteServ(user->fd,"900 %s :%s [ %s]",user->nick,CleanFilename(modulename),dlist);
100 WriteServ(user->fd,"900 %s :=== DEBUG: Implementation counts ===",user->nick);
101 for (int it = 0; itab[it]; it++)
103 if (Config->global_implementation[it])
104 WriteServ(user->fd,"900 %s :%s: %d times",user->nick, itab[it],(int)Config->global_implementation[it]);
110 WriteServ(user->fd,"900 %s :0x%08lx %d.%d.%d.%d %s (%s)",user->nick,modules[i],V.Major,V.Minor,V.Revision,V.Build,CleanFilename(modulename),flagstate+2);
115 WriteServ(user->fd,"900 %s :%s",user->nick,CleanFilename(modulename));
118 WriteServ(user->fd,"901 %s :End of MODULES list",user->nick);