summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-11-15 18:26:35 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-11-15 18:26:35 +0000
commitd3747f2943c403863bc31c8d3e9802ccc763f4d3 (patch)
tree7b3f110edbf8796b4f0fda3ca1c37d45b29d9552 /include
parentdf37ab42f454e3a96d59a2a86eb76bcb4af0818a (diff)
Add ModeHandler* versions of channel mode access
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12133 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r--include/channels.h20
-rw-r--r--include/mode.h6
2 files changed, 7 insertions, 19 deletions
diff --git a/include/channels.h b/include/channels.h
index 3ad26ceda..59f4d1cf3 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -15,19 +15,7 @@
#define __CHANNELS_H__
#include "membership.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 "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 +115,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 +123,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 +145,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
diff --git a/include/mode.h b/include/mode.h
index f4e5e8a60..f1768f559 100644
--- a/include/mode.h
+++ b/include/mode.h
@@ -14,11 +14,7 @@
#ifndef __MODE_H
#define __MODE_H
-/* Forward declarations. */
-class User;
-
#include "ctables.h"
-#include "channels.h"
/**
* Holds the values for different type of modes
@@ -214,7 +210,7 @@ class CoreExport ModeHandler : public classbase
* Returns the mode character this handler handles.
* @return The mode character
*/
- char GetModeChar();
+ inline char GetModeChar() { return mode; }
/** For user modes, return the current parameter, if any
*/