]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/channels.h
Fixed to not allow :Abc NICK Abc, where the case of the old and new nick are *identical*
[user/henk/code/inspircd.git] / include / channels.h
index 7771c292d04830095601a33944f30b6808cd4b6b..dac6713762082f1c04ec9e8db3eda0b9653bbbea 100644 (file)
@@ -30,6 +30,8 @@
 #define CM_SECRET 16
 #define CM_PRIVATE 32
 
+class userrec;
+
 /** Holds an entry for a ban list, exemption list, or invite list.
  * This class contains a single element in a channel list, such as a banlist.
  */
@@ -84,15 +86,15 @@ class ModeParameter : public classbase
 
 /** Holds a complete ban list
  */
-typedef std::vector<BanItem, __single_client_alloc>    BanList;
+typedef std::vector<BanItem>   BanList;
 
 /** Holds a complete exempt list
  */
-typedef std::vector<ExemptItem, __single_client_alloc> ExemptList;
+typedef std::vector<ExemptItem>        ExemptList;
 
 /** Holds a complete invite list
  */
-typedef std::vector<InviteItem, __single_client_alloc> InviteList;
+typedef std::vector<InviteItem>        InviteList;
 
 /** Holds all relevent information for a channel.
  * This class represents a channel, and contains its name, modes, time created, topic, topic set time,
@@ -112,7 +114,7 @@ class chanrec : public Extensible
        /** User list (casted to char*'s to stop forward declaration stuff)
         * (chicken and egg scenario!)
         */
-       std::vector<char*, __single_client_alloc> internal_userlist;
+       std::vector<char*> internal_userlist;
        
        /** Channel topic.
         * If this is an empty string, no channel topic is set.
@@ -149,22 +151,33 @@ class chanrec : public Extensible
        BanList bans;
        
        /** Sets or unsets a custom mode in the channels info
+        * @param mode The mode character to set or unset
+        * @param mode_on True if you want to set the mode or false if you want to remove it
         */
        void SetCustomMode(char mode,bool mode_on);
 
        /** Sets or unsets the parameters for a custom mode in a channels info
+        * @param mode The mode character to set or unset
+        * @param parameter The parameter string to associate with this mode character
+        * @param mode_on True if you want to set the mode or false if you want to remove it
         */
        void SetCustomModeParam(char mode,char* parameter,bool mode_on);
  
        /** Returns true if a custom mode is set on a channel
+         * @param mode The mode character you wish to query
+         * @return True if the custom mode is set, false if otherwise
          */
        bool IsCustomModeSet(char mode);
 
        /** Returns the parameter for a custom mode on a channel.
+         * @param mode The mode character you wish to query
+         *
          * For example if "+L #foo" is set, and you pass this method
          * 'L', it will return '#foo'. If the mode is not set on the
          * channel, or the mode has no parameters associated with it,
          * it will return an empty string.
+         *
+         * @return The parameter for this mode is returned, or an empty string
          */
        std::string GetModeParameter(char mode);
 
@@ -172,10 +185,14 @@ class chanrec : public Extensible
         * This returns the channel reference counter, which is initialized
         * to 0 when the channel is created and incremented/decremented
         * upon joins, parts quits and kicks.
+        *
+        * @return The number of users on this channel
         */
        long GetUserCounter();
 
        /** Add a user pointer to the internal reference list
+        * @param castuser This should be a pointer to a userrec, casted to char*
+        *
         * The data inserted into the reference list is a table as it is
         * an arbitary pointer compared to other users by its memory address,
         * as this is a very fast 32 or 64 bit integer comparison.
@@ -183,6 +200,8 @@ class chanrec : public Extensible
        void AddUser(char* castuser);
 
         /** Delete a user pointer to the internal reference list
+        * @param castuser This should be a pointer to a userrec, casted to char*
+        *
          * The data removed from the reference list is a table as it is
          * an arbitary pointer compared to other users by its memory address,
          * as this is a very fast 32 or 64 bit integer comparison.
@@ -195,8 +214,10 @@ class chanrec : public Extensible
         * channel membership for PRIVMSG, NOTICE, QUIT, PART etc.
         * The resulting pointer to the vector should be considered
         * readonly and only modified via AddUser and DelUser.
+        *
+        * @return This function returns a vector of userrec pointers, each of which has been casted to char* to prevent circular references
         */
-       std::vector<char*, __single_client_alloc> *GetUsers();
+       std::vector<char*> *GetUsers();
 
        /** Creates a channel record and initialises it with default values
         */
@@ -236,5 +257,9 @@ class ucrec : public classbase
        virtual ~ucrec() { /* stub */ }
 };
 
+chanrec* add_channel(userrec *user, const char* cn, const char* key, bool override);
+chanrec* del_channel(userrec *user, const char* cname, const char* reason, bool local);
+void kick_channel(userrec *src,userrec *user, chanrec *Ptr, char* reason);
+
 #endif