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

User Class Reference

Holds all information about a user This class stores all information about a user connected to the irc server. More...

#include <users.h>

Inheritance diagram for User:

Inheritance graph
[legend]
Collaboration diagram for User:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void StartDNSLookup ()
 Starts a DNS lookup of the user's IP.
void SetSockAddr (int protocol_family, const char *ip, int port)
 Initialize the clients sockaddr.
int GetPort ()
 Get port number from sockaddr.
int GetProtocolFamily ()
 Get protocol family from sockaddr.
const char * GetIPString (bool translate4in6=true)
 Get IP string from sockaddr, using static internal buffer.
const char * GetCIDRMask (int range)
 Get a CIDR mask from the IP of this user, using a static internal buffer.
 User (InspIRCd *Instance, const std::string &uid="")
 Default constructor.
bool CheckLines ()
 Check if the user matches a G or K line, and disconnect them if they do.
virtual const std::stringGetFullHost ()
 Returns the full displayed host of the user This member function returns the hostname of the user as seen by other users on the server, in nick!identhost form.
virtual const std::stringGetFullRealHost ()
 Returns the full real host of the user This member function returns the hostname of the user as seen by other users on the server, in nick!identhost form.
void InvalidateCache ()
 This clears any cached results that are used for GetFullRealHost() etc.
const char * FormatNoticeMasks ()
 Create a displayable mode string for this users snomasks.
std::string ProcessNoticeMasks (const char *sm)
 Process a snomask modifier string, e.g.
bool IsNoticeMaskSet (unsigned char sm)
 Returns true if a notice mask is set.
void SetNoticeMask (unsigned char sm, bool value)
 Changed a specific notice mask value.
const char * FormatModes (bool showparameters=false)
 Create a displayable mode string for this users umodes.
bool IsModeSet (unsigned char m)
 Returns true if a specific mode is set.
void SetMode (unsigned char m, bool value)
 Set a specific usermode to on or off.
virtual bool IsInvited (const irc::string &channel)
 Returns true if a user is invited to a channel.
virtual void InviteTo (const irc::string &channel, time_t timeout)
 Adds a channel to a users invite list (invites them to a channel).
virtual void RemoveInvite (const irc::string &channel)
 Removes a channel from a users invite list.
bool HasPermission (const std::string &command)
 Returns true or false for if a user can execute a privilaged oper command.
bool HasModePermission (unsigned char mode, ModeType type)
 Returns true or false if a user can set a privileged user or channel mode.
int ReadData (void *buffer, size_t size)
 Calls read() to read some data for this user using their fd.
bool AddBuffer (const std::string &a)
 This method adds data to the read buffer of the user.
