]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/channels.h
Add testsuite tests for UID generation
[user/henk/code/inspircd.git] / include / channels.h
index 3ad26cedaa140a048b26461a890022ece609c2e7..89ac6b86ca0327b6a43e9b3da741dc7bb44d802a 100644 (file)
@@ -1,33 +1,30 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
  *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
+ *   Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
+ *   Copyright (C) 2007 Robin Burchell <robin+git@viroteck.net>
+ *   Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
+ *   Copyright (C) 2003-2007 Craig Edwards <craigedwards@brainbox.cc>
  *
- * This program is free but copyrighted software; see
- *            the file COPYING for details.
+ * This file is part of InspIRCd.  InspIRCd is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation, version 2.
  *
- * ---------------------------------------------------
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef __CHANNELS_H__
-#define __CHANNELS_H__
 
-#include "membership.h"
+#ifndef CHANNELS_H
+#define CHANNELS_H
 
-/** RFC1459 channel modes
- */
-enum ChannelModes {
-       CM_TOPICLOCK = 't'-65,  /* +t: Only operators can change topic */
-       CM_NOEXTERNAL = 'n'-65, /* +n: Only users in the channel can message it */
-       CM_INVITEONLY = 'i'-65, /* +i: Invite only */
-       CM_MODERATED = 'm'-65,  /* +m: Only voices and above can talk */
-       CM_SECRET = 's'-65,     /* +s: Secret channel */
-       CM_PRIVATE = 'p'-65,    /* +p: Private channel */
-       CM_KEY = 'k'-65,        /* +k: Keyed channel */
-       CM_LIMIT = 'l'-65       /* +l: Maximum user limit */
-};
+#include "membership.h"
+#include "mode.h"
 
 /** 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.
@@ -127,6 +124,7 @@ class CoreExport Channel : public Extensible
         * @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 SetMode(ModeHandler* mode, bool value);
        void SetMode(char mode,bool mode_on);
 
        /** Sets or unsets a custom mode in the channels info
@@ -134,13 +132,15 @@ class CoreExport Channel : public Extensible
         * @param parameter The parameter string to associate with this mode character.
         * If it is empty, the mode is unset; if it is nonempty, the mode is set.
         */
-       void SetModeParam(char mode, std::string parameter);
+       void SetModeParam(ModeHandler* mode, const std::string& parameter);
+       void SetModeParam(char mode, const std::string& parameter);
 
        /** Returns true if a 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
          */
        inline bool IsModeSet(char mode) { return modes[mode-'A']; }
+       inline bool IsModeSet(ModeHandler* mode) { return modes[mode->GetModeChar()-'A']; }
 
 
        /** Returns the parameter for a custom mode on a channel.
@@ -154,6 +154,7 @@ class CoreExport Channel : public Extensible
          * @return The parameter for this mode is returned, or an empty string
          */
        std::string GetModeParameter(char mode);
+       std::string GetModeParameter(ModeHandler* mode);
 
        /** Sets the channel topic.
         * @param u The user setting the topic
@@ -370,8 +371,9 @@ class CoreExport Channel : public Extensible
         * @param user The user to associate the privilage with
         * @param prefix The prefix character to associate
         * @param adding True if adding the prefix, false when removing
+        * @return True if a change was made
         */
-       void SetPrefix(User* user, char prefix, bool adding);
+       bool SetPrefix(User* user, char prefix, bool adding);
 
        /** Check if a user is banned on this channel
         * @param user A user to check against the banlist