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