bool BufferIsReady ()
 This method returns true if the buffer contains at least one carriage return character (e.g.
void ClearBuffer ()
 This function clears the entire buffer by setting it to an empty string.
std::string GetBuffer ()
 This method returns the first available string at the tail end of the buffer and advances the tail end of the buffer past the string.
void AddWriteBuf (const std::string &data)
 Adds to the user's write buffer.
void FlushWriteBuf ()
 Flushes as much of the user's buffer to the file descriptor as possible.
InvitedListGetInviteList ()
 Returns the list of channels this user has been invited to but has not yet joined.
char * MakeWildHost ()
 Creates a wildcard host.
const std::stringMakeHost ()
 Creates a usermask with real host.
const std::stringMakeHostIP ()
 Creates a usermask with real ip.
void CloseSocket ()
 Shuts down and closes the user's socket This will not cause the user to be deleted.
void AddToWhoWas ()
 Add the user to WHOWAS system.
void Oper (const std::string &opertype, const std::string &opername)
 Oper up the user using the given opertype.
void CheckClass ()
 Call this method to find the matching <connect> for a user, and to check them against it.
void FullConnect ()
 Use this method to fully connect a user.
UserUpdateNickHash (const char *New)
 Change this users hash key to a new string.
bool ForceNickChange (const char *newnick)
 Force a nickname change.
void UnOper ()
 Oper down.
void Write (std::string text)
 Write text to this user, appending CR/LF.
void Write (const char *text,...) CUSTOM_PRINTF(2
 Write text to this user, appending CR/LF.
void void WriteServ (const std::string &text)
 Write text to this user, appending CR/LF and prepending :server.name.
void WriteServ (const char *text,...) CUSTOM_PRINTF(2
 Write text to this user, appending CR/LF and prepending :server.name.
void void WriteNumeric (unsigned int numeric, const char *text,...) CUSTOM_PRINTF(3
void void void WriteNumeric (unsigned int numeric, const std::string &text)
void WriteFrom (User *user, const std::string &text)
 Write text to this user, appending CR/LF and prepending :nick!user of the user provided in the first parameter.
void WriteFrom (User *user, const char *text,...) CUSTOM_PRINTF(3
 Write text to this user, appending CR/LF and prepending :nick!user of the user provided in the first parameter.
void void WriteTo (User *dest, const std::string &data)
 Write text to the user provided in the first parameter, appending CR/LF, and prepending THIS user's :nick!user.
void WriteTo (User *dest, const char *data,...) CUSTOM_PRINTF(3
 Write text to the user provided in the first parameter, appending CR/LF, and prepending THIS user's :nick!user.
void void WriteCommon (const std::string &text)
 Write to all users that can see this user (including this user in the list), appending CR/LF.
void WriteCommon (const char *text,...) CUSTOM_PRINTF(2
 Write to all users that can see this user (including this user in the list), appending CR/LF.
void void WriteCommonExcept (const char *text,...) CUSTOM_PRINTF(2
 Write to all users that can see this user (not including this user in the list), appending CR/LF.
void void void WriteCommonExcept (const std::string &text)
 Write to all users that can see this user (not including this user in the list), appending CR/LF.
void WriteCommonQuit (const std::string &normal_text, const std::string &oper_text)
 Write a quit message to all common users, as in User::WriteCommonExcept but with a specific quit message for opers only.
void WriteWallOps (const char *text,...) CUSTOM_PRINTF(2
 Write a WALLOPS message from this user to all local opers.
void void WriteWallOps (const std::string &text)
 Write a WALLOPS message from this user to all local opers.
bool SharesChannelWith (User *other)
 Return true if the user shares at least one channel with another user.
bool ChangeDisplayedHost (const char *host)
 Change the displayed host of a user.
bool ChangeIdent (const char *newident)
 Change the ident (username) of a user.
bool ChangeName (const char *gecos)
 Change a users realname field.
void SendAll (const char *command, const char *text,...) CUSTOM_PRINTF(3
 Send a command to all local users from this user The command given must be able to send text with the first parameter as a servermask (e.g.
void std::string ChannelList (User *source)
 Compile a channel list for this user, and send it to the user 'source' Used internally by WHOIS.
void SplitChanList (User *dest, const std::string &cl)
 Split the channel list in cl which came from dest, and spool it to this user Used internally by WHOIS.
void PurgeEmptyChannels ()
 Remove this user from all channels they are on, and delete any that are now empty.
ConnectClassGetClass ()
 Get the connect class which this user belongs to.
ConnectClassSetClass (const std::string &explicit_name="")
 Set the connect class to which this user belongs to.
void ShowMOTD ()
 Show the message of the day to this user.
void ShowRULES ()
 Show the server RULES file to this user.
void SetOperQuit (const std::string &oquit)
 Set oper-specific quit message shown to opers only when the user quits (overrides any sent by QuitUser).
const std::stringGetOperQuit ()
 Get oper-specific quit message shown only to opers when the user quits.
void IncreasePenalty (int increase)
 Increases a user's command penalty by a set amount.
void DecreasePenalty (int decrease)
 Decreases a user's command penalty by a set amount.
void HandleEvent (EventType et, int errornum=0)
 Handle socket event.
virtual ~User ()
 Default destructor.

Public Attributes

Moduleio
 Module responsible for raw i/o.
ConnectClassMyClass
 Contains a pointer to the connect class a user is on from - this will be NULL for remote connections.
VisDataVisibility
 User visibility state, see definition of VisData.
std::string stored_host
 Stored reverse lookup from res_forward.
std::string nick
 The users nickname.
std::string uuid
 The user's unique identifier.
std::string ident
 The users ident reply.
std::string dhost
 The host displayed to non-opers (used for cloaking etc).
std::string fullname
 The users full name (GECOS).
std::bitset< 64 > modes
 The user's mode list.
std::bitset< 64 > snomasks
 What snomasks are set on this user.
UserChanList chans
 Channels this user is on, and the permissions they have there.
const char * server
 The server the user is connected to.
std::string awaymsg
 The user's away message.
time_t awaytime
 Time the user last went away.
std::string oper
 The oper type they logged in as, if they are an oper.
bool dns_done
 True when DNS lookups are completed.
std::string password
 Password specified by the user when they registered.
std::string recvq
 User's receive queue.
std::string sendq
 User's send queue.
std::string quitmsg
 Message user will quit with.
std::string operquitmsg
 Quit message shown to opers - not to be set externally.
bool quietquit
 Whether or not to send an snotice about this user's quitting.
unsigned int lines_in
 Flood counters - lines received.
time_t reset_due
 Flood counters - time lines_in is due to be reset.
bool quitting
 If this is set to true, then all socket operations for the user are dropped into the bit-bucket.
sockaddr * ip
 IPV4 or IPV6 ip address.
bool exempt
 This is true if the user matched an exception (E:Line).
int Penalty
 This value contains how far into the penalty threshold the user is.
bool OverPenalty
 True if we are flushing penalty lines.
bool ExemptFromPenalty
 If this bool is set then penalty rules do not apply to this user.

Private Member Functions

void DecrementModes ()
 When we erase the user (in the destructor), we call this method to subtract one from all mode characters this user is making use of.

Private Attributes

InspIRCdServerInstance
 Pointer to creator.
InvitedList invites
 A list of channels the user has a pending invite to.
std::string cached_fullhost
 Cached nick!ident value using the real hostname.
std::string cached_hostip
 Cached nick!ident value using the real IP address.
std::string cached_makehost
 Cached nick!ident value using the masked hostname.
std::string cached_fullrealhost
 Cached nick!ident value using the real hostname.
std::string cachedip
 Set by GetIPString() to avoid constantly re-grabbing IP via sockets voodoo.
std::map< std::string, bool > * AllowedOperCommands
bool * AllowedUserModes
 Allowed user modes from oper classes.
bool * AllowedChanModes
 Allowed channel modes from oper classes.

Detailed Description

Holds all information about a user This class stores all information about a user connected to the irc server.

Everything about a connection is stored here primarily, from the user's socket ID (file descriptor) through to the user's nickname and hostname. Use the FindNick method of the InspIRCd class to locate a specific user by nickname, or the FindDescriptor method of the InspIRCd class to find a specific user by their file descriptor value.

Definition at line 416 of file users.h.


Constructor & Destructor Documentation

User::User InspIRCd Instance,
const std::string uid = ""
 

Default constructor.

Exceptions:
CoreException if the UID allocated to the user already exists
Parameters:
Instance Creator instance
uid User UUID, or empty to allocate one automatically

Definition at line 204 of file users.cpp.

References classbase::age, AllowedChanModes, AllowedOperCommands, AllowedUserModes, connection::bytes_in, connection::bytes_out, chans, connection::cmds_in, connection::cmds_out, InspIRCd::Config, DEBUG, dns_done, exempt, ExemptFromPenalty, EventHandler::fd, InspIRCd::FindServerNamePtr(), InspIRCd::GetUID(), connection::haspassed, connection::idle_lastmsg, invites, io, ip, connection::lastping, lines_in, LogManager::Log(), InspIRCd::Logs, MyClass, connection::nping, OverPenalty, Penalty, quietquit, quitting, recvq, connection::registered, reset_due, sendq, server, ServerInstance, ServerConfig::ServerName, connection::signon, InspIRCd::Time(), InspIRCd::Users, uuid, UUID_LENGTH, UserManager::uuidlist, and Visibility.

User::~User  )  [virtual]
 

Default destructor.

Definition at line 240 of file users.cpp.

References AllowedChanModes, AllowedOperCommands, AllowedUserModes, DEBUG, DecrementModes(), InvalidateCache(), ip, LogManager::Log(), InspIRCd::Logs, MyClass, ConnectClass::RefCount, UserManager::RemoveCloneCounts(), ServerInstance, InspIRCd::Users, uuid, and UserManager::uuidlist.


Member Function Documentation

bool User::AddBuffer const std::string a  ) 
 

This method adds data to the read buffer of the user.

The buffer can grow to any size within limits of the available memory, managed by the size of a std::string, however if any individual line in the buffer grows over 600 bytes in length (which is 88 chars over the RFC-specified limit per line) then the method will return false and the text will not be inserted.

Parameters:
a The string to add to the users read buffer
Returns:
True if the string was successfully added to the read buffer

Definition at line 523 of file users.cpp.

References ConnectClass::GetRecvqMax(), MyClass, UserManager::QuitUser(), recvq, ServerInstance, InspIRCd::SNO, InspIRCd::Users, and SnomaskManager::WriteToSnoMask().

void User::AddToWhoWas  ) 
 

Add the user to WHOWAS system.

Definition at line 845 of file users.cpp.

References CommandParser::GetHandler(), Command::HandleInternal(), InspIRCd::Parser, ServerInstance, and WHOWAS_ADD.

void User::AddWriteBuf const std::string data  ) 
 

Adds to the user's write buffer.

You may add any amount of text up to this users sendq value, if you exceed the sendq value, the user will be removed, and further buffer adds will be dropped.

Parameters:
data The data to add to the write buffer

Definition at line 637 of file users.cpp.

References ConnectClass::GetSendqMax(), MAXBUF, MyClass, UserManager::QuitUser(), sendq, ServerInstance, InspIRCd::SNO, InspIRCd::Users, and SnomaskManager::WriteToSnoMask().

Referenced by ModuleXMLSocket::OnRawSocketWrite(), and Write().

bool User::BufferIsReady  ) 
 

This method returns true if the buffer contains at least one carriage return character (e.g.

one complete line may be read)

Returns:
True if there is at least one complete line in the users buffer

Definition at line 587 of file users.cpp.

References recvq.

Referenced by CommandParser::DoLines().

bool User::ChangeDisplayedHost const char *  host  ) 
 

Change the displayed host of a user.

ALWAYS use this function, rather than writing User::dhost directly, as this triggers module events allowing the change to be syncronized to remote servers. This will also emulate a QUIT and rejoin (where configured) before setting their host field.

Parameters:
host The new hostname to set
Returns:
True if the change succeeded, false if it didn't

Definition at line 1634 of file users.cpp.

References chans, dhost, FOREACH_MOD, FOREACH_RESULT, I_OnChangeHost, I_OnChangeLocalUserHost, InvalidateCache(), IS_LOCAL, InspIRCd::Modes, ModeParser::ModeString(), RPL_YOURDISPLAYEDHOST, ServerInstance, WriteCommonExcept(), and WriteNumeric().

Referenced by TreeSocket::ChangeHost(), CommandVhost::Handle(), CommandSethost::Handle(), CommandTitle::Handle(), CommandChghost::Handle(), CloakUser::OnModeChange(), ModuleHostChange::OnUserConnect(), and ModuleSQLOper::OperUser().

bool User::ChangeIdent const char *  newident  ) 
 

Change the ident (username) of a user.

ALWAYS use this function, rather than writing User::ident directly, as this correctly causes the user to seem to quit (where configured) before setting their ident field.

Parameters:
host The new ident to set
Returns:
True if the change succeeded, false if it didn't

Definition at line 1673 of file users.cpp.

References chans, InspIRCd::Config, ident, ServerLimits::IdentMax, InvalidateCache(), ServerConfig::Limits, InspIRCd::Modes, ModeParser::ModeString(), ServerInstance, and WriteCommonExcept().

Referenced by CommandSetident::Handle(), and CommandChgident::Handle().

bool User::ChangeName const char *  gecos  ) 
 

Change a users realname field.

ALWAYS use this function, rather than writing User::fullname directly, as this triggers module events allowing the change to be syncronized to remote servers.

Parameters:
gecos The user's new realname
Returns:
True if the change succeeded, false if otherwise

Definition at line 1616 of file users.cpp.

References InspIRCd::Config, FOREACH_MOD, FOREACH_RESULT, fullname, I_OnChangeLocalUserGECOS, I_OnChangeName, IS_LOCAL, ServerConfig::Limits, ServerLimits::MaxGecos, and ServerInstance.

Referenced by TreeSocket::ChangeName(), CommandSetname::Handle(), and CommandChgname::Handle().

std::string User::ChannelList User source  ) 
 

Compile a channel list for this user, and send it to the user 'source' Used internally by WHOIS.

Parameters:
The user to send the channel list to if it is not too long
Returns:
This user's channel list

Definition at line 1719 of file users.cpp.

References chans, InspIRCd::Config, IS_OPER, ServerConfig::OperSpyWhois, and ServerInstance.

Referenced by CommandCheck::Handle().

void User::CheckClass  ) 
 

Call this method to find the matching <connect> for a user, and to check them against it.

Definition at line 859 of file users.cpp.

References CC_DENY, InspIRCd::Config, ServerConfig::dns_timeout, GetIPString(), ConnectClass::GetMaxGlobal(), ConnectClass::GetMaxLocal(), ConnectClass::GetPingTime(), ConnectClass::GetType(), UserManager::GlobalCloneCount(), UserManager::LocalCloneCount(), MyClass, connection::nping, UserManager::QuitUser(), ServerInstance, InspIRCd::SNO, InspIRCd::Time(), InspIRCd::Users, and SnomaskManager::WriteToSnoMask().

Referenced by UserManager::AddUser(), ModuleCgiIRC::CheckIdent(), ModuleCgiIRC::CheckPass(), and ModuleCgiIRC::OnUserConnect().

bool User::CheckLines  ) 
 

