]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/modules.h
Change the behaviour of insp in windows to keep its window open, with some status...
[user/henk/code/inspircd.git] / include / modules.h
index 1f8f0fb5ed140d9bb7dd907cff303646553720e6..bba71365dcab416cef800c4bf3f9d7ada682652a 100644 (file)
@@ -75,7 +75,7 @@ enum MessageType {
  * ipv4 servers, so this value will be ten times as
  * high on ipv6 servers.
  */
-#define NATIVE_API_VERSION 11019
+#define NATIVE_API_VERSION 11024
 #ifdef IPV6
 #define API_VERSION (NATIVE_API_VERSION * 10)
 #else
@@ -187,8 +187,11 @@ typedef std::map<std::string, std::pair<int, modulelist> > interfacelist;
 #define FD_MAGIC_NUMBER -42
 
 // useful macros
-
+#ifdef WINDOWS
+#define IS_LOCAL(x) ((x->GetFd() > -1))
+#else
 #define IS_LOCAL(x) ((x->GetFd() > -1) && (x->GetFd() <= MAX_DESCRIPTORS))
+#endif
 #define IS_REMOTE(x) (x->GetFd() < 0)
 #define IS_MODULE_CREATED(x) (x->GetFd() == FD_MAGIC_NUMBER)
 #define IS_OPER(x) (*x->oper)
@@ -198,7 +201,7 @@ typedef std::map<std::string, std::pair<int, modulelist> > interfacelist;
  *  The four members (set by the constructor only) indicate details as to the version number
  *  of a module. A class of type Version is returned by the GetVersion method of the Module class.
  */
-class Version : public classbase
+class CoreExport Version : public classbase
 {
  public:
         const int Major, Minor, Revision, Build, Flags, API;
@@ -209,7 +212,7 @@ class Version : public classbase
  * This class is used to represent a basic data structure which is passed
  * between modules for safe inter-module communications.
  */
-class ModuleMessage : public Extensible
+class CoreExport ModuleMessage : public Extensible
 {
  public:
        virtual ~ModuleMessage() {};
@@ -220,7 +223,7 @@ class ModuleMessage : public Extensible
  * using the Send() method, which will call the given module's OnRequest
  * method with this class as its parameter.
  */
-class Request : public ModuleMessage
+class CoreExport Request : public ModuleMessage
 {
  protected:
        /** This member holds a pointer to arbitary data set by the emitter of the message
@@ -282,7 +285,7 @@ class Request : public ModuleMessage
  * using the Send() method, which will trigger the OnEvent method in
  * all modules passing the object as its parameter.
  */
-class Event : public ModuleMessage
+class CoreExport Event : public ModuleMessage
 {
  protected:
        /** This member holds a pointer to arbitary data set by the emitter of the message
@@ -324,7 +327,7 @@ class Event : public ModuleMessage
  * be loaded. If this happens, the error message returned by ModuleException::GetReason will be displayed to the user
  * attempting to load the module, or dumped to the console if the ircd is currently loading for the first time.
  */
-class CoreException : public std::exception
+class CoreExport CoreException : public std::exception
 {
  protected:
        /** Holds the error message to be displayed
@@ -361,7 +364,7 @@ class CoreException : public std::exception
        }
 };
 
-class ModuleException : public CoreException
+class CoreExport ModuleException : public CoreException
 {
  public:
        /** Default constructor, just uses the error mesage 'Module threw an exception'.
@@ -403,7 +406,7 @@ enum Implementation {       I_OnUserConnect, I_OnUserQuit, I_OnUserDisconnect, I_OnUse
  *  its methods will be called when irc server events occur. class inherited from module must be
  *  instantiated by the ModuleFactory class (see relevent section) for the module to be initialised.
  */
-class Module : public Extensible
+class CoreExport Module : public Extensible
 {
  protected:
        InspIRCd* ServerInstance;
@@ -496,8 +499,10 @@ class Module : public Extensible
         * and the details of the channel they have joined is available in the variable chanrec *channel
         * @param user The user who is joining
         * @param channel The channel being joined
+        * @param silent Change this to true if you want to conceal the JOIN command from the other users
+        * of the channel (useful for modules such as auditorium)
         */
-       virtual void OnUserJoin(userrec* user, chanrec* channel);
+       virtual void OnUserJoin(userrec* user, chanrec* channel, bool &silent);
 
        /** Called after a user joins a channel
         * Identical to OnUserJoin, but called immediately afterwards, when any linking module has
@@ -513,8 +518,10 @@ class Module : public Extensible
         * @param user The user who is parting
         * @param channel The channel being parted
         * @param partmessage The part message, or an empty string
+        * @param silent Change this to true if you want to conceal the PART command from the other users
+        * of the channel (useful for modules such as auditorium)
         */
-       virtual void OnUserPart(userrec* user, chanrec* channel, const std::string &partmessage);
+       virtual void OnUserPart(userrec* user, chanrec* channel, const std::string &partmessage, bool &silent);
 
        /** Called on rehash.
         * This method is called prior to a /REHASH or when a SIGHUP is received from the operating
@@ -580,8 +587,10 @@ class Module : public Extensible
         * @param user The user being kicked
         * @param chan The channel the user is being kicked from
         * @param reason The kick reason
+        * @param silent Change this to true if you want to conceal the PART command from the other users
+        * of the channel (useful for modules such as auditorium)
         */
-       virtual void OnUserKick(userrec* source, userrec* user, chanrec* chan, const std::string &reason);
+       virtual void OnUserKick(userrec* source, userrec* user, chanrec* chan, const std::string &reason, bool &silent);
 
        /** Called whenever a user opers locally.
         * The userrec will contain the oper mode 'o' as this function is called after any modifications
@@ -785,8 +794,10 @@ class Module : public Extensible
         * @param proto A pointer to the module handling network protocol
         * @param opaque An opaque pointer set by the protocol module, should not be modified!
         * @param extname The extensions name which is being searched for
+        * @param displayable If this value is true, the data is going to be displayed to a user,
+        * and not sent across the network. Use this to determine wether or not to show sensitive data.
         */
-       virtual void OnSyncChannelMetaData(chanrec* chan, Module* proto,void* opaque, const std::string &extname);
+       virtual void OnSyncChannelMetaData(chanrec* chan, Module* proto,void* opaque, const std::string &extname, bool displayable = false);
 
        /* Allows modules to syncronize metadata related to users over the network during a netburst.
         * Whenever the linking module wants to send out data, but doesnt know what the data
@@ -798,8 +809,10 @@ class Module : public Extensible
         * @param proto A pointer to the module handling network protocol
         * @param opaque An opaque pointer set by the protocol module, should not be modified!
         * @param extname The extensions name which is being searched for
+        * @param displayable If this value is true, the data is going to be displayed to a user,
+        * and not sent across the network. Use this to determine wether or not to show sensitive data.
         */
-       virtual void OnSyncUserMetaData(userrec* user, Module* proto,void* opaque, const std::string &extname);
+       virtual void OnSyncUserMetaData(userrec* user, Module* proto,void* opaque, const std::string &extname, bool displayable = false);
 
        /* Allows modules to syncronize metadata not related to users or channels, over the network during a netburst.
         * Whenever the linking module wants to send out data, but doesnt know what the data
@@ -809,8 +822,10 @@ class Module : public Extensible
         * if it belongs to your module.
         * @param proto A pointer to the module handling network protocol
         * @param opaque An opaque pointer set by the protocol module, should not be modified!
+        * @param displayable If this value is true, the data is going to be displayed to a user,
+        * and not sent across the network. Use this to determine wether or not to show sensitive data.
         */
-       virtual void OnSyncOtherMetaData(Module* proto, void* opaque);
+       virtual void OnSyncOtherMetaData(Module* proto, void* opaque, bool displayable = false);
 
        /** Allows module data, sent via ProtoSendMetaData, to be decoded again by a receiving module.
         * Please see src/modules/m_swhois.cpp for a working example of how to use this method call.
@@ -1332,7 +1347,7 @@ class Module : public Extensible
         * and if you do you must return 1. If you do not handle the names list,
         * return 0.
         */
-       virtual int OnUserList(userrec* user, chanrec* Ptr);
+       virtual int OnUserList(userrec* user, chanrec* Ptr, CUList* &userlist);
 
        /** Called whenever a line of WHOIS output is sent to a user.
         * You may change the numeric and the text of the output by changing
@@ -1377,7 +1392,7 @@ class Module : public Extensible
  * Constructing the class using one parameter allows you to specify a path to your own configuration
  * file, otherwise, inspircd.conf is read.
  */
-class ConfigReader : public classbase
+class CoreExport ConfigReader : public classbase
 {
   protected:
        InspIRCd* ServerInstance;
@@ -1494,7 +1509,7 @@ class ConfigReader : public classbase
  * Either use the constructor type with one parameter to load a file into memory
  * at construction, or use the LoadFile method to load a file.
  */
-class FileReader : public classbase
+class CoreExport FileReader : public classbase
 {
        InspIRCd* ServerInstance;
        /** The file contents
@@ -1565,7 +1580,7 @@ class FileReader : public classbase
  * In most cases, the simple class shown in the example module m_foobar.so will suffice for most
  * modules.
  */
-class ModuleFactory : public classbase
+class CoreExport ModuleFactory : public classbase
 {
  public:
        /** The default constructor does nothing.