summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-11-19 01:53:03 +0000
committerAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-11-19 01:53:03 +0000
commite514a3793d251409428caf53cbb75f0be90a6f38 (patch)
tree349c4cfc9fc45735999fd81d39a515560ab0e083 /include
parent68381e69d94735010df986b22c8e758981b50995 (diff)
Changed the mode param handling code to be more into the general mode handling code, this cleans up and fixes some small problems with mlocking params. This also helps clarify that the ChannelInfo mode functions are for mlock only. Also, this adds the OnMLock and OnUnMLock events which can be used to control if something can be (un)mlocked
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2660 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'include')
-rw-r--r--include/modules.h15
-rw-r--r--include/regchannel.h22
-rw-r--r--include/services.h18
3 files changed, 25 insertions, 30 deletions
diff --git a/include/modules.h b/include/modules.h
index cfa639d08..df917581d 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -967,6 +967,20 @@ class CoreExport Module
*/
virtual void OnUserModeAdd(UserMode *um) { }
+ /** Called when a mode is about to be mlocked
+ * @param Name The mode being mlocked
+ * @param status true if its being mlocked +, false for -
+ * @param param The param, if there is one and if status is true
+ * @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to deny the mlock.
+ */
+ virtual EventReturn OnMLock(ChannelModeName Name, bool status, const std::string &param) { return EVENT_CONTINUE; }
+
+ /** Called when a mode is about to be unlocked
+ * @param Name The mode being mlocked
+ * @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to deny the mlock.
+ */
+ virtual EventReturn OnUnMLock(ChannelModeName Name) { return EVENT_CONTINUE; }
+
};
@@ -1009,6 +1023,7 @@ enum Implementation
I_OnServerQuit, I_OnTopicUpdated,
I_OnEncrypt, I_OnEncryptInPlace, I_OnEncryptCheckLen, I_OnDecrypt, I_OnCheckPassword,
I_OnChannelModeSet, I_OnChannelModeUnset, I_OnUserModeSet, I_OnUserModeUnset, I_OnChannelModeAdd, I_OnUserModeAdd,
+ I_OnMLock, I_OnUnMLock,
I_END
};
diff --git a/include/regchannel.h b/include/regchannel.h
index eda83a1b7..8a906c818 100644
--- a/include/regchannel.h
+++ b/include/regchannel.h
@@ -62,7 +62,7 @@ enum ChannelInfoFlag
class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag>
{
private:
- std::map<ChannelModeName, std::string> Params; /* Map of parameters by mode name */
+ std::map<ChannelModeName, std::string> Params; /* Map of parameters by mode name for mlock */
std::vector<ChanAccess *> access; /* List of authorized users */
std::vector<AutoKick *> akick; /* List of users to kickban */
std::vector<BadWord *> badwords; /* List of badwords */
@@ -253,14 +253,16 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag>
/** Set a mlock
* @param Name The mode
* @param status True for mlock on, false for mlock off
+ * @param param An optional param arg for + mlocked modes
+ * @return true on success, false on failure (module blocking)
*/
- void SetMLock(ChannelModeName Name, bool status);
+ bool SetMLock(ChannelModeName Name, bool status, const std::string param = "");
/** Remove a mlock
* @param Name The mode
- * @param status True for mlock on, false for mlock off
+ * @return true on success, false on failure (module blcoking)
*/
- void RemoveMLock(ChannelModeName Name, bool status);
+ bool RemoveMLock(ChannelModeName Name);
/** Clear all mlocks on the channel
*/
@@ -272,18 +274,6 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag>
*/
const size_t GetMLockCount(bool status) const;
- /** Set a channel mode param on the channel
- * @param Name The mode
- * @param param The param
- * @param true on success
- */
- bool SetParam(ChannelModeName Name, std::string Value);
-
- /** Unset a param from the channel
- * @param Name The mode
- */
- void UnsetParam(ChannelModeName Name);
-
/** Get a param from the channel
* @param Name The mode
* @param Target a string to put the param into
diff --git a/include/services.h b/include/services.h
index 5a8e84ee0..f8e48aa8a 100644
--- a/include/services.h
+++ b/include/services.h
@@ -989,14 +989,16 @@ class CoreExport Channel : public Extensible
/**
* Set a mode on a channel
* @param Name The mode name
+ * @param param Optional param arg for the mode
*/
- void SetMode(ChannelModeName Name);
+ void SetMode(ChannelModeName Name, const std::string param = "");
/**
* Set a mode on a channel
* @param Mode The mode
+ * @param param Optional param arg for the mode
*/
- void SetMode(char Mode);
+ void SetMode(char Mode, const std::string param = "");
/**
* Remove a mode from a channel
@@ -1030,18 +1032,6 @@ class CoreExport Channel : public Extensible
*/
void ClearInvites(char *client = NULL);
- /** Set a channel mode param on the channel
- * @param Name The mode
- * @param param The param
- * @param true on success
- */
- bool SetParam(ChannelModeName Name, std::string &param);
-
- /** Unset a param from the channel
- * @param Name The mode
- */
- void UnsetParam(ChannelModeName Name);
-
/** Get a param from the channel
* @param Name The mode
* @param Target a string to put the param into