|
|||
|
|||
|
#include <mode.h>
Inheritance diagram for ModeHandler:


Public Member Functions | |
| ModeHandler (InspIRCd *Instance, char modeletter, int parameters_on, int parameters_off, bool listmode, ModeType type, bool operonly, char mprefix=0, char prefixrequired= '%') | |
| The constructor for ModeHandler initalizes the mode handler. | |
| virtual | ~ModeHandler () |
| The default destructor does nothing. | |
| bool | IsListMode () |
| Returns true if the mode is a list mode. | |
| char | GetPrefix () |
| Mode prefix or 0. | |
| virtual unsigned int | GetCount () |
| Get number of items with this mode set on them. | |
| virtual void | ChangeCount (int modifier) |
| Adjust usage count returned by GetCount. | |
| virtual unsigned int | GetPrefixRank () |
| Get the 'value' of this modes prefix. | |
| ModeType | GetModeType () |
| Returns the modes type. | |
| bool | NeedsOper () |
| Returns true if the mode can only be set/unset by an oper. | |
| int | GetNumParams (bool adding) |
| Returns the number of parameters for the mode. | |
| char | GetModeChar () |
| Returns the mode character this handler handles. | |
| virtual std::string | GetUserParameter (User *useor) |
| For user modes, return the current parameter, if any. | |
| virtual ModeAction | OnModeChange (User *source, User *dest, Channel *channel, std::string ¶meter, bool adding, bool servermode=false) |
| Called when a mode change for your mode occurs. | |
| virtual void | DisplayList (User *user, Channel *channel) |
| If your mode is a listmode, then this method will be called for displaying an item list, e.g. | |
| virtual void | OnParameterMissing (User *user, User *dest, Channel *channel) |
| In the event that the mode should be given a parameter, and no parameter was provided, this method is called. | |
| virtual void | DisplayEmptyList (User *user, Channel *channel) |
| If your mode is a listmode, this method will be called to display an empty list (just the end of list numeric). | |
| virtual bool | CheckTimeStamp (time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, Channel *channel) |
| If your mode needs special action during a server sync to determine which side wins when comparing timestamps, override this function and use it to return true or false. | |
| virtual ModePair | ModeSet (User *source, User *dest, Channel *channel, const std::string ¶meter) |
| When a remote server needs to bounce a set of modes, it will call this method for every mode in the mode string to determine if the mode is set or not. | |
| virtual void | RemoveMode (User *user, irc::modestacker *stack=NULL) |
| When a MODETYPE_USER mode handler is being removed, the server will call this method for every user on the server. | |
| virtual void | RemoveMode (Channel *channel, irc::modestacker *stack=NULL) |
| When a MODETYPE_CHANNEL mode handler is being removed, the server will call this method for every channel on the server. | |
| char | GetNeededPrefix () |
| void | SetNeededPrefix (char needsprefix) |
Protected Attributes | |
| InspIRCd * | ServerInstance |
| Creator/owner pointer. | |
| char | mode |
| The mode letter you're implementing. | |
| int | n_params_on |
| Number of parameters when being set. | |
| int | n_params_off |
| Number of parameters when being unset. | |
| bool | list |
| Mode is a 'list' mode. | |
| ModeType | m_type |
| The mode type, either MODETYPE_USER or MODETYPE_CHANNEL. | |
| bool | oper |
| True if the mode requires oper status to set. | |
| char | prefix |
| Mode prefix, or 0. | |
| unsigned int | count |
| Number of items with this mode set on them. | |
| char | prefixneeded |
| The prefix char needed on channel to use this mode, only checked for channel modes. | |
You must derive ModeHandler and add the child class to the list of modes handled by the ircd, using ModeParser::AddMode. When the mode you implement is set by a user, the virtual function OnModeChange is called. If you specify a value greater than 0 for parameters_on or parameters_off, then when the mode is set or unset respectively, std::string ¶meter will contain the parameter given by the user, else it will contain an empty string. You may alter this parameter string, and if you alter it to an empty string, and your mode is expected to have a parameter, then this is equivalent to returning MODEACTION_DENY.
Definition at line 93 of file mode.h.
|
||||||||||||||||||||||||||||||||||||||||
|
The constructor for ModeHandler initalizes the mode handler. The constructor of any class you derive from ModeHandler should probably call this constructor with the parameters set correctly.
|
|
|
The default destructor does nothing.
|
|
|
Adjust usage count returned by GetCount.
Definition at line 89 of file mode.cpp. References count, DEBUG, LogManager::Log(), InspIRCd::Logs, mode, and ServerInstance. Referenced by User::DecrementModes(), TreeSocket::ParseUID(), and ModeParser::Process(). |
|
||||||||||||||||||||||||
|
If your mode needs special action during a server sync to determine which side wins when comparing timestamps, override this function and use it to return true or false. The default implementation just returns true if theirs < ours. This will only be called for non-listmodes with parameters, when adding the mode and where theirs == ours (therefore the default implementation will always return false).
Reimplemented in JoinFlood, KickRejoin, MsgFlood, NickFlood, Redirect, ModeChannelKey, and ModeChannelLimit. |
|
||||||||||||
|
If your mode is a listmode, this method will be called to display an empty list (just the end of list numeric).
Reimplemented in ModeChannelBan, and ListModeBase. Definition at line 146 of file mode.cpp. Referenced by ModeParser::Process(). |
|
||||||||||||
|
If your mode is a listmode, then this method will be called for displaying an item list, e.g. on MODE channel +modechar without any parameter or other modes in the command.
Reimplemented in ChanFounder, ChanProtect, ModeChannelBan, and ListModeBase. Definition at line 142 of file mode.cpp. Referenced by ModeParser::Process(). |
|
|
Get number of items with this mode set on them.
Reimplemented in ModeUserInvisible, ModeUserOperator, and ModeUserWallops. Definition at line 84 of file mode.cpp. Referenced by UserManager::ModeCount(). |
|
|
Returns the mode character this handler handles.
Definition at line 115 of file mode.cpp. References mode. Referenced by ModeParser::AddMode(), ModeParser::ChanModes(), ModeParser::DelMode(), ModeParser::ModeString(), and ModeParser::Process(). |
|
|
Returns the modes type.
Definition at line 95 of file mode.cpp. References m_type. Referenced by ModeParser::AddMode(), and ModeParser::DelMode(). |
|
|
Definition at line 69 of file mode.cpp. References prefixneeded. Referenced by ModeParser::Process(). |
|
|
Returns the number of parameters for the mode. Any non-zero value should be considered to be equivalent to one.
Definition at line 110 of file mode.cpp. References n_params_off, and n_params_on. Referenced by User::FormatModes(), ModeParser::ModeString(), ModulePermanentChannels::OnRehash(), TreeSocket::ParseUID(), and Channel::SetDefaultModes(). |
|
|
Mode prefix or 0. If this is defined, you should also implement GetPrefixRank() to return an integer value for this mode prefix. Definition at line 105 of file mode.cpp. References prefix. Referenced by ModeParser::AddMode(), ModeParser::BuildPrefixes(), and Channel::ForceChan(). |
|
|
Get the 'value' of this modes prefix. determines which to display when there are multiple. The mode with the highest value is ranked first. See the PrefixModeValue enum and Channel::GetPrefixValue() for more information. Reimplemented in ChanFounder, ChanProtect, ModeChannelHalfOp, ModeChannelOp, and ModeChannelVoice. Definition at line 79 of file mode.cpp. Referenced by Channel::ForceChan(), and ModeParser::Process(). |
|
|
For user modes, return the current parameter, if any.
Reimplemented in ModeUserServerNoticeMask. Definition at line 120 of file mode.cpp. Referenced by User::FormatModes(). |
|
|
Returns true if the mode is a list mode.
Definition at line 64 of file mode.cpp. References list. Referenced by ModeParser::Process(). |
|
||||||||||||||||||||
|
When a remote server needs to bounce a set of modes, it will call this method for every mode in the mode string to determine if the mode is set or not.
Reimplemented in ChanFounder, ChanProtect, JoinFlood, KickRejoin, MsgFlood, NickFlood, Redirect, ModeChannelBan, ModeChannelHalfOp, ModeChannelKey, ModeChannelLimit, ModeChannelOp, ModeChannelVoice, and ListModeBase. Definition at line 130 of file mode.cpp. References Channel::IsModeSet(), and User::IsModeSet(). Referenced by ModeParser::ModeString(). |
|
|
Returns true if the mode can only be set/unset by an oper.
Reimplemented in ServProtectMode. Definition at line 100 of file mode.cpp. References oper. Referenced by User::UnOper(). |
|
||||||||||||||||||||||||||||
|
Called when a mode change for your mode occurs.
Reimplemented in AuditoriumMode, ChanFounder, ChanProtect, CloakUser, PrivacyMode, User_d, DelayJoinMode, HideChans, HideOper, InvisibleMode, JoinFlood, KickRejoin, MsgFlood, NickFlood, NoCTCP, NoNicks, OperChans, PermChannel, Redirect, Channel_r, User_r, ServProtectMode, SeeWhois, SSLMode, ModeChannelBan, ModeChannelHalfOp, ModeChannelKey, ModeChannelLimit, ModeChannelOp, ModeChannelTopicOps, ModeChannelVoice, ModeUserOperator, ModeUserServerNoticeMask, SimpleUserModeHandler, SimpleChannelModeHandler, and ListModeBase. Definition at line 125 of file mode.cpp. References MODEACTION_DENY. Referenced by Channel::ForceChan(), ModulePermanentChannels::OnRehash(), TreeSocket::ParseUID(), ModeParser::Process(), and Channel::SetDefaultModes(). |
|
||||||||||||||||
|
In the event that the mode should be given a parameter, and no parameter was provided, this method is called. This allows you to give special information to the user, or handle this any way you like.
Reimplemented in ModeUserServerNoticeMask. Definition at line 150 of file mode.cpp. Referenced by ModeParser::Process(). |
|
||||||||||||
|
When a MODETYPE_CHANNEL mode handler is being removed, the server will call this method for every channel on the server. Your mode handler should remove its user mode from the channel by sending the appropriate server modes using InspIRCd::SendMode(). The default implementation of this method can remove simple modes which have no parameters, and can be used when your mode is of this type, otherwise you must implement a more advanced version of it to remove your mode properly from each channel. Note that in the case of listmodes, you should remove the entire list of items.
Reimplemented in ChanFounder, ChanProtect, ModeChannelBan, ModeChannelHalfOp, ModeChannelKey, ModeChannelOp, ModeChannelVoice, and ListModeBase. Definition at line 1176 of file mode.cpp. References InspIRCd::FakeClient, Channel::IsModeSet(), MAXBUF, Channel::name, irc::modestacker::Push(), InspIRCd::SendMode(), and ServerInstance. |
|
||||||||||||
|
When a MODETYPE_USER mode handler is being removed, the server will call this method for every user on the server. Your mode handler should remove its user mode from the user by sending the appropriate server modes using InspIRCd::SendMode(). The default implementation of this method can remove simple modes which have no parameters, and can be used when your mode is of this type, otherwise you must implement a more advanced version of it to remove your mode properly from each user.
Reimplemented in ChanFounder, ChanProtect, ModeChannelBan, ModeChannelHalfOp, ModeChannelKey, ModeChannelOp, ModeChannelVoice, and ListModeBase. Definition at line 1152 of file mode.cpp. References CommandParser::CallHandler(), User::IsModeSet(), MAXBUF, User::nick, InspIRCd::Parser, irc::modestacker::Push(), and ServerInstance. Referenced by ModeParser::DelMode(), and TreeSocket::RemoveStatus(). |
|
|
Definition at line 74 of file mode.cpp. References prefixneeded. |
|
|
Number of items with this mode set on them.
Definition at line 140 of file mode.h. Referenced by ChangeCount(), ModeUserWallops::GetCount(), ModeUserOperator::GetCount(), and ModeUserInvisible::GetCount(). |
|
|
Mode is a 'list' mode. The behaviour of your mode is now set entirely within the class as of the 1.1 api, rather than inside the mode parser as in the 1.0 api, so the only use of this value (along with IsListMode()) is for the core to determine wether your module can produce 'lists' or not (e.g. banlists, etc) Definition at line 122 of file mode.h. Referenced by IsListMode(). |
|
|
The mode type, either MODETYPE_USER or MODETYPE_CHANNEL.
Definition at line 127 of file mode.h. Referenced by GetModeType(). |
|
|
The mode letter you're implementing.
Definition at line 103 of file mode.h. Referenced by ChangeCount(), ListModeBase::DoSyncChannel(), GetModeChar(), and ListModeBase::ListModeBase(). |
|
|
Number of parameters when being unset.
Definition at line 111 of file mode.h. Referenced by GetNumParams(). |
|
|
Number of parameters when being set.
Definition at line 107 of file mode.h. Referenced by GetNumParams(). |
|
|
True if the mode requires oper status to set.
Definition at line 132 of file mode.h. Referenced by NeedsOper(). |
|
|
Mode prefix, or 0.
Reimplemented in CloakUser. Definition at line 136 of file mode.h. Referenced by GetPrefix(). |
|
|
The prefix char needed on channel to use this mode, only checked for channel modes.
Definition at line 145 of file mode.h. Referenced by GetNeededPrefix(), and SetNeededPrefix(). |
|