Check if the user matches a G or K line, and disconnect them if they do.

Returns true if the user matched a ban, false else.

Definition at line 884 of file users.cpp.

References XLine::Apply(), XLineManager::MatchesLine(), ServerInstance, and InspIRCd::XLines.

Referenced by CGIResolver::OnLookupComplete(), ModuleCgiIRC::OnUserConnect(), and ModuleCgiIRC::OnUserRegister().

void User::ClearBuffer  ) 
 

This function clears the entire buffer by setting it to an empty string.

Definition at line 592 of file users.cpp.

References recvq.

void User::CloseSocket  ) 
 

Shuts down and closes the user's socket This will not cause the user to be deleted.

Use InspIRCd::QuitUser for this, which will call CloseSocket() for you.

Definition at line 328 of file users.cpp.

References SocketEngine::Close(), InspIRCd::SE, ServerInstance, and SocketEngine::Shutdown().

Referenced by CullList::Apply().

void User::DecreasePenalty int  decrease  ) 
 

Decreases a user's command penalty by a set amount.

Definition at line 2001 of file users.cpp.

References Penalty.

void User::DecrementModes  )  [private]
 

When we erase the user (in the destructor), we call this method to subtract one from all mode characters this user is making use of.

Definition at line 186 of file users.cpp.

