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