X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=inline;f=include%2Finspircd.h;h=b4fd12026a2b35667d06a999cdc1b29ff808a1b6;hb=db2a4c2c15bb170464bbff464d7cc79cd098df26;hp=44e6abe57791ca41cea8da10be8abc08d5101519;hpb=3cda2e0971d279b1840d1689bb2821a93d475a4e;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/inspircd.h b/include/inspircd.h index 44e6abe57..b4fd12026 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -234,6 +234,7 @@ class serverstats }; DEFINE_HANDLER2(IsNickHandler, bool, const char*, size_t); +DEFINE_HANDLER2(GenRandomHandler, void, char*, size_t); DEFINE_HANDLER1(IsIdentHandler, bool, const char*); DEFINE_HANDLER1(FloodQuitUserHandler, void, User*); DEFINE_HANDLER2(IsChannelHandler, bool, const char*, size_t); @@ -310,6 +311,7 @@ class CoreExport InspIRCd IsChannelHandler HandleIsChannel; IsSIDHandler HandleIsSID; RehashHandler HandleRehash; + GenRandomHandler HandleGenRandom; /** Globally accessible fake user record. This is used to force mode changes etc across s2s, etc.. bit ugly, but.. better than how this was done in 1.1 * Reason for it: @@ -449,6 +451,20 @@ class CoreExport InspIRCd /** Update the current time. Don't call this unless you have reason to do so. */ void UpdateTime(); + /** Generate a random string with the given length + * @param length The length in bytes + * @param printable if false, the string will use characters 0-255; otherwise, + * it will be limited to 0x30-0x7E ('0'-'~', nonspace printable characters) + */ + std::string GenRandomStr(int length, bool printable = true); + /** Generate a random integer. + * This is generally more secure than rand() + */ + unsigned long GenRandomInt(unsigned long max); + + /** Fill a buffer with random bits */ + caller2 GenRandom; + /** Bind all ports specified in the configuration file. * @return The number of ports bound without error */ @@ -612,6 +628,14 @@ class CoreExport InspIRCd */ void SendMode(const std::vector& parameters, User *user); + /** Send a modechange and route it to the network. + * The parameters provided are identical to that sent to the + * handler for class cmd_mode. + * @param parameters The mode parameters + * @param user The user to send error messages to + */ + void SendGlobalMode(const std::vector& parameters, User *user); + /** Match two strings using pattern matching, optionally, with a map * to check case against (may be NULL). If map is null, match will be case insensitive. * @param str The literal string to match against