X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fmodules.h;h=2e0a614c58de7a0375d3a490d2bebb1130ebf12b;hb=b1fcb6a770eb45174ad6daf81c325a073fccd532;hp=5e985b8bbaf5a42775ab1c71257f9e5cf51f3155;hpb=eb61271c43f563277820ee5d86655113607571fa;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/modules.h b/include/modules.h index 5e985b8bb..2e0a614c5 100644 --- a/include/modules.h +++ b/include/modules.h @@ -2,7 +2,7 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * Inspire is copyright (C) 2002-2004 ChatSpike-Dev. + * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev. * E-mail: * * @@ -15,44 +15,54 @@ */ -#ifndef __PLUGIN_H -#define __PLUGIN_H +#ifndef __MODULES_H +#define __MODULES_H /** log levels */ -#define DEBUG 10 -#define VERBOSE 20 -#define DEFAULT 30 -#define SPARSE 40 -#define NONE 50 +enum DebugLevels { DEBUG, VERBOSE, DEFAULT, SPARSE, NONE }; /** Used with OnExtendedMode() method of modules */ -#define MT_CHANNEL 1 -#define MT_CLIENT 2 -#define MT_SERVER 3 +enum ModeTargetType { MT_CHANNEL, MT_CLIENT, MT_SERVER }; /** Used with OnAccessCheck() method of modules */ -#define ACR_DEFAULT 0 // Do default action (act as if the module isnt even loaded) -#define ACR_DENY 1 // deny the action -#define ACR_ALLOW 2 // allow the action -#define AC_KICK 0 // a user is being kicked -#define AC_DEOP 1 // a user is being deopped -#define AC_OP 2 // a user is being opped -#define AC_VOICE 3 // a user is being voiced -#define AC_DEVOICE 4 // a user is being devoiced -#define AC_HALFOP 5 // a user is being halfopped -#define AC_DEHALFOP 6 // a user is being dehalfopped -#define AC_INVITE 7 // a user is being invited -#define AC_GENERAL_MODE 8 // a user channel mode is being changed +enum AccessControlType { + ACR_DEFAULT, // Do default action (act as if the module isnt even loaded) + ACR_DENY, // deny the action + ACR_ALLOW, // allow the action + AC_KICK, // a user is being kicked + AC_DEOP, // a user is being deopped + AC_OP, // a user is being opped + AC_VOICE, // a user is being voiced + AC_DEVOICE, // a user is being devoiced + AC_HALFOP, // a user is being halfopped + AC_DEHALFOP, // a user is being dehalfopped + AC_INVITE, // a user is being invited + AC_GENERAL_MODE // a channel mode is being changed +}; /** Used to define a set of behavior bits for a module */ -#define VF_STATIC 1 // module is static, cannot be /unloadmodule'd -#define VF_VENDOR 2 // module is a vendor module (came in the original tarball, not 3rd party) -#define VF_SERVICEPROVIDER 4 // module provides a service to other modules (can be a dependency) -#define VF_COMMON 8 // module needs to be common on all servers in a mesh to link +enum ModuleFlags { + VF_STATIC = 1, // module is static, cannot be /unloadmodule'd + VF_VENDOR = 2, // module is a vendor module (came in the original tarball, not 3rd party) + VF_SERVICEPROVIDER = 4, // module provides a service to other modules (can be a dependency) + VF_COMMON = 8 // module needs to be common on all servers in a network to link +}; + +enum WriteModeFlags { + WM_AND = 1, + WM_OR = 2 +}; + +enum TargetTypeFlags { + TYPE_USER = 1, + TYPE_CHANNEL, + TYPE_SERVER, + TYPE_OTHER +}; #include "dynamic.h" #include "base.h" @@ -61,6 +71,7 @@ #include #include #include +#include class Server; class ServerConfig; @@ -79,7 +90,19 @@ typedef std::deque chanuserlist; // loaded modules in a readable simple way, e.g.: // 'FOREACH_MOD OnConnect(user);' -#define FOREACH_MOD for (int _i = 0; _i <= MODCOUNT; _i++) modules[_i]-> +#define FOREACH_MOD(y,x) if (Config->global_implementation[y] > 0) { \ + for (int _i = 0; _i <= MODCOUNT; _i++) { \ + if (Config->implement_lists[_i][y]) \ + try \ + { \ + modules[_i]->x ; \ + } \ + catch (ModuleException& modexcept) \ + { \ + log(DEBUG,"Module exception cought: %s",modexcept.GetReason()); \ + } \ + } \ + } // This define is similar to the one above but returns a result in MOD_RESULT. // The first module to return a nonzero result is the value to be accepted, @@ -87,30 +110,36 @@ typedef std::deque chanuserlist; // ********************************************************************************************* -#define FOREACH_RESULT(x) { MOD_RESULT = 0; \ +#define FOREACH_RESULT(y,x) { if (Config->global_implementation[y] > 0) { \ + MOD_RESULT = 0; \ for (int _i = 0; _i <= MODCOUNT; _i++) { \ - int res = modules[_i]->x ; \ - if (res != 0) { \ - MOD_RESULT = res; \ - break; \ + if (Config->implement_lists[_i][y]) {\ + try \ + { \ + int res = modules[_i]->x ; \ + if (res != 0) { \ + MOD_RESULT = res; \ + break; \ + } \ + } \ + catch (ModuleException& modexcept) \ + { \ + log(DEBUG,"Module exception cought: %s",modexcept.GetReason()); \ + } \ } \ } \ - } + } \ + } // ********************************************************************************************* #define FD_MAGIC_NUMBER -42 -// flags for use with WriteMode - -#define WM_AND 1 -#define WM_OR 2 - -// flags for use with OnUserPreMessage and OnUserPreNotice +// useful macros -#define TYPE_USER 1 -#define TYPE_CHANNEL 2 -#define TYPE_SERVER 3 +#define IS_LOCAL(x) (x->fd > -1) +#define IS_REMOTE(x) (x->fd < 0) +#define IS_MODULE_CREATED(x) (x->fd == FD_MAGIC_NUMBER) /*extern void createcommand(char* cmd, handlerfunc f, char flags, int minparams, char* source); extern void server_mode(char **parameters, int pcnt, userrec *user);*/ @@ -254,10 +283,43 @@ class ExtMode : public classbase int params_when_on; int params_when_off; bool list; - ExtMode(char mc, int ty, bool oper, int p_on, int p_off) : modechar(mc), type(ty), needsoper(oper), params_when_on(p_on), params_when_off(p_off) { }; + ExtMode(char mc, int ty, bool oper, int p_on, int p_off) : modechar(mc), type(ty), needsoper(oper), params_when_on(p_on), params_when_off(p_off), list(false) { }; }; +class ModuleException +{ + private: + std::string err; + public: + ModuleException() : err("Module threw an exception") {} + ModuleException(std::string message) : err(message) {} + virtual ~ModuleException() {}; + virtual char *GetReason() + { + return (char*)err.c_str(); + } +}; + +/** Priority types which can be returned from Module::Prioritize() + */ +enum Priority { PRIORITY_FIRST, PRIORITY_DONTCARE, PRIORITY_LAST, PRIORITY_BEFORE, PRIORITY_AFTER }; + +/** Implementation-specific flags which may be set in Module::Implements() + */ +enum Implementation { I_OnUserConnect, I_OnUserQuit, I_OnUserDisconnect, I_OnUserJoin, I_OnUserPart, I_OnRehash, I_OnServerRaw, + I_OnExtendedMode, 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_OnSendList, I_OnPreCommand, I_OnCheckReady, I_OnUserRrgister, I_OnRawMode, 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_OnGlobalConnect, 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 }; + /** Base class for all InspIRCd modules * This class is the base class for InspIRCd modules. All modules must inherit from this class, * its methods will be called when irc server events occur. class inherited from module must be @@ -284,6 +346,41 @@ class Module : public classbase */ virtual Version GetVersion(); + /** 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; + * + * @param The implement list + */ + virtual void Implements(char* Implements); + + /** Used to set the 'priority' of a module (e.g. when it is called in relation to other modules. + * Some modules prefer to be called before other modules, due to their design. For example, a + * module which is expected to operate on complete information would expect to be placed last, so + * that any other modules which wish to adjust that information would execute before it, to be sure + * its information is correct. You can change your module's priority by returning one of: + * + * PRIORITY_FIRST - To place your module first in the list + * + * PRIORITY_LAST - To place your module last in the list + * + * PRIORITY_DONTCARE - To leave your module as it is (this is the default value, if you do not implement this function) + * + * The result of Server::PriorityBefore() - To move your module before another named module + * + * The result of Server::PriorityLast() - To move your module after another named module + * + * For a good working example of this method call, please see src/modules/m_spanningtree.cpp + * and src/modules/m_hostchange.so which make use of it. It is highly recommended that unless + * your module has a real need to reorder its priority, it should not implement this function, + * as many modules changing their priorities can make the system redundant. + */ + virtual Priority Prioritize(); + /** Called when a user connects. * The details of the connecting user are available to you in the parameter userrec *user * @param user The user who is connecting @@ -307,6 +404,11 @@ class Module : public classbase */ virtual void OnUserDisconnect(userrec* user); + /** Called whenever a channel is deleted, either by QUIT, KICK or PART. + * @param chan The channel being deleted + */ + virtual void OnChannelDelete(chanrec* chan); + /** Called when a user joins a channel. * The details of the joining user are available to you in the parameter userrec *user, * and the details of the channel they have joined is available in the variable chanrec *channel @@ -320,8 +422,9 @@ class Module : public classbase * and the details of the channel they have left is available in the variable chanrec *channel * @param user The user who is parting * @param channel The channel being parted + * @param partmessage The part message, or an empty string */ - virtual void OnUserPart(userrec* user, chanrec* channel); + virtual void OnUserPart(userrec* user, chanrec* channel, std::string partmessage); /** Called on rehash. * This method is called prior to a /REHASH or when a SIGHUP is received from the operating @@ -388,7 +491,7 @@ class Module : public classbase * @param user The user being kicked * @param chan The channel the user is being kicked from * @param reason The kick reason - * @return 1 to prevent the kick, 0 to allow it + * @return 1 to prevent the kick, 0 to continue normally, -1 to explicitly allow the kick regardless of normal operation */ virtual int OnUserPreKick(userrec* source, userrec* user, chanrec* chan, std::string reason); @@ -409,6 +512,15 @@ class Module : public classbase * @param opertype The opers type name */ virtual void OnOper(userrec* user, std::string opertype); + + /** Called after a user opers locally. + * This is identical to Module::OnOper(), except it is called after OnOper so that other modules + * can be gauranteed to already have processed the oper-up, for example m_spanningtree has sent + * out the OPERTYPE, etc. + * @param user The user who is opering up + * @param opertype The opers type name + */ + virtual void OnPostOper(userrec* user, std::string opertype); /** Called whenever a user types /INFO. * The userrec will contain the information of the user who typed the command. Modules may use this @@ -461,9 +573,10 @@ class Module : public classbase * @param dest The target of the message (chanrec* or userrec*) * @param target_type The type of target (TYPE_USER or TYPE_CHANNEL) * @param text Changeable text being sent by the user + * @param status The status being used, e.g. PRIVMSG @#chan has status== '@', 0 to send to everyone. * @return 1 to deny the NOTICE, 0 to allow it */ - virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text); + virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text,char status); /** Called whenever a user is about to NOTICE A user or a channel, before any processing is done. * Returning any nonzero value from this function stops the process immediately, causing no @@ -479,9 +592,10 @@ class Module : public classbase * @param dest The target of the message (chanrec* or userrec*) * @param target_type The type of target (TYPE_USER or TYPE_CHANNEL) * @param text Changeable text being sent by the user + * @param status The status being used, e.g. PRIVMSG @#chan has status== '@', 0 to send to everyone. * @return 1 to deny the NOTICE, 0 to allow it */ - virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text); + virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text,char status); /** Called before any nickchange, local or remote. This can be used to implement Q-lines etc. * Please note that although you can see remote nickchanges through this function, you should @@ -502,8 +616,9 @@ class Module : public classbase * @param dest The target of the message * @param target_type The type of target (TYPE_USER or TYPE_CHANNEL) * @param text the text being sent by the user + * @param status The status being used, e.g. PRIVMSG @#chan has status== '@', 0 to send to everyone. */ - virtual void OnUserMessage(userrec* user, void* dest, int target_type, std::string text); + virtual void OnUserMessage(userrec* user, void* dest, int target_type, std::string text, char status); /** Called after any NOTICE sent from a user. * The dest variable contains a userrec* if target_type is TYPE_USER and a chanrec* @@ -512,8 +627,9 @@ class Module : public classbase * @param dest The target of the message * @param target_type The type of target (TYPE_USER or TYPE_CHANNEL) * @param text the text being sent by the user + * @param status The status being used, e.g. NOTICE @#chan has status== '@', 0 to send to everyone. */ - virtual void OnUserNotice(userrec* user, void* dest, int target_type, std::string text); + virtual void OnUserNotice(userrec* user, void* dest, int target_type, std::string text, char status); /** Called after every MODE command sent from a user * The dest variable contains a userrec* if target_type is TYPE_USER and a chanrec* @@ -593,6 +709,17 @@ class Module : public classbase */ virtual void OnSyncUserMetaData(userrec* user, Module* proto,void* opaque, std::string extname); + /* Allows modules to syncronize metadata not related to users or channels, over the network during a netburst. + * Whenever the linking module wants to send out data, but doesnt know what the data + * represents (e.g. it is Extensible metadata, added to a userrec or chanrec by a module) then + * this method is called. You should use the ProtoSendMetaData function after you've + * correctly decided how the data should be represented, to send the metadata on its way if + * if it belongs to your module. + * @param proto A pointer to the module handling network protocol + * @param opaque An opaque pointer set by the protocol module, should not be modified! + */ + virtual void OnSyncOtherMetaData(Module* proto, void* opaque); + /** Allows module data, sent via ProtoSendMetaData, to be decoded again by a receiving module. * Please see src/modules/m_swhois.cpp for a working example of how to use this method call. * @param target_type The type of item to decode data for, TYPE_USER or TYPE_CHANNEL @@ -871,9 +998,10 @@ class Module : public classbase * @param parameters An array of array of characters containing the parameters for the command * @param pcnt The nuimber of parameters passed to the command * @param user the user issuing the command + * @param validated True if the command has passed all checks, e.g. it is recognised, has enough parameters, the user has permission to execute it, etc. * @return 1 to block the command, 0 to allow */ - virtual int OnPreCommand(std::string command, char **parameters, int pcnt, userrec *user); + virtual int OnPreCommand(std::string command, char **parameters, int pcnt, userrec *user, bool validated); /** Called to check if a user who is connecting can now be allowed to register * If any modules return false for this function, the user is held in the waiting @@ -955,8 +1083,10 @@ class Module : public classbase /** Called on all /STATS commands * This method is triggered for all /STATS use, including stats symbols handled by the core. * @param symbol the symbol provided to /STATS + * @user the user issuing the /STATS command + * @return 1 to block the /STATS from being processed by the core, 0 to allow it */ - virtual void OnStats(char symbol); + virtual int OnStats(char symbol, userrec* user); /** Called whenever a change of a local users displayed host is attempted. * Return 1 to deny the host change, or 0 to allow it. @@ -1097,6 +1227,10 @@ class Module : public classbase * @return nonzero if the event was handled, in which case readresult must be valid on exit */ virtual int OnRawSocketRead(int fd, char* buffer, unsigned int count, int &readresult); + + virtual void OnSetAway(userrec* user); + + virtual void OnCancelAway(userrec* user); }; @@ -1112,46 +1246,76 @@ class Server : public classbase * Creates a Server object. */ Server(); + /** Default destructor. * Destroys a Server object. */ virtual ~Server(); + /** Obtains a pointer to the server's ServerConfig object. * The ServerConfig object contains most of the configuration data * of the IRC server, as read from the config file by the core. */ ServerConfig* GetConfig(); + + /** For use with Module::Prioritize(). + * When the return value of this function is returned from + * Module::Prioritize(), this specifies that the module wishes + * to be ordered exactly BEFORE 'modulename'. For more information + * please see Module::Prioritize(). + * @param modulename The module your module wants to be before in the call list + * @returns a priority ID which the core uses to relocate the module in the list + */ + long PriorityBefore(std::string modulename); + + /** For use with Module::Prioritize(). + * When the return value of this function is returned from + * Module::Prioritize(), this specifies that the module wishes + * to be ordered exactly AFTER 'modulename'. For more information please + * see Module::Prioritize(). + * @param modulename The module your module wants to be after in the call list + * @returns a priority ID which the core uses to relocate the module in the list + */ + long PriorityAfter(std::string modulename); + /** Sends text to all opers. * This method sends a server notice to all opers with the usermode +s. */ virtual void SendOpers(std::string s); + /** Returns the version string of this server */ std::string GetVersion(); + /** Writes a log string. * This method writes a line of text to the log. If the level given is lower than the * level given in the configuration, this command has no effect. */ virtual void Log(int level, std::string s); + /** Sends a line of text down a TCP/IP socket. * This method writes a line of text to an established socket, cutting it to 510 characters * plus a carriage return and linefeed if required. */ virtual void Send(int Socket, std::string s); + /** Sends text from the server to a socket. * This method writes a line of text to an established socket, with the servername prepended * as used by numerics (see RFC 1459) */ virtual void SendServ(int Socket, std::string s); + /** Writes text to a channel, but from a server, including all. * This can be used to send server notices to a group of users. */ virtual void SendChannelServerNotice(std::string ServName, chanrec* Channel, std::string text); + /** Sends text from a user to a socket. * This method writes a line of text to an established socket, with the given user's nick/ident * /host combination prepended, as used in PRIVSG etc commands (see RFC 1459) */ virtual void SendFrom(int Socket, userrec* User, std::string s); + /** Sends text from a user to another user. * This method writes a line of text to a user, with a user's nick/ident * /host combination prepended, as used in PRIVMSG etc commands (see RFC 1459) @@ -1167,6 +1331,7 @@ class Server : public classbase * Which is useful for numerics and server notices to single users, etc. */ virtual void SendTo(userrec* Source, userrec* Dest, std::string s); + /** Sends text from a user to a channel (mulicast). * This method writes a line of text to a channel, with the given user's nick/ident * /host combination prepended, as used in PRIVMSG etc commands (see RFC 1459). If the @@ -1174,11 +1339,13 @@ class Server : public classbase * it originated, as seen in MODE (see RFC 1459). */ virtual void SendChannel(userrec* User, chanrec* Channel, std::string s,bool IncludeSender); + /** Returns true if two users share a common channel. * This method is used internally by the NICK and QUIT commands, and the Server::SendCommon * method. */ virtual bool CommonChannels(userrec* u1, userrec* u2); + /** Sends text from a user to one or more channels (mulicast). * This method writes a line of text to all users which share a common channel with a given * user, with the user's nick/ident/host combination prepended, as used in PRIVMSG etc @@ -1187,6 +1354,7 @@ class Server : public classbase * is only sent to the other recipients, as seen in QUIT. */ virtual void SendCommon(userrec* User, std::string text,bool IncludeSender); + /** Sends a WALLOPS message. * This method writes a WALLOPS message to all users with the +w flag, originating from the * specified user. @@ -1197,46 +1365,57 @@ class Server : public classbase * Nicks for unregistered connections will return false. */ virtual bool IsNick(std::string nick); + /** Returns a count of the number of users on a channel. * This will NEVER be 0, as if the chanrec exists, it will have at least one user in the channel. */ virtual int CountUsers(chanrec* c); + /** Attempts to look up a nick and return a pointer to it. * This function will return NULL if the nick does not exist. */ virtual userrec* FindNick(std::string nick); + /** Attempts to look up a nick using the file descriptor associated with that nick. * This function will return NULL if the file descriptor is not associated with a valid user. */ virtual userrec* FindDescriptor(int socket); + /** Attempts to look up a channel and return a pointer to it. * This function will return NULL if the channel does not exist. */ virtual chanrec* FindChannel(std::string channel); + /** Attempts to look up a user's privilages on a channel. * This function will return a string containing either @, %, +, or an empty string, * representing the user's privilages upon the channel you specify. */ virtual std::string ChanMode(userrec* User, chanrec* Chan); + /** Checks if a user is on a channel. * This function will return true or false to indicate if user 'User' is on channel 'Chan'. */ virtual bool IsOnChannel(userrec* User, chanrec* Chan); + /** Returns the server name of the server where the module is loaded. */ virtual std::string GetServerName(); + /** Returns the network name, global to all linked servers. */ virtual std::string GetNetworkName(); + /** Returns the server description string of the local server */ virtual std::string GetServerDescription(); + /** Returns the information of the server as returned by the /ADMIN command. * See the Admin class for further information of the return value. The members * Admin::Nick, Admin::Email and Admin::Name contain the information for the * server where the module is loaded. */ virtual Admin GetAdmin(); + /** Adds an extended mode letter which is parsed by a module. * This allows modules to add extra mode letters, e.g. +x for hostcloak. * the "type" parameter is either MT_CHANNEL, MT_CLIENT, or MT_SERVER, to @@ -1297,7 +1476,7 @@ class Server : public classbase * extension) e.g. "m_blarp.so". If you place the wrong identifier here, you can cause crashes if your module * is unloaded. */ - virtual void AddCommand(char* cmd, handlerfunc f, char flags, int minparams, char* source); + virtual void AddCommand(command_t *f); /** Sends a servermode. * you must format the parameters array with the target, modes and parameters for those modes. @@ -1368,6 +1547,15 @@ class Server : public classbase * action after calling this method is to immediately bail from your handler. */ virtual void QuitUser(userrec* user, std::string reason); + + /** Makes a user kick another user, with the specified reason. + * If source is NULL, the server will peform the kick. + * @param The person or server (if NULL) performing the KICK + * @param target The person being kicked + * @param chan The channel to kick from + * @param reason The kick reason + */ + virtual void KickUser(userrec* source, userrec* target, chanrec* chan, std::string reason); /** Matches text against a glob pattern. * Uses the ircd's internal matching function to match string against a globbing pattern, e.g. *!*@*.com @@ -1388,6 +1576,11 @@ class Server : public classbase */ virtual void CallCommandHandler(std::string commandname, char** parameters, int pcnt, userrec* user); + /** This function returns true if the commandname exists, pcnt is equal to or greater than the number + * of paramters the command requires, the user specified is allowed to execute the command, AND + * if the command is implemented by a module (not the core). This has a few specific uses, usually + * within network protocols (see src/modules/m_spanningtree.cpp) + */ virtual bool IsValidModuleCommand(std::string commandname, int pcnt, userrec* user); /** Change displayed hostname of a user. @@ -1407,10 +1600,7 @@ class Server : public classbase /** Returns true if the servername you give is ulined. * ULined servers have extra privilages. They are allowed to change nicknames on remote servers, * change modes of clients which are on remote servers and set modes of channels where there are - * no channel operators for that channel on the ulined server, amongst other things. Ulined server - * data is also broadcast across the mesh at all times as opposed to selectively messaged in the - * case of normal servers, as many ulined server types (such as services) do not support meshed - * links and must operate in this manner. + * no channel operators for that channel on the ulined server, amongst other things. */ virtual bool IsUlined(std::string server); @@ -1429,7 +1619,7 @@ class Server : public classbase /** This user takes one user, and switches their file descriptor with another user, so that one user * "becomes" the other. The user in 'alive' is booted off the server with the given message. The user - * referred to by 'zombie' should have previously been locked with Server::ZombifyUser, otherwise + * referred to by 'zombie' should have previously been locked with Server::UserToPseudo, otherwise * stale sockets and file descriptor leaks can occur. After this call, the pointer to alive will be * invalid, and the pointer to zombie will be equivalent in effect to the old pointer to alive. */ @@ -1480,15 +1670,15 @@ class Server : public classbase */ virtual void AddELine(long duration, std::string source, std::string reason, std::string hostmask); - /** Deletes a G-Line from all servers on the mesh + /** Deletes a G-Line from all servers */ virtual bool DelGLine(std::string hostmask); - /** Deletes a Q-Line from all servers on the mesh + /** Deletes a Q-Line from all servers */ virtual bool DelQLine(std::string nickname); - /** Deletes a Z-Line from all servers on the mesh + /** Deletes a Z-Line from all servers */ virtual bool DelZLine(std::string ipaddr); @@ -1521,6 +1711,10 @@ class Server : public classbase */ virtual void AddSocket(InspSocket* sock); + /** Forcibly removes a class derived from InspSocket from the servers socket engine. + */ + virtual void RemoveSocket(InspSocket* sock); + /** Deletes a class derived from InspSocket from the server's socket engine. */ virtual void DelSocket(InspSocket* sock);