InspIRCd  3.0
Public Member Functions | Public Attributes | List of all members
LocalUser Class Reference
Inheritance diagram for LocalUser:
User insp::intrusive_list_node< LocalUser > Extensible classbase

Public Member Functions

 LocalUser (int fd, irc::sockets::sockaddrs *client, irc::sockets::sockaddrs *server)
 
CullResult cull () CXX11_OVERRIDE
 
ConnectClassGetClass () const
 
void CheckClass (bool clone_count=true)
 
int GetServerPort ()
 
bool CheckLines (bool doZline=false)
 
void FullConnect ()
 
void SetClass (const std::string &explicit_name="")
 
bool SetClientIP (const char *sip, bool recheck_eline=true) CXX11_OVERRIDE
 
void SetClientIP (const irc::sockets::sockaddrs &sa, bool recheck_eline=true) CXX11_OVERRIDE
 
void Write (const std::string &text) CXX11_OVERRIDE
 
void Write (const char *,...) CXX11_OVERRIDE CUSTOM_PRINTF(2
 
void void WriteRemoteNotice (const std::string &text) CXX11_OVERRIDE
 
bool HasPermission (const std::string &command) CXX11_OVERRIDE
 
bool HasPrivPermission (const std::string &privstr, bool noisy=false) CXX11_OVERRIDE
 
bool HasModePermission (const ModeHandler *mh) const CXX11_OVERRIDE
 
void OverruleNick ()
 
- Public Member Functions inherited from User
const std::string & GetIPString ()
 
irc::sockets::cidr_mask GetCIDRMask ()
 
 User (const std::string &uid, Server *srv, int objtype)
 
virtual const std::string & GetFullHost ()
 
virtual const std::string & GetFullRealHost ()
 
void InvalidateCache ()
 
bool IsAway () const
 
bool IsOper () const
 
bool IsNoticeMaskSet (unsigned char sm)
 
std::string GetModeLetters (bool includeparams=false) const
 
bool IsModeSet (unsigned char m) const
 
bool IsModeSet (const ModeHandler *mh) const
 
bool IsModeSet (const ModeHandler &mh) const
 
bool IsModeSet (UserModeReference &moderef) const
 
void SetMode (ModeHandler *mh, bool value)
 
void SetMode (ModeHandler &mh, bool value)
 
const std::string & MakeHost ()
 
const std::string & MakeHostIP ()
 
void Oper (OperInfo *info)
 
void UnOper ()
 
virtual void void WriteServ (const std::string &text)
 
void WriteServ (const char *text,...) CUSTOM_PRINTF(2
 
void void WriteCommand (const char *command, const std::string &text)
 
void WriteNotice (const std::string &text)
 
virtual void WriteRemoteNumeric (const Numeric::Numeric &numeric)
 
template<typename T1 >
void WriteRemoteNumeric (unsigned int numeric, T1 p1)
 
template<typename T1 , typename T2 >
void WriteRemoteNumeric (unsigned int numeric, T1 p1, T2 p2)
 
template<typename T1 , typename T2 , typename T3 >
void WriteRemoteNumeric (unsigned int numeric, T1 p1, T2 p2, T3 p3)
 
template<typename T1 , typename T2 , typename T3 , typename T4 >
void WriteRemoteNumeric (unsigned int numeric, T1 p1, T2 p2, T3 p3, T4 p4)
 
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 >
void WriteRemoteNumeric (unsigned int numeric, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5)
 
void WriteNumeric (const Numeric::Numeric &numeric)
 
template<typename T1 >
void WriteNumeric (unsigned int numeric, T1 p1)
 
template<typename T1 , typename T2 >
void WriteNumeric (unsigned int numeric, T1 p1, T2 p2)
 
template<typename T1 , typename T2 , typename T3 >
void WriteNumeric (unsigned int numeric, T1 p1, T2 p2, T3 p3)
 
template<typename T1 , typename T2 , typename T3 , typename T4 >
void WriteNumeric (unsigned int numeric, T1 p1, T2 p2, T3 p3, T4 p4)
 
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 >
void WriteNumeric (unsigned int numeric, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5)
 
void WriteFrom (User *user, const std::string &text)
 
void WriteFrom (User *user, const char *text,...) CUSTOM_PRINTF(3
 
void void WriteCommonRaw (const std::string &line, bool include_self=true)
 
void WriteCommon (const char *text,...) CUSTOM_PRINTF(2
 
void void ForEachNeighbor (ForEachNeighborHandler &handler, bool include_self=true)
 
bool SharesChannelWith (User *other)
 
bool ChangeDisplayedHost (const std::string &host)
 
bool ChangeIdent (const std::string &newident)
 
bool ChangeName (const std::string &gecos)
 
bool ChangeNick (const std::string &newnick, time_t newts=0)
 
void PurgeEmptyChannels ()
 
virtual ~User ()
 
- Public Member Functions inherited from Extensible
const ExtensibleStoreGetExtList () const
 
void doUnhookExtensions (const std::vector< reference< ExtensionItem > > &toRemove)
 
void FreeAllExtItems ()
 

Public Attributes

UserIOHandler eh
 
unsigned int bytes_in
 
unsigned int bytes_out
 
unsigned int cmds_in
 
unsigned int cmds_out
 
std::string password
 
reference< ConnectClassMyClass
 
irc::sockets::sockaddrs server_sa
 
unsigned int quitting_sendq:1
 
unsigned int lastping:1
 
unsigned int exempt:1
 
time_t nping
 
time_t idle_lastmsg
 
unsigned int CommandFloodPenalty
 
already_sent_t already_sent
 
- Public Attributes inherited from User
std::string host
 
time_t age
 
time_t signon
 
irc::sockets::sockaddrs client_sa
 
std::string nick
 
const std::string uuid
 
std::string ident
 
std::string dhost
 
std::string fullname
 
std::bitset< 64 > snomasks
 
ChanList chans
 
Serverserver
 
std::string awaymsg
 
time_t awaytime
 
reference< OperInfooper
 
unsigned int registered:3
 
unsigned int quitting:1
 
const unsigned int usertype:2
 

Additional Inherited Members

- Public Types inherited from User
typedef insp::intrusive_list< MembershipChanList
 
- Public Types inherited from Extensible
typedef insp::flat_map< reference< ExtensionItem >, void * > ExtensibleStore
 

Member Function Documentation

◆ CheckClass()

void LocalUser::CheckClass ( bool  clone_count = true)

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

◆ CheckLines()

bool LocalUser::CheckLines ( bool  doZline = false)

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

Parameters
doZlineTrue if ZLines should be checked (if IP has changed since initial connect) Returns true if the user matched a ban, false else.

◆ cull()

CullResult LocalUser::cull ( )
virtual

Called just prior to destruction via cull list.

Reimplemented from User.

◆ FullConnect()

void LocalUser::FullConnect ( )

Use this method to fully connect a user. This will send the message of the day, check G/K/E lines, etc.

◆ GetClass()

ConnectClass* LocalUser::GetClass ( ) const
inline

Get the connect class which this user belongs to.

Returns
A pointer to this user's connect class.

◆ GetServerPort()

int LocalUser::GetServerPort ( )
Returns
The port number of this user.

◆ HasModePermission()

bool LocalUser::HasModePermission ( const ModeHandler mh) const
virtual

Returns true or false if a user can set a privileged user or channel mode. This is done by looking up their oper type from User::oper, then referencing this to their oper classes, and checking the modes they can set.

Parameters
mhMode to check
Returns
True if the user can set or unset this mode.

Reimplemented from User.

◆ HasPermission()

bool LocalUser::HasPermission ( const std::string &  command)
virtual

Returns true or false for if a user can execute a privilaged oper command. This is done by looking up their oper type from User::oper, then referencing this to their oper classes and checking the commands they can execute.

Parameters
commandA command (should be all CAPS)
Returns
True if this user can execute the command

Reimplemented from User.

◆ HasPrivPermission()

bool LocalUser::HasPrivPermission ( const std::string &  privstr,
bool  noisy = false 
)
virtual

Returns true if a user has a given permission. This is used to check whether or not users may perform certain actions which admins may not wish to give to all operators, yet are not commands. An example might be oper override, mass messaging (/notice $*), etc.

Parameters
privstrThe priv to chec, e.g. "users/override/topic". These are loaded free-form from the config file.
noisyIf set to true, the user is notified that they do not have the specified permission where applicable. If false, no notification is sent.
Returns
True if this user has the permission in question.

Reimplemented from User.

◆ OverruleNick()

void LocalUser::OverruleNick ( )

Change nick to uuid, unset REG_NICK and send a nickname overruled numeric. This is called when another user (either local or remote) needs the nick of this user and this user isn't registered.

◆ SetClass()

void LocalUser::SetClass ( const std::string &  explicit_name = "")

Set the connect class to which this user belongs to.

Parameters
explicit_nameSet this string to tie the user to a specific class name. Otherwise, the class is fitted by checking <connect> tags from the configuration file.
Returns
A reference to this user's current connect class.

◆ SetClientIP()

bool LocalUser::SetClientIP ( const char *  sip,
bool  recheck_eline = true 
)
virtual

Sets the client IP for this user

Returns
true if the conversion was successful

Reimplemented from User.

◆ Write() [1/2]

void LocalUser::Write ( const std::string &  text)
virtual

Write text to this user, appending CR/LF. Works on local users only.

Parameters
textA std::string to send to the user

Reimplemented from User.

◆ Write() [2/2]

void LocalUser::Write ( const char *  text,
  ... 
)
virtual

Write()

Reimplemented from User.

◆ WriteRemoteNotice()

void LocalUser::WriteRemoteNotice ( const std::string &  text)
virtual

Send a NOTICE message from the local server to the user. The message will be sent even if the user is connected to a remote server.

Parameters
textText to send

Reimplemented from User.

Member Data Documentation

◆ bytes_in

unsigned int LocalUser::bytes_in

Stats counter for bytes inbound

◆ bytes_out

unsigned int LocalUser::bytes_out

Stats counter for bytes outbound

◆ cmds_in

unsigned int LocalUser::cmds_in

Stats counter for commands inbound

◆ cmds_out

unsigned int LocalUser::cmds_out

Stats counter for commands outbound

◆ CommandFloodPenalty

unsigned int LocalUser::CommandFloodPenalty

This value contains how far into the penalty threshold the user is. This is used either to enable fake lag or for excess flood quits

◆ exempt

unsigned int LocalUser::exempt

This is true if the user matched an exception (E:Line). It is used to save time on ban checks.

◆ idle_lastmsg

time_t LocalUser::idle_lastmsg

Time that the connection last sent a message, used to calculate idle time

◆ lastping

unsigned int LocalUser::lastping

has the user responded to their previous ping?

◆ MyClass

reference<ConnectClass> LocalUser::MyClass

Contains a pointer to the connect class a user is on from

◆ nping

time_t LocalUser::nping

Used by PING checking code

◆ password

std::string LocalUser::password

Password specified by the user when they registered (if any). This is stored even if the <connect> block doesnt need a password, so that modules may check it.

◆ quitting_sendq

unsigned int LocalUser::quitting_sendq

Recursion fix: user is out of SendQ and will be quit as soon as possible. This can't be handled normally because QuitUser itself calls Write on other users, which could trigger their SendQ to overrun.

◆ server_sa

irc::sockets::sockaddrs LocalUser::server_sa

Server address and port that this user is connected to.


The documentation for this class was generated from the following files: