1 .TH "userrec" 3 "26 Apr 2005" "InspIRCd" \" -*- nroff -*-
5 userrec \- Holds all information about a user This class stores all information about a user connected to the irc server.
11 \fC#include <users.h>\fP
13 Inherits \fBconnection\fP.
15 .SS "Public Member Functions"
19 .RI "\fBuserrec\fP ()"
22 .RI "virtual \fB~userrec\fP ()"
25 .RI "virtual char * \fBGetFullHost\fP ()"
27 .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"
29 .RI "virtual char * \fBGetFullRealHost\fP ()"
31 .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"
33 .RI "virtual bool \fBIsInvited\fP (char *channel)"
35 .RI "\fIReturns true if a user is invited to a channel. \fP"
37 .RI "virtual void \fBInviteTo\fP (char *channel)"
39 .RI "\fIAdds a channel to a users invite list (invites them to a channel). \fP"
41 .RI "virtual void \fBRemoveInvite\fP (char *channel)"
43 .RI "\fIRemoves a channel from a users invite list. \fP"
45 .RI "bool \fBHasPermission\fP (char *command)"
47 .RI "\fIReturns true or false for if a user can execute a privilaged oper command. \fP"
49 .SS "Public Attributes"
53 .RI "char \fBnick\fP [NICKMAX]"
55 .RI "\fIThe users nickname. \fP"
57 .RI "char \fBident\fP [64]"
59 .RI "\fIThe users ident reply. \fP"
61 .RI "char \fBdhost\fP [256]"
63 .RI "\fIThe host displayed to non-opers (used for cloaking etc). \fP"
65 .RI "char \fBfullname\fP [128]"
67 .RI "\fIThe users full name. \fP"
69 .RI "char \fBmodes\fP [MAXBUF]"
71 .RI "\fIThe user's mode string. \fP"
73 .RI "\fBucrec\fP \fBchans\fP [MAXCHANS]"
76 .RI "char \fBserver\fP [256]"
78 .RI "\fIThe server the user is connected to. \fP"
80 .RI "char \fBawaymsg\fP [512]"
82 .RI "\fIThe user's away message. \fP"
84 .RI "char \fBresult\fP [256]"
86 .RI "\fIStores the result of the last GetFullHost or GetRealHost call. \fP"
90 .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"
92 .RI "unsigned long \fBtimeout\fP"
94 .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"
96 .RI "char \fBoper\fP [NICKMAX]"
98 .RI "\fIThe oper type they logged in as, if they are an oper. \fP"
100 .RI "bool \fBdns_done\fP"
102 .RI "\fITrue when \fBDNS\fP lookups are completed. \fP"
104 .RI "unsigned long \fBpingmax\fP"
106 .RI "\fINumber of seconds between PINGs for this user (set from <connect:allow> tag. \fP"
108 .RI "char \fBpassword\fP [MAXBUF]"
110 .RI "\fIPassword specified by the user when they registered. \fP"
112 .SS "Private Attributes"
116 .RI "\fBInvitedList\fP \fBinvites\fP"
118 .RI "\fIA list of channels the user has a pending invite to. \fP"
120 .SH "Detailed Description"
122 Holds all information about a user This class stores all information about a user connected to the irc server.
124 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.
126 Definition at line 93 of file users.h.
127 .SH "Constructor & Destructor Documentation"
129 .SS "userrec::userrec ()"
131 Definition at line 28 of file users.cpp.
133 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.
137 30 // the PROPER way to do it, AVOID bzero at *ALL* costs
139 32 strcpy(ip,'127.0.0.1');
144 37 strcpy(fullname,'');
147 40 strcpy(server,'');
148 41 strcpy(awaymsg,'');
150 43 fd = lastping = signon = idle_lastmsg = nping = registered = 0;
151 44 flood = port = bytes_in = bytes_out = cmds_in = cmds_out = 0;
152 45 haspassed = false;
154 47 strcpy(result,'');
155 48 for (int i = 0; i < MAXCHANS; i++)
157 50 this->chans[i].channel = NULL;
158 51 this->chans[i].uc_modes = 0;
163 .SS "virtual userrec::~\fBuserrec\fP ()\fC [inline, virtual]\fP"
165 Definition at line 178 of file users.h.
170 .SH "Member Function Documentation"
172 .SS "char * userrec::GetFullHost ()\fC [virtual]\fP"
174 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.
176 References dhost, ident, nick, and result.
180 60 snprintf(result,MAXBUF,'%s!%s@%s',nick,ident,dhost);
184 .SS "char * userrec::GetFullRealHost ()\fC [virtual]\fP"
186 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.
188 References connection::host, ident, nick, and result.
192 67 snprintf(result,MAXBUF,'%s!%s@%s',nick,ident,host);
196 .SS "bool userrec::HasPermission (char * command)"
198 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.
200 References config_f, and DEBUG.
204 116 char TypeName[MAXBUF],Classes[MAXBUF],ClassName[MAXBUF],CommandList[MAXBUF];
209 121 // are they even an oper at all?
210 122 if (strchr(this->modes,'o'))
212 124 log(DEBUG,'*** HasPermission: %s is an oper',this->nick);
213 125 for (int j =0; j < ConfValueEnum('type',&config_f); j++)
215 127 ConfValue('type','name',j,TypeName,&config_f);
216 128 if (!strcmp(TypeName,this->oper))
218 130 log(DEBUG,'*** HasPermission: %s is an oper of type '%s'',this->nick,this->oper);
219 131 ConfValue('type','classes',j,Classes,&config_f);
220 132 char* myclass = strtok_r(Classes,' ',&savept);
223 135 log(DEBUG,'*** HasPermission: checking classtype '%s'',myclass);
224 136 for (int k =0; k < ConfValueEnum('class',&config_f); k++)
226 138 ConfValue('class','name',k,ClassName,&config_f);
227 139 if (!strcmp(ClassName,myclass))
229 141 ConfValue('class','commands',k,CommandList,&config_f);
230 142 log(DEBUG,'*** HasPermission: found class named %s with commands: '%s'',ClassName,CommandList);
233 145 mycmd = strtok_r(CommandList,' ',&savept2);
236 148 if (!strcasecmp(mycmd,command))
238 150 log(DEBUG,'*** Command %s found, returning true',command);
241 153 mycmd = strtok_r(NULL,' ',&savept2);
245 157 myclass = strtok_r(NULL,' ',&savept);
253 .SS "void userrec::InviteTo (char * channel)\fC [virtual]\fP"
255 Adds a channel to a users invite list (invites them to a channel). Definition at line 85 of file users.cpp.
257 References Invited::channel, and invites.
262 88 strlcpy(i.channel,channel,CHANMAX);
263 89 invites.push_back(i);
266 .SS "bool userrec::IsInvited (char * channel)\fC [virtual]\fP"
268 Returns true if a user is invited to a channel. Definition at line 71 of file users.cpp.
274 73 for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
277 76 if (!strcasecmp(i->channel,channel))
286 .SS "void userrec::RemoveInvite (char * channel)\fC [virtual]\fP"
288 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.
290 References DEBUG, and invites.
294 94 log(DEBUG,'Removing invites');
297 97 if (invites.size())
299 99 for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
303 103 if (!strcasecmp(i->channel,channel))
305 105 invites.erase(i);
314 .SH "Member Data Documentation"
316 .SS "char \fBuserrec::awaymsg\fP[512]"
318 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.
320 Referenced by userrec().
321 .SS "\fBucrec\fP \fBuserrec::chans\fP[MAXCHANS]"
323 Definition at line 127 of file users.h.
325 Referenced by Server::PseudoToUser(), and userrec().
326 .SS "char \fBuserrec::dhost\fP[256]"
328 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.
330 Referenced by GetFullHost(), and userrec().
331 .SS "bool \fBuserrec::dns_done\fP"
333 True when \fBDNS\fP lookups are completed. Definition at line 164 of file users.h.
335 Referenced by userrec().
336 .SS "int \fBuserrec::flood\fP"
338 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.
340 Referenced by userrec().
341 .SS "char \fBuserrec::fullname\fP[128]"
343 The users full name. Definition at line 119 of file users.h.
345 Referenced by userrec().
346 .SS "char \fBuserrec::ident\fP[64]"
348 The users ident reply. Definition at line 110 of file users.h.
350 Referenced by GetFullHost(), GetFullRealHost(), Server::PseudoToUser(), userrec(), and Server::UserToPseudo().
351 .SS "\fBInvitedList\fP \fBuserrec::invites\fP\fC [private]\fP"
353 A list of channels the user has a pending invite to. Definition at line 99 of file users.h.
355 Referenced by InviteTo(), IsInvited(), RemoveInvite(), and userrec().
356 .SS "char \fBuserrec::modes\fP[MAXBUF]"
358 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.
360 Referenced by userrec().
361 .SS "char \fBuserrec::nick\fP[NICKMAX]"
363 The users nickname. An invalid nickname indicates an unregistered connection prior to the NICK command.Definition at line 106 of file users.h.
365 Referenced by ConfigReader::DumpErrors(), GetFullHost(), GetFullRealHost(), Server::PseudoToUser(), Server::QuitUser(), and userrec().
366 .SS "char \fBuserrec::oper\fP[NICKMAX]"
368 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.
370 Referenced by userrec().
371 .SS "char \fBuserrec::password\fP[MAXBUF]"
373 Password specified by the user when they registered. This is stored even if the block doesnt need a password, so that modules may check it.Definition at line 174 of file users.h.
374 .SS "unsigned long \fBuserrec::pingmax\fP"
376 Number of seconds between PINGs for this user (set from <connect:allow> tag. Definition at line 168 of file users.h.
377 .SS "char \fBuserrec::result\fP[256]"
379 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.
381 Referenced by GetFullHost(), GetFullRealHost(), and userrec().
382 .SS "char \fBuserrec::server\fP[256]"
384 The server the user is connected to. Definition at line 131 of file users.h.
386 Referenced by userrec().
387 .SS "unsigned long \fBuserrec::timeout\fP"
389 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.
391 Referenced by userrec().
395 Generated automatically by Doxygen for InspIRCd from the source code.