diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/channels.h | 7 | ||||
-rw-r--r-- | include/mode.h | 33 | ||||
-rw-r--r-- | include/modes/cmode_h.h | 1 | ||||
-rw-r--r-- | include/modes/cmode_o.h | 1 | ||||
-rw-r--r-- | include/modes/cmode_v.h | 1 |
5 files changed, 38 insertions, 5 deletions
diff --git a/include/channels.h b/include/channels.h index 8f3b8ba3d..5186822e1 100644 --- a/include/channels.h +++ b/include/channels.h @@ -144,6 +144,9 @@ class ucrec : public classbase class InspIRCd; +typedef std::pair<char, unsigned int> prefixtype; +typedef std::vector<prefixtype> pfxcontainer; +typedef std::map<userrec*, std::vector<prefixtype> > prefixlist; /** Holds all relevent information for a channel. * This class represents a channel, and contains its name, modes, time created, topic, topic set time, @@ -161,6 +164,8 @@ class chanrec : public Extensible */ static chanrec* ForceChan(InspIRCd* Instance, chanrec* Ptr,ucrec *a,userrec* user, int created); + prefixlist prefixes; + public: /** The channels name. */ @@ -468,6 +473,8 @@ class chanrec : public Extensible */ const char* GetStatusChar(userrec *user); + void SetPrefix(userrec* user, char prefix, unsigned int prefix_rank, bool adding); + /** Destructor for chanrec */ virtual ~chanrec() { /* stub */ } diff --git a/include/mode.h b/include/mode.h index f1ef388d3..10b21a6b7 100644 --- a/include/mode.h +++ b/include/mode.h @@ -34,7 +34,8 @@ class InspIRCd; * Holds the values for different type of modes * that can exist, USER or CHANNEL type. */ -enum ModeType { +enum ModeType +{ MODETYPE_USER = 0, MODETYPE_CHANNEL = 1 }; @@ -42,7 +43,8 @@ enum ModeType { /** * Holds mode actions - modes can be allowed or denied. */ -enum ModeAction { +enum ModeAction +{ MODEACTION_DENY = 0, /* Drop the mode change, AND a parameter if its a parameterized mode */ MODEACTION_ALLOW = 1 /* Allow the mode */ }; @@ -52,11 +54,19 @@ enum ModeAction { * array. Used in a simple two instruction hashing function * "(modeletter - 65) OR mask" */ -enum ModeMasks { +enum ModeMasks +{ MASK_USER = 128, /* A user mode */ MASK_CHANNEL = 0 /* A channel mode */ }; +enum PrefixModeValue +{ + VOICE_VALUE = 10000, + HALFOP_VALUE = 20000, + OP_VALUE = 30000 +}; + /** * Used by ModeHandler::ModeSet() to return the state of a mode upon a channel or user. * The pair contains an activity flag, true if the mode is set with the given parameter, @@ -116,6 +126,10 @@ class ModeHandler : public Extensible */ bool oper; + /** Mode prefix, or 0 + */ + char prefix; + public: /** * The constructor for ModeHandler initalizes the mode handler. @@ -128,17 +142,26 @@ class ModeHandler : public Extensible * @param ModeType Set this to MODETYPE_USER for a usermode, or MODETYPE_CHANNEL for a channelmode. * @param operonly Set this to true if only opers should be allowed to set or unset the mode. */ - ModeHandler(InspIRCd* Instance, char modeletter, int parameters_on, int parameters_off, bool listmode, ModeType type, bool operonly); + ModeHandler(InspIRCd* Instance, char modeletter, int parameters_on, int parameters_off, bool listmode, ModeType type, bool operonly, char mprefix = 0); /** * The default destructor does nothing */ virtual ~ModeHandler(); - /** * Returns true if the mode is a list mode */ bool IsListMode(); /** + * Mode prefix or 0 + */ + char GetPrefix(); + /** + * Get the 'value' of this modes prefix. + * determines which to display when there are multiple. + * The mode with the highest value is ranked first. + */ + virtual unsigned int GetPrefixRank(); + /** * Returns the modes type */ ModeType GetModeType(); diff --git a/include/modes/cmode_h.h b/include/modes/cmode_h.h index cf61726da..277d89625 100644 --- a/include/modes/cmode_h.h +++ b/include/modes/cmode_h.h @@ -14,5 +14,6 @@ class ModeChannelHalfOp : public ModeHandler std::string AddHalfOp(userrec *user,const char *dest,chanrec *chan,int status); std::string DelHalfOp(userrec *user,const char *dest,chanrec *chan,int status); ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter); + unsigned int GetPrefixRank(); }; diff --git a/include/modes/cmode_o.h b/include/modes/cmode_o.h index a308f9903..3fe097ec3 100644 --- a/include/modes/cmode_o.h +++ b/include/modes/cmode_o.h @@ -14,5 +14,6 @@ class ModeChannelOp : public ModeHandler std::string AddOp(userrec *user,const char *dest,chanrec *chan,int status); std::string DelOp(userrec *user,const char *dest,chanrec *chan,int status); ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter); + unsigned int GetPrefixRank(); }; diff --git a/include/modes/cmode_v.h b/include/modes/cmode_v.h index 51846d11a..b7e9b800e 100644 --- a/include/modes/cmode_v.h +++ b/include/modes/cmode_v.h @@ -14,5 +14,6 @@ class ModeChannelVoice : public ModeHandler std::string AddVoice(userrec *user,const char *dest,chanrec *chan,int status); std::string DelVoice(userrec *user,const char *dest,chanrec *chan,int status); ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter); + unsigned int GetPrefixRank(); }; |