The InspIRCd Project
Home | Developers | Wiki | Forums | Bug Tracker | SVN | Download | Blog | Stats
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

cmd_modules Class Reference

Handle /MODULES. More...

#include <cmd_modules.h>

Inheritance diagram for cmd_modules:

Inheritance graph
[legend]
Collaboration diagram for cmd_modules:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 cmd_modules (InspIRCd *Instance)
 Constructor for modules.
CmdResult Handle (const char **parameters, int pcnt, userrec *user)
 Handle command.

Detailed Description

Handle /MODULES.

These command handlers can be reloaded by the core, and handle basic RFC1459 commands. Commands within modules work the same way, however, they can be fully unloaded, where these may not.

Definition at line 27 of file cmd_modules.h.


Constructor & Destructor Documentation

cmd_modules::cmd_modules InspIRCd Instance  )  [inline]
 

Constructor for modules.

Definition at line 32 of file cmd_modules.h.

References command_t::syntax.

00032 : command_t(Instance,"MODULES",0,0) { syntax = "[debug]"; }


Member Function Documentation

CmdResult cmd_modules::Handle const char **  parameters,
int  pcnt,
userrec user
[virtual]
 

Handle command.

Parameters:
parameters The parameters to the comamnd
pcnt The number of parameters passed to teh command
user The user issuing the command
Returns:
A value from CmdResult to indicate command success or failure.

Implements command_t.

Definition at line 44 of file cmd_modules.cpp.

References Version::Build, ServerConfig::CleanFilename(), CMD_SUCCESS, InspIRCd::Config, Version::Flags, IS_OPER, Version::Major, MAXBUF, Version::Minor, ServerConfig::module_names, InspIRCd::modules, userrec::nick, Version::Revision, command_t::ServerInstance, strlcat(), strlcpy(), VF_COMMON, VF_SERVICEPROVIDER, VF_STATIC, VF_VENDOR, and userrec::WriteServ().

00045 {
00046         for (unsigned int i = 0; i < ServerInstance->Config->module_names.size(); i++)
00047         {
00048                 Version V = ServerInstance->modules[i]->GetVersion();
00049                 char modulename[MAXBUF];
00050                 char flagstate[MAXBUF];
00051                 *flagstate = 0;
00052                 if (V.Flags & VF_STATIC)
00053                         strlcat(flagstate,", static",MAXBUF);
00054                 if (V.Flags & VF_VENDOR)
00055                         strlcat(flagstate,", vendor",MAXBUF);
00056                 if (V.Flags & VF_COMMON)
00057                         strlcat(flagstate,", common",MAXBUF);
00058                 if (V.Flags & VF_SERVICEPROVIDER)
00059                         strlcat(flagstate,", service provider",MAXBUF);
00060                 if (!flagstate[0])
00061                         strcpy(flagstate,"  <no flags>");
00062                 strlcpy(modulename,ServerInstance->Config->module_names[i].c_str(),256);
00063                 if (IS_OPER(user))
00064                 {
00065                         user->WriteServ("702 %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);
00066                 }
00067                 else
00068                 {
00069                         user->WriteServ("702 %s :%s",user->nick,ServerConfig::CleanFilename(modulename));
00070                 }
00071         }
00072         user->WriteServ("703 %s :End of MODULES list",user->nick);
00073 
00074         return CMD_SUCCESS;
00075 }


The documentation for this class was generated from the following files: