The InspIRCd Project
Home | Developers | Wiki | Forums | Bug Tracker | SVN | Download
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

Channel Class Reference

Holds all relevent information for a channel. More...

#include <channels.h>

Inheritance diagram for Channel:

Inheritance graph
[legend]
Collaboration diagram for Channel:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Channel (InspIRCd *Instance, const std::string &name, time_t ts)
 Creates a channel record and initialises it with default values.
void SetMode (char mode, bool mode_on)
 Sets or unsets a custom mode in the channels info.
void SetModeParam (char mode, const char *parameter, bool mode_on)
 Sets or unsets the parameters for a custom mode in a channels info.
bool IsModeSet (char mode)
 Returns true if a mode is set on a channel.
std::string GetModeParameter (char mode)
 Returns the parameter for a custom mode on a channel.
int SetTopic (User *u, std::string &t, bool forceset=false)
 Sets the channel topic.
long GetUserCounter ()
 Obtain the channel "user counter" This returns the channel reference counter, which is initialized to 0 when the channel is created and incremented/decremented upon joins, parts quits and kicks.
void AddUser (User *user)
 Add a user pointer to the internal reference list.
void AddOppedUser (User *user)
 Add a user pointer to the internal reference list of opped users.
void AddHalfoppedUser (User *user)
 Add a user pointer to the internal reference list of halfopped users.
void AddVoicedUser (User *user)
 Add a user pointer to the internal reference list of voiced users.
unsigned long DelUser (User *user)
 Delete a user pointer to the internal reference list.
void DelOppedUser (User *user)
 Delete a user pointer to the internal reference list of opped users.
void DelHalfoppedUser (User *user)
 Delete a user pointer to the internal reference list of halfopped users.
void DelVoicedUser (User *user)
 Delete a user pointer to the internal reference list of voiced users.
CUListGetUsers ()
 Obtain the internal reference list The internal reference list contains a list of User*.
CUListGetOppedUsers ()
 Obtain the internal reference list of opped users.
CUListGetHalfoppedUsers ()
 Obtain the internal reference list of halfopped users.
CUListGetVoicedUsers ()
 Obtain the internal reference list of voiced users.
bool HasUser (User *user)
 Returns true if the user given is on the given channel.
long KickUser (User *src, User *user, const char *reason)
 Make src kick user from this channel with the given reason.
long ServerKickUser (User *user, const char *reason, bool triggerevents, const char *servername=NULL)
 Make the server kick user from this channel with the given reason.
long PartUser (User *user, std::string &reason)
 Part a user from this channel with the given reason.
