|
|||
|
|||
|
#include <main.h>
Inheritance diagram for ModuleSpanningTree:


Public Member Functions | |
| ModuleSpanningTree (InspIRCd *Me) | |
| Constructor. | |
| void | ShowLinks (TreeServer *Current, User *user, int hops) |
| Shows /LINKS. | |
| int | CountLocalServs () |
| Counts local servers. | |
| int | CountServs () |
| Counts local and remote servers. | |
| void | HandleLinks (const std::vector< std::string > ¶meters, User *user) |
| Handle LINKS command. | |
| void | HandleLusers (const std::vector< std::string > ¶meters, User *user) |
| Handle LUSERS command. | |
| void | ShowMap (TreeServer *Current, User *user, int depth, char matrix[250][250], float &totusers, float &totservers) |
| Show MAP output to a user (recursive). | |
| int | HandleMotd (const std::vector< std::string > ¶meters, User *user) |
| Handle remote MOTD. | |
| int | HandleAdmin (const std::vector< std::string > ¶meters, User *user) |
| Handle remote ADMIN. | |
| int | HandleStats (const std::vector< std::string > ¶meters, User *user) |
| Handle remote STATS. | |
| int | HandleMap (const std::vector< std::string > ¶meters, User *user) |
| Handle MAP command. | |
| int | HandleSquit (const std::vector< std::string > ¶meters, User *user) |
| Handle SQUIT. | |
| int | HandleTime (const std::vector< std::string > ¶meters, User *user) |
| Handle TIME. | |
| int | HandleRemoteWhois (const std::vector< std::string > ¶meters, User *user) |
| Handle remote WHOIS. | |
| int | HandleModules (const std::vector< std::string > ¶meters, User *user) |
| Handle remote MODULES. | |
| void | DoPingChecks (time_t curtime) |
| Ping all local servers. | |
| void | ConnectServer (Link *x) |
| Connect a server locally. | |
| void | AutoConnectServers (time_t curtime) |
| Check if any servers are due to be autoconnected. | |
| void | DoConnectTimeout (time_t curtime) |
| Check if any connecting servers should timeout. | |
| int | HandleVersion (const std::vector< std::string > ¶meters, User *user) |
| Handle remote VERSON. | |
| int | HandleConnect (const std::vector< std::string > ¶meters, User *user) |
| Handle CONNECT. | |
| void | RemoteMessage (User *user, const char *format,...) CUSTOM_PRINTF(3 |
| Attempt to send a message to a user. | |
| void const std::string | MapOperInfo (TreeServer *Current) |
| Returns oper-specific MAP information. | |
| std::string | TimeToStr (time_t secs) |
| Display a time as a human readable string. | |
| virtual int | OnPreCommand (std::string &command, std::vector< std::string > ¶meters, User *user, bool validated, const std::string &original_line) |
| *** MODULE EVENTS *** | |
| virtual void | OnPostCommand (const std::string &command, const std::vector< std::string > ¶meters, User *user, CmdResult result, const std::string &original_line) |
| Called after any command has been executed. | |
| virtual void | OnGetServerDescription (const std::string &servername, std::string &description) |
| Allows modules to alter or create server descriptions Whenever a module requires a server description, for example for display in WHOIS, this function is called in all modules. | |
| virtual void | OnUserInvite (User *source, User *dest, Channel *channel, time_t) |
| Called after a user has been successfully invited to a channel. | |
| virtual void | OnPostLocalTopicChange (User *user, Channel *chan, const std::string &topic) |
| Called whenever a local topic has been changed. | |
| virtual void | OnWallops (User *user, const std::string &text) |
| Called after every WALLOPS command. | |
| virtual void | OnUserNotice (User *user, void *dest, int target_type, const std::string &text, char status, const CUList &exempt_list) |
| Called after any NOTICE sent from a user. | |
| virtual void | OnUserMessage (User *user, void *dest, int target_type, const std::string &text, char status, const CUList &exempt_list) |
| Called after any PRIVMSG sent from a user. | |
| virtual void | OnBackgroundTimer (time_t curtime) |
| Called once every five seconds for background processing. | |
| virtual void | OnUserJoin (User *user, Channel *channel, bool sync, bool &silent) |
| Called when a user joins a channel. | |
| virtual int | OnChangeLocalUserHost (User *user, const std::string &newhost) |
| Called whenever a change of a local users displayed host is attempted. | |
| virtual void | OnChangeName (User *user, const std::string &gecos) |
| Called whenever a user's GECOS (realname) is changed. | |
| virtual void | OnUserPart (User *user, Channel *channel, std::string &partmessage, bool &silent) |
| Called when a user parts a channel. | |
| virtual void | OnUserQuit (User *user, const std::string &reason, const std::string &oper_message) |
| Called when a user quits. | |
| virtual void | OnUserPostNick (User *user, const std::string &oldnick) |
| virtual void | OnUserKick (User *source, User *user, Channel *chan, const std::string &reason, bool &silent) |
| Called whenever a user is kicked. | |
| virtual void | OnRemoteKill (User *source, User *dest, const std::string &reason, const std::string &operreason) |
| Called when an oper wants to disconnect a remote user via KILL. | |
| virtual void | OnRehash (User *user, const std::string ¶meter) |
| Called on rehash. | |
| virtual void | OnOper (User *user, const std::string &opertype) |
| Called whenever a user opers locally. | |
| void | OnLine (User *source, const std::string &host, bool adding, char linetype, long duration, const std::string &reason) |
| virtual void | OnAddLine (User *u, XLine *x) |
| Called whenever an xline is added by a local user. | |
| virtual void | OnDelLine (User *u, XLine *x) |
| Called whenever an xline is deleted MANUALLY. | |
| virtual void | OnMode (User *user, void *dest, int target_type, const std::string &text) |
| Called after every MODE command sent from a user The dest variable contains a User* if target_type is TYPE_USER and a Channel* if target_type is TYPE_CHANNEL. | |
| virtual int | OnStats (char statschar, User *user, string_list &results) |
| Called on all /STATS commands This method is triggered for all /STATS use, including stats symbols handled by the core. | |
| virtual int | OnSetAway (User *user, const std::string &awaymsg) |
| Called whenever a user sets away or returns from being away. | |
| virtual void | ProtoSendMode (void *opaque, TargetTypeFlags target_type, void *target, const std::string &modeline) |
| Implemented by modules which provide the ability to link servers. | |
| virtual void | ProtoSendMetaData (void *opaque, TargetTypeFlags target_type, void *target, const std::string &extname, const std::string &extdata) |
| Implemented by modules which provide the ability to link servers. | |
| virtual void | OnEvent (Event *event) |
| Called whenever an Event class is sent to all module by another module. | |
| virtual | ~ModuleSpanningTree () |
| virtual Version | GetVersion () |
| Returns the version number of a Module. | |
| void | Prioritize () |
Public Attributes | |
| CacheRefreshTimer * | RefreshTimer |
Private Attributes | |
| int | line |
| int | NumServers |
| unsigned int | max_local |
| unsigned int | max_global |
| cmd_rconnect * | command_rconnect |
| cmd_rsquit * | command_rsquit |
| SpanningTreeUtilities * | Utils |
Definition at line 42 of file main.h.
|
|
|
Definition at line 879 of file main.cpp. References TimerManager::DelTimer(), ModuleManager::DoneWithInterface(), InspIRCd::Modules, InspIRCd::PI, RefreshTimer, Module::ServerInstance, InspIRCd::Timers, and Utils. |
|
|
Check if any servers are due to be autoconnected.
Definition at line 306 of file main.cpp. References ConnectServer(), SpanningTreeUtilities::FindServer(), SpanningTreeUtilities::LinkBlocks, Module::ServerInstance, InspIRCd::SNO, Utils, and SnomaskManager::WriteToSnoMask(). Referenced by OnBackgroundTimer(). |
|
|
Connect a server locally.
Definition at line 244 of file main.cpp. References InspIRCd::AddResolver(), assign(), Link::Bind, InspIRCd::Config, DNS_QUERY_A, DNS_QUERY_AAAA, SpanningTreeUtilities::DoFailOver(), EventHandler::GetFd(), CoreException::GetReason(), Link::Hook, SpanningTreeUtilities::hooks, Link::IPAddr, InspIRCd::Match(), Link::Name, Link::Port, Module::ServerInstance, ServerConfig::ServerName, InspIRCd::SNO, InspIRCd::SocketCull, Link::Timeout, Utils, and SnomaskManager::WriteToSnoMask(). Referenced by AutoConnectServers(), SpanningTreeUtilities::DoFailOver(), and HandleConnect(). |
|
|
Counts local servers.
Definition at line 102 of file main.cpp. References TreeServer::ChildCount(), SpanningTreeUtilities::TreeRoot, and Utils. Referenced by HandleLusers(). |
|
|
Counts local and remote servers.
Definition at line 107 of file main.cpp. References SpanningTreeUtilities::serverlist, and Utils. Referenced by HandleLusers(). |
|
|
Check if any connecting servers should timeout.
Definition at line 336 of file main.cpp. References classbase::age, BufferedSocket::Close(), SocketEngine::DelFd(), SpanningTreeUtilities::DoFailOver(), SpanningTreeUtilities::FindLink(), InspIRCd::SE, Module::ServerInstance, InspIRCd::SNO, SpanningTreeUtilities::timeoutlist, Utils, and SnomaskManager::WriteToSnoMask(). Referenced by OnBackgroundTimer(). |
|
|
|
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 892 of file main.cpp. References API_VERSION, and VF_VENDOR. |
|
||||||||||||
|
Handle remote ADMIN.
Definition at line 30 of file override_admin.cpp. References InspIRCd::Config, SpanningTreeUtilities::DoOneToOne(), ERR_NOSUCHSERVER, SpanningTreeUtilities::FindServerMask(), TreeServer::GetName(), InspIRCd::Match(), User::nick, Module::ServerInstance, ServerConfig::ServerName, Utils, User::uuid, and User::WriteNumeric(). Referenced by OnPreCommand(). |
|
||||||||||||
|
Handle CONNECT.
Definition at line 397 of file main.cpp. References assign(), InspIRCd::Config, ConnectServer(), SpanningTreeUtilities::FindServer(), TreeServer::GetName(), TreeServer::GetParent(), SpanningTreeUtilities::LinkBlocks, InspIRCd::Match(), RemoteMessage(), Module::ServerInstance, ServerConfig::ServerName, and Utils. Referenced by OnPreCommand(). |
|
||||||||||||
|
Handle LINKS command.
Definition at line 112 of file main.cpp. References User::nick, ShowLinks(), SpanningTreeUtilities::TreeRoot, Utils, and User::WriteNumeric(). Referenced by OnPreCommand(). |
|
||||||||||||
|
Handle LUSERS command.
Definition at line 119 of file main.cpp. References InspIRCd::ChannelCount(), CountLocalServs(), CountServs(), SpanningTreeUtilities::HideULines, IS_OPER, UserManager::LocalUserCount(), max_global, max_local, UserManager::ModeCount(), User::nick, UserManager::OperCount(), Module::ServerInstance, SpanningTreeUtilities::serverlist, SpanningTreeUtilities::TreeRoot, InspIRCd::ULine(), UserManager::UnregisteredUserCount(), UserManager::UserCount(), InspIRCd::Users, Utils, and User::WriteNumeric(). Referenced by OnPreCommand(). |
|
||||||||||||
|
Handle MAP command.
Definition at line 102 of file override_map.cpp. References InspIRCd::Config, ConvToStr(), DEBUG, SpanningTreeUtilities::DoOneToOne(), ERR_NOSUCHSERVER, SpanningTreeUtilities::FindServerMask(), TreeServer::GetName(), IS_LOCAL, line, LogManager::Log(), InspIRCd::Logs, User::nick, InspIRCd::PI, ProtocolInterface::PushToClient(), RPL_ENDMAP, RPL_MAP, RPL_MAPUSERS, Module::ServerInstance, ServerConfig::ServerName, ShowMap(), SpanningTreeUtilities::TreeRoot, Utils, User::uuid, and User::WriteNumeric(). Referenced by OnPreCommand(), and TreeSocket::ProcessLine(). |
|
||||||||||||
|
Handle remote MODULES.
Definition at line 30 of file override_modules.cpp. References InspIRCd::Config, SpanningTreeUtilities::DoOneToOne(), ERR_NOSUCHSERVER, SpanningTreeUtilities::FindServerMask(), TreeServer::GetName(), InspIRCd::Match(), User::nick, Module::ServerInstance, ServerConfig::ServerName, Utils, User::uuid, and User::WriteNumeric(). Referenced by OnPreCommand(). |
|
||||||||||||
|
Handle remote MOTD.
Definition at line 30 of file override_motd.cpp. References InspIRCd::Config, SpanningTreeUtilities::DoOneToOne(), ERR_NOSUCHSERVER, SpanningTreeUtilities::FindServerMask(), TreeServer::GetName(), InspIRCd::Match(), User::nick, Module::ServerInstance, ServerConfig::ServerName, Utils, User::uuid, and User::WriteNumeric(). Referenced by OnPreCommand(). |
|
||||||||||||
|
Handle remote WHOIS.
Definition at line 30 of file override_whois.cpp. References SpanningTreeUtilities::DoOneToOne(), InspIRCd::FindNick(), EventHandler::GetFd(), IS_LOCAL, User::nick, User::server, Module::ServerInstance, Utils, User::uuid, and User::WriteNumeric(). Referenced by OnPreCommand(). |
|
||||||||||||
|
Handle SQUIT.
Definition at line 30 of file override_squit.cpp. References BufferedSocket::Close(), SocketEngine::DelFd(), SpanningTreeUtilities::FindServerMask(), User::GetFullRealHost(), TreeServer::GetSocket(), User::nick, InspIRCd::SE, Module::ServerInstance, InspIRCd::SNO, TreeSocket::Squit(), SpanningTreeUtilities::TreeRoot, Utils, User::WriteServ(), and SnomaskManager::WriteToSnoMask(). Referenced by OnPreCommand(). |
|
||||||||||||
|
Handle remote STATS.
Definition at line 31 of file override_stats.cpp. References InspIRCd::Config, SpanningTreeUtilities::DoOneToOne(), SpanningTreeUtilities::FindServerMask(), TreeServer::GetName(), InspIRCd::Match(), User::nick, Module::ServerInstance, ServerConfig::ServerName, Utils, User::uuid, and User::WriteServ(). Referenced by OnPreCommand(). |
|
||||||||||||
|
Handle TIME.
Definition at line 30 of file override_time.cpp. References InspIRCd::Config, SpanningTreeUtilities::DoOneToOne(), ERR_NOSUCHSERVER, SpanningTreeUtilities::FindServerMask(), TreeServer::GetName(), ServerConfig::GetSID(), IS_LOCAL, User::nick, Module::ServerInstance, SpanningTreeUtilities::TreeRoot, Utils, User::uuid, and User::WriteNumeric(). Referenced by OnPreCommand(). |
|
||||||||||||
|
Handle remote VERSON.
Definition at line 360 of file main.cpp. References InspIRCd::Config, SpanningTreeUtilities::FindServerMask(), TreeServer::GetVersion(), User::nick, ServerConfig::Send005(), Module::ServerInstance, SpanningTreeUtilities::TreeRoot, Utils, and User::WriteNumeric(). Referenced by OnPreCommand(). |
|
|
Returns oper-specific MAP information.
Definition at line 25 of file override_map.cpp. References classbase::age, ConvToStr(), TreeServer::rtt, Module::ServerInstance, InspIRCd::Time(), and TimeToStr(). Referenced by ShowMap(). |
|
||||||||||||
|
Called whenever an xline is added by a local user. This method is triggered after the line is added.
Reimplemented from Module. Definition at line 730 of file main.cpp. References InspIRCd::Config, XLine::Displayable(), SpanningTreeUtilities::DoOneToMany(), XLine::duration, ServerConfig::GetSID(), IS_LOCAL, XLine::IsBurstable(), MAXBUF, XLine::reason, Module::ServerInstance, ServerConfig::ServerName, XLine::set_time, XLine::type, Utils, and User::uuid. |
|
|
Called once every five seconds for background processing. This timer can be used to control timed features. Its period is not accurate enough to be used as a clock, but it is gauranteed to be called at least once in any five second period, directly from the main loop of the server.
Reimplemented from Module. Definition at line 572 of file main.cpp. References AutoConnectServers(), DoConnectTimeout(), and DoPingChecks(). |
|
||||||||||||
|
Called whenever a change of a local users displayed host is attempted. Return 1 to deny the host change, or 0 to allow it.
Reimplemented from Module. Definition at line 596 of file main.cpp. References SpanningTreeUtilities::DoOneToMany(), Utils, and User::uuid. |
|
||||||||||||
|
Called whenever a user's GECOS (realname) is changed. This event triggers after the name has been set.
Reimplemented from Module. Definition at line 604 of file main.cpp. References SpanningTreeUtilities::DoOneToMany(), REG_ALL, User::registered, Utils, and User::uuid. |
|
||||||||||||
|
Called whenever an xline is deleted MANUALLY. See OnExpireLine for expiry. This method is triggered after the line is deleted.
Reimplemented from Module. Definition at line 753 of file main.cpp. References InspIRCd::Config, XLine::Displayable(), SpanningTreeUtilities::DoOneToMany(), ServerConfig::GetSID(), IS_LOCAL, MAXBUF, Module::ServerInstance, XLine::type, Utils, and User::uuid. |
|
|
Called whenever an Event class is sent to all module by another module. Please see the documentation of Event::Send() for further information. The Event sent can always be assumed to be non-NULL, you should *always* check the value of Event::GetEventID() before doing anything to the event data, and you should *not* change the event data in any way!
Reimplemented from Module. Definition at line 870 of file main.cpp. References DEBUG, Event::GetEventID(), LogManager::Log(), InspIRCd::Logs, and Module::ServerInstance. |
|
||||||||||||
|
Allows modules to alter or create server descriptions Whenever a module requires a server description, for example for display in WHOIS, this function is called in all modules. You may change or define the description given in std::string &description. If you do, this description will be shown in the WHOIS fields.
Reimplemented from Module. Definition at line 427 of file main.cpp. References SpanningTreeUtilities::FindServer(), TreeServer::GetDesc(), and Utils. |
|
||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||
|
Called after every MODE command sent from a user The dest variable contains a User* if target_type is TYPE_USER and a Channel* if target_type is TYPE_CHANNEL. The text variable contains the remainder of the mode string after the target, e.g. "+wsi" or "+ooo nick1 nick2 nick3".
Reimplemented from Module. Definition at line 775 of file main.cpp. References classbase::age, ConvToStr(), SpanningTreeUtilities::DoOneToMany(), IS_LOCAL, Channel::name, InspIRCd::Parser, REG_ALL, User::registered, Module::ServerInstance, TR_SPACENICKLIST, CommandParser::TranslateUIDs(), TYPE_USER, Utils, and User::uuid. |
|
||||||||||||
|
Called whenever a user opers locally. The User will contain the oper mode 'o' as this function is called after any modifications are made to the user's structure by the core.
Reimplemented from Module. Definition at line 720 of file main.cpp. References SpanningTreeUtilities::DoOneToMany(), IS_LOCAL, Utils, and User::uuid. |
|
||||||||||||||||||||||||
|
Called after any command has been executed. This event occurs for all registered commands, wether they are registered in the core, or another module, but it will not occur for invalid commands (e.g. ones which do not exist within the command table). The result code returned by the command handler is provided.
Reimplemented from Module. Definition at line 30 of file postcommand.cpp. References CMD_SUCCESS, DEBUG, SpanningTreeUtilities::DoOneToMany(), Command::EncodeParameter(), |