|
|||
|
|||
|
#include "globals.h"#include "dynamic.h"#include "base.h"#include "ctables.h"#include "inspsocket.h"#include <string>#include <deque>#include <sstream>#include "timer.h"#include "mode.h"#include "dns.h"Include dependency graph for modules.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Classes | |
| class | Version |
| Holds a module's Version information. More... | |
| class | ModuleMessage |
| The ModuleMessage class is the base class of Request and Event This class is used to represent a basic data structure which is passed between modules for safe inter-module communications. More... | |
| class | Request |
| The Request class is a unicast message directed at a given module. More... | |
| class | Event |
| The Event class is a unicast message directed at all modules. More... | |
| class | CoreException |
| This class can be used on its own to represent an exception, or derived to represent a module-specific exception. More... | |
| class | ModuleException |
| class | Module |
| Base class for all InspIRCd modules This class is the base class for InspIRCd modules. More... | |
| class | ConfigReader |
| Allows reading of values from configuration files This class allows a module to read from either the main configuration file (inspircd.conf) or from a module-specified configuration file. More... | |
| class | FileReader |
| Caches a text file into memory and can be used to retrieve lines from it. More... | |
| class | ModuleFactory |
| Instantiates classes inherited from Module. More... | |
Defines | |
| #define | NATIVE_API_VERSION 11025 |
| If you change the module API, change this value. | |
| #define | API_VERSION (NATIVE_API_VERSION * 1) |
| #define | FOREACH_MOD(y, x) |
| This define allows us to call a method in all loaded modules in a readable simple way, e.g. | |
| #define | FOREACH_MOD_I(z, y, x) |
| This define allows us to call a method in all loaded modules in a readable simple way and pass an instance pointer to the macro. | |
| #define | FOREACH_RESULT(y, x) |
| This define is similar to the one above but returns a result in MOD_RESULT. | |
| #define | FOREACH_RESULT_I(z, y, x) |
| This define is similar to the one above but returns a result in MOD_RESULT. | |
| #define | FD_MAGIC_NUMBER -42 |
| Represents a non-local user. | |
| #define | IS_LOCAL(x) ((x->GetFd() > -1) && (x->GetFd() <= MAX_DESCRIPTORS)) |
| Is a local user. | |
| #define | IS_REMOTE(x) (x->GetFd() < 0) |
| Is a remote user. | |
| #define | IS_MODULE_CREATED(x) (x->GetFd() == FD_MAGIC_NUMBER) |
| Is a module created user. | |
| #define | IS_OPER(x) (*x->oper) |
| Is an oper. | |
| #define | IS_AWAY(x) (*x->awaymsg) |
| Is away. | |
| #define | CONF_NOT_A_NUMBER 0x000010 |
| #define | CONF_NOT_UNSIGNED 0x000080 |
| #define | CONF_VALUE_NOT_FOUND 0x000100 |
| #define | CONF_FILE_NOT_FOUND 0x000200 |
| #define | MODULE_INIT(y) |
| This definition is used as shorthand for the various classes and functions needed to make a module loadable by the OS. | |
Typedefs | |
| typedef std::deque< std::string > | file_cache |
| Low level definition of a FileReader classes file cache area - a text file seperated into lines. | |
| typedef file_cache | string_list |
| A set of strings. | |
| typedef std::map< std::string, Module * > | featurelist |
| Holds a list of 'published features' for modules. | |
| typedef std::deque< Module * > | modulelist |
| Holds a list of modules which implement an interface. | |
| typedef std::map< std::string, std::pair< int, modulelist > > | interfacelist |
| Holds a list of all modules which implement interfaces, by interface name. | |
| typedef DLLFactory< ModuleFactory > | ircd_module |
| A DLLFactory (designed to load shared objects) containing a ModuleFactory. | |
| typedef std::vector< Module * > | ModuleList |
| A list of loaded Modules. | |
| typedef std::vector< ircd_module * > | FactoryList |
| A list of loaded ModuleFactories. | |
Enumerations | |
| enum | AccessControlType { ACR_DEFAULT, ACR_DENY, ACR_ALLOW, AC_KICK, AC_DEOP, AC_OP, AC_VOICE, AC_DEVOICE, AC_HALFOP, AC_DEHALFOP, AC_INVITE, AC_GENERAL_MODE } |
| Used with OnAccessCheck() method of modules. More... | |
| enum | ModuleFlags { VF_STATIC = 1, VF_VENDOR = 2, VF_SERVICEPROVIDER = 4, VF_COMMON = 8 } |
| Used to define a set of behavior bits for a module. More... | |
| enum | WriteModeFlags { WM_AND = 1, WM_OR = 2 } |
| Used with SendToMode(). More... | |
| enum | TargetTypeFlags { TYPE_USER = 1, TYPE_CHANNEL, TYPE_SERVER, TYPE_OTHER } |
| Used to represent an event type, for user, channel or server. More... | |
| enum | MessageType { MSG_PRIVMSG = 0, MSG_NOTICE = 1 } |
| Used to represent wether a message was PRIVMSG or NOTICE. More... | |
| enum | Priority { PRIORITY_FIRST, PRIORITY_DONTCARE, PRIORITY_LAST, PRIORITY_BEFORE, PRIORITY_AFTER } |
| Priority types which can be returned from Module::Prioritize(). More... | |
| enum | Implementation { I_OnUserConnect, I_OnUserQuit, I_OnUserDisconnect, I_OnUserJoin, I_OnUserPart, I_OnRehash, I_OnServerRaw, I_OnUserPreJoin, I_OnUserPreKick, I_OnUserKick, I_OnOper, I_OnInfo, I_OnWhois, I_OnUserPreInvite, I_OnUserInvite, I_OnUserPreMessage, I_OnUserPreNotice, I_OnUserPreNick, I_OnUserMessage, I_OnUserNotice, I_OnMode, I_OnGetServerDescription, I_OnSyncUser, I_OnSyncChannel, I_OnSyncChannelMetaData, I_OnSyncUserMetaData, I_OnDecodeMetaData, I_ProtoSendMode, I_ProtoSendMetaData, I_OnWallops, I_OnChangeHost, I_OnChangeName, I_OnAddGLine, I_OnAddZLine, I_OnAddQLine, I_OnAddKLine, I_OnAddELine, I_OnDelGLine, I_OnDelZLine, I_OnDelKLine, I_OnDelELine, I_OnDelQLine, I_OnCleanup, I_OnUserPostNick, I_OnAccessCheck, I_On005Numeric, I_OnKill, I_OnRemoteKill, I_OnLoadModule, I_OnUnloadModule, I_OnBackgroundTimer, I_OnPreCommand, I_OnCheckReady, I_OnUserRrgister, I_OnCheckInvite, I_OnCheckKey, I_OnCheckLimit, I_OnCheckBan, I_OnStats, I_OnChangeLocalUserHost, I_OnChangeLocalUserGecos, I_OnLocalTopicChange, I_OnPostLocalTopicChange, I_OnEvent, I_OnRequest, I_OnOperCompre, I_OnGlobalOper, I_OnPostConnect, I_OnAddBan, I_OnDelBan, I_OnRawSocketAccept, I_OnRawSocketClose, I_OnRawSocketWrite, I_OnRawSocketRead, I_OnChangeLocalUserGECOS, I_OnUserRegister, I_OnOperCompare, I_OnChannelDelete, I_OnPostOper, I_OnSyncOtherMetaData, I_OnSetAway, I_OnCancelAway, I_OnUserList, I_OnPostCommand, I_OnPostJoin, I_OnWhoisLine, I_OnBuildExemptList, I_OnRawSocketConnect, I_OnGarbageCollect, I_OnBufferFlushed } |
| Implementation-specific flags which may be set in Module::Implements(). More... | |
|
|
|
Definition at line 1442 of file modules.h. Referenced by ConfigReader::ConfigReader(). |
|
|
|
|
|
Definition at line 1440 of file modules.h. Referenced by ConfigReader::ReadInteger(). |
|
|
Definition at line 1441 of file modules.h. Referenced by ModuleWaitPong::OnRehash(), ModuleCgiIRC::OnRehash(), ModuleBlockAmsg::OnRehash(), ConfigReader::ReadInteger(), and ConfigReader::ReadValue(). |
|
|
Represents a non-local user. (in fact, any FD less than -1 does) Definition at line 211 of file modules.h. Referenced by userrec::FlushWriteBuf(), chanrec::ForceChan(), TreeSocket::ForceJoin(), TreeSocket::ForceMode(), cmd_samode::Handle(), cmd_devoice::Handle(), TreeSocket::IntroduceClient(), ModuleTimedBans::OnBackgroundTimer(), ModuleBanRedirect::OnCleanup(), TreeSocket::ProcessLine(), InspIRCd::ProcessUser(), ListModeBase::RemoveMode(), ModeHandler::RemoveMode(), FounderProtectBase::RemoveMode(), and chanrec::SetDefaultModes(). |
|
|
|
Value: if (z->Config->global_implementation[y] > 0) { \ for (int _i = 0; _i <= z->GetModuleCount(); _i++) { \ if (z->Config->implement_lists[_i][y]) \ try \ { \ z->modules[_i]->x ; \ } \ catch (CoreException& modexcept) \ { \ z->Log(DEFAULT,"Exception cought: %s",modexcept.GetReason()); \ } \ } \ } e.g.: 'FOREACH_MOD_I(Instance, OnConnect, OnConnect(user));' Definition at line 143 of file modules.h. Referenced by CullList::Apply(), InspIRCd::BuildISupport(), TreeSocket::DoBurst(), InspIRCd::DoOneIteration(), chanrec::ForceChan(), InspIRCd::GetServerDescription(), TreeSocket::IntroduceClient(), InspIRCd::LoadModule(), TreeSocket::MetaData(), InspIRCd::Rehash(), TreeSocket::RemoteRehash(), TreeSocket::SendChannelModes(), TreeSocket::SendUsers(), and InspIRCd::UnloadModule(). |
|
|
Value: { if (ServerInstance->Config->global_implementation[y] > 0) { \
MOD_RESULT = 0; \
for (int _i = 0; _i <= ServerInstance->GetModuleCount(); _i++) { \
if (ServerInstance->Config->implement_lists[_i][y]) { \
try \
{ \
int res = ServerInstance->modules[_i]->x ; \
if (res != 0) { \
MOD_RESULT = res; \
break; \
} \
} \
catch (CoreException& modexcept) \
{ \
ServerInstance->Log(DEFAULT,"Exception cought: %s",modexcept.GetReason()); \
} \
} \
} \
} \
}
The first module to return a nonzero result is the value to be accepted, and any modules after are ignored. Definition at line 161 of file modules.h. Referenced by userrec::ChangeDisplayedHost(), userrec::ChangeName(), DoStats(), userrec::ForceNickChange(), userrec::FullConnect(), cmd_user::Handle(), cmd_topic::Handle(), cmd_privmsg::Handle(), cmd_notice::Handle(), cmd_nick::Handle(), cmd_kill::Handle(), cmd_invite::Handle(), chanrec::IsBanned(), chanrec::KickUser(), ModeParser::Process(), CommandParser::ProcessCommand(), and chanrec::UserList(). |
|
|
Value: { if (z->Config->global_implementation[y] > 0) { \
MOD_RESULT = 0; \
for (int _i = 0; _i <= z->GetModuleCount(); _i++) { \
if (z->Config->implement_lists[_i][y]) { \
try \
{ \
int res = z->modules[_i]->x ; \
if (res != 0) { \
MOD_RESULT = res; \
break; \
} \
} \
catch (CoreException& modexcept) \
{ \
z->Log(DEBUG,"Exception cought: %s",modexcept.GetReason()); \
} \
} \
} \
} \
}
The first module to return a nonzero result is the value to be accepted, and any modules after are ignored. Definition at line 187 of file modules.h. Referenced by chanrec::JoinUser(), InspIRCd::OperPassCompare(), and InspIRCd::SendWhoisLine(). |
|
|
Is away.
Definition at line 228 of file modules.h. Referenced by do_whois(), cmd_userip::Handle(), cmd_check::Handle(), cmd_userhost::Handle(), cmd_privmsg::Handle(), and cmd_who::SendWhoLine(). |
|
|
|
Is a module created user.
|
|
|
|
Is a remote user.
|
|
|
Value: class Factory : public ModuleFactory \ { \ public: \ virtual Module * CreateModule(InspIRCd* Me) \ { \ return new y(Me); \ } \ }; \ extern "C" DllExport void * init_module(void) \ { \ return new Factory; \ } It defines the class factory and external init_module function. |
|
|
If you change the module API, change this value. If you have enabled ipv6, the sizes of structs is different, and modules will be incompatible with ipv4 servers, so this value will be ten times as high on ipv6 servers. |
|
|
A list of loaded ModuleFactories.
|
|
|
Holds a list of 'published features' for modules.
|
|
|
Low level definition of a FileReader classes file cache area - a text file seperated into lines.
|
|
|
Holds a list of all modules which implement interfaces, by interface name.
|
|
|
A DLLFactory (designed to load shared objects) containing a ModuleFactory.
|
|
|
A list of loaded Modules.
|
|
|
Holds a list of modules which implement an interface.
|
|
|
A set of strings.
|
|
|
Used with OnAccessCheck() method of modules.
Definition at line 19 of file modules.h. 00019 { 00020 ACR_DEFAULT, // Do default action (act as if the module isnt even loaded) 00021 ACR_DENY, // deny the action 00022 ACR_ALLOW, // allow the action 00023 AC_KICK, // a user is being kicked 00024 AC_DEOP, // a user is being deopped 00025 AC_OP, // a user is being opped 00026 AC_VOICE, // a user is being voiced 00027 AC_DEVOICE, // a user is being devoiced 00028 AC_HALFOP, // a user is being halfopped 00029 AC_DEHALFOP, // a user is being dehalfopped 00030 AC_INVITE, // a user is being invited 00031 AC_GENERAL_MODE // a channel mode is being changed 00032 };
|
|
|
Implementation-specific flags which may be set in Module::Implements().
Definition at line 432 of file modules.h. 00432 { I_OnUserConnect, I_OnUserQuit, I_OnUserDisconnect, I_OnUserJoin, I_OnUserPart, I_OnRehash, I_OnServerRaw, 00433 I_OnUserPreJoin, I_OnUserPreKick, I_OnUserKick, I_OnOper, I_OnInfo, I_OnWhois, I_OnUserPreInvite, 00434 I_OnUserInvite, I_OnUserPreMessage, I_OnUserPreNotice, I_OnUserPreNick, I_OnUserMessage, I_OnUserNotice, I_OnMode, 00435 I_OnGetServerDescription, I_OnSyncUser, I_OnSyncChannel, I_OnSyncChannelMetaData, I_OnSyncUserMetaData, 00436 I_OnDecodeMetaData, I_ProtoSendMode, I_ProtoSendMetaData, I_OnWallops, I_OnChangeHost, I_OnChangeName, I_OnAddGLine, 00437 I_OnAddZLine, I_OnAddQLine, I_OnAddKLine, I_OnAddELine, I_OnDelGLine, I_OnDelZLine, I_OnDelKLine, I_OnDelELine, I_OnDelQLine, 00438 I_OnCleanup, I_OnUserPostNick, I_OnAccessCheck, I_On005Numeric, I_OnKill, I_OnRemoteKill, I_OnLoadModule, I_OnUnloadModule, 00439 I_OnBackgroundTimer, I_OnPreCommand, I_OnCheckReady, I_OnUserRrgister, I_OnCheckInvite, 00440 I_OnCheckKey, I_OnCheckLimit, I_OnCheckBan, I_OnStats, I_OnChangeLocalUserHost, I_OnChangeLocalUserGecos, I_OnLocalTopicChange, 00441 I_OnPostLocalTopicChange, I_OnEvent, I_OnRequest, I_OnOperCompre, I_OnGlobalOper, I_OnPostConnect, I_OnAddBan, I_OnDelBan, 00442 I_OnRawSocketAccept, I_OnRawSocketClose, I_OnRawSocketWrite, I_OnRawSocketRead, I_OnChangeLocalUserGECOS, I_OnUserRegister, 00443 I_OnOperCompare, I_OnChannelDelete, I_OnPostOper, I_OnSyncOtherMetaData, I_OnSetAway, I_OnCancelAway, I_OnUserList, 00444 I_OnPostCommand, I_OnPostJoin, I_OnWhoisLine, I_OnBuildExemptList, I_OnRawSocketConnect, I_OnGarbageCollect, I_OnBufferFlushed };
|
|
|
Used to represent wether a message was PRIVMSG or NOTICE.
Definition at line 61 of file modules.h. 00061 { 00062 MSG_PRIVMSG = 0, 00063 MSG_NOTICE = 1 00064 };
|
|
|
Used to define a set of behavior bits for a module.
Definition at line 36 of file modules.h. 00036 { 00037 VF_STATIC = 1, // module is static, cannot be /unloadmodule'd 00038 VF_VENDOR = 2, // module is a vendor module (came in the original tarball, not 3rd party) 00039 VF_SERVICEPROVIDER = 4, // module provides a service to other modules (can be a dependency) 00040 VF_COMMON = 8 // module needs to be common on all servers in a network to link 00041 };
|
|
|
Priority types which can be returned from Module::Prioritize().
Definition at line 428 of file modules.h. 00428 { PRIORITY_FIRST, PRIORITY_DONTCARE, PRIORITY_LAST, PRIORITY_BEFORE, PRIORITY_AFTER };
|
|
|
Used to represent an event type, for user, channel or server.
Definition at line 52 of file modules.h. 00052 { 00053 TYPE_USER = 1, 00054 TYPE_CHANNEL, 00055 TYPE_SERVER, 00056 TYPE_OTHER 00057 };
|
|
|
Used with SendToMode().
Definition at line 45 of file modules.h.
|