InspIRCd  4.0
Public Member Functions | Public Attributes | List of all members
LocalUser Class Reference
Inheritance diagram for LocalUser:
User insp::intrusive_list_node< LocalUser > Extensible Cullable Serializable insp::uncopiable

Public Member Functions

 LocalUser (int fd, irc::sockets::sockaddrs *client, irc::sockets::sockaddrs *server)
 LocalUser (int fd, const std::string &uuid, Serializable::Data &data)
Cullable::Result Cull () override
std::shared_ptr< ConnectClassGetClass () const
void CheckClass (bool clone_count=true)
bool CheckLines (bool doZline=false)
void FullConnect ()
void SetClass (const std::string &explicit_name="")
bool SetClientIP (const std::string &address) override
void SetClientIP (const irc::sockets::sockaddrs &sa) override
void WriteRemoteNotice (const std::string &text) override
bool HasCommandPermission (const std::string &command) override
bool HasPrivPermission (const std::string &privstr) override
bool HasModePermission (const ModeHandler *mh) const override
bool HasSnomaskPermission (char chr) const override
void OverruleNick ()
void Send (ClientProtocol::Event &protoev)
void Send (ClientProtocol::EventProvider &protoevprov, ClientProtocol::Message &msg)
bool Deserialize (Data &data) override
bool Serialize (Serializable::Data &data) override
- Public Member Functions inherited from User
const std::string & GetIPString ()
const std::string & GetHost (bool uncloak) const
const std::string & GetDisplayedHost () const
const std::string & GetRealHost () const
const std::string & GetRealName () const
irc::sockets::cidr_mask GetCIDRMask ()
 User (const std::string &uid, Server *srv, Type 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 (std::shared_ptr< OperInfo > info)
void UnOper ()
void WriteNotice (const std::string &text)
virtual void WriteRemoteNumeric (const Numeric::Numeric &numeric)
template<typename... Param>
void WriteRemoteNumeric (unsigned int numeric, Param... p)
void WriteNumeric (const Numeric::Numeric &numeric)
template<typename... Param>
void WriteNumeric (unsigned int numeric, Param... p)
void WriteCommonRaw (ClientProtocol::Event &protoev, bool include_self=true)
void ForEachNeighbor (ForEachNeighborHandler &handler, bool include_self=true)
bool SharesChannelWith (User *other)
bool ChangeDisplayedHost (const std::string &host)
void ChangeRealHost (const std::string &host, bool resetdisplay)
bool ChangeIdent (const std::string &newident)
bool ChangeRealName (const std::string &real)
bool ChangeNick (const std::string &newnick, time_t newts=0)
void PurgeEmptyChannels ()
- Public Member Functions inherited from Extensible
const ExtensibleStoreGetExtList () const
void UnhookExtensions (const std::vector< ExtensionItem * > &toRemove)
void FreeAllExtItems ()
- Public Member Functions inherited from Cullable
virtual ~Cullable ()

Public Attributes

UserIOHandler eh
ClientProtocol::Serializerserializer = nullptr
unsigned int bytes_in = 0
unsigned int bytes_out = 0
unsigned int cmds_in = 0
unsigned int cmds_out = 0
std::string password
irc::sockets::sockaddrs server_sa
unsigned int quitting_sendq:1
unsigned int lastping:1
unsigned int exempt:1
time_t nextping = 0
time_t idle_lastmsg = 0
unsigned int CommandFloodPenalty = 0
uint64_t already_sent = 0
- Public Attributes inherited from User
time_t age
time_t signon = 0
irc::sockets::sockaddrs client_sa
std::string nick
const std::string uuid
std::string ident
std::bitset< 64 > snomasks
ChanList chans
std::string awaymsg
time_t awaytime
std::shared_ptr< OperInfooper
unsigned int registered:3
unsigned int quitting:1
const uint8_t usertype:2

Additional Inherited Members

- Public Types inherited from User
enum  Type : uint8_t { TYPE_LOCAL = 0 , TYPE_REMOTE = 1 , TYPE_SERVER = 2 }
typedef insp::intrusive_list< MembershipChanList
- Public Types inherited from Extensible
typedef insp::flat_map< ExtensionItem *, void * > ExtensibleStore
- Protected Member Functions inherited from Cullable
 Cullable ()

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.

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

◆ Cull()

Cullable::Result LocalUser::Cull ( )

Called just before the instance is deleted to allow culling members.

Reimplemented from User.

◆ Deserialize()

bool LocalUser::Deserialize ( Serializable::Data data)

Deserializes the specified Data instance into this object.

dataThe Data object to deserialize from.
True if the deserialisation succeeded; otherwise, false.

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()

std::shared_ptr<ConnectClass> LocalUser::GetClass ( ) const

Get the connect class which this user belongs to.

A pointer to this user's connect class.

◆ HasCommandPermission()

bool LocalUser::HasCommandPermission ( const std::string &  command)

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.

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

Reimplemented from User.

◆ HasModePermission()

bool LocalUser::HasModePermission ( const ModeHandler mh) const

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.

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

Reimplemented from User.

◆ HasPrivPermission()

bool LocalUser::HasPrivPermission ( const std::string &  privstr)

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.

privstrThe priv to chec, e.g. "users/override/topic". These are loaded free-form from the config file.
True if this user has the permission in question.

Reimplemented from User.

◆ HasSnomaskPermission()

bool LocalUser::HasSnomaskPermission ( char  chr) const

Determines whether this user can set the specified snomask.

chrThe server notice mask character to look up.
True if the user can set the specified snomask; otherwise, false.

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.

◆ Send() [1/2]

void LocalUser::Send ( ClientProtocol::Event protoev)

Send a protocol event to the user, consisting of one or more messages.

protoevEvent to send, may contain any number of messages.

◆ Send() [2/2]

void LocalUser::Send ( ClientProtocol::EventProvider protoevprov,
ClientProtocol::Message msg 

Send a single message to the user.

protoevprovProtocol event provider.
msgMessage to send.

◆ Serialize()

bool LocalUser::Serialize ( Serializable::Data data)

Deserializes the specified Data instance into this object.

dataThe Data object to deserialize from.
True if the deserialisation succeeded; otherwise, false.

Reimplemented from User.

◆ SetClass()

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

Set the connect class to which this user belongs to.

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.

◆ SetClientIP()

bool LocalUser::SetClientIP ( const std::string &  address)

Sets the client IP for this user

true if the conversion was successful

Reimplemented from User.

◆ WriteRemoteNotice()

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

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.

textText to send

Reimplemented from User.

Member Data Documentation

◆ bytes_in

unsigned int LocalUser::bytes_in = 0

Stats counter for bytes inbound

◆ bytes_out

unsigned int LocalUser::bytes_out = 0

Stats counter for bytes outbound

◆ cmds_in

unsigned int LocalUser::cmds_in = 0

Stats counter for commands inbound

◆ cmds_out

unsigned int LocalUser::cmds_out = 0

Stats counter for commands outbound

◆ CommandFloodPenalty

unsigned int LocalUser::CommandFloodPenalty = 0

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 = 0

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?

◆ nextping

time_t LocalUser::nextping = 0

The time at which this user should be pinged next.

◆ 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.

◆ serializer

ClientProtocol::Serializer* LocalUser::serializer = nullptr

Serializer to use when communicating with the user

◆ 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: