|
|||
|
|||
|
#include <channels.h>
Inheritance diagram for Channel:


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. | |
| CUList * | GetUsers () |
| Obtain the internal reference list The internal reference list contains a list of User*. | |
| CUList * | GetOppedUsers () |
| Obtain the internal reference list of opped users. | |
| CUList * | GetHalfoppedUsers () |
| Obtain the internal reference list of halfopped users. | |
| CUList * | GetVoicedUsers () |
| 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 Channel * | JoinUser (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 Channel * | ForceChan (InspIRCd *Instance, Channel *Ptr, User *user, const std::string &privs, bool bursting) |
| Connect a Channel to a User. | |
Private Attributes | |
| InspIRCd * | ServerInstance |
| 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). | |
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.
|
||||||||||||||||
|
Creates a channel record and initialises it with default values.
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(). |
|
|
Destructor for Channel.
Definition at line 545 of file channels.h. |
|
|
Add a user pointer to the internal reference list of halfopped users.
Definition at line 172 of file channels.cpp. References internal_halfop_userlist, and User::nick. |
|
|
Add a user pointer to the internal reference list of opped users.
Definition at line 157 of file channels.cpp. References internal_op_userlist, and User::nick. |
|
|
Add a user pointer to the internal reference list.
Definition at line 131 of file channels.cpp. References internal_userlist, and User::nick. Referenced by ForceChan(). |
|
|
Add a user pointer to the internal reference list of voiced users.
Definition at line 187 of file channels.cpp. References internal_voice_userlist, and User::nick. |
|
|
Return the channel's modes with parameters.
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(). |
|
|
Get the number of invisible users on this channel.
Definition at line 870 of file channels.cpp. References GetUsers(). |
|
|
Delete a user pointer to the internal reference list of halfopped users.
Definition at line 177 of file channels.cpp. References internal_halfop_userlist. Referenced by DelUser(). |
|
|
Delete a user pointer to the internal reference list of opped users.
Definition at line 162 of file channels.cpp. References internal_op_userlist. Referenced by DelUser(). |
|
|
Delete a user pointer to the internal reference list.
Definition at line 136 of file channels.cpp. References DelHalfoppedUser(), DelOppedUser(), DelVoicedUser(), and internal_userlist. |
|
|
Delete a user pointer to the internal reference list of voiced users.
Definition at line 192 of file channels.cpp. References internal_voice_userlist. Referenced by DelUser(). |
|
||||||||||||||||||||||||
|
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(). |
|
|
Return all of a users mode prefixes into a char* string.
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(). |
|
|
Obtain the internal reference list of halfopped users.
Definition at line 212 of file channels.cpp. References internal_halfop_userlist. Referenced by ModuleSilence::OnBuildExemptList(), ModuleHttpStats::OnEvent(), and ModeChannelHalfOp::RemoveMode(). |
|
|
Returns the maximum number of bans allowed to be set on this channel.
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(). |
|
|
Returns the parameter for a custom mode on a channel.
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(). |
|
|
Obtain the internal reference list of opped users.
Definition at line 207 of file channels.cpp. References internal_op_userlist. Referenced by ModuleSilence::OnBuildExemptList(), ModuleHttpStats::OnEvent(), and ModeChannelOp::RemoveMode(). |
|
|
Get a users prefix on this channel in a string.
Definition at line 1066 of file channels.cpp. References prefixes. Referenced by RemoveBase::Handle(), and UserList(). |
|
|
Get the value of a users prefix on this channel.
Definition at line 1110 of file channels.cpp. References prefixes. |
|
|
|
Get a users status on this channel in a bitmask.
Definition at line 1121 of file channels.cpp. References User::chans. Referenced by ModeChannelVoice::ModeSet(), ModeChannelOp::ModeSet(), and ModeChannelHalfOp::ModeSet(). |
|
|
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.
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(). |
|
|
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.
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(). |
|
|
Obtain the internal reference list of voiced users.
Definition at line 217 of file channels.cpp. References internal_voice_userlist. Referenced by ModuleSilence::OnBuildExemptList(), ModuleHttpStats::OnEvent(), and ModeChannelVoice::RemoveMode(). |
|
|
Returns true if the user given is on the given 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(). |
|
|
Check if a user is banned on this channel.
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(). |
|
||||||||||||
|
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. |
|
||||||||||||
|
Check whether an extban of a given type matches a given user for this channel.
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(). |
|
|
Returns true if a mode is set on a channel.
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(). |
|
||||||||||||||||||||||||||||||||
|
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(). |
|
||||||||||||||||
|
Make src kick user from this channel with the given reason.
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(). |
|
||||||||||||
|
Part a user from this channel with the given reason. If the reason field is NULL, no reason will be sent.
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(). |
|
|
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.
Definition at line 1193 of file channels.cpp. References prefixes. Referenced by KickUser(), PartUser(), and ServerKickUser(). |
|
|
Clears the cached max bans value.
Definition at line 1057 of file channels.cpp. References maxbans. |
|
||||||||||||||||||||
|
Make the server kick user from this channel with the given reason.
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, |