void WriteChannel (User *user, const char *text,...) CUSTOM_PRINTF(3
 Write to a channel, from a user, using va_args for text.
void void WriteChannel (User *user, const std::string &text)
 Write to a channel, from a user, using std::string for text.
void WriteChannelWithServ (const char *ServName, const char *text,...) CUSTOM_PRINTF(3
 Write to a channel, from a server, using va_args for text.
void void WriteChannelWithServ (const char *ServName, const std::string &text)
 Write to a channel, from a server, using std::string for text.
void WriteAllExceptSender (User *user, bool serversource, char status, const char *text,...) CUSTOM_PRINTF(5
 Write to all users on a channel except a specific user, using va_args for text.
void void WriteAllExcept (User *user, bool serversource, char status, CUList &except_list, const char *text,...) CUSTOM_PRINTF(6
 Write to all users on a channel except a list of users, using va_args for text.
void void void WriteAllExceptSender (User *user, bool serversource, char status, const std::string &text)
 Write to all users on a channel except a specific user, using std::string for text.
void WriteAllExcept (User *user, bool serversource, char status, CUList &except_list, const std::string &text)
 Write to all users on a channel except a list of users, using std::string for text.
long GetMaxBans ()
 Returns the maximum number of bans allowed to be set on this channel.
char * ChanModes (bool showkey)
 Return the channel's modes with parameters.
void UserList (User *user, CUList *ulist=NULL)
 Spool the NAMES list for this channel to the given user.
int CountInvisible ()
 Get the number of invisible users on this channel.
int GetStatus (User *user)
 Get a users status on this channel.
int GetStatusFlags (User *user)
 Get a users status on this channel in a bitmask.
const char * GetPrefixChar (User *user)
 Get a users prefix on this channel in a string.
const char * GetAllPrefixChars (User *user)
 Return all of a users mode prefixes into a char* string.
unsigned int GetPrefixValue (User *user)
 Get the value of a users prefix on this channel.
void RemoveAllPrefixes (User *user)
 This method removes all prefix characters from a user.
void SetPrefix (User *user, char prefix, unsigned int prefix_rank, bool adding)
 Add a prefix character to a user.
bool IsBanned (User *user)
 Check if a user is banned on this channel.
bool IsExtBanned (User *u, char type)
 Check whether an extban of a given type matches a given user for this channel.
bool IsExtBanned (const std::string &str, char type)
 Overloaded version to check whether a particular string is extbanned.
void ResetMaxBans ()
 Clears the cached max bans value.
virtual ~Channel ()
 Destructor for Channel.

Static Public Member Functions

static ChannelJoinUser (InspIRCd *ServerInstance, User *user, const char *cn, bool override, const char *key, bool bursting, time_t TS=0)

Public Attributes

std::string name
 The channel's name.
std::bitset< 64 > modes
 Modes for the channel.
CUList internal_userlist
 User lists.
CUList internal_op_userlist
 Opped users.
CUList internal_halfop_userlist
 Halfopped users.
CUList internal_voice_userlist
 Voiced users.
CustomModeList custom_mode_params
 Parameters for custom modes.
std::string topic
 Channel topic.
time_t created
 Creation time.
time_t topicset
 Time topic was set.
std::string setby
 The last user to set the topic.
BanList bans
 The list of all bans set on the channel.

Private Member Functions

void SetDefaultModes ()
 Set default modes for the channel on creation.

Static Private Member Functions

static ChannelForceChan (InspIRCd *Instance, Channel *Ptr, User *user, const std::string &privs, bool bursting)
 Connect a Channel to a User.

Private Attributes

InspIRCdServerInstance
 Pointer to creator object.
prefixlist prefixes
 A list of prefixes associated with each user in the channel (e.g.
int maxbans
 Maximum number of bans (cached).

Detailed Description

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.

Definition at line 104 of file channels.h.


Constructor & Destructor Documentation

Channel::Channel InspIRCd Instance,
const std::string name,
time_t  ts
 

Creates a channel record and initialises it with default values.

Exceptions:
Nothing at present.

Definition at line 20 of file channels.cpp.

References classbase::age, InspIRCd::chanlist, ServerLimits::ChanMax, InspIRCd::Config, created, ServerConfig::Limits, maxbans, modes, name, ServerInstance, InspIRCd::Time(), and topicset.

Referenced by JoinUser().

virtual Channel::~Channel  )  [inline, virtual]
 

Destructor for Channel.

Definition at line 545 of file channels.h.


Member Function Documentation

void Channel::AddHalfoppedUser User user  ) 
 

Add a user pointer to the internal reference list of halfopped users.

Parameters:
user The user to add

Definition at line 172 of file channels.cpp.

References internal_halfop_userlist, and User::nick.

void Channel::AddOppedUser User user  ) 
 

Add a user pointer to the internal reference list of opped users.

Parameters:
user The user to add

Definition at line 157 of file channels.cpp.

References internal_op_userlist, and User::nick.

void Channel::AddUser User user  ) 
 

Add a user pointer to the internal reference list.

Parameters:
user The user to add
The data inserted into the reference list is a table as it is an arbitary pointer compared to other users by its memory address, as this is a very fast 32 or 64 bit integer comparison.

Definition at line 131 of file channels.cpp.

References internal_userlist, and User::nick.

Referenced by ForceChan().

void Channel::AddVoicedUser User user  ) 
 

Add a user pointer to the internal reference list of voiced users.

Parameters:
user The user to add

Definition at line 187 of file channels.cpp.

References internal_voice_userlist, and User::nick.

char * Channel::ChanModes bool  showkey  ) 
 

Return the channel's modes with parameters.

Parameters:
showkey If this is set to true, the actual key is shown, otherwise it is replaced with '<KEY>'
Returns:
The channel mode string

Definition at line 883 of file channels.cpp.

