Main Page   Namespace List   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>

Inheritance diagram for userrec:

Inheritance graph
[legend]
Collaboration diagram for userrec:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 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.

char ident [64]
 The users ident reply.

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

char fullname [128]
 The users full name.

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

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

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

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

int flood
 Number of lines the user can place into the buffer (up to the global NetBufferSize bytes) before they are disconnected for excess flood.

unsigned long timeout
 Number of seconds this user is given to send USER/NICK If they do not send their details in this time limit they will be disconnected.


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 78 of file users.h.


Constructor & Destructor Documentation

userrec::userrec  
 

Definition at line 11 of file users.cpp.

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

00012 {
00013         // the PROPER way to do it, AVOID bzero at *ALL* costs
00014         strcpy(nick,"");
00015         strcpy(ip,"127.0.0.1");
00016         timeout = 0;
00017         strcpy(ident,"");
00018         strcpy(host,"");
00019         strcpy(dhost,"");
00020         strcpy(fullname,"");
00021         strcpy(modes,"");
00022         strcpy(inbuf,"");
00023         strcpy(server,"");
00024         strcpy(awaymsg,"");
00025         fd = lastping = signon = idle_lastmsg = nping = registered = 0;
00026         flood = port = bytes_in = bytes_out = cmds_in = cmds_out = 0;
00027         haspassed = false;
00028         strcpy(result,"");
00029         for (int i = 0; i < MAXCHANS; i++)
00030         {
00031                 this->chans[i].channel = NULL;
00032                 this->chans[i].uc_modes = 0;
00033         }
00034         invites.clear();
00035 }

virtual userrec::~userrec   [inline, virtual]
 

Definition at line 142 of file users.h.

00142 {  }


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 39 of file users.cpp.

References result.

00040 {
00041         sprintf(result,"%s!%s@%s",nick,ident,dhost);
00042         return result;
00043 }

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 46 of file users.cpp.

References result.

00047 {
00048         sprintf(result,"%s!%s@%s",nick,ident,host);
00049         return result;
00050 }

void userrec::InviteTo char *    channel [virtual]
 

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

Definition at line 66 of file users.cpp.

References Invited::channel, and invites.

00067 {
00068         Invited i;
00069         strcpy(i.channel,channel);
00070         invites.push_back(i);
00071 }

bool userrec::IsInvited char *    channel [virtual]
 

Returns true if a user is invited to a channel.

Definition at line 52 of file users.cpp.

References invites.

00053 {
00054         for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
00055         {
00056                 if (i->channel) {
00057                         if (!strcasecmp(i->channel,channel))
00058                         {
00059                                 return true;
00060                         }
00061                 }
00062         }
00063         return false;
00064 }

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 73 of file users.cpp.

References invites.

00074 {
00075         log(DEBUG,"Removing invites");
00076         if (channel)
00077         {
00078                 if (invites.size())
00079                 {
00080                         for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
00081                         {
00082                                 if (i->channel)
00083                                 {
00084                                         if (!strcasecmp(i->channel,channel))
00085                                         {
00086                                                 invites.erase(i);
00087                                                 return;
00088                                         }
00089                                 }
00090                         }
00091                 }
00092         }
00093 }


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 121 of file users.h.

ucrec userrec::chans[MAXCHANS]
 

Definition at line 112 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 100 of file users.h.

int userrec::flood
 

Number of lines the user can place into the buffer (up to the global NetBufferSize bytes) before they are disconnected for excess flood.

Definition at line 132 of file users.h.

Referenced by userrec().

char userrec::fullname[128]
 

The users full name.

Definition at line 104 of file users.h.

char userrec::ident[64]
 

The users ident reply.

Definition at line 95 of file users.h.

InvitedList userrec::invites [private]
 

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

Definition at line 84 of file users.h.

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

char userrec::modes[MAXBUF]
 

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 110 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 91 of file users.h.

Referenced by Server::QuitUser().

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 126 of file users.h.

Referenced by GetFullHost(), and GetFullRealHost().

char userrec::server[256]
 

The server the user is connected to.

Definition at line 116 of file users.h.

unsigned long userrec::timeout
 

Number of seconds this user is given to send USER/NICK If they do not send their details in this time limit they will be disconnected.

Definition at line 138 of file users.h.

Referenced by userrec().


The documentation for this class was generated from the following files:
Generated on Thu Apr 29 16:22:13 2004 for InspIRCd by doxygen1.3-rc3