/* +------------------------------------+
* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
* InspIRCd: (C) 2002-2007 InspIRCd Development Team
* See: http://www.inspircd.org/wiki/index.php/Credits
*
* This program is free but copyrighted software; see
* the file COPYING for details.
*
* ---------------------------------------------------
*/#ifndef __CHANNELS_H__#define __CHANNELS_H__#include"inspircd_config.h"#include"base.h"#include<time.h>#include<vector>#include<string>#include<map>/** RFC1459 channel modes
*/enumChannelModes{CM_TOPICLOCK='t'-65,/* +t: Only operators can change topic */CM_NOEXTERNAL='n'-65,/* +n: Only users in the channel can message it */CM_INVITEONLY='i'-65,/* +i: Invite only */CM_MODERATED='m'-65,/* +m: Only voices and above can talk */CM_SECRET='s'-65,/* +s: Secret channel */CM_PRIVATE='p'-65,/* +p: Private channel */CM_KEY='k'-65,/* +k: Keyed channel */CM_LIMIT='l'-65/* +l: Maximum user limit */};/* Forward declarations - needed */classuserrec;classchanrec;/** 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.
*/classHostItem:publicclassbase{public:/** Time the item was added
*/time_tset_time;/** Who added the item
*/charset_by[NICKMAX];/** The actual item data
*/chardata[MAXBUF];HostItem(){/* stub */}virtual~HostItem(){/* stub */}};/** A subclass of HostItem designed to hold channel bans (+b)
*/classBanItem:publicHostItem{};/** Holds a complete ban list
*/typedefstd::vector<BanItem>BanList;/** A list of users on a channel
*/typedefstd::map<userrec*,std::string>CUList;/** Shorthand for CUList::iterator
*/typedefCUList::iteratorCUListIter;/** Shorthand for CUList::const_iterator
*/typedefCUList::const_iteratorCUListConstIter;/** A list of custom modes parameters on a channel
*/typedefstd::map<char,char*>CustomModeList;/** used to hold a channel and a users modes on that channel, e.g. +v, +h, +o
*/enumUserChannelModes{UCMODE_OP=1,/* Opped user */UCMODE_VOICE=2,/* Voiced user */UCMODE_HOP=4/* Halfopped user */};/* Forward declaration -- required */classInspIRCd;/** A stored prefix and its rank
*/typedefstd::pair<char,unsignedint>prefixtype;/** A list of prefixes set on a user in a channel
*/typedefstd::vector<prefixtype>pfxcontainer;/** A list of users with zero or more prefixes set on them
*/typedefstd::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,
* etc, and an instance of the BanList type.
*/classCoreExportchanrec:publicExtensible{private:/** Pointer to creator object
*/InspIRCd*ServerInstance;/** Connect a chanrec to a userrec
*/staticchanrec*ForceChan(InspIRCd*Instance,chanrec*Ptr,userrec*user,conststd::string&privs);/** Set default modes for the channel on creation
*/voidSetDefaultModes();/** A list of prefixes associated with each user in the channel
* (e.g. &%+ etc)
*/prefixlistprefixes;/** Maximum number of bans (cached)
*/intmaxbans;public:/** The channel's name.
*/charname[CHANMAX];/** Modes for the channel.
* This is not a null terminated string! It is a hash 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.
*/charmodes[64];/** User lists.
* There are four user lists, one for
* all the users, one for the ops, one for
* the halfops and another for the voices.
*/CUListinternal_userlist;/** Opped users.
* There are four user lists, one for
* all the users, one for the ops, one for
* the halfops and another for the voices.
*/CUListinternal_op_userlist;/** Halfopped