References charlcat(), CM_INVITEONLY, CM_KEY, CM_MODERATED, CM_NOEXTERNAL, CM_PRIVATE, CM_SECRET, CM_TOPICLOCK, GetModeParameter(), MAXBUF, modes, and strlcat().

Referenced by ModeParser::DisplayCurrentModes(), CommandCheck::Handle(), ModuleSafeList::OnBufferFlushed(), ModuleHttpStats::OnEvent(), ModuleSpanningTree::OnUserJoin(), and TreeSocket::SendFJoins().

int Channel::CountInvisible  ) 
 

Get the number of invisible users on this channel.

Returns:
Number of invisible users

Definition at line 870 of file channels.cpp.

References GetUsers().

void Channel::DelHalfoppedUser User user  ) 
 

Delete a user pointer to the internal reference list of halfopped users.

Parameters:
user The user to delete

Definition at line 177 of file channels.cpp.

References internal_halfop_userlist.

Referenced by DelUser().

void Channel::DelOppedUser User user  ) 
 

Delete a user pointer to the internal reference list of opped users.

Parameters:
user The user to delete

Definition at line 162 of file channels.cpp.

References internal_op_userlist.

Referenced by DelUser().

unsigned long Channel::DelUser User user  ) 
 

Delete a user pointer to the internal reference list.

Parameters:
user The user to delete
Returns:
number of users left on the channel after deletion of the user

Definition at line 136 of file channels.cpp.

References DelHalfoppedUser(), DelOppedUser(), DelVoicedUser(), and internal_userlist.

void Channel::DelVoicedUser User user  ) 
 

Delete a user pointer to the internal reference list of voiced users.

Parameters:
user The user to delete

Definition at line 192 of file channels.cpp.

References internal_voice_userlist.

Referenced by DelUser().

Channel * Channel::ForceChan InspIRCd Instance,
Channel Ptr,
User user,
const std::string privs,
bool  bursting
[static, private]
 

Connect a Channel to a User.

Definition at line 423 of file channels.cpp.

References AddUser(), User::chans, InspIRCd::FakeClient, ModeParser::FindPrefix(), FOREACH_MOD_I, ModeHandler::GetPrefix(), ModeHandler::GetPrefixRank(), GetUserCounter(), I_OnPostJoin, I_OnUserJoin, IS_LOCAL, InspIRCd::Modes, ModeParser::ModeString(), name, User::nick, ModeHandler::OnModeChange(), RPL_TOPIC, RPL_TOPICTIME, setby, SetPrefix(), topic, topicset, UCMODE_HOP, UCMODE_OP, UCMODE_VOICE, UserList(), WriteAllExceptSender(), and WriteChannel().

Referenced by JoinUser().

const char * Channel::GetAllPrefixChars User user  ) 
 

Return all of a users mode prefixes into a char* string.

Parameters:
user The user to look up
Returns:
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.

Definition at line 1090 of file channels.cpp.

References MAXBUF, prefix, and prefixes.

Referenced by ModuleDeaf::BuildDeafList(), SpanningTreeUtilities::GetListOfServersForChannel(), CommandCheck::Handle(), ModuleHttpStats::OnEvent(), ModuleNamesX::OnNamesListItem(), and ModeParser::Process().

CUList * Channel::GetHalfoppedUsers  ) 
 

Obtain the internal reference list of halfopped users.

Returns:
This function returns pointer to a map of User pointers (CUList*).

Definition at line 212 of file channels.cpp.

References internal_halfop_userlist.

Referenced by ModuleSilence::OnBuildExemptList(), ModuleHttpStats::OnEvent(), and ModeChannelHalfOp::RemoveMode().

long Channel::GetMaxBans  ) 
 

Returns the maximum number of bans allowed to be set on this channel.

Returns:
The maximum number of bans allowed

Definition at line 1036 of file channels.cpp.

References InspIRCd::Config, InspIRCd::Match(), ServerConfig::maxbans, maxbans, and ServerInstance.

Referenced by ModeChannelBan::AddBan(), and BanRedirect::BeforeMode().

std::string Channel::GetModeParameter char  mode  ) 
 

Returns the parameter for a custom mode on a channel.

Parameters:
mode The mode character you wish to query
For example if "+L #foo" is set, and you pass this method 'L', it will return 'foo'. If the mode is not set on the channel, or the mode has no parameters associated with it, it will return an empty string.

