|
|||
|
|||
|


Public Member Functions | |
| ModuleSecureList (InspIRCd *Me) | |
| virtual | ~ModuleSecureList () |
| virtual Version | GetVersion () |
| Returns the version number of a Module. | |
| void | OnRehash (userrec *user, const std::string ¶meter) |
| Called on rehash. | |
| void | Implements (char *List) |
| The Implements function specifies which methods a module should receive events for. | |
| virtual int | OnPreCommand (const std::string &command, const char **parameters, int pcnt, userrec *user, bool validated, const std::string &original_line) |
| Called whenever any command is about to be executed. | |
| virtual void | On005Numeric (std::string &output) |
| Called when a 005 numeric is about to be output. | |
| virtual Priority | Prioritize () |
| Used to set the 'priority' of a module (e.g. | |
Private Attributes | |
| std::vector< std::string > | allowlist |
| time_t | WaitTime |
Definition at line 21 of file m_securelist.cpp.
|
|
Definition at line 27 of file m_securelist.cpp. References OnRehash().
|
|
|
Definition at line 32 of file m_securelist.cpp.
|
|
|
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 36 of file m_securelist.cpp. References API_VERSION, and VF_VENDOR. 00037 { 00038 return Version(1,1,0,0,VF_VENDOR,API_VERSION); 00039 }
|
|
|
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;
Reimplemented from Module. Definition at line 51 of file m_securelist.cpp. References I_On005Numeric, I_OnPreCommand, and I_OnRehash. 00052 { 00053 List[I_OnRehash] = List[I_OnPreCommand] = List[I_On005Numeric] = 1; 00054 }
|
|
|
Called when a 005 numeric is about to be output. The module should modify the 005 numeric if needed to indicate its features.
Reimplemented from Module. Definition at line 85 of file m_securelist.cpp.
|
|
||||||||||||||||||||||||||||
|
Called whenever any command is about to be executed. This event occurs for all registered commands, wether they are registered in the core, or another module, and for invalid commands. Invalid commands may only be sent to this function when the value of validated is false. By returning 1 from this method you may prevent the command being executed. If you do this, no output is created by the core, and it is down to your module to produce any output neccessary. Note that unless you return 1, you should not destroy any structures (e.g. by using InspIRCd::QuitUser) otherwise when the command's handler function executes after your method returns, it will be passed an invalid pointer to the user object and crash!)
Reimplemented from Module. Definition at line 60 of file m_securelist.cpp. References allowlist, IS_OPER, userrec::MakeHost(), InspIRCd::MatchText(), userrec::nick, Module::ServerInstance, connection::signon, InspIRCd::Time(), WaitTime, and userrec::WriteServ(). 00061 { 00062 /* If the command doesnt appear to be valid, we dont want to mess with it. */ 00063 if (!validated) 00064 return 0; 00065 00066 if ((command == "LIST") && (ServerInstance->Time() < (user->signon+WaitTime)) && (!IS_OPER(user))) 00067 { 00068 /* Normally wouldnt be allowed here, are they exempt? */ 00069 for (std::vector<std::string>::iterator x = allowlist.begin(); x != allowlist.end(); x++) 00070 if (ServerInstance->MatchText(user->MakeHost(), *x)) 00071 return 0; 00072 00073 /* Not exempt, BOOK EM DANNO! */ 00074 user->WriteServ("NOTICE %s :*** You cannot list within the first %d seconds of connecting. Please try again later.",user->nick, WaitTime); 00075 /* Some crap clients (read: mIRC, various java chat applets) muck up if they don't 00076 * receive these numerics whenever they send LIST, so give them an empty LIST to mull over. 00077 */ 00078 user->WriteServ("321 %s Channel :Users Name",user->nick); 00079 user->WriteServ("323 %s :End of channel list.",user->nick); 00080 return 1; 00081 } 00082 return 0; 00083 }
|
|
||||||||||||
|
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.
Reimplemented from Module. Definition at line 41 of file m_securelist.cpp. References allowlist, DELETE(), ConfigReader::ReadInteger(), ConfigReader::ReadValue(), Module::ServerInstance, and WaitTime. Referenced by ModuleSecureList(). 00042 { 00043 ConfigReader* MyConf = new ConfigReader(ServerInstance); 00044 allowlist.clear(); 00045 for (int i = 0; i < MyConf->Enumerate("securehost"); i++) 00046 allowlist.push_back(MyConf->ReadValue("securehost", "exception", i)); 00047 W |