.TH "userrec" 3 "16 Apr 2005" "InspIRCd" \" -*- nroff -*- .ad l .nh .SH NAME userrec \- Holds all information about a user This class stores all information about a user connected to the irc server. .PP .SH SYNOPSIS .br .PP \fC#include \fP .PP Inherits \fBconnection\fP. .PP .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBuserrec\fP ()" .br .ti -1c .RI "virtual \fB~userrec\fP ()" .br .ti -1c .RI "virtual char * \fBGetFullHost\fP ()" .br .RI "\fIReturns 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. \fP" .ti -1c .RI "virtual char * \fBGetFullRealHost\fP ()" .br .RI "\fIReturns 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. \fP" .ti -1c .RI "virtual bool \fBIsInvited\fP (char *channel)" .br .RI "\fIReturns true if a user is invited to a channel. \fP" .ti -1c .RI "virtual void \fBInviteTo\fP (char *channel)" .br .RI "\fIAdds a channel to a users invite list (invites them to a channel). \fP" .ti -1c .RI "virtual void \fBRemoveInvite\fP (char *channel)" .br .RI "\fIRemoves a channel from a users invite list. \fP" .ti -1c .RI "bool \fBHasPermission\fP (char *command)" .br .RI "\fIReturns true or false for if a user can execute a privilaged oper command. \fP" .in -1c .SS "Public Attributes" .in +1c .ti -1c .RI "char \fBnick\fP [NICKMAX]" .br .RI "\fIThe users nickname. \fP" .ti -1c .RI "char \fBident\fP [64]" .br .RI "\fIThe users ident reply. \fP" .ti -1c .RI "char \fBdhost\fP [256]" .br .RI "\fIThe host displayed to non-opers (used for cloaking etc). \fP" .ti -1c .RI "char \fBfullname\fP [128]" .br .RI "\fIThe users full name. \fP" .ti -1c .RI "char \fBmodes\fP [MAXBUF]" .br .RI "\fIThe user's mode string. \fP" .ti -1c .RI "\fBucrec\fP \fBchans\fP [MAXCHANS]" .br .ti -1c .RI "char \fBserver\fP [256]" .br .RI "\fIThe server the user is connected to. \fP" .ti -1c .RI "char \fBawaymsg\fP [512]" .br .RI "\fIThe user's away message. \fP" .ti -1c .RI "char \fBresult\fP [256]" .br .RI "\fIStores the result of the last GetFullHost or GetRealHost call. \fP" .ti -1c .RI "int \fBflood\fP" .br .RI "\fINumber of lines the user can place into the buffer (up to the global NetBufferSize bytes) before they are disconnected for excess flood. \fP" .ti -1c .RI "unsigned long \fBtimeout\fP" .br .RI "\fINumber 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. \fP" .ti -1c .RI "char \fBoper\fP [NICKMAX]" .br .RI "\fIThe oper type they logged in as, if they are an oper. \fP" .ti -1c .RI "bool \fBdns_done\fP" .br .RI "\fITrue when \fBDNS\fP lookups are completed. \fP" .ti -1c .RI "unsigned long \fBpingmax\fP" .br .RI "\fINumber of seconds between PINGs for this user (set from tag. \fP" .in -1c .SS "Private Attributes" .in +1c .ti -1c .RI "\fBInvitedList\fP \fBinvites\fP" .br .RI "\fIA list of channels the user has a pending invite to. \fP" .in -1c .SH "Detailed Description" .PP 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. .PP Definition at line 93 of file users.h. .SH "Constructor & Destructor Documentation" .PP .SS "userrec::userrec ()" .PP Definition at line 28 of file users.cpp. .PP References awaymsg, connection::bytes_in, connection::bytes_out, ucrec::channel, chans, connection::cmds_in, connection::cmds_out, dhost, dns_done, connection::fd, flood, fullname, connection::haspassed, connection::host, ident, connection::idle_lastmsg, connection::inbuf, invites, connection::ip, connection::lastping, modes, nick, connection::nping, oper, connection::port, connection::registered, result, server, connection::signon, timeout, and ucrec::uc_modes. .PP .nf 29 { 30 // the PROPER way to do it, AVOID bzero at *ALL* costs 31 strcpy(nick,''); 32 strcpy(ip,'127.0.0.1'); 33 timeout = 0; 34 strcpy(ident,''); 35 strcpy(host,''); 36 strcpy(dhost,''); 37 strcpy(fullname,''); 38 strcpy(modes,''); 39 strcpy(inbuf,''); 40 strcpy(server,''); 41 strcpy(awaymsg,''); 42 strcpy(oper,''); 43 fd = lastping = signon = idle_lastmsg = nping = registered = 0; 44 flood = port = bytes_in = bytes_out = cmds_in = cmds_out = 0; 45 haspassed = false; 46 dns_done = false; 47 strcpy(result,''); 48 for (int i = 0; i < MAXCHANS; i++) 49 { 50 this->chans[i].channel = NULL; 51 this->chans[i].uc_modes = 0; 52 } 53 invites.clear(); 54 } .fi .SS "virtual userrec::~\fBuserrec\fP ()\fC [inline, virtual]\fP" .PP Definition at line 172 of file users.h. .PP .nf 172 { } .fi .SH "Member Function Documentation" .PP .SS "char * userrec::GetFullHost ()\fC [virtual]\fP" .PP 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 58 of file users.cpp. .PP References dhost, ident, nick, and result. .PP .nf 59 { 60 snprintf(result,MAXBUF,'%s!%s@%s',nick,ident,dhost); 61 return result; 62 } .fi .SS "char * userrec::GetFullRealHost ()\fC [virtual]\fP" .PP 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 65 of file users.cpp. .PP References connection::host, ident, nick, and result. .PP .nf 66 { 67 snprintf(result,MAXBUF,'%s!%s@%s',nick,ident,host); 68 return result; 69 } .fi .SS "bool userrec::HasPermission (char * command)" .PP Returns true or false for if a user can execute a privilaged oper command. This is done by looking up their oper type from \fBuserrec::oper\fP, then referencing this to their oper classes and checking the commands they can execute.Definition at line 114 of file users.cpp. .PP References config_f, and DEBUG. .PP .nf 115 { 116 char TypeName[MAXBUF],Classes[MAXBUF],ClassName[MAXBUF],CommandList[MAXBUF]; 117 char* myclass; 118 char* mycmd; 119 char* savept; 120 char* savept2; 121 122 // are they even an oper at all? 123 if (strchr(this->modes,'o')) 124 { 125 log(DEBUG,'*** HasPermission: %s is an oper',this->nick); 126 for (int j =0; j < ConfValueEnum('type',&config_f); j++) 127 { 128 ConfValue('type','name',j,TypeName,&config_f); 129 if (!strcmp(TypeName,this->oper)) 130 { 131 log(DEBUG,'*** HasPermission: %s is an oper of type '%s'',this->nick,this->oper); 132 ConfValue('type','classes',j,Classes,&config_f); 133 char* myclass = strtok_r(Classes,' ',&savept); 134 while (myclass) 135 { 136 log(DEBUG,'*** HasPermission: checking classtype '%s'',myclass); 137 for (int k =0; k < ConfValueEnum('class',&config_f); k++) 138 { 139 ConfValue('class','name',k,ClassName,&config_f); 140 if (!strcmp(ClassName,myclass)) 141 { 142 ConfValue('class','commands',k,CommandList,&config_f); 143 log(DEBUG,'*** HasPermission: found class named %s with commands: '%s'',ClassName,CommandList); 144 145 146 mycmd = strtok_r(CommandList,' ',&savept2); 147 while (mycmd) 148 { 149 if (!strcasecmp(mycmd,command)) 150 { 151 log(DEBUG,'*** Command %s found, returning true',command); 152 return true; 153 } 154 mycmd = strtok_r(NULL,' ',&savept2); 155 } 156 } 157 } 158 myclass = strtok_r(NULL,' ',&savept); 159 } 160 } 161 } 162 } 163 return false; 164 } .fi .SS "void userrec::InviteTo (char * channel)\fC [virtual]\fP" .PP Adds a channel to a users invite list (invites them to a channel). Definition at line 85 of file users.cpp. .PP References Invited::channel, and invites. .PP .nf 86 { 87 Invited i; 88 strlcpy(i.channel,channel,CHANMAX); 89 invites.push_back(i); 90 } .fi .SS "bool userrec::IsInvited (char * channel)\fC [virtual]\fP" .PP Returns true if a user is invited to a channel. Definition at line 71 of file users.cpp. .PP References invites. .PP .nf 72 { 73 for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++) 74 { 75 if (i->channel) { 76 if (!strcasecmp(i->channel,channel)) 77 { 78 return true; 79 } 80 } 81 } 82 return false; 83 } .fi .SS "void userrec::RemoveInvite (char * channel)\fC [virtual]\fP" .PP 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 92 of file users.cpp. .PP References DEBUG, and invites. .PP .nf 93 { 94 log(DEBUG,'Removing invites'); 95 if (channel) 96 { 97 if (invites.size()) 98 { 99 for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++) 100 { 101 if (i->channel) 102 { 103 if (!strcasecmp(i->channel,channel)) 104 { 105 invites.erase(i); 106 return; 107 } 108 } 109 } 110 } 111 } 112 } .fi .SH "Member Data Documentation" .PP .SS "char \fBuserrec::awaymsg\fP[512]" .PP The user's away message. If this string is empty, the user is not marked as away.Definition at line 136 of file users.h. .PP Referenced by userrec(). .SS "\fBucrec\fP \fBuserrec::chans\fP[MAXCHANS]" .PP Definition at line 127 of file users.h. .PP Referenced by Server::PseudoToUser(), and userrec(). .SS "char \fBuserrec::dhost\fP[256]" .PP The host displayed to non-opers (used for cloaking etc). This usually matches the value of \fBuserrec::host\fP.Definition at line 115 of file users.h. .PP Referenced by GetFullHost(), and userrec(). .SS "bool \fBuserrec::dns_done\fP" .PP True when \fBDNS\fP lookups are completed. Definition at line 164 of file users.h. .PP Referenced by userrec(). .SS "int \fBuserrec::flood\fP" .PP 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 147 of file users.h. .PP Referenced by userrec(). .SS "char \fBuserrec::fullname\fP[128]" .PP The users full name. Definition at line 119 of file users.h. .PP Referenced by userrec(). .SS "char \fBuserrec::ident\fP[64]" .PP The users ident reply. Definition at line 110 of file users.h. .PP Referenced by GetFullHost(), GetFullRealHost(), Server::PseudoToUser(), userrec(), and Server::UserToPseudo(). .SS "\fBInvitedList\fP \fBuserrec::invites\fP\fC [private]\fP" .PP A list of channels the user has a pending invite to. Definition at line 99 of file users.h. .PP Referenced by InviteTo(), IsInvited(), RemoveInvite(), and userrec(). .SS "char \fBuserrec::modes\fP[MAXBUF]" .PP 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 125 of file users.h. .PP Referenced by userrec(). .SS "char \fBuserrec::nick\fP[NICKMAX]" .PP The users nickname. An invalid nickname indicates an unregistered connection prior to the NICK command.Definition at line 106 of file users.h. .PP Referenced by ConfigReader::DumpErrors(), GetFullHost(), GetFullRealHost(), Server::PseudoToUser(), Server::QuitUser(), and userrec(). .SS "char \fBuserrec::oper\fP[NICKMAX]" .PP The oper type they logged in as, if they are an oper. This is used to check permissions in operclasses, so that we can say 'yay' or 'nay' to any commands they issue. The value of this is the value of a valid 'type name=' tag.Definition at line 160 of file users.h. .PP Referenced by userrec(). .SS "unsigned long \fBuserrec::pingmax\fP" .PP Number of seconds between PINGs for this user (set from tag. Definition at line 168 of file users.h. .SS "char \fBuserrec::result\fP[256]" .PP 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 141 of file users.h. .PP Referenced by GetFullHost(), GetFullRealHost(), and userrec(). .SS "char \fBuserrec::server\fP[256]" .PP The server the user is connected to. Definition at line 131 of file users.h. .PP Referenced by userrec(). .SS "unsigned long \fBuserrec::timeout\fP" .PP 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 153 of file users.h. .PP Referenced by userrec(). .SH "Author" .PP Generated automatically by Doxygen for InspIRCd from the source code.