]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/channels.h
Fixed recursive 'splat' in the actors table
[user/henk/code/inspircd.git] / include / channels.h
index c9cdd7b31e5409354a7825971314051b1fe1fb21..633d7edef4541b490d0c1811e7008584108758a7 100644 (file)
@@ -1,27 +1,24 @@
-/*
-
-$Log$
-Revision 1.1  2003/01/23 19:45:58  brain
-Initial revision
-
-Revision 1.7  2003/01/22 00:44:26  brain
-Added documentation comments
-
-Revision 1.6  2003/01/21 21:11:17  brain
-Added documentation
-
-Revision 1.5  2003/01/16 20:11:55  brain
-fixed some ugly pointer bugs (thanks dblack and a|KK|y!)
-
-Revision 1.4  2003/01/15 22:47:44  brain
-Changed user and channel structs to classes (finally)
-
-   
-*/
+/*       +------------------------------------+
+ *       | Inspire Internet Relay Chat Daemon |
+ *       +------------------------------------+
+ *
+ *  Inspire is copyright (C) 2002-2004 ChatSpike-Dev.
+ *                       E-mail:
+ *                <brain@chatspike.net>
+ *               <Craig@chatspike.net>
+ *     
+ * Written by Craig Edwards, Craig McLure, and others.
+ * This program is free but copyrighted software; see
+ *            the file COPYING for details.
+ *
+ * ---------------------------------------------------
+ */
 
 #include "inspircd_config.h"
+#include "base.h"
 #include <time.h>
 #include <vector>
+#include <string>
 
 #ifndef __CHANNELS_H__
 #define __CHANNELS_H__
@@ -29,7 +26,7 @@ Changed user and channel structs to classes (finally)
 /** 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.
  */
-class HostItem
+class HostItem : public classbase
 {
  public:
        time_t set_time;
@@ -66,23 +63,35 @@ class InviteItem : public HostItem
 };
 
 
+/** Holds a custom parameter to a module-defined channel mode
+  * e.g. for +L this would hold the channel name.
+  */
+
+class ModeParameter : public classbase
+{
+ public:
+       char mode;
+       char parameter[MAXBUF];
+       char channel[CHANMAX];
+};
+
 /** Holds a complete ban list
  */
-typedef vector<BanItem>        BanList;
+typedef std::vector<BanItem>   BanList;
 
 /** Holds a complete exempt list
  */
-typedef vector<ExemptItem>     ExemptList;
+typedef std::vector<ExemptItem>        ExemptList;
 
 /** Holds a complete invite list
  */
-typedef vector<InviteItem>     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,
  * etc, and an instance of the BanList type.
  */
-class chanrec
+class chanrec : public Extensible
 {
  public:
        /** The channels name.
@@ -92,6 +101,7 @@ class chanrec
         * Plugins may use this field in any way they see fit.
         */
        char custom_modes[MAXMODES];     /* modes handled by modules */
+       
        /** Channel topic.
         * If this is an empty string, no channel topic is set.
         */
@@ -147,19 +157,30 @@ class chanrec
        /** The list of all bans set on the channel.
         */
        BanList bans;
+       
+       /** Sets or unsets a custom mode in the channels info
+        */
+       void SetCustomMode(char mode,bool mode_on);
+
+       /** Sets or unsets the parameters for a custom mode in a channels info
+        */
+       void SetCustomModeParam(char mode,char* parameter,bool mode_on);
+       /** Returns true if a custom mode is set on a channel
+         */
+       bool IsCustomModeSet(char mode);
+
+       /** Returns the parameter for a custom mode on a channel.
+         * 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.
+         */
+       std::string GetModeParameter(char mode);
 
        /** Creates a channel record and initialises it with default values
         */
-       chanrec()
-       {
-               strcpy(name,"");
-               strcpy(custom_modes,"");
-               strcpy(topic,"");
-               strcpy(setby,"");
-               strcpy(key,"");
-               created = topicset = limit = 0;
-               topiclock = noexternal = inviteonly = moderated = secret = c_private = false;
-       }
+       chanrec();
 
        virtual ~chanrec() { /* stub */ }
 };
@@ -178,7 +199,7 @@ class chanrec
  * a userrec and chanrec class. The uc_modes member holds a bitmask of which privilages the user
  * has on the channel, such as op, voice, etc.
  */
-class ucrec
+class ucrec : public classbase
 {
  public:
        /** Contains a bitmask of the UCMODE_OP ... UCMODE_FOUNDER values.