]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/coremods/core_user/core_user.h
Merge pull request #984 from Renegade334/modules-exempt-uline
[user/henk/code/inspircd.git] / src / coremods / core_user / core_user.h
index ad4b739199d16921ababb57932269852df4b10b6..0418588c1e2916ff81fd7425590c06ac55108d89 100644 (file)
 
 #include "inspircd.h"
 
+class MessageWrapper
+{
+       std::string prefix;
+       std::string suffix;
+       bool fixed;
+
+ public:
+       /**
+        * Wrap the given message according to the config rules
+        * @param message The message to wrap
+        * @param out String where the result is placed
+        */
+       void Wrap(const std::string& message, std::string& out);
+
+       /**
+        * Read the settings from the given config keys (options block)
+        * @param prefixname Name of the config key to read the prefix from
+        * @param suffixname Name of the config key to read the suffix from
+        * @param fixedname Name of the config key to read the fixed string string from.
+        * If this key has a non-empty value, all messages will be replaced with it.
+        */
+       void ReadConfig(const char* prefixname, const char* suffixname, const char* fixedname);
+};
+
 /** Handle /AWAY.
  */
 class CommandAway : public Command
@@ -38,9 +62,43 @@ class CommandAway : public Command
        RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters);
 };
 
+class CommandMode : public Command
+{
+       unsigned int sent[256];
+       unsigned int seq;
+
+       /** Show the list of one or more list modes to a user.
+        * @param user User to send to.
+        * @param chan Channel whose lists to show.
+        * @param mode_sequence Mode letters to show the lists of.
+        */
+       void DisplayListModes(User* user, Channel* chan, const std::string& mode_sequence);
+
+       /** Show the current modes of a channel or a user to a user.
+        * @param user User to show the modes to.
+        * @param targetuser User whose modes to show. NULL if showing the modes of a channel.
+        * @param targetchannel Channel whose modes to show. NULL if showing the modes of a user.
+        */
+       void DisplayCurrentModes(User* user, User* targetuser, Channel* targetchannel);
+
+ public:
+       /** Constructor for mode.
+        */
+       CommandMode(Module* parent);
+
+       /** Handle command.
+        * @param parameters The parameters to the command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User* user);
+
+       RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters);
+};
+
 /** Handle /NICK.
  */
-class CommandNick : public Command
+class CommandNick : public SplitCommand
 {
  public:
        /** Constructor for nick.
@@ -52,7 +110,7 @@ class CommandNick : public Command
         * @param user The user issuing the command
         * @return A value from CmdResult to indicate command success or failure.
         */
-       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+       CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser* user);
 };
 
 /** Handle /PART.
@@ -60,6 +118,8 @@ class CommandNick : public Command
 class CommandPart : public Command
 {
  public:
+       MessageWrapper msgwrap;
+
        /** Constructor for part.
         */
        CommandPart(Module* parent);
@@ -78,6 +138,8 @@ class CommandPart : public Command
 class CommandQuit : public Command
 {
  public:
+       MessageWrapper msgwrap;
+
        /** Constructor for quit.
         */
        CommandQuit(Module* parent);
@@ -107,4 +169,13 @@ class CommandUser : public SplitCommand
         * @return A value from CmdResult to indicate command success or failure.
         */
        CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser *user);
+
+       /** Run the OnUserRegister hook if the user has sent both NICK and USER. Called after an unregistered user
+        * successfully executes the USER or the NICK command.
+        * @param user User to inspect and possibly pass to the OnUserRegister hook
+        * @return CMD_FAILURE if OnUserRegister was called and it returned MOD_RES_DENY, CMD_SUCCESS in every other case
+        * (i.e. if the hook wasn't fired because the user still needs to send NICK/USER or if it was fired and finished with
+        * a non-MOD_RES_DENY result).
+        */
+       static CmdResult CheckRegister(LocalUser* user);
 };