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