#include "membership.h"
#include "mode.h"
+#include "parammode.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.
void SetDefaultModes();
/** Modes for the channel.
- * This is not a null terminated string! It is a bitset where
- * each item in it represents if a mode is set. For example
- * for mode +A, index 0. Use modechar-65 to calculate which
- * field to check.
+ * It is a bitset where each item in it represents if a mode is set.
+ * To see if a mode is set, inspect modes[mh->modeid]
*/
- std::bitset<64> modes;
-
- /** Parameters for custom modes.
- * One for each custom mode letter.
- */
- CustomModeList custom_mode_params;
+ std::bitset<ModeParser::MODEID_MAX> modes;
/** Remove the given membership from the channel's internal map of
* memberships and destroy the Membership object.
*/
void SetMode(ModeHandler* mode, bool value);
- /** Sets or unsets a custom mode in the channels info
- * @param mode The mode character to set or unset
- * @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(ModeHandler* 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(ModeHandler* mode) { return modes[mode->GetModeChar()-'A']; }
+ bool IsModeSet(ModeHandler* mode) { return ((mode->GetId() != ModeParser::MODEID_MAX) && (modes[mode->GetId()])); }
bool IsModeSet(ModeHandler& mode) { return IsModeSet(&mode); }
bool IsModeSet(ChanModeReference& mode);
*/
std::string GetModeParameter(ModeHandler* mode);
std::string GetModeParameter(ChanModeReference& mode);
+ std::string GetModeParameter(ParamModeBase* pm);
/** Sets the channel topic.
* @param user The user setting the topic.
/** Spool the NAMES list for this channel to the given user
* @param user The user to spool the NAMES list to
+ * @param isinside If true, the user is inside the channel, if not then false
*/
- void UserList(User *user);
-
- /** Return all of a users mode prefixes into a char* string.
- * @param user The user to look up
- * @return A list of all prefix characters. The prefixes will always
- * be in rank order, greatest first, as certain IRC clients require
- * this when multiple prefixes are used names lists.
- */
- const char* GetAllPrefixChars(User* user);
+ void UserList(User* user, bool isinside = true);
/** Get the value of a users prefix on this channel.
* @param user The user to look up
return GetModeParameter(*mode);
}
+inline std::string Channel::GetModeParameter(ModeHandler* mh)
+{
+ std::string out;
+ ParamModeBase* pm = mh->IsParameterMode();
+ if (pm && this->IsModeSet(pm))
+ pm->GetParameter(this, out);
+ return out;
+}
+
+inline std::string Channel::GetModeParameter(ParamModeBase* pm)
+{
+ std::string out;
+ if (this->IsModeSet(pm))
+ pm->GetParameter(this, out);
+ return out;
+}
+
inline bool Channel::IsModeSet(ChanModeReference& mode)
{
if (!mode)