Returns:
The parameter for this mode is returned, or an empty string

Definition at line 67 of file channels.cpp.

References custom_mode_params.

Referenced by ChanModes(), JoinUser(), Redirect::ModeSet(), KickRejoin::ModeSet(), ModeChannelLimit::ModeSet(), ModeChannelKey::ModeSet(), NickFlood::OnModeChange(), MsgFlood::OnModeChange(), KickRejoin::OnModeChange(), JoinFlood::OnModeChange(), ModeChannelLimit::OnModeChange(), ModeChannelKey::OnModeChange(), ModuleKickNoRejoin::OnUserKick(), ModuleRedirect::OnUserPreJoin(), ModuleKickNoRejoin::OnUserPreJoin(), ModuleBanRedirect::OnUserPreJoin(), and ModeChannelKey::RemoveMode().

CUList * Channel::GetOppedUsers  ) 
 

Obtain the internal reference list of opped users.

Returns:
This function returns pointer to a map of User pointers (CUList*).

Definition at line 207 of file channels.cpp.

References internal_op_userlist.

Referenced by ModuleSilence::OnBuildExemptList(), ModuleHttpStats::OnEvent(), and ModeChannelOp::RemoveMode().

const char * Channel::GetPrefixChar User user  ) 
 

Get a users prefix on this channel in a string.

Parameters:
user The user to look up
Returns:
A character array containing the prefix string. Unlike GetStatus and GetStatusFlags which will only return the core specified modes @, % and + (op, halfop and voice), GetPrefixChar will also return module-defined prefixes. If the user has to prefix, an empty but non-null string 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 'proprtional' manner compared to known prefixes, using GetPrefixValue().

Definition at line 1066 of file channels.cpp.

References prefixes.

Referenced by RemoveBase::Handle(), and UserList().

unsigned int Channel::GetPrefixValue User user  ) 
 

Get the value of a users prefix on this channel.

Parameters:
user The user to look up
Returns:
The module or core-defined value of the users prefix. The values for op, halfop and voice status are constants in mode.h, and are OP_VALUE, HALFOP_VALUE, and VOICE_VALUE respectively. If the value you are given does not match one of these three, it is a module-defined mode, and it should be compared in proportion to these three constants. For example a value greater than OP_VALUE is a prefix of greater 'worth' than ops, and a value less than VOICE_VALUE is of lesser 'worth' than a voice.

Definition at line 1110 of file channels.cpp.

References prefixes.

int Channel::GetStatus User user  ) 
 

Get a users status on this channel.

Parameters:
user The user to look up
Returns:
One of STATUS_OP, STATUS_HOP, STATUS_VOICE, or zero.

Definition at line 1131 of file channels.cpp.

References User::chans, User::server, ServerInstance, STATUS_HOP, STATUS_NORMAL, STATUS_OP, STATUS_VOICE, UCMODE_HOP, UCMODE_OP, UCMODE_VOICE, and InspIRCd::ULine().

Referenced by ModuleRestrictBanned::CheckRestricted(), CommandUninvite::Handle(), CommandTban::Handle(), CommandCycle::Handle(), KickUser(), ModuleOverride::OnAccessCheck(), ModuleOverride::OnLocalTopicChange(), AuditoriumMode::OnModeChange(), ModeChannelVoice::OnModeChange(), ModeChannelOp::OnModeChange(), ModeChannelHalfOp::OnModeChange(), ModeChannelBan::OnModeChange(), ModuleAuditorium::OnNamesListItem(), ModuleAuditorium::OnUserJoin(), ModuleAuditorium::OnUserKick(), ModuleAuditorium::OnUserPart(), ModuleOverride::OnUserPreKick(), ModuleStripColor::OnUserPreMessage(), ModuleCensor::OnUserPreMessage(), ModuleBlockColour::OnUserPreMessage(), ModuleBlockCAPS::OnUserPreMessage(), ModuleNoNickChange::OnUserPreNick(), ModuleNickFlood::OnUserPreNick(), ModuleNoNotice::OnUserPreNotice(), ModuleNoCTCP::OnUserPreNotice(), ModeParser::Process(), ModuleMsgFlood::ProcessMessages(), ModuleChanFilter::ProcessMessages(), and SetTopic().

