]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - docs/man/man3/userrec.3
New documentation!
[user/henk/code/inspircd.git] / docs / man / man3 / userrec.3
1 .TH "userrec" 3 "26 Apr 2005" "InspIRCd" \" -*- nroff -*-
2 .ad l
3 .nh
4 .SH NAME
5 userrec \- Holds all information about a user This class stores all information about a user connected to the irc server.  
6
7 .PP
8 .SH SYNOPSIS
9 .br
10 .PP
11 \fC#include <users.h>\fP
12 .PP
13 Inherits \fBconnection\fP.
14 .PP
15 .SS "Public Member Functions"
16
17 .in +1c
18 .ti -1c
19 .RI "\fBuserrec\fP ()"
20 .br
21 .ti -1c
22 .RI "virtual \fB~userrec\fP ()"
23 .br
24 .ti -1c
25 .RI "virtual char * \fBGetFullHost\fP ()"
26 .br
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"
28 .ti -1c
29 .RI "virtual char * \fBGetFullRealHost\fP ()"
30 .br
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"
32 .ti -1c
33 .RI "virtual bool \fBIsInvited\fP (char *channel)"
34 .br
35 .RI "\fIReturns true if a user is invited to a channel. \fP"
36 .ti -1c
37 .RI "virtual void \fBInviteTo\fP (char *channel)"
38 .br
39 .RI "\fIAdds a channel to a users invite list (invites them to a channel). \fP"
40 .ti -1c
41 .RI "virtual void \fBRemoveInvite\fP (char *channel)"
42 .br
43 .RI "\fIRemoves a channel from a users invite list. \fP"
44 .ti -1c
45 .RI "bool \fBHasPermission\fP (char *command)"
46 .br
47 .RI "\fIReturns true or false for if a user can execute a privilaged oper command. \fP"
48 .in -1c
49 .SS "Public Attributes"
50
51 .in +1c
52 .ti -1c
53 .RI "char \fBnick\fP [NICKMAX]"
54 .br
55 .RI "\fIThe users nickname. \fP"
56 .ti -1c
57 .RI "char \fBident\fP [64]"
58 .br
59 .RI "\fIThe users ident reply. \fP"
60 .ti -1c
61 .RI "char \fBdhost\fP [256]"
62 .br
63 .RI "\fIThe host displayed to non-opers (used for cloaking etc). \fP"
64 .ti -1c
65 .RI "char \fBfullname\fP [128]"
66 .br
67 .RI "\fIThe users full name. \fP"
68 .ti -1c
69 .RI "char \fBmodes\fP [MAXBUF]"
70 .br
71 .RI "\fIThe user's mode string. \fP"
72 .ti -1c
73 .RI "\fBucrec\fP \fBchans\fP [MAXCHANS]"
74 .br
75 .ti -1c
76 .RI "char \fBserver\fP [256]"
77 .br
78 .RI "\fIThe server the user is connected to. \fP"
79 .ti -1c
80 .RI "char \fBawaymsg\fP [512]"
81 .br
82 .RI "\fIThe user's away message. \fP"
83 .ti -1c
84 .RI "char \fBresult\fP [256]"
85 .br
86 .RI "\fIStores the result of the last GetFullHost or GetRealHost call. \fP"
87 .ti -1c
88 .RI "int \fBflood\fP"
89 .br
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"
91 .ti -1c
92 .RI "unsigned long \fBtimeout\fP"
93 .br
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"
95 .ti -1c
96 .RI "char \fBoper\fP [NICKMAX]"
97 .br
98 .RI "\fIThe oper type they logged in as, if they are an oper. \fP"
99 .ti -1c
100 .RI "bool \fBdns_done\fP"
101 .br
102 .RI "\fITrue when \fBDNS\fP lookups are completed. \fP"
103 .ti -1c
104 .RI "unsigned long \fBpingmax\fP"
105 .br
106 .RI "\fINumber of seconds between PINGs for this user (set from <connect:allow> tag. \fP"
107 .ti -1c
108 .RI "char \fBpassword\fP [MAXBUF]"
109 .br
110 .RI "\fIPassword specified by the user when they registered. \fP"
111 .in -1c
112 .SS "Private Attributes"
113
114 .in +1c
115 .ti -1c
116 .RI "\fBInvitedList\fP \fBinvites\fP"
117 .br
118 .RI "\fIA list of channels the user has a pending invite to. \fP"
119 .in -1c
120 .SH "Detailed Description"
121 .PP 
122 Holds all information about a user This class stores all information about a user connected to the irc server. 
123
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. 
125 .PP
126 Definition at line 93 of file users.h.
127 .SH "Constructor & Destructor Documentation"
128 .PP 
129 .SS "userrec::userrec ()"
130 .PP
131 Definition at line 28 of file users.cpp.
132 .PP
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.
134 .PP
135 .nf
136 29 {
137 30         // the PROPER way to do it, AVOID bzero at *ALL* costs
138 31         strcpy(nick,'');
139 32         strcpy(ip,'127.0.0.1');
140 33         timeout = 0;
141 34         strcpy(ident,'');
142 35         strcpy(host,'');
143 36         strcpy(dhost,'');
144 37         strcpy(fullname,'');
145 38         strcpy(modes,'');
146 39         strcpy(inbuf,'');
147 40         strcpy(server,'');
148 41         strcpy(awaymsg,'');
149 42         strcpy(oper,'');
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;
153 46         dns_done = false;
154 47         strcpy(result,'');
155 48         for (int i = 0; i < MAXCHANS; i++)
156 49         {
157 50                 this->chans[i].channel = NULL;
158 51                 this->chans[i].uc_modes = 0;
159 52         }
160 53         invites.clear();
161 54 }
162 .fi
163 .SS "virtual userrec::~\fBuserrec\fP ()\fC [inline, virtual]\fP"
164 .PP
165 Definition at line 178 of file users.h.
166 .PP
167 .nf
168 178 {  }
169 .fi
170 .SH "Member Function Documentation"
171 .PP 
172 .SS "char * userrec::GetFullHost ()\fC [virtual]\fP"
173 .PP
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.
175 .PP
176 References dhost, ident, nick, and result.
177 .PP
178 .nf
179 59 {
180 60         snprintf(result,MAXBUF,'%s!%s@%s',nick,ident,dhost);
181 61         return result;
182 62 }
183 .fi
184 .SS "char * userrec::GetFullRealHost ()\fC [virtual]\fP"
185 .PP
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.
187 .PP
188 References connection::host, ident, nick, and result.
189 .PP
190 .nf
191 66 {
192 67         snprintf(result,MAXBUF,'%s!%s@%s',nick,ident,host);
193 68         return result;
194 69 }
195 .fi
196 .SS "bool userrec::HasPermission (char * command)"
197 .PP
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.
199 .PP
200 References config_f, and DEBUG.
201 .PP
202 .nf
203 115 {
204 116         char TypeName[MAXBUF],Classes[MAXBUF],ClassName[MAXBUF],CommandList[MAXBUF];
205 117         char* mycmd;
206 118         char* savept;
207 119         char* savept2;
208 120         
209 121         // are they even an oper at all?
210 122         if (strchr(this->modes,'o'))
211 123         {
212 124                 log(DEBUG,'*** HasPermission: %s is an oper',this->nick);
213 125                 for (int j =0; j < ConfValueEnum('type',&config_f); j++)
214 126                 {
215 127                         ConfValue('type','name',j,TypeName,&config_f);
216 128                         if (!strcmp(TypeName,this->oper))
217 129                         {
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);
221 133                                 while (myclass)
222 134                                 {
223 135                                         log(DEBUG,'*** HasPermission: checking classtype '%s'',myclass);
224 136                                         for (int k =0; k < ConfValueEnum('class',&config_f); k++)
225 137                                         {
226 138                                                 ConfValue('class','name',k,ClassName,&config_f);
227 139                                                 if (!strcmp(ClassName,myclass))
228 140                                                 {
229 141                                                         ConfValue('class','commands',k,CommandList,&config_f);
230 142                                                         log(DEBUG,'*** HasPermission: found class named %s with commands: '%s'',ClassName,CommandList);
231 143                                                         
232 144                                                         
233 145                                                         mycmd = strtok_r(CommandList,' ',&savept2);
234 146                                                         while (mycmd)
235 147                                                         {
236 148                                                                 if (!strcasecmp(mycmd,command))
237 149                                                                 {
238 150                                                                         log(DEBUG,'*** Command %s found, returning true',command);
239 151                                                                         return true;
240 152                                                                 }
241 153                                                                 mycmd = strtok_r(NULL,' ',&savept2);
242 154                                                         }
243 155                                                 }
244 156                                         }
245 157                                         myclass = strtok_r(NULL,' ',&savept);
246 158                                 }
247 159                         }
248 160                 }
249 161         }
250 162         return false;
251 163 }
252 .fi
253 .SS "void userrec::InviteTo (char * channel)\fC [virtual]\fP"
254 .PP
255 Adds a channel to a users invite list (invites them to a channel). Definition at line 85 of file users.cpp.
256 .PP
257 References Invited::channel, and invites.
258 .PP
259 .nf
260 86 {
261 87         Invited i;
262 88         strlcpy(i.channel,channel,CHANMAX);
263 89         invites.push_back(i);
264 90 }
265 .fi
266 .SS "bool userrec::IsInvited (char * channel)\fC [virtual]\fP"
267 .PP
268 Returns true if a user is invited to a channel. Definition at line 71 of file users.cpp.
269 .PP
270 References invites.
271 .PP
272 .nf
273 72 {
274 73         for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
275 74         {
276 75                 if (i->channel) {
277 76                         if (!strcasecmp(i->channel,channel))
278 77                         {
279 78                                 return true;
280 79                         }
281 80                 }
282 81         }
283 82         return false;
284 83 }
285 .fi
286 .SS "void userrec::RemoveInvite (char * channel)\fC [virtual]\fP"
287 .PP
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.
289 .PP
290 References DEBUG, and invites.
291 .PP
292 .nf
293 93 {
294 94         log(DEBUG,'Removing invites');
295 95         if (channel)
296 96         {
297 97                 if (invites.size())
298 98                 {
299 99                         for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
300 100                         {
301 101                                 if (i->channel)
302 102                                 {
303 103                                         if (!strcasecmp(i->channel,channel))
304 104                                         {
305 105                                                 invites.erase(i);
306 106                                                 return;
307 107                                         }
308 108                                 }
309 109                         }
310 110                 }
311 111         }
312 112 }
313 .fi
314 .SH "Member Data Documentation"
315 .PP 
316 .SS "char \fBuserrec::awaymsg\fP[512]"
317 .PP
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.
319 .PP
320 Referenced by userrec().
321 .SS "\fBucrec\fP \fBuserrec::chans\fP[MAXCHANS]"
322 .PP
323 Definition at line 127 of file users.h.
324 .PP
325 Referenced by Server::PseudoToUser(), and userrec().
326 .SS "char \fBuserrec::dhost\fP[256]"
327 .PP
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.
329 .PP
330 Referenced by GetFullHost(), and userrec().
331 .SS "bool \fBuserrec::dns_done\fP"
332 .PP
333 True when \fBDNS\fP lookups are completed. Definition at line 164 of file users.h.
334 .PP
335 Referenced by userrec().
336 .SS "int \fBuserrec::flood\fP"
337 .PP
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.
339 .PP
340 Referenced by userrec().
341 .SS "char \fBuserrec::fullname\fP[128]"
342 .PP
343 The users full name. Definition at line 119 of file users.h.
344 .PP
345 Referenced by userrec().
346 .SS "char \fBuserrec::ident\fP[64]"
347 .PP
348 The users ident reply. Definition at line 110 of file users.h.
349 .PP
350 Referenced by GetFullHost(), GetFullRealHost(), Server::PseudoToUser(), userrec(), and Server::UserToPseudo().
351 .SS "\fBInvitedList\fP \fBuserrec::invites\fP\fC [private]\fP"
352 .PP
353 A list of channels the user has a pending invite to. Definition at line 99 of file users.h.
354 .PP
355 Referenced by InviteTo(), IsInvited(), RemoveInvite(), and userrec().
356 .SS "char \fBuserrec::modes\fP[MAXBUF]"
357 .PP
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.
359 .PP
360 Referenced by userrec().
361 .SS "char \fBuserrec::nick\fP[NICKMAX]"
362 .PP
363 The users nickname. An invalid nickname indicates an unregistered connection prior to the NICK command.Definition at line 106 of file users.h.
364 .PP
365 Referenced by ConfigReader::DumpErrors(), GetFullHost(), GetFullRealHost(), Server::PseudoToUser(), Server::QuitUser(), and userrec().
366 .SS "char \fBuserrec::oper\fP[NICKMAX]"
367 .PP
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.
369 .PP
370 Referenced by userrec().
371 .SS "char \fBuserrec::password\fP[MAXBUF]"
372 .PP
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"
375 .PP
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]"
378 .PP
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.
380 .PP
381 Referenced by GetFullHost(), GetFullRealHost(), and userrec().
382 .SS "char \fBuserrec::server\fP[256]"
383 .PP
384 The server the user is connected to. Definition at line 131 of file users.h.
385 .PP
386 Referenced by userrec().
387 .SS "unsigned long \fBuserrec::timeout\fP"
388 .PP
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.
390 .PP
391 Referenced by userrec().
392
393 .SH "Author"
394 .PP 
395 Generated automatically by Doxygen for InspIRCd from the source code.