References ModeHandler::ChangeCount(), DEBUG, ModeParser::FindMode(), LogManager::Log(), InspIRCd::Logs, InspIRCd::Modes, modes, MODETYPE_USER, and ServerInstance.

Referenced by ~User().

void User::FlushWriteBuf  ) 
 

Flushes as much of the user's buffer to the file descriptor as possible.

This function may not always flush the entire buffer, rather instead as much of it as it possibly can. If the send() call fails to send the entire buffer, the buffer position is advanced forwards and the rest of the data sent at the next call to this method.

Definition at line 661 of file users.cpp.

References connection::bytes_out, connection::cmds_out, EventHandler::fd, FD_MAGIC_NUMBER, FOREACH_MOD, I_OnBufferFlushed, UserManager::QuitUser(), InspIRCd::SE, SocketEngine::Send(), sendq, ServerInstance, InspIRCd::Users, and SocketEngine::WantWrite().

Referenced by CullList::Apply(), and HandleEvent().

bool User::ForceNickChange const char *  newnick  ) 
 

Force a nickname change.

If the nickname change fails (for example, because the nick in question already exists) this function will return false, and you must then either output an error message, or quit the user for nickname collision.

Parameters:
newnick The nickname to change to
Returns:
True if the nickchange was successful.

Definition at line 1001 of file users.cpp.

