InspIRCd
2.0
|
#include <channels.h>
Public Member Functions | |
Channel (const std::string &name, time_t ts) | |
void | SetMode (ModeHandler *mode, bool value) |
void | SetMode (char mode, bool mode_on) |
void | SetModeParam (ModeHandler *mode, const std::string ¶meter) |
void | SetModeParam (char mode, const std::string ¶meter) |
bool | IsModeSet (char mode) |
bool | IsModeSet (ModeHandler *mode) |
std::string | GetModeParameter (char mode) |
std::string | GetModeParameter (ModeHandler *mode) |
int | SetTopic (User *u, std::string &t, bool forceset=false) |
long | GetUserCounter () |
Membership * | AddUser (User *user) |
void | DelUser (User *user) |
const UserMembList * | GetUsers () |
bool | HasUser (User *user) |
Membership * | GetUser (User *user) |
void | KickUser (User *src, User *user, const char *reason) |
void | PartUser (User *user, std::string &reason) |
void | WriteChannel (User *user, const char *text,...) CUSTOM_PRINTF(3 |
void void | WriteChannel (User *user, const std::string &text) |
void | WriteChannelWithServ (const std::string &ServName, const char *text,...) CUSTOM_PRINTF(3 |
void void | WriteChannelWithServ (const std::string &ServName, const std::string &text) |
void | WriteAllExceptSender (User *user, bool serversource, char status, const char *text,...) CUSTOM_PRINTF(5 |
void void | WriteAllExcept (User *user, bool serversource, char status, CUList &except_list, const char *text,...) CUSTOM_PRINTF(6 |
void void void | WriteAllExceptSender (User *user, bool serversource, char status, const std::string &text) |
void | WriteAllExcept (User *user, bool serversource, char status, CUList &except_list, const std::string &text) |
void | RawWriteAllExcept (User *user, bool serversource, char status, CUList &except_list, const std::string &text) |
long | GetMaxBans () |
char * | ChanModes (bool showkey) |
void | UserList (User *user) |
int | CountInvisible () |
const char * | GetPrefixChar (User *user) |
const char * | GetAllPrefixChars (User *user) |
unsigned int | GetPrefixValue (User *user) |
void | RemoveAllPrefixes (User *user) |
bool | SetPrefix (User *user, char prefix, bool adding) |
bool | IsBanned (User *user) |
bool | CheckBan (User *user, const std::string &banmask) |
ModResult | GetExtBanStatus (User *u, char type) |
void | ResetMaxBans () |
![]() | |
const ExtensibleStore & | GetExtList () const |
virtual CullResult | cull () |
void | doUnhookExtensions (const std::vector< reference< ExtensionItem > > &toRemove) |
![]() | |
void | ClearInvites () |
Static Public Member Functions | |
static Channel * | JoinUser (User *user, const char *cn, bool override, const char *key, bool bursting, time_t TS=0) |
Public Attributes | |
std::string | name |
time_t | age |
UserMembList | userlist |
std::string | topic |
time_t | topicset |
std::string | setby |
BanList | bans |
Additional Inherited Members | |
![]() | |
typedef std::map< reference< ExtensionItem >, void * > | ExtensibleStore |
![]() | |
InviteList | invites |
Holds all relevent information for a channel. This class represents a channel, and contains its name, modes, topic, topic set time, etc, and an instance of the BanList type.
Channel::Channel | ( | const std::string & | name, |
time_t | ts | ||
) |
Creates a channel record and initialises it with default values
Nothing | at present. |
Membership * Channel::AddUser | ( | User * | user | ) |
Add a user pointer to the internal reference list
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.
char * Channel::ChanModes | ( | bool | showkey | ) |
Return the channel's modes with parameters.
showkey | If this is set to true, the actual key is shown, otherwise it is replaced with '<KEY>' |
bool Channel::CheckBan | ( | User * | user, |
const std::string & | banmask | ||
) |
Check a single ban for match
int Channel::CountInvisible | ( | ) |
Get the number of invisible users on this channel
void Channel::DelUser | ( | User * | user | ) |
Delete a user pointer to the internal reference list
user | The user to delete |
const char * Channel::GetAllPrefixChars | ( | User * | user | ) |
Return all of a users mode prefixes into a char* string.
user | The user to look up |
Get the status of an "action" type extban
long Channel::GetMaxBans | ( | ) |
Returns the maximum number of bans allowed to be set on this channel
std::string Channel::GetModeParameter | ( | char | mode | ) |
Returns the parameter for a custom mode on a channel.
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.
const char * Channel::GetPrefixChar | ( | User * | user | ) |
Get a users prefix on this channel in a string.
user | The user to look up |
unsigned int Channel::GetPrefixValue | ( | User * | user | ) |
Get the value of a users prefix on this channel.
user | The user to look up |
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.
const UserMembList * 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.
bool Channel::HasUser | ( | User * | user | ) |
Returns true if the user given is on the given channel.
user | The user to look for |
bool Channel::IsBanned | ( | User * | user | ) |
Check if a user is banned on this channel
user | A user to check against the banlist |
|
inline |
Returns true if a mode is set on a channel
mode | The mode character you wish to query |
Make src kick user from this channel with the given reason.
src | The source of the kick |
user | The user being kicked (must be on this channel) |
reason | The reason for the kick |
void 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.
user | The user who is parting (must be on this channel) |
reason | The part reason |
void Channel::RawWriteAllExcept | ( | User * | user, |
bool | serversource, | ||
char | status, | ||
CUList & | except_list, | ||
const std::string & | text | ||
) |
Write a line of text that already includes the source
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.
user | The user to remove all prefixes from |
void Channel::ResetMaxBans | ( | ) |
Clears the cached max bans value
void Channel::SetMode | ( | ModeHandler * | mode, |
bool | value | ||
) |
Sets or unsets a custom mode in the channels info
mode | The mode character to set or unset |
value | True if you want to set the mode or false if you want to remove it |
void Channel::SetModeParam | ( | ModeHandler * | mode, |
const std::string & | parameter | ||
) |
Sets or unsets a custom mode in the channels info
mode | The mode character to set or unset |
parameter | The parameter string to associate with this mode character. If it is empty, the mode is unset; if it is nonempty, the mode is set. |
bool Channel::SetPrefix | ( | User * | user, |
char | prefix, | ||
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 ops to them)
user | The user to associate the privilage with |
prefix | The prefix character to associate |
adding | True if adding the prefix, false when removing |
int Channel::SetTopic | ( | User * | u, |
std::string & | t, | ||
bool | forceset = false |
||
) |
Sets the channel topic.
u | The user setting the topic |
t | The topic to set it to. Non-const, as it may be modified by a hook. |
forceset | If set to true then all access checks will be bypassed. |
void Channel::UserList | ( | User * | user | ) |
Spool the NAMES list for this channel to the given user
user | The user to spool the NAMES list to |
void Channel::WriteAllExcept | ( | User * | user, |
bool | serversource, | ||
char | status, | ||
CUList & | except_list, | ||
const char * | text, | ||
... | |||
) |
Write to all users on a channel except a list of users, using va_args for text
user | User whos details to prefix the line with, and to omit from receipt of the message |
serversource | If this parameter is true, use the local server name as the source of the text, otherwise, use the [email protected] of the user. |
status | The status of the users to write to, e.g. '@' or ''. Use a value of 0 to write to everyone |
except_list | A list of users NOT to send the text to |
text | A printf-style format string which builds the output line without prefix |
... | Zero or more POD type |
void Channel::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
user | User whos details to prefix the line with, and to omit from receipt of the message |
serversource | If this parameter is true, use the local server name as the source of the text, otherwise, use the [email protected] of the user. |
status | The status of the users to write to, e.g. '@' or ''. Use a value of 0 to write to everyone |
except_list | A list of users NOT to send the text to |
text | A std::string containing the output line without prefix |
void Channel::WriteAllExceptSender | ( | User * | user, |
bool | serversource, | ||
char | status, | ||
const char * | text, | ||
... | |||
) |
Write to all users on a channel except a specific user, using va_args for text. Internally, this calls WriteAllExcept().
user | User whos details to prefix the line with, and to omit from receipt of the message |
serversource | If this parameter is true, use the local server name as the source of the text, otherwise, use the [email protected] of the user. |
status | The status of the users to write to, e.g. '@' or ''. Use a value of 0 to write to everyone |
text | A printf-style format string which builds the output line without prefix |
... | Zero or more POD type |
void Channel::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. Internally, this calls WriteAllExcept().
user | User whos details to prefix the line with, and to omit from receipt of the message |
serversource | If this parameter is true, use the local server name as the source of the text, otherwise, use the [email protected] of the user. |
status | The status of the users to write to, e.g. '@' or ''. Use a value of 0 to write to everyone |
text | A std::string containing the output line without prefix |
void Channel::WriteChannel | ( | User * | user, |
const char * | text, | ||
... | |||
) |
Write to a channel, from a user, using va_args for text
user | User whos details to prefix the line with |
text | A printf-style format string which builds the output line without prefix |
... | Zero or more POD types |
void Channel::WriteChannel | ( | User * | user, |
const std::string & | text | ||
) |
Write to a channel, from a user, using std::string for text
user | User whos details to prefix the line with |
text | A std::string containing the output line without prefix |
void Channel::WriteChannelWithServ | ( | const std::string & | ServName, |
const char * | text, | ||
... | |||
) |
Write to a channel, from a server, using va_args for text
ServName | Server name to prefix the line with |
text | A printf-style format string which builds the output line without prefix |
... | Zero or more POD type |
void Channel::WriteChannelWithServ | ( | const std::string & | ServName, |
const std::string & | text | ||
) |
Write to a channel, from a server, using std::string for text
ServName | Server name to prefix the line with |
text | A std::string containing the output line without prefix |
time_t Channel::age |
Time that the object was instantiated (used for TS calculation etc)
BanList Channel::bans |
The list of all bans set on the channel.
std::string Channel::name |
The channel's name.
std::string Channel::setby |
The last user to set the topic. If this member is an empty string, no topic was ever set.
std::string Channel::topic |
Channel topic. If this is an empty string, no channel topic is set.
time_t Channel::topicset |
Time topic was set. If no topic was ever set, this will be equal to Channel::created
UserMembList Channel::userlist |
User list.