]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/modules.h
Added m_alias module which provides command aliases.
[user/henk/code/inspircd.git] / include / modules.h
index c93e565fb324822863a8d47585085e26021a3aea..e6b4739d8c7a34c63414e0ec5b19434a63d5383d 100644 (file)
@@ -30,6 +30,7 @@
 typedef std::deque<std::string> file_cache;
 typedef file_cache string_list;
 
+
 // This #define allows us to call a method in all
 // loaded modules in a readable simple way, e.g.:
 // 'FOREACH_MOD OnConnect(user);'
@@ -158,9 +159,11 @@ class Module : public classbase
         * This method is the lowest level of handler available to a module. It will be called with raw
         * data which is passing through a connected socket. If you wish, you may munge this data by changing
         * the string parameter "raw". If you do this, after your function exits it will immediately be
-        * cut down to 510 characters plus a carriage return and linefeed.
+        * cut down to 510 characters plus a carriage return and linefeed. For INBOUND messages only (where
+        * inbound is set to true) the value of user will be the userrec of the connection sending the
+        * data. This is not possible for outbound data because the data may be being routed to multiple targets.
         */
-       virtual void OnServerRaw(std::string &raw, bool inbound);
+       virtual void OnServerRaw(std::string &raw, bool inbound, userrec* user);
 
        /** Called whenever an extended mode is to be processed.
         * The type parameter is MT_SERVER, MT_CLIENT or MT_CHANNEL, dependent on where the mode is being
@@ -229,6 +232,15 @@ class Module : public classbase
         * of where the message is destined to be sent.
         */
        virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string text);
+       
+       /** Called before any nickchange, local or remote. This can be used to implement Q-lines etc.
+        * Please note that although you can see remote nickchanges through this function, you should
+        * NOT make any changes to the userrec if the user is a remote user as this may cause a desnyc.
+        * check user->server before taking any action (including returning nonzero from the method).
+        * If your method returns nonzero, the nickchange is silently forbidden, and it is down to your
+        * module to generate some meaninful output.
+        */
+       virtual int OnUserPreNick(userrec* user, std::string newnick);
 };
 
 
@@ -458,6 +470,43 @@ class Server : public classbase
         * Returns true if the literal successfully matches the pattern, false if otherwise.
         */
        virtual bool MatchText(std::string sliteral, std::string spattern);
+       
+       /** Calls the handler for a command, either implemented by the core or by another module.
+        * You can use this function to trigger other commands in the ircd, such as PRIVMSG, JOIN,
+        * KICK etc, or even as a method of callback. By defining command names that are untypeable
+        * for users on irc (e.g. those which contain a \r or \n) you may use them as callback identifiers.
+        * The first parameter to this method is the name of the command handler you wish to call, e.g.
+        * PRIVMSG. This will be a command handler previously registered by the core or wih AddCommand().
+        * The second parameter is an array of parameters, and the third parameter is a count of parameters
+        * in the array. If you do not pass enough parameters to meet the minimum needed by the handler, the
+        * functiom will silently ignore it. The final parameter is the user executing the command handler,
+        * used for privilage checks, etc.
+        */
+       virtual void CallCommandHandler(std::string commandname, char** parameters, int pcnt, userrec* user);
+       
+       /** Change displayed hostname of a user.
+        * You should always call this method to change a user's host rather than writing directly to the
+        * dhost member of userrec, as any change applied via this method will be propogated to any
+        * linked servers.
+        */     
+       virtual void ChangeHost(userrec* user, std::string host);
+       
+       /** Change GECOS (fullname) of a user.
+        * You should always call this method to change a user's GECOS rather than writing directly to the
+        * fullname member of userrec, as any change applied via this method will be propogated to any
+        * linked servers.
+        */     
+       virtual void ChangeGECOS(userrec* user, std::string gecos);
+       
+       /** Returns true if the servername you give is ulined.
+        * ULined servers have extra privilages. They are allowed to change nicknames on remote servers,
+        * change modes of clients which are on remote servers and set modes of channels where there are
+        * no channel operators for that channel on the ulined server, amongst other things. Ulined server
+        * data is also broadcast across the mesh at all times as opposed to selectively messaged in the
+        * case of normal servers, as many ulined server types (such as services) do not support meshed
+        * links and must operate in this manner.
+        */
+       virtual bool IsUlined(std::string server);
 };
 
 /** Allows reading of values from configuration files
@@ -510,6 +559,13 @@ class ConfigReader : public classbase
         * file does not exist or could not be opened.
         */
        bool Verify();
+
+       /** Returns the number of items within a tag.
+        * For example if the tag was &lt;test tag="blah" data="foo"&gt; then this
+        * function would return 2. Spaces and newlines both qualify as valid seperators
+        * between values.
+        */
+       int EnumerateValues(std::string tag, int index);
 };