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

ModuleChgHost Class Reference

Inheritance diagram for ModuleChgHost:

Inheritance graph
[legend]
Collaboration diagram for ModuleChgHost:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ModuleChgHost (InspIRCd *Me)
void Implements (char *List)
 The Implements function specifies which methods a module should receive events for.
void OnRehash (userrec *user, const std::string &parameter)
 Called on rehash.
 ~ModuleChgHost ()
Version GetVersion ()
 Returns the version number of a Module.

Private Attributes

cmd_chghostmycommand
char hostmap [256]

Detailed Description

Definition at line 78 of file m_chghost.cpp.


Constructor & Destructor Documentation

ModuleChgHost::ModuleChgHost InspIRCd Me  )  [inline]
 

Definition at line 83 of file m_chghost.cpp.

References InspIRCd::AddCommand(), hostmap, mycommand, OnRehash(), and Module::ServerInstance.

00084                 : Module(Me)
00085         {
00086                 OnRehash(NULL,"");
00087                 mycommand = new cmd_chghost(ServerInstance, hostmap);
00088                 ServerInstance->AddCommand(mycommand);
00089         }

ModuleChgHost::~ModuleChgHost  )  [inline]
 

Definition at line 109 of file m_chghost.cpp.

00110         {
00111         }


Member Function Documentation

Version ModuleChgHost::GetVersion  )  [inline, virtual]
 

Returns the version number of a Module.

The method should return a Version object with its version information assigned via Version::Version

Reimplemented from Module.

Definition at line 113 of file m_chghost.cpp.

References API_VERSION, VF_COMMON, and VF_VENDOR.

00114         {
00115                 return Version(1, 1, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION);
00116         }

void ModuleChgHost::Implements char *  List  )  [inline, virtual]
 

The Implements function specifies which methods a module should receive events for.

The char* parameter passed to this function contains a set of true or false values (1 or 0) which indicate wether each function is implemented. You must use the Iimplementation enum (documented elsewhere on this page) to mark functions as active. For example, to receive events for OnUserJoin():

Implements[I_OnUserJoin] = 1;

Parameters:
The implement list

Reimplemented from Module.

Definition at line 91 of file m_chghost.cpp.

References I_OnRehash.

00092         {
00093                 List[I_OnRehash] = 1;
00094         }

void ModuleChgHost::OnRehash userrec user,
const std::string parameter
[inline, virtual]
 

Called on rehash.

This method is called prior to a /REHASH or when a SIGHUP is received from the operating system. You should use it to reload any files so that your module keeps in step with the rest of the application. If a parameter is given, the core has done nothing. The module receiving the event can decide if this parameter has any relevence to it.

Parameters:
user The user performing the rehash, if any -- if this is server initiated, the value of this variable will be NULL.
parameter The (optional) parameter given to REHASH from the user.

Reimplemented from Module.

Definition at line 96 of file m_chghost.cpp.

References Conf, hostmap, ConfigReader::ReadValue(), and Module::ServerInstance.

Referenced by ModuleChgHost().

00097         {
00098                 ConfigReader Conf(ServerInstance);
00099                 std::string hmap = Conf.ReadValue("hostname", "charmap", 0);
00100 
00101                 if (hmap.empty())
00102                         hmap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_/0123456789";
00103 
00104                 memset(&hostmap, 0, 255);
00105                 for (std::string::iterator n = hmap.begin(); n != hmap.end(); n++)
00106                         hostmap[(unsigned char)*n] = 1;
00107         }


Member Data Documentation

char ModuleChgHost::hostmap[256] [private]
 

Definition at line 81 of file m_chghost.cpp.

Referenced by ModuleChgHost(), and OnRehash().

cmd_chghost* ModuleChgHost::mycommand [private]
 

Definition at line 80 of file m_chghost.cpp.

Referenced by ModuleChgHost().


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