InspIRCd  2.0
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
LocalUser Class Reference
Inheritance diagram for LocalUser:
User InviteBase Extensible classbase

Public Member Functions

 LocalUser (int fd, irc::sockets::sockaddrs *client, irc::sockets::sockaddrs *server)
CullResult cull ()
ConnectClassGetClass ()
void CheckClass ()
int GetServerPort ()
void StartDNSLookup ()
void FullConnect ()
void SetClass (const std::string &explicit_name="")
bool SetClientIP (const char *sip, bool recheck_eline=true)
void SetClientIP (const irc::sockets::sockaddrs &sa, bool recheck_eline=true)
void SendText (const std::string &line)
void Write (const std::string &text)
void Write (const char *,...) CUSTOM_PRINTF(2
void InviteList & GetInviteList ()
bool IsInvited (const irc::string &channel)
void InviteTo (const irc::string &channel, time_t timeout)
void RemoveInvite (const irc::string &channel)
void RemoveExpiredInvites ()
bool HasPermission (const std::string &command)
bool HasPrivPermission (const std::string &privstr, bool noisy=false)
bool HasModePermission (unsigned char mode, ModeType type)
- Public Member Functions inherited from User
const char * GetIPString ()
irc::sockets::cidr_mask GetCIDRMask ()
 User (const std::string &uid, const std::string &srv, int objtype)
bool CheckLines (bool doZline=false)
virtual const std::string & GetFullHost ()
virtual const std::string & GetFullRealHost ()
void InvalidateCache ()
const char * FormatNoticeMasks ()
std::string ProcessNoticeMasks (const char *sm)
bool IsNoticeMaskSet (unsigned char sm)
void SetNoticeMask (unsigned char sm, bool value)
const char * FormatModes (bool showparameters=false)
bool IsModeSet (unsigned char m)
void SetMode (unsigned char m, bool value)
char * MakeWildHost ()
const std::string & MakeHost ()
const std::string & MakeHostIP ()
void AddToWhoWas ()
void Oper (OperInfo *info)
bool ForceNickChange (const char *newnick)
void UnOper ()
virtual void void WriteServ (const std::string &text)
void WriteServ (const char *text,...) CUSTOM_PRINTF(2
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)
void WriteFrom (User *user, const char *text,...) CUSTOM_PRINTF(3
void void WriteTo (User *dest, const std::string &data)
void WriteTo (User *dest, const char *data,...) CUSTOM_PRINTF(3
void void WriteCommonRaw (const std::string &line, bool include_self=true)
void WriteCommon (const char *text,...) CUSTOM_PRINTF(2
void void WriteCommonExcept (const char *text,...) CUSTOM_PRINTF(2
void void void WriteCommonQuit (const std::string &normal_text, const std::string &oper_text)
void SendText (const std::string &LinePrefix, std::stringstream &TextStream)
void SendText (const char *text,...) CUSTOM_PRINTF(2
void bool SharesChannelWith (User *other)
void DoHostCycle (const std::string &quitline)
bool ChangeDisplayedHost (const char *host)
bool ChangeIdent (const char *newident)
bool ChangeName (const char *gecos)
bool ChangeNick (const std::string &newnick, bool force=false)
void SendAll (const char *command, const char *text,...) CUSTOM_PRINTF(3
void std::string ChannelList (User *source, bool spy)
void SplitChanList (User *dest, const std::string &cl)
void PurgeEmptyChannels ()
virtual ~User ()
- Public Member Functions inherited from Extensible
const ExtensibleStore & GetExtList () const
void doUnhookExtensions (const std::vector< reference< ExtensionItem > > &toRemove)
- Public Member Functions inherited from InviteBase
void ClearInvites ()

Public Attributes

UserIOHandler eh
LocalUserList::iterator localuseriter
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
time_t nping
unsigned int CommandFloodPenalty
already_sent_t already_sent
std::string stored_host
- Public Attributes inherited from User
std::string host
time_t age
time_t signon
time_t idle_lastmsg
irc::sockets::sockaddrs client_sa
std::string nick
const std::string uuid
std::string ident
std::string dhost
std::string fullname
std::bitset< 64 > modes
std::bitset< 64 > snomasks
UserChanList chans
const std::string server
std::string awaymsg
time_t awaytime
reference< OperInfooper
unsigned int registered:3
unsigned int dns_done:1
unsigned int quietquit:1
unsigned int quitting:1
unsigned int quitting_sendq:1
unsigned int exempt:1
unsigned int lastping:1
const unsigned int usertype:2

Static Public Attributes

static already_sent_t already_sent_id = 0

Additional Inherited Members

- Public Types inherited from Extensible
typedef std::map< reference< ExtensionItem >, void * > ExtensibleStore
- Protected Attributes inherited from InviteBase
InviteList invites

Member Function Documentation

◆ CheckClass()

void LocalUser::CheckClass ( )

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

◆ cull()

CullResult LocalUser::cull ( )

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

Get the connect class which this user belongs to. NULL for remote users.

A pointer to this user's connect class.

Reimplemented from User.

◆ GetInviteList()

InviteList & LocalUser::GetInviteList ( )

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

A list of channels the user is invited to

◆ GetServerPort()

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

◆ HasModePermission()

bool LocalUser::HasModePermission ( unsigned char  mode,
ModeType  type 

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.

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

Reimplemented from User.

◆ HasPermission()

bool LocalUser::HasPermission ( 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.

◆ HasPrivPermission()

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

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.
noisyIf set to true, the user is notified that they do not have the specified permission where applicable. If false, no notification is sent.
True if this user has the permission in question.

Reimplemented from User.

◆ InviteTo()

void LocalUser::InviteTo ( const irc::string channel,
time_t  timeout 

Adds a channel to a users invite list (invites them to a channel)

channelA channel name to add
timeoutWhen the invite should expire (0 == never)

◆ IsInvited()

bool LocalUser::IsInvited ( const irc::string channel)

Returns true if a user is invited to a channel.

channelA channel name to look up
True if the user is invited to the given channel

◆ RemoveInvite()

void LocalUser::RemoveInvite ( const irc::string channel)

Removes a channel from a users invite list. This member function is called on successfully joining an invite only channel to which the user has previously been invited, to clear the invitation.

channelThe channel to remove the invite to

◆ SendText()

void LocalUser::SendText ( const std::string &  line)

Write to the user, routing the line if the user is remote.

Implements 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.
A reference to this user's current connect class.

◆ SetClientIP()

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

Sets the client IP for this user

true if the conversion was successful

Reimplemented from User.

◆ StartDNSLookup()

void LocalUser::StartDNSLookup ( )

Starts a DNS lookup of the user's IP. This will cause two UserResolver classes to be instantiated. When complete, these objects set User::dns_done to true.

◆ Write() [1/2]

void LocalUser::Write ( const char *  text,


Reimplemented from User.

◆ Write() [2/2]

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

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

textA std::string to send to the user

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

◆ localuseriter

LocalUserList::iterator LocalUser::localuseriter

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

◆ server_sa

irc::sockets::sockaddrs LocalUser::server_sa

Server address and port that this user is connected to.

◆ stored_host

std::string LocalUser::stored_host

Stored reverse lookup from res_forward. Should not be used after resolution.

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