int Channel::GetStatusFlags User user  ) 
 

Get a users status on this channel in a bitmask.

Parameters:
user The user to look up
Returns:
A bitmask containing zero or more of STATUS_OP, STATUS_HOP, STATUS_VOICE

Definition at line 1121 of file channels.cpp.

References User::chans.

Referenced by ModeChannelVoice::ModeSet(), ModeChannelOp::ModeSet(), and ModeChannelHalfOp::ModeSet().

long Channel::GetUserCounter  ) 
 

Obtain the channel "user counter" This returns the channel reference counter, which is initialized to 0 when the channel is created and incremented/decremented upon joins, parts quits and kicks.

Returns:
The number of users on this channel

Definition at line 126 of file channels.cpp.

Referenced by ForceChan(), CommandCheck::Handle(), JoinUser(), KickUser(), ModuleSafeList::OnBufferFlushed(), PermChannel::OnModeChange(), ModuleChanProtect::OnPostJoin(), ModuleChanCreate::OnUserJoin(), ModuleRedirect::OnUserPreJoin(), ModuleBanRedirect::OnUserPreJoin(), PartUser(), and ServerKickUser().

CUList * Channel::GetUsers  ) 
 

Obtain the internal reference list The internal reference list contains a list of User*.

These are used for rapid comparison to determine channel membership for PRIVMSG, NOTICE, QUIT, PART etc. The resulting pointer to the vector should be considered readonly and only modified via AddUser and DelUser.

Returns:
This function returns pointer to a map of User pointers (CUList*).

Definition at line 202 of file channels.cpp.

References internal_userlist.

Referenced by ModuleDeaf::BuildDeafList(), CountInvisible(), FounderProtectBase::DisplayList(), SpanningTreeUtilities::GetListOfServersForChannel(), CommandCheck::Handle(), ModuleSilence::OnBuildExemptList(), ModuleHttpStats::OnEvent(), SSLMode::OnModeChange(), FounderProtectBase::RemoveMode(), TreeSocket::SendFJoins(), UserList(), WriteAllExcept(), WriteChannel(), WriteChannelWithServ(), ModuleInvisible::WriteCommonFrom(), and ModuleDelayJoin::WriteCommonFrom().

CUList * Channel::GetVoicedUsers  ) 
 

Obtain the internal reference list of voiced users.

Returns:
This function returns pointer to a map of User pointers (CUList*).

Definition at line 217 of file channels.cpp.

References internal_voice_userlist.

Referenced by ModuleSilence::OnBuildExemptList(), ModuleHttpStats::OnEvent(), and ModeChannelVoice::RemoveMode().

bool Channel::HasUser User user  ) 
 

Returns true if the user given is on the given channel.

Parameters:
The user to look for
Returns:
True if the user is on this channel

Definition at line 152 of file channels.cpp.

References internal_userlist.

Referenced by ModeParser::DisplayCurrentModes(), FounderProtectBase::FindAndVerify(), CommandUninvite::Handle(), CommandSapart::Handle(), CommandSajoin::Handle(), RemoveBase::Handle(), CommandKnock::Handle(), CommandDevoice::Handle(), CommandCycle::Handle(), JoinUser(), FounderProtectBase::ModeSet(), ModuleOverride::OnAccessCheck(), ModuleSafeList::OnBufferFlushed(), ModuleOverride::OnLocalTopicChange(), ModuleSpy::OnUserList(), and UserList().

bool Channel::IsBanned User user  ) 
 

Check if a user is banned on this channel.

Parameters:
user A user to check against the banlist
Returns:
True if the user given is banned

Definition at line 487 of file channels.cpp.

References bans, FOREACH_RESULT, User::GetFullHost(), User::GetFullRealHost(), User::GetIPString(), I_OnCheckBan, User::ident, InspIRCd::Match(), InspIRCd::MatchCIDR(), MAXBUF, and User::nick.

Referenced by ModuleRestrictBanned::CheckRestricted(), CommandCycle::Handle(), and JoinUser().

bool Channel::IsExtBanned const std::string str,
char  type
 

Overloaded version to check whether a particular string is extbanned.

Definition at line 511 of file channels.cpp.

References bans, DEBUG, FOREACH_RESULT, I_OnCheckStringExtBan, LogManager::Log(), InspIRCd::Logs, InspIRCd::Match(), and ServerInstance.

bool Channel::IsExtBanned User u,
char  type
 

Check whether an extban of a given type matches a given user for this channel.

Parameters:
u The user to match bans against
type The type of extban to check

Definition at line 537 of file channels.cpp.

References FOREACH_RESULT, User::GetFullHost(), User::GetFullRealHost(), User::GetIPString(), I_OnCheckExtBan, User::ident, MAXBUF, and User::nick.

Referenced by ModuleNoKicks::OnAccessCheck(), ModulePartMsgBan::OnUserPart(), ModuleAllowInvite::OnUserPreInvite(), ModuleServicesAccount::OnUserPreJoin(), ModuleServerBan::OnUserPreJoin(), ModuleOperChans::OnUserPreJoin(), ModuleGecosBan::OnUserPreJoin(), ModuleBadChannelExtban::OnUserPreJoin(), ModuleStripColor::OnUserPreMessage(), ModuleServicesAccount::OnUserPreMessage(), ModuleBlockColour::OnUserPreMessage(), ModuleBlockCAPS::OnUserPreMessage(), ModuleNoNickChange::OnUserPreNick(), ModuleNoNotice::OnUserPreNotice(), and ModuleNoCTCP::OnUserPreNotice().

bool Channel::IsModeSet char  mode  ) 
 

Returns true if a mode is set on a channel.

Parameters:
mode The mode character you wish to query
Returns:
True if the custom mode is set, false if otherwise

Definition at line 62 of file channels.cpp.

References modes.

Referenced by RemoveBase::Handle(), CommandKnock::Handle(), JoinUser(), ModeHandler::ModeSet(), Redirect::ModeSet(), KickRejoin::ModeSet(), ModuleNoKicks::OnAccessCheck(), ModuleSafeList::OnBufferFlushed(), ModulePermanentChannels::OnChannelPreDelete(), ModuleOverride::OnLocalTopicChange(), SimpleChannelModeHandler::OnModeChange(), SSLMode::OnModeChange(), Channel_r::OnModeChange(), Redirect::OnModeChange(), PermChannel::OnModeChange(), OperChans::OnModeChange(), NoNicks::OnModeChange(), NoCTCP::OnModeChange(), KickRejoin::OnModeChange(), AuditoriumMode::OnModeChange(), ModeChannelKey::OnModeChange(), ModuleDelayJoin::OnNamesListItem(), ModuleAuditorium::OnNamesListItem(), ModuleDelayJoin::OnUserJoin(), ModuleChanCreate::OnUserJoin(), ModuleAuditorium::OnUserJoin(), ModuleKickNoRejoin::OnUserKick(), ModuleDelayJoin::OnUserKick(), ModuleAuditorium::OnUserKick(), ModuleDelayJoin::OnUserPart(), ModuleAuditorium::OnUserPart(), ModuleAllowInvite::OnUserPreInvite(), ModuleSSLModes::OnUserPreJoin(), ModuleServicesAccount::OnUserPreJoin(), ModuleServices::OnUserPreJoin(), ModuleRedirect::OnUserPreJoin(), ModuleDenyChannels::OnUserPreJoin(), ModuleBanRedirect::OnUserPreJoin(), ModuleStripColor::OnUserPreMessage(), ModuleServicesAccount::OnUserPreMessage(), ModuleServices::OnUserPreMessage(), ModuleBlockColour::OnUserPreMessage(), ModuleBlockCAPS::OnUserPreMessage(), ModuleNoNickChange::OnUserPreNick(), ModuleNoNotice::OnUserPreNotice(), ModuleNoCTCP::OnUserPreNotice(), ModeHandler::RemoveMode(), ModeChannelKey::RemoveMode(), and UserList().

Channel * Channel::JoinUser InspIRCd ServerInstance,
User user,
const char *  cn,
bool  override,
const char *  key,
bool  bursting,
time_t  TS = 0
[static]
 

Definition at line 250 of file channels.cpp.

