Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

userrec 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>

List of all members.

Public Methods

 userrec ()
virtual ~userrec ()
virtual char * GetFullHost ()
 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 char * GetFullRealHost ()
 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.

virtual bool IsInvited (char *channel)
 Returns true if a user is invited to a channel.

virtual void InviteTo (char *channel)
 Adds a channel to a users invite list (invites them to a channel).

virtual void RemoveInvite (char *channel)
 Removes a channel from a users invite list.


Public Attributes

char nick [NICKMAX]
 The users nickname.

unsigned long ip
 The users ip address in network order.

char ident [64]
 The users ident reply.

char host [256]
 The users hostname, or ip address in string form.

char dhost [256]
 The host displayed to non-opers (used for cloaking etc).

char fullname [128]
 The users full name.

int fd
 The users file descriptor.

char modes [32]
 The user's mode string.

char inbuf [MAXBUF]
 The users input buffer.

time_t lastping
 The last time the user was pinged by the core.

time_t signon
 The users signon time.

time_t idle_lastmsg
 The time the user last sent a message.

time_t nping
 True if the user replied to their last ping.

int registered
 Bit 1 is set if the user sent a NICK command, bit 2 is set if the user sent a USER command.

ucrec chans [MAXCHANS]
 A list of the channels the user is currently on.

char server [256]
 The server the user is connected to.

char awaymsg [512]
 The user's away message.

int port
 The port that the user connected to.

long bytes_in
 Stores the number of incoming bytes from the connection.

long bytes_out
 Stores the number of outgoing bytes to the connection.

long cmds_in
 Stores the number of incoming commands from the connection.

long cmds_out
 Stores the number of outgoing commands to the connection.

char result [256]
 Stores the result of the last GetFullHost or GetRealHost call.

bool haspassed
 True if a correct password has been given using PASS command.


Private Attributes

InvitedList invites
 A list of channels the user has a pending invite to.


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 Find method of the server class to locate a specific user by nickname.

Definition at line 80 of file users.h.


Constructor & Destructor Documentation

userrec::userrec  
 

Definition at line 23 of file users.cpp.

References bytes_in, bytes_out, ucrec::channel, chans, cmds_in, cmds_out, fd, haspassed, idle_lastmsg, invites, ip, lastping, nping, port, registered, and signon.

00024 {
00025         // the PROPER way to do it, AVOID bzero at *ALL* costs
00026         strcpy(nick,"");
00027         ip = 0;
00028         strcpy(ident,"");
00029         strcpy(host,"");
00030         strcpy(dhost,"");
00031         strcpy(fullname,"");
00032         strcpy(modes,"");
00033         strcpy(inbuf,"");
00034         strcpy(server,"");
00035         strcpy(awaymsg,"");
00036         fd = lastping = signon = idle_lastmsg = nping = registered = 0;
00037         port = bytes_in = bytes_out = cmds_in = cmds_out = 0;
00038         haspassed = false;
00039         strcpy(result,"");
00040         for (int i = 0; i < MAXCHANS; i++)
00041         {
00042                 chans[i].channel = NULL;
00043         }
00044         invites.clear();
00045 }

virtual userrec::~userrec   [inline, virtual]
 

Definition at line 213 of file users.h.

00213 {  }


Member Function Documentation

char * userrec::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.

Definition at line 48 of file users.cpp.

References result.

00049 {
00050         sprintf(result,"%s!%s@%s",nick,ident,dhost);
00051         return result;
00052 }

char * userrec::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.

Definition at line 55 of file users.cpp.

References result.

00056 {
00057         sprintf(result,"%s!%s@%s",nick,ident,host);
00058         return result;
00059 }

void userrec::InviteTo char *    channel [virtual]
 

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

Definition at line 72 of file users.cpp.

References Invited::channel, and invites.

00073 {
00074         Invited i;
00075         strcpy(i.channel,channel);
00076         invites.push_back(i);
00077 }

bool userrec::IsInvited char *    channel [virtual]
 

Returns true if a user is invited to a channel.

Definition at line 61 of file users.cpp.

References invites.

00062 {
00063         for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
00064         {
00065                 if (!strcasecmp(i->channel,channel))
00066                 {
00067                         return true;
00068                 }
00069         }
00070 }

void userrec::RemoveInvite char *    channel [virtual]
 

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.

Definition at line 79 of file users.cpp.

References invites.

00080 {
00081         for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
00082         {
00083                 if (!strcasecmp(i->channel,channel))
00084                 {
00085                         invites.erase(i);
00086                         return;
00087                 }
00088         }
00089 }