References CommandParser::CallHandler(), CMD_SUCCESS, dummy, FOREACH_RESULT, CommandParser::GetHandler(), Command::HandleInternal(), I_OnUserPreNick, InvalidateCache(), InspIRCd::Parser, ServerInstance, InspIRCd::stats, and serverstats::statsCollisions.

Referenced by QLine::Apply(), TreeSocket::DoCollision(), TreeSocket::ForceNick(), CommandSanick::Handle(), and CommandNicklock::Handle().

const char * User::FormatModes bool  showparameters = false  ) 
 

Create a displayable mode string for this users umodes.

Parameters:
The mode string

Definition at line 161 of file users.cpp.

References ModeParser::FindMode(), ModeHandler::GetNumParams(), ModeHandler::GetUserParameter(), MAXBUF, InspIRCd::Modes, modes, MODETYPE_USER, ServerInstance, and strlcat().

Referenced by ModeParser::DisplayCurrentModes(), CommandCheck::Handle(), and SpanningTreeProtocolInterface::Introduce().

const char * User::FormatNoticeMasks  ) 
 

Create a displayable mode string for this users snomasks.

Returns:
The notice mask character sequence

Definition at line 132 of file users.cpp.

References MAXBUF, and snomasks.

Referenced by ModeParser::DisplayCurrentModes(), ModeUserServerNoticeMask::GetUserParameter(), and CommandCheck::Handle().

void User::FullConnect  ) 
 

Use this method to fully connect a user.

This will send the message of the day, check G/K/E lines, etc.

Definition at line 905 of file users.cpp.

References BanCacheManager::AddHit(), InspIRCd::BanCache, InspIRCd::CallCommandHandler(), ModeParser::ChannelModeList(), InspIRCd::Config, DEBUG, FOREACH_MOD, FOREACH_RESULT, fullname, GetIPString(), connection::haspassed, connection::host, I_OnPostConnect, I_OnPreCommand, I_OnUserConnect, ident, connection::idle_lastmsg, ProtocolInterface::Introduce(), LogManager::Log(), InspIRCd::Logs, InspIRCd::Modes, ServerConfig::Network, nick, ModeParser::ParaModeList(), InspIRCd::PI, UserManager::QuitUser(), REG_ALL, connection::registered, RPL_SERVERCREATED, RPL_SERVERVERSION, RPL_WELCOME, RPL_YOURHOSTIS, RPL_YOURUUID, ServerConfig::Send005(), ServerInstance, ServerConfig::ServerName, SetClass(), ShowMOTD(), InspIRCd::SNO, InspIRCd::stats, serverstats::statsConnects, InspIRCd::Time(), UserManager::unregistered_count, ModeParser::UserModeList(), InspIRCd::Users, uuid, WriteNumeric(), WriteServ(), and SnomaskManager::WriteToSnoMask().

Referenced by InspIRCd::DoBackgroundUserStuff().

std::string User::GetBuffer  ) 
 

This method returns the first available string at the tail end of the buffer and advances the tail end of the buffer past the string.

This means it is a one way operation in a similar way to strtok(), and multiple calls return multiple lines if they are available. The results of this function if there are no lines to be read are unknown, always use BufferIsReady() to check if it is ok to read the buffer before calling GetBuffer().

Returns:
The string at the tail end of this users buffer

Definition at line 597 of file users.cpp.

References DEBUG, LogManager::Log(), InspIRCd::Logs, recvq, and ServerInstance.

Referenced by CommandParser::DoLines().

const char * User::GetCIDRMask int  range  ) 
 

Get a CIDR mask from the IP of this user, using a static internal buffer.

e.g., GetCIDRMask(16) for 223.254.214.52 returns 223.254.0.0/16 This may be used for CIDR clone detection, etc.

(XXX, brief note: when we do the sockets rewrite, this should move down a level so it may be used on more derived objects. -- w00t)

Definition at line 1099 of file users.cpp.

References ip.

Referenced by UserManager::AddGlobalClone(), UserManager::AddLocalClone(), ModuleQuitBan::OnUserConnect(), and UserManager::RemoveCloneCounts().

ConnectClass * User::GetClass  ) 
 

Get the connect class which this user belongs to.

Returns:
A pointer to this user's connect class

Definition at line 1893 of file users.cpp.

References MyClass.

const std::string & User::GetFullHost  )  [virtual]
 

Returns the full displayed host of the user This member function returns the hostname of the user as seen by other users on the server, in nick!identhost form.

Returns:
The full masked host of the user

Definition at line 337 of file users.cpp.

References cached_fullhost, dhost, ident, MAXBUF, and nick.

Referenced by ListModeBase::DoOnRequest(), CommandDccallow::Handle(), CommandCheck::Handle(), Channel::IsBanned(), Channel::IsExtBanned(), Shun::Matches(), ModuleSilence::MatchPattern(), ModuleBanException::OnCheckBan(), ModuleBanException::OnCheckExtBan(), ModuleInviteException::OnCheckInvite(), ModuleServicesAccount::OnDecodeMetaData(), ModuleUHNames::OnNamesListItem(), ModuleInvisible::OnUserJoin(), ModuleBanRedirect::OnUserPreJoin(), ModuleDCCAllow::OnUserPreNotice(), Channel::SetTopic(), Channel::WriteAllExcept(), Channel::WriteChannel(), ModuleInvisible::WriteCommonFrom(), ModuleDelayJoin::WriteCommonFrom(), and WriteFrom().

const std::string & User::GetFullRealHost  )  [virtual]
 

Returns the full real host of the user This member function returns the hostname of the user as seen by other users on the server, in nick!identhost form.

If any form of hostname cloaking is in operation, e.g. through a module, then this method will ignore it and return the true hostname.

Returns:
The full real host of the user

Definition at line 386 of file users.cpp.

References cached_fullrealhost, connection::host, ident, MAXBUF, and nick.

Referenced by ListModeBase::DoOnRequest(), cmd_rsquit::Handle(), CommandCheck::Handle(), ModuleSpanningTree::HandleSquit(), Channel::IsBanned(), Channel::IsExtBanned(), Shun::Matches(), ModuleBanException::OnCheckBan(), ModuleBanException::OnCheckExtBan(), ModuleInviteException::OnCheckInvite(), DNSBLResolver::OnLookupComplete(), and ModuleBanRedirect::OnUserPreJoin().

InvitedList * User::GetInviteList  ) 
 

Returns the list of channels this user has been invited to but has not yet joined.

Returns:
A list of channels the user is invited to

Definition at line 430 of file users.cpp.

References invites.

const char * User::GetIPString bool  translate4in6 = true  ) 
 

Get IP string from sockaddr, using static internal buffer.

Returns:
The IP string

Definition at line 1206 of file users.cpp.

References cachedip, ip, and strlcpy().

Referenced by UserManager::AddUser(), CheckClass(), ModuleSQLAuth::CheckCredentials(), ModuleCgiIRC::CheckIdent(), ModuleCgiIRC::CheckPass(), XLine::DefaultApply(), ListModeBase::DoOnRequest(), FullConnect(), UserManager::GlobalCloneCount(), CommandUserip::Handle(), CommandStartTLS::Handle(), CommandTitle::Handle(), CommandWebirc::Handle(), IdentRequestSocket::IdentRequestSocket(), SpanningTreeProtocolInterface::Introduce(), Channel::IsBanned(), Channel::IsExtBanned(), UserManager::LocalCloneCount(), MakeHostIP(), ZLine::Matches(), ELine::Matches(), GLine::Matches(), KLine::Matches(), ModuleBanException::OnCheckBan(), ModuleBanException::OnCheckExtBan(), ModuleInviteException::OnCheckInvite(), UserResolver::OnError(), ModuleSSLGnuTLS::OnEvent(), ModuleHttpStats::OnEvent(), UserResolver::OnLookupComplete(), DNSBLResolver::OnLookupComplete(), ModuleModesOnConnect::OnPostConnect(), ModuleOperSSLCert::OnPreCommand(), FilterBase::OnPreCommand(), ModuleAntiBear::OnPreCommand(), ModuleCloaking::OnUserConnect(), FilterBase::OnUserPreNotice(), ModuleIdent::OnUserRegister(), ModuleGeoIP::OnUserRegister(), ModuleDNSBL::OnUserRegister(), ModuleCgiIRC::OnUserRegister(), ModuleSQLOper::OperUser(), TreeSocket::ParseUID(), TreeSocket::ProcessLine(), and StartDNSLookup().

const std::string & User::GetOperQuit  ) 
 

Get oper-specific quit message shown only to opers when the user quits.

(overrides any sent by QuitUser)

Definition at line 1991 of file users.cpp.

References operquitmsg.

Referenced by CullList::Apply().

int User::GetPort  ) 
 

Get port number from sockaddr.

Returns:
The port number of this user.

Definition at line 1063 of file users.cpp.

References ip.

Referenced by CommandStartTLS::Handle(), CommandCheck::Handle(), ModuleSSLGnuTLS::OnEvent(), ModuleHttpStats::OnEvent(), ModuleXMLSocket::OnHookUserIO(), ModuleSSLOpenSSL::OnHookUserIO(), ModuleSSLGnuTLS::OnHookUserIO(), and ModuleHostChange::OnUserConnect().

int User::GetProtocolFamily  )