References bans, ServerLimits::ChanMax, Channel(), User::chans, InspIRCd::Config, DEBUG, ERR_BADCHANNELKEY, ERR_BANNEDFROMCHAN, ERR_CHANNELISFULL, ERR_INVITEONLYCHAN, ERR_TOOMANYCHANNELS, InspIRCd::FindChan(), ForceChan(), FOREACH_RESULT_I, ConnectClass::GetMaxChans(), GetModeParameter(), GetUserCounter(), HasUser(), I_OnCheckInvite, I_OnCheckKey, I_OnCheckLimit, I_OnUserPreJoin, ServerConfig::InvBypassModes, IS_LOCAL, IS_OPER, IsBanned(), User::IsInvited(), IsModeSet(), ServerConfig::Limits, LogManager::Log(), InspIRCd::Logs, MAXBUF, ServerConfig::MaxChans, User::MyClass, name, User::nick, ServerConfig::OperMaxChans, User::RemoveInvite(), SetDefaultModes(), strlcpy(), and User::WriteNumeric().

Referenced by TreeSocket::ForceJoin(), CommandSajoin::Handle(), CommandCycle::Handle(), ModuleConnJoin::OnPostConnect(), ModuleOperjoin::OnPostOper(), ModuleRedirect::OnUserPreJoin(), ModuleDenyChannels::OnUserPreJoin(), ModuleBanRedirect::OnUserPreJoin(), and TreeSocket::ServiceJoin().

long Channel::KickUser User src,
User user,
const char *  reason
 

Make src kick user from this channel with the given reason.

Parameters:
src The source of the kick
user The user being kicked (must be on this channel)
reason The reason for the kick
Returns:
The number of users left on the channel. If this is zero when the method returns, you MUST delete the Channel immediately!

Definition at line 658 of file channels.cpp.

References AC_KICK, ACR_DEFAULT, ACR_DENY, InspIRCd::chanlist, User::chans, ERR_CHANOPRIVSNEEDED, ERR_USERNOTINCHANNEL, FOREACH_MOD, FOREACH_RESULT, FOREACH_RESULT_I, GetStatus(), GetUserCounter(), I_OnAccessCheck, I_OnChannelDelete, I_OnChannelPreDelete, I_OnUserKick, I_OnUserPreKick, IS_LOCAL, name, User::nick, RemoveAllPrefixes(), User::server, ServerInstance, STATUS_HOP, InspIRCd::ULine(), WriteChannel(), and User::WriteNumeric().

long Channel::PartUser User user,
std::string reason
 

Part a user from this channel with the given reason.

If the reason field is NULL, no reason will be sent.

Parameters:
user The user who is parting (must be on this channel)
reason The part reason
Returns:
The number of users left on the channel. If this is zero when the method returns, you MUST delete the Channel immediately!

Definition at line 567 of file channels.cpp.

References InspIRCd::chanlist, User::chans, FOREACH_MOD, FOREACH_RESULT_I, GetUserCounter(), I_OnChannelDelete, I_OnChannelPreDelete, I_OnUserPart, RemoveAllPrefixes(), ServerInstance, and WriteChannel().

Referenced by CommandSapart::Handle(), RemoveBase::Handle(), CommandCycle::Handle(), and TreeSocket::ServicePart().

void Channel::RemoveAllPrefixes User user  ) 
 

This method removes all prefix characters from a user.

It will not inform the user or the channel of the removal of prefixes, and should be used when the user parts or quits.

Parameters:
user The user to remove all prefixes from

Definition at line 1193 of file channels.cpp.

References prefixes.

Referenced by KickUser(), PartUser(), and ServerKickUser().

void Channel::ResetMaxBans  ) 
 

Clears the cached max bans value.

Definition at line 1057 of file channels.cpp.

References maxbans.

long Channel::ServerKickUser User user,
const char *  reason,
bool  triggerevents,
const char *  servername = NULL
 

Make the server kick user from this channel with the given reason.

Parameters:
user The user being kicked (must be on this channel)
reason The reason for the kick
triggerevents True if you wish this kick to trigger module events
Returns:
The number of users left on the channel. If this is zero when the method returns, you MUST delete the Channel immediately!

Definition at line 605 of file channels.cpp.

References InspIRCd::chanlist, User::chans, InspIRCd::Config, FOREACH_MOD, FOREACH_RESULT_I, GetUserCounter(), ServerConfig::HideWhoisServer, I_OnChannelDelete, I_OnChannelPreDelete, I_OnUserKick, IS_LOCAL,