X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fchannels.h;h=736ca2e98f602e36370712900e9f52970eee621b;hb=5ebb49de65a3f53730177665b5922dc3a62a94eb;hp=daf8be9e2a2e4ac561705a19191b005fc3ab0b0b;hpb=74ccc28da30896ee715504d53822f7b3ce6ec86f;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/channels.h b/include/channels.h index daf8be9e2..736ca2e98 100644 --- a/include/channels.h +++ b/include/channels.h @@ -24,6 +24,7 @@ #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. @@ -40,17 +41,10 @@ class CoreExport Channel : public Extensible, public InviteBase 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 modes; /** Remove the given membership from the channel's internal map of * memberships and destroy the Membership object. @@ -113,18 +107,11 @@ class CoreExport Channel : public Extensible, public InviteBase */ 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); @@ -140,6 +127,7 @@ class CoreExport Channel : public Extensible, public InviteBase */ 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. @@ -301,16 +289,9 @@ class CoreExport Channel : public Extensible, public InviteBase /** 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 @@ -352,6 +333,23 @@ inline std::string Channel::GetModeParameter(ChanModeReference& mode) 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)