X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fcommand_parse.h;h=2c883be203b696458ea4c6366af404c907161355;hb=e6d000042ea75d4e0485bec9564b47163a3ca414;hp=e8240fcf9bf1a57a501947ab39a46e79ae3d6795;hpb=f42aa995415c14eb5511b896df74aea78602dc63;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/command_parse.h b/include/command_parse.h index e8240fcf9..2c883be20 100644 --- a/include/command_parse.h +++ b/include/command_parse.h @@ -56,10 +56,6 @@ class CoreExport CommandParser : public classbase */ void ProcessCommand(userrec *user, std::string &cmd); - /** Insert the default RFC1459 commands into the command hash. - */ - void SetupCommandTable(); - /** Finds the init_command symbol in a .so file * @param v A function pointer to be initialized * @param h A valid shared object handle @@ -73,8 +69,9 @@ class CoreExport CommandParser : public classbase /** Load a command from a shared object on disk. * @param name The shared object to load (without path) + * @return NULL on success, pointer to dlerrr() error message on failure */ - void LoadCommand(const char* name); + const char* LoadCommand(const char* name); /** Removes a command if the sources match. Used as a helper for * safe hash_map delete while iter in RemoveCommands(const char* source). @@ -95,7 +92,7 @@ class CoreExport CommandParser : public classbase * @return True if the command was reloaded, false if it could not be found * or another error occured */ - bool ReloadCommand(const char* cmd); + bool ReloadCommand(const char* cmd, userrec* user); /** Default constructor. * @param Instance The creator of this class @@ -197,6 +194,21 @@ class CoreExport CommandParser : public classbase * @return True if the command was added */ bool CreateCommand(command_t *f, void* so_handle = NULL); + + /** Insert the default RFC1459 commands into the command hash. + * Ignore any already loaded commands. + * @param user User to spool errors to, or if NULL, when an error occurs spool the errors to + * stdout then exit with EXIT_STATUS_HANDLER. + */ + void SetupCommandTable(userrec* user); + + /** Translate nicknames in a string into UIDs, based on the TranslationType given. + * @param to The translation type to use for the process. + * @param source The input string + * @param dest The output string, it is safe to pass source and dest as the same variable only for translation type TR_TEXT. + * @return returns the number of substitutions made. Will always be 0 or 1 for TR_TEXT and 0..n for other types. + */ + int TranslateUIDs(TranslateType to, const std::string &source, std::string &dest); }; /** Command handler class for the RELOAD command.