Member Data Documentation

char userrec::awaymsg[512]
 

The user's away message.

If this string is empty, the user is not marked as away.

Definition at line 174 of file users.h.

long userrec::bytes_in
 

Stores the number of incoming bytes from the connection.

Used by /STATS

Definition at line 183 of file users.h.

Referenced by userrec().

long userrec::bytes_out
 

Stores the number of outgoing bytes to the connection.

Used by /STATS

Definition at line 188 of file users.h.

Referenced by userrec().

ucrec userrec::chans[MAXCHANS]
 

A list of the channels the user is currently on.

If any of these values are NULL, the record is not in use and may be associated with a channel by the JOIN command. see RFC 1459.

Definition at line 165 of file users.h.

Referenced by userrec().

long userrec::cmds_in
 

Stores the number of incoming commands from the connection.

Used by /STATS

Definition at line 193 of file users.h.

Referenced by userrec().

long userrec::cmds_out
 

Stores the number of outgoing commands to the connection.

Used by /STATS

Definition at line 198 of file users.h.

Referenced by userrec().

char userrec::dhost[256]
 

The host displayed to non-opers (used for cloaking etc).

This usually matches the value of userrec::host.

Definition at line 110 of file users.h.

int userrec::fd
 

The users file descriptor.

If this is zero, the socket has been closed and the core has not yet realised and removed the record from memory.

Definition at line 120 of file users.h.

Referenced by userrec().

char userrec::fullname[128]
 

The users full name.

Definition at line 114 of file users.h.

bool userrec::haspassed
 

True if a correct password has been given using PASS command.

If the user is a member of a connection class that does not require a password, the value stored here is of no use.

Definition at line 209 of file users.h.

Referenced by userrec().

char userrec::host[256]
 

The users hostname, or ip address in string form.

Definition at line 105 of file users.h.

char userrec::ident[64]
 

The users ident reply.

Definition at line 101 of file users.h.

time_t userrec::idle_lastmsg
 

The time the user last sent a message.

See also userrec::lastping and userrec::signon

Definition at line 147 of file users.h.

Referenced by userrec().

char userrec::inbuf[MAXBUF]
 

The users input buffer.

Used by the C recv() function.

Definition at line 131 of file users.h.

InvitedList userrec::invites [private]
 

A list of channels the user has a pending invite to.

Definition at line 86 of file users.h.

Referenced by InviteTo(), IsInvited(), RemoveInvite(), and userrec().

unsigned long userrec::ip
 

The users ip address in network order.

Definition at line 97 of file users.h.

Referenced by userrec().

time_t userrec::lastping
 

The last time the user was pinged by the core.

When this value is more than 120 seconds difference from 'time(NULL)', a ping is sent to the client. If the user has an outstanding PING request the next time this event occurs after 4 total minutes, they are disconnected.

Definition at line 138 of file users.h.

Referenced by userrec().

char userrec::modes[32]
 

The user's mode string.

This may contain any of the following RFC characters: o, w, s, i Your module may define other mode characters as it sees fit.

Definition at line 126 of file users.h.

char userrec::nick[NICKMAX]
 

The users nickname.

An invalid nickname indicates an unregistered connection prior to the NICK command.

Definition at line 93 of file users.h.

time_t userrec::nping
 

True if the user replied to their last ping.

If this is true, the user can be sent another ping at the specified time, otherwise they will be discnnected. See also userrec::lastping

Definition at line 153 of file users.h.

Referenced by userrec().

int userrec::port
 

The port that the user connected to.

Definition at line 178 of file users.h.

Referenced by userrec().

int userrec::registered
 

Bit 1 is set if the user sent a NICK command, bit 2 is set if the user sent a USER command.

If both bits are set then the connection is awaiting MOTD. Sending of MOTD sets bit 3, and makes the value of userrec::registered == 7, showing a fully established client session.

Definition at line 159 of file users.h.

Referenced by userrec().

char userrec::result[256]
 

Stores the result of the last GetFullHost or GetRealHost call.

You may use this to increase the speed of use of this class.

Definition at line 203 of file users.h.

Referenced by GetFullHost(), and GetFullRealHost().

char userrec::server[256]
 

The server the user is connected to.

Definition at line 169 of file users.h.

time_t userrec::signon
 

The users signon time.

Definition at line 142 of file users.h.

Referenced by userrec().


The documentation for this class was generated from the following files:
Generated on Wed Jan 22 20:56:48 2003 for InspIRCd by doxygen1.3-rc2