InspIRCd  3.0
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Membership Class Reference

#include <membership.h>

Inheritance diagram for Membership:
Extensible insp::intrusive_list_node< Membership > classbase

Public Types

typedef uint64_t Id
- Public Types inherited from Extensible
typedef insp::flat_map< reference< ExtensionItem >, void * > ExtensibleStore

Public Member Functions

 Membership (User *u, Channel *c)
bool HasMode (const PrefixMode *pm) const
unsigned int getRank ()
bool SetPrefix (PrefixMode *mh, bool adding)
char GetPrefixChar () const
std::string GetAllPrefixChars () const
- Public Member Functions inherited from Extensible
const ExtensibleStoreGetExtList () const
virtual CullResult cull () CXX11_OVERRIDE
void doUnhookExtensions (const std::vector< reference< ExtensionItem > > &toRemove)
void FreeAllExtItems ()

Static Public Member Functions

static Id IdFromString (const std::string &str)

Public Attributes

User *const user
Channel *const chan
std::string modes
Id id

Detailed Description

Represents a member of a channel. A Membership object is created when a user joins a channel, and destroyed when a user leaves (via kick, part or quit) a channel. All prefix modes a member has is tracked by this object. Moreover, Memberships are Extensibles meaning modules can add arbitrary data to them using extensions (see m_delaymsg for an example).

Member Typedef Documentation

◆ Id

typedef uint64_t Membership::Id

Type of the Membership id

Constructor & Destructor Documentation

◆ Membership()

Membership::Membership ( User u,
Channel c 

Constructor, sets the user and chan fields to the parameters, does NOT update any bookkeeping information in the User or the Channel. Call Channel::JoinUser() or ForceJoin() to make a user join a channel instead of constructing Membership objects directly.

Member Function Documentation

◆ GetAllPrefixChars()

std::string Membership::GetAllPrefixChars ( ) const

Return all prefix chars this member has.

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.

◆ GetPrefixChar()

char Membership::GetPrefixChar ( ) const

Get the highest prefix this user has on the channel

A character containing the highest prefix. If the user has no prefix, 0 is returned. If the user has multiple prefixes, the highest is returned. If you do not recognise the prefix character you can get, you can deal with it in a 'proportional' manner compared to known prefixes, using GetPrefixValue().

◆ getRank()

unsigned int Membership::getRank ( )

Returns the rank of this member. The rank of a member is defined as the rank given by the 'strongest' prefix mode a member has. See the PrefixMode class description for more info.

The rank of the member

◆ HasMode()

bool Membership::HasMode ( const PrefixMode pm) const

Check if this member has a given prefix mode set

pmPrefix mode to check
True if the member has the prefix mode set, false otherwise

◆ IdFromString()

static Id Membership::IdFromString ( const std::string &  str)

Converts a string to a Membership::Id

strThe string to convert
Raw value of type Membership::Id

◆ SetPrefix()

bool Membership::SetPrefix ( PrefixMode mh,
bool  adding 

Add a prefix character to a user. Only the core should call this method, usually from within the mode parser or when the first user joins the channel (to grant the default privs to them)

mhThe mode handler of the prefix mode to associate
addingTrue if adding the prefix, false when removing
True if a change was made

Member Data Documentation

◆ chan

Channel* const Membership::chan

Channel the user is on

◆ id

Id Membership::id

Id of this Membership, set by the protocol module, other components should never read or write this field.

◆ modes

std::string Membership::modes

List of prefix mode letters this member has, sorted by prefix rank, highest first

◆ user

User* const Membership::user

User on the channel

The documentation for this class was generated from the following files: