1 .TH "userrec" 3 "20 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 .SS "Private Attributes"
112 .RI "\fBInvitedList\fP \fBinvites\fP"
114 .RI "\fIA list of channels the user has a pending invite to. \fP"
116 .SH "Detailed Description"
118 Holds all information about a user This class stores all information about a user connected to the irc server.
120 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.
122 Definition at line 93 of file users.h.
123 .SH "Constructor & Destructor Documentation"
125 .SS "userrec::userrec ()"
127 Definition at line 28 of file users.cpp.
129 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.
133 30 // the PROPER way to do it, AVOID bzero at *ALL* costs
135 32 strcpy(ip,'127.0.0.1');
140 37 strcpy(fullname,'');
143 40 strcpy(server,'');
144 41 strcpy(awaymsg,'');
146 43 fd = lastping = signon = idle_lastmsg = nping = registered = 0;
147 44 flood = port = bytes_in = bytes_out = cmds_in = cmds_out = 0;
148 45 haspassed = false;
150 47 strcpy(result,'');
151 48 for (int i = 0; i < MAXCHANS; i++)
153 50 this->chans[i].channel = NULL;
154 51 this->chans[i].uc_modes = 0;
159 .SS "virtual userrec::~\fBuserrec\fP ()\fC [inline, virtual]\fP"
161 Definition at line 172 of file users.h.
166 .SH "Member Function Documentation"
168 .SS "char * userrec::GetFullHost ()\fC [virtual]\fP"
170 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.
172 References dhost, ident, nick, and result.
176 60 snprintf(result,MAXBUF,'%s!%s@%s',nick,ident,dhost);
180 .SS "char * userrec::GetFullRealHost ()\fC [virtual]\fP"
182 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.
184 References connection::host, ident, nick, and result.
188 67 snprintf(result,MAXBUF,'%s!%s@%s',nick,ident,host);
192 .SS "bool userrec::HasPermission (char * command)"
194 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.
196 References config_f, and DEBUG.
200 116 char TypeName[MAXBUF],Classes[MAXBUF],ClassName[MAXBUF],CommandList[MAXBUF];
206 122 // are they even an oper at all?
207 123 if (strchr(this->modes,'o'))
209 125 log(DEBUG,'*** HasPermission: %s is an oper',this->nick);
210 126 for (int j =0; j < ConfValueEnum('type',&config_f); j++)
212 128 ConfValue('type','name',j,TypeName,&config_f);
213 129 if (!strcmp(TypeName,this->oper))
215 131 log(DEBUG,'*** HasPermission: %s is an oper of type '%s'',this->nick,this->oper);
216 132 ConfValue('type','classes',j,Classes,&config_f);
217 133 char* myclass = strtok_r(Classes,' ',&savept);
220 136 log(DEBUG,'*** HasPermission: checking classtype '%s'',myclass);
221 137 for (int k =0; k < ConfValueEnum('class',&config_f); k++)
223 139 ConfValue('class','name',k,ClassName,&config_f);
224 140 if (!strcmp(ClassName,myclass))
226 142 ConfValue('class','commands',k,CommandList,&config_f);
227 143 log(DEBUG,'*** HasPermission: found class named %s with commands: '%s'',ClassName,CommandList);
230 146 mycmd = strtok_r(CommandList,' ',&savept2);
233 149 if (!strcasecmp(mycmd,command))
235 151 log(DEBUG,'*** Command %s found, returning true',command);
238 154 mycmd = strtok_r(NULL,' ',&savept2);
242 158 myclass = strtok_r(NULL,' ',&savept);
250 .SS "void userrec::InviteTo (char * channel)\fC [virtual]\fP"
252 Adds a channel to a users invite list (invites them to a channel). Definition at line 85 of file users.cpp.
254 References Invited::channel, and invites.
259 88 strlcpy(i.channel,channel,CHANMAX);
260 89 invites.push_back(i);
263 .SS "bool userrec::IsInvited (char * channel)\fC [virtual]\fP"
265 Returns true if a user is invited to a channel. Definition at line 71 of file users.cpp.
271 73 for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
274 76 if (!strcasecmp(i->channel,channel))
283 .SS "void userrec::RemoveInvite (char * channel)\fC [virtual]\fP"
285 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.
287 References DEBUG, and invites.
291 94 log(DEBUG,'Removing invites');
294 97 if (invites.size())
296 99 for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
300 103 if (!strcasecmp(i->channel,channel))
302 105 invites.erase(i);
311 .SH "Member Data Documentation"
313 .SS "char \fBuserrec::awaymsg\fP[512]"
315 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.
317 Referenced by userrec().
318 .SS "\fBucrec\fP \fBuserrec::chans\fP[MAXCHANS]"
320 Definition at line 127 of file users.h.
322 Referenced by Server::PseudoToUser(), and userrec().
323 .SS "char \fBuserrec::dhost\fP[256]"
325 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.
327 Referenced by GetFullHost(), and userrec().
328 .SS "bool \fBuserrec::dns_done\fP"
330 True when \fBDNS\fP lookups are completed. Definition at line 164 of file users.h.
332 Referenced by userrec().
333 .SS "int \fBuserrec::flood\fP"
335 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.
337 Referenced by userrec().
338 .SS "char \fBuserrec::fullname\fP[128]"
340 The users full name. Definition at line 119 of file users.h.
342 Referenced by userrec().
343 .SS "char \fBuserrec::ident\fP[64]"
345 The users ident reply. Definition at line 110 of file users.h.
347 Referenced by GetFullHost(), GetFullRealHost(), Server::PseudoToUser(), userrec(), and Server::UserToPseudo().
348 .SS "\fBInvitedList\fP \fBuserrec::invites\fP\fC [private]\fP"
350 A list of channels the user has a pending invite to. Definition at line 99 of file users.h.
352 Referenced by InviteTo(), IsInvited(), RemoveInvite(), and userrec().
353 .SS "char \fBuserrec::modes\fP[MAXBUF]"
355 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.
357 Referenced by userrec().
358 .SS "char \fBuserrec::nick\fP[NICKMAX]"
360 The users nickname. An invalid nickname indicates an unregistered connection prior to the NICK command.Definition at line 106 of file users.h.
362 Referenced by ConfigReader::DumpErrors(), GetFullHost(), GetFullRealHost(), Server::PseudoToUser(), Server::QuitUser(), and userrec().
363 .SS "char \fBuserrec::oper\fP[NICKMAX]"
365 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.
367 Referenced by userrec().
368 .SS "unsigned long \fBuserrec::pingmax\fP"
370 Number of seconds between PINGs for this user (set from <connect:allow> tag. Definition at line 168 of file users.h.
371 .SS "char \fBuserrec::result\fP[256]"
373 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.
375 Referenced by GetFullHost(), GetFullRealHost(), and userrec().
376 .SS "char \fBuserrec::server\fP[256]"
378 The server the user is connected to. Definition at line 131 of file users.h.
380 Referenced by userrec().
381 .SS "unsigned long \fBuserrec::timeout\fP"
383 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.
385 Referenced by userrec().
389 Generated automatically by Doxygen for InspIRCd from the source code.