1 .TH "userrec" 3 "4 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 .SS "Private Attributes"
108 .RI "\fBInvitedList\fP \fBinvites\fP"
110 .RI "\fIA list of channels the user has a pending invite to. \fP"
112 .SH "Detailed Description"
114 Holds all information about a user This class stores all information about a user connected to the irc server.
116 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.
118 Definition at line 89 of file users.h.
119 .SH "Constructor & Destructor Documentation"
121 .SS "userrec::userrec ()"
123 Definition at line 26 of file users.cpp.
125 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.
129 28 // the PROPER way to do it, AVOID bzero at *ALL* costs
131 30 strcpy(ip,'127.0.0.1');
136 35 strcpy(fullname,'');
139 38 strcpy(server,'');
140 39 strcpy(awaymsg,'');
142 41 fd = lastping = signon = idle_lastmsg = nping = registered = 0;
143 42 flood = port = bytes_in = bytes_out = cmds_in = cmds_out = 0;
144 43 haspassed = false;
146 45 strcpy(result,'');
147 46 for (int i = 0; i < MAXCHANS; i++)
149 48 this->chans[i].channel = NULL;
150 49 this->chans[i].uc_modes = 0;
155 .SS "virtual userrec::~\fBuserrec\fP ()\fC [inline, virtual]\fP"
157 Definition at line 164 of file users.h.
162 .SH "Member Function Documentation"
164 .SS "char * userrec::GetFullHost ()\fC [virtual]\fP"
166 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 56 of file users.cpp.
168 References dhost, ident, nick, and result.
172 58 snprintf(result,MAXBUF,'%s!%s@%s',nick,ident,dhost);
176 .SS "char * userrec::GetFullRealHost ()\fC [virtual]\fP"
178 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 63 of file users.cpp.
180 References connection::host, ident, nick, and result.
184 65 snprintf(result,MAXBUF,'%s!%s@%s',nick,ident,host);
188 .SS "bool userrec::HasPermission (char * command)"
190 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 112 of file users.cpp.
192 References config_f, and DEBUG.
196 114 char TypeName[MAXBUF],Classes[MAXBUF],ClassName[MAXBUF],CommandList[MAXBUF];
202 120 // are they even an oper at all?
203 121 if (strchr(this->modes,'o'))
205 123 log(DEBUG,'*** HasPermission: %s is an oper',this->nick);
206 124 for (int j =0; j < ConfValueEnum('type',&config_f); j++)
208 126 ConfValue('type','name',j,TypeName,&config_f);
209 127 if (!strcmp(TypeName,this->oper))
211 129 log(DEBUG,'*** HasPermission: %s is an oper of type '%s'',this->nick,this->oper);
212 130 ConfValue('type','classes',j,Classes,&config_f);
213 131 char* myclass = strtok_r(Classes,' ',&savept);
216 134 log(DEBUG,'*** HasPermission: checking classtype '%s'',myclass);
217 135 for (int k =0; k < ConfValueEnum('class',&config_f); k++)
219 137 ConfValue('class','name',k,ClassName,&config_f);
220 138 if (!strcmp(ClassName,myclass))
222 140 ConfValue('class','commands',k,CommandList,&config_f);
223 141 log(DEBUG,'*** HasPermission: found class named %s with commands: '%s'',ClassName,CommandList);
226 144 mycmd = strtok_r(CommandList,' ',&savept2);
229 147 if (!strcasecmp(mycmd,command))
231 149 log(DEBUG,'*** Command %s found, returning true',command);
234 152 mycmd = strtok_r(NULL,' ',&savept2);
238 156 myclass = strtok_r(NULL,' ',&savept);
246 .SS "void userrec::InviteTo (char * channel)\fC [virtual]\fP"
248 Adds a channel to a users invite list (invites them to a channel). Definition at line 83 of file users.cpp.
250 References Invited::channel, and invites.
255 86 strlcpy(i.channel,channel,CHANMAX);
256 87 invites.push_back(i);
259 .SS "bool userrec::IsInvited (char * channel)\fC [virtual]\fP"
261 Returns true if a user is invited to a channel. Definition at line 69 of file users.cpp.
267 71 for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
270 74 if (!strcasecmp(i->channel,channel))
279 .SS "void userrec::RemoveInvite (char * channel)\fC [virtual]\fP"
281 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 90 of file users.cpp.
283 References DEBUG, and invites.
287 92 log(DEBUG,'Removing invites');
290 95 if (invites.size())
292 97 for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
296 101 if (!strcasecmp(i->channel,channel))
298 103 invites.erase(i);
307 .SH "Member Data Documentation"
309 .SS "char \fBuserrec::awaymsg\fP[512]"
311 The user's away message. If this string is empty, the user is not marked as away.Definition at line 132 of file users.h.
313 Referenced by userrec().
314 .SS "\fBucrec\fP \fBuserrec::chans\fP[MAXCHANS]"
316 Definition at line 123 of file users.h.
318 Referenced by userrec().
319 .SS "char \fBuserrec::dhost\fP[256]"
321 The host displayed to non-opers (used for cloaking etc). This usually matches the value of \fBuserrec::host\fP.Definition at line 111 of file users.h.
323 Referenced by GetFullHost(), and userrec().
324 .SS "bool \fBuserrec::dns_done\fP"
326 True when \fBDNS\fP lookups are completed. Definition at line 160 of file users.h.
328 Referenced by userrec().
329 .SS "int \fBuserrec::flood\fP"
331 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 143 of file users.h.
333 Referenced by userrec().
334 .SS "char \fBuserrec::fullname\fP[128]"
336 The users full name. Definition at line 115 of file users.h.
338 Referenced by userrec().
339 .SS "char \fBuserrec::ident\fP[64]"
341 The users ident reply. Definition at line 106 of file users.h.
343 Referenced by GetFullHost(), GetFullRealHost(), and userrec().
344 .SS "\fBInvitedList\fP \fBuserrec::invites\fP\fC [private]\fP"
346 A list of channels the user has a pending invite to. Definition at line 95 of file users.h.
348 Referenced by InviteTo(), IsInvited(), RemoveInvite(), and userrec().
349 .SS "char \fBuserrec::modes\fP[MAXBUF]"
351 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 121 of file users.h.
353 Referenced by userrec().
354 .SS "char \fBuserrec::nick\fP[NICKMAX]"
356 The users nickname. An invalid nickname indicates an unregistered connection prior to the NICK command.Definition at line 102 of file users.h.
358 Referenced by ConfigReader::DumpErrors(), GetFullHost(), GetFullRealHost(), Server::QuitUser(), and userrec().
359 .SS "char \fBuserrec::oper\fP[NICKMAX]"
361 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 156 of file users.h.
363 Referenced by userrec().
364 .SS "char \fBuserrec::result\fP[256]"
366 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 137 of file users.h.
368 Referenced by GetFullHost(), GetFullRealHost(), and userrec().
369 .SS "char \fBuserrec::server\fP[256]"
371 The server the user is connected to. Definition at line 127 of file users.h.
373 Referenced by userrec().
374 .SS "unsigned long \fBuserrec::timeout\fP"
376 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 149 of file users.h.
378 Referenced by userrec().
382 Generated automatically by Doxygen for InspIRCd from the source code.