]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - docs/man/man3/userrec.3
Commented new functions
[user/henk/code/inspircd.git] / docs / man / man3 / userrec.3
1 .TH "userrec" 3 "20 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 .in -1c
108 .SS "Private Attributes"
109
110 .in +1c
111 .ti -1c
112 .RI "\fBInvitedList\fP \fBinvites\fP"
113 .br
114 .RI "\fIA list of channels the user has a pending invite to. \fP"
115 .in -1c
116 .SH "Detailed Description"
117 .PP 
118 Holds all information about a user This class stores all information about a user connected to the irc server. 
119
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. 
121 .PP
122 Definition at line 93 of file users.h.
123 .SH "Constructor & Destructor Documentation"
124 .PP 
125 .SS "userrec::userrec ()"
126 .PP
127 Definition at line 28 of file users.cpp.
128 .PP
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.
130 .PP
131 .nf
132 29 {
133 30         // the PROPER way to do it, AVOID bzero at *ALL* costs
134 31         strcpy(nick,'');
135 32         strcpy(ip,'127.0.0.1');
136 33         timeout = 0;
137 34         strcpy(ident,'');
138 35         strcpy(host,'');
139 36         strcpy(dhost,'');
140 37         strcpy(fullname,'');
141 38         strcpy(modes,'');
142 39         strcpy(inbuf,'');
143 40         strcpy(server,'');
144 41         strcpy(awaymsg,'');
145 42         strcpy(oper,'');
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;
149 46         dns_done = false;
150 47         strcpy(result,'');
151 48         for (int i = 0; i < MAXCHANS; i++)
152 49         {
153 50                 this->chans[i].channel = NULL;
154 51                 this->chans[i].uc_modes = 0;
155 52         }
156 53         invites.clear();
157 54 }
158 .fi
159 .SS "virtual userrec::~\fBuserrec\fP ()\fC [inline, virtual]\fP"
160 .PP
161 Definition at line 172 of file users.h.
162 .PP
163 .nf
164 172 {  }
165 .fi
166 .SH "Member Function Documentation"
167 .PP 
168 .SS "char * userrec::GetFullHost ()\fC [virtual]\fP"
169 .PP
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.
171 .PP
172 References dhost, ident, nick, and result.
173 .PP
174 .nf
175 59 {
176 60         snprintf(result,MAXBUF,'%s!%s@%s',nick,ident,dhost);
177 61         return result;
178 62 }
179 .fi
180 .SS "char * userrec::GetFullRealHost ()\fC [virtual]\fP"
181 .PP
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.
183 .PP
184 References connection::host, ident, nick, and result.
185 .PP
186 .nf
187 66 {
188 67         snprintf(result,MAXBUF,'%s!%s@%s',nick,ident,host);
189 68         return result;
190 69 }
191 .fi
192 .SS "bool userrec::HasPermission (char * command)"
193 .PP
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.
195 .PP
196 References config_f, and DEBUG.
197 .PP
198 .nf
199 115 {
200 116         char TypeName[MAXBUF],Classes[MAXBUF],ClassName[MAXBUF],CommandList[MAXBUF];
201 117         char* myclass;
202 118         char* mycmd;
203 119         char* savept;
204 120         char* savept2;
205 121         
206 122         // are they even an oper at all?
207 123         if (strchr(this->modes,'o'))
208 124         {
209 125                 log(DEBUG,'*** HasPermission: %s is an oper',this->nick);
210 126                 for (int j =0; j < ConfValueEnum('type',&config_f); j++)
211 127                 {
212 128                         ConfValue('type','name',j,TypeName,&config_f);
213 129                         if (!strcmp(TypeName,this->oper))
214 130                         {
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);
218 134                                 while (myclass)
219 135                                 {
220 136                                         log(DEBUG,'*** HasPermission: checking classtype '%s'',myclass);
221 137                                         for (int k =0; k < ConfValueEnum('class',&config_f); k++)
222 138                                         {
223 139                                                 ConfValue('class','name',k,ClassName,&config_f);
224 140                                                 if (!strcmp(ClassName,myclass))
225 141                                                 {
226 142                                                         ConfValue('class','commands',k,CommandList,&config_f);
227 143                                                         log(DEBUG,'*** HasPermission: found class named %s with commands: '%s'',ClassName,CommandList);
228 144                                                         
229 145                                                         
230 146                                                         mycmd = strtok_r(CommandList,' ',&savept2);
231 147                                                         while (mycmd)
232 148                                                         {
233 149                                                                 if (!strcasecmp(mycmd,command))
234 150                                                                 {
235 151                                                                         log(DEBUG,'*** Command %s found, returning true',command);
236 152                                                                         return true;
237 153                                                                 }
238 154                                                                 mycmd = strtok_r(NULL,' ',&savept2);
239 155                                                         }
240 156                                                 }
241 157                                         }
242 158                                         myclass = strtok_r(NULL,' ',&savept);
243 159                                 }
244 160                         }
245 161                 }
246 162         }
247 163         return false;
248 164 }
249 .fi
250 .SS "void userrec::InviteTo (char * channel)\fC [virtual]\fP"
251 .PP
252 Adds a channel to a users invite list (invites them to a channel). Definition at line 85 of file users.cpp.
253 .PP
254 References Invited::channel, and invites.
255 .PP
256 .nf
257 86 {
258 87         Invited i;
259 88         strlcpy(i.channel,channel,CHANMAX);
260 89         invites.push_back(i);
261 90 }
262 .fi
263 .SS "bool userrec::IsInvited (char * channel)\fC [virtual]\fP"
264 .PP
265 Returns true if a user is invited to a channel. Definition at line 71 of file users.cpp.
266 .PP
267 References invites.
268 .PP
269 .nf
270 72 {
271 73         for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
272 74         {
273 75                 if (i->channel) {
274 76                         if (!strcasecmp(i->channel,channel))
275 77                         {
276 78                                 return true;
277 79                         }
278 80                 }
279 81         }
280 82         return false;
281 83 }
282 .fi
283 .SS "void userrec::RemoveInvite (char * channel)\fC [virtual]\fP"
284 .PP
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.
286 .PP
287 References DEBUG, and invites.
288 .PP
289 .nf
290 93 {
291 94         log(DEBUG,'Removing invites');
292 95         if (channel)
293 96         {
294 97                 if (invites.size())
295 98                 {
296 99                         for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
297 100                         {
298 101                                 if (i->channel)
299 102                                 {
300 103                                         if (!strcasecmp(i->channel,channel))
301 104                                         {
302 105                                                 invites.erase(i);
303 106                                                 return;
304 107                                         }
305 108                                 }
306 109                         }
307 110                 }
308 111         }
309 112 }
310 .fi
311 .SH "Member Data Documentation"
312 .PP 
313 .SS "char \fBuserrec::awaymsg\fP[512]"
314 .PP
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.
316 .PP
317 Referenced by userrec().
318 .SS "\fBucrec\fP \fBuserrec::chans\fP[MAXCHANS]"
319 .PP
320 Definition at line 127 of file users.h.
321 .PP
322 Referenced by Server::PseudoToUser(), and userrec().
323 .SS "char \fBuserrec::dhost\fP[256]"
324 .PP
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.
326 .PP
327 Referenced by GetFullHost(), and userrec().
328 .SS "bool \fBuserrec::dns_done\fP"
329 .PP
330 True when \fBDNS\fP lookups are completed. Definition at line 164 of file users.h.
331 .PP
332 Referenced by userrec().
333 .SS "int \fBuserrec::flood\fP"
334 .PP
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.
336 .PP
337 Referenced by userrec().
338 .SS "char \fBuserrec::fullname\fP[128]"
339 .PP
340 The users full name. Definition at line 119 of file users.h.
341 .PP
342 Referenced by userrec().
343 .SS "char \fBuserrec::ident\fP[64]"
344 .PP
345 The users ident reply. Definition at line 110 of file users.h.
346 .PP
347 Referenced by GetFullHost(), GetFullRealHost(), Server::PseudoToUser(), userrec(), and Server::UserToPseudo().
348 .SS "\fBInvitedList\fP \fBuserrec::invites\fP\fC [private]\fP"
349 .PP
350 A list of channels the user has a pending invite to. Definition at line 99 of file users.h.
351 .PP
352 Referenced by InviteTo(), IsInvited(), RemoveInvite(), and userrec().
353 .SS "char \fBuserrec::modes\fP[MAXBUF]"
354 .PP
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.
356 .PP
357 Referenced by userrec().
358 .SS "char \fBuserrec::nick\fP[NICKMAX]"
359 .PP
360 The users nickname. An invalid nickname indicates an unregistered connection prior to the NICK command.Definition at line 106 of file users.h.
361 .PP
362 Referenced by ConfigReader::DumpErrors(), GetFullHost(), GetFullRealHost(), Server::PseudoToUser(), Server::QuitUser(), and userrec().
363 .SS "char \fBuserrec::oper\fP[NICKMAX]"
364 .PP
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.
366 .PP
367 Referenced by userrec().
368 .SS "unsigned long \fBuserrec::pingmax\fP"
369 .PP
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]"
372 .PP
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.
374 .PP
375 Referenced by GetFullHost(), GetFullRealHost(), and userrec().
376 .SS "char \fBuserrec::server\fP[256]"
377 .PP
378 The server the user is connected to. Definition at line 131 of file users.h.
379 .PP
380 Referenced by userrec().
381 .SS "unsigned long \fBuserrec::timeout\fP"
382 .PP
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.
384 .PP
385 Referenced by userrec().
386
387 .SH "Author"
388 .PP 
389 Generated automatically by Doxygen for InspIRCd from the source code.