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