]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/users.h
95805454e517100d985fcd2c1ca4cc29ca501b8c
[user/henk/code/inspircd.git] / include / users.h
1 /*
2
3 $Log$
4 Revision 1.3  2003/01/27 00:22:53  brain
5 Modified documentation
6 Moved some classes below base class
7
8 Revision 1.2  2003/01/26 23:52:59  brain
9 Modified documentation for base classes
10 Added base classes
11
12 Revision 1.1.1.1  2003/01/23 19:45:58  brain
13 InspIRCd second source tree
14
15 Revision 1.9  2003/01/22 00:44:26  brain
16 Added documentation comments
17
18 Revision 1.8  2003/01/21 21:11:17  brain
19 Added documentation
20
21 Revision 1.7  2003/01/17 13:21:38  brain
22 Added CONNECT ALLOW and CONNECT DENY config tags
23 Added PASS command
24
25 Revision 1.6  2003/01/17 10:37:55  brain
26 Added /INVITE command and relevent structures
27
28 Revision 1.5  2003/01/16 20:11:56  brain
29 fixed some ugly pointer bugs (thanks dblack and a|KK|y!)
30
31 Revision 1.4  2003/01/15 22:47:44  brain
32 Changed user and channel structs to classes (finally)
33
34 Revision 1.3  2003/01/14 21:14:30  brain
35 added /ISON command (for mIRC etc basic notify)
36
37
38 */
39
40 #include "inspircd_config.h" 
41 #include "channels.h"
42 #include "connection.h"
43
44 #include <string>
45  
46 #ifndef __USERS_H__ 
47 #define __USERS_H__ 
48  
49 #define STATUS_OP       4
50 #define STATUS_HOP      2
51 #define STATUS_VOICE    1
52 #define STATUS_NORMAL   0
53
54 #define CC_ALLOW        0
55 #define CC_DENY         1
56
57 /** Holds a channel name to which a user has been invited.
58  */
59 class Invited : public classbase
60 {
61  public:
62         char channel[CHANMAX];
63 };
64
65
66 /** Holds information relevent to &lt;connect allow&gt; and &lt;connect deny&gt; tags in the config file.
67  */
68 class ConnectClass : public classbase
69 {
70  public:
71         int type;
72         char host[MAXBUF];
73         char pass[MAXBUF];
74 };
75
76 /** Holds a complete list of all channels to which a user has been invited and has not yet joined.
77  */
78 typedef vector<Invited> InvitedList;
79
80
81
82 /** Holds a complete list of all allow and deny tags from the configuration file (connection classes)
83  */
84 typedef vector<ConnectClass> ClassVector;
85
86 /** Holds all information about a user
87  * This class stores all information about a user connected to the irc server. Everything about a
88  * connection is stored here primarily, from the user's socket ID (file descriptor) through to the
89  * user's nickname and hostname. Use the Find method of the server class to locate a specific user
90  * by nickname.
91  */
92 class userrec : public connection
93 {
94  private:
95
96         /** A list of channels the user has a pending invite to.
97          */
98         InvitedList invites;
99  public:
100         
101         /** The users nickname.
102          * An invalid nickname indicates an unregistered connection prior to the NICK command.
103          */
104         
105         char nick[NICKMAX];
106         
107         /** The users ident reply.
108          */
109         char ident[64];
110
111         /** The host displayed to non-opers (used for cloaking etc).
112          * This usually matches the value of userrec::host.
113          */
114         char dhost[256];
115         
116         /** The users full name.
117          */
118         char fullname[128];
119         
120         /** The user's mode string.
121          * This may contain any of the following RFC characters: o, w, s, i
122          * Your module may define other mode characters as it sees fit.
123          */
124         char modes[32];
125         
126         ucrec chans[MAXCHANS];
127         
128         /** The server the user is connected to.
129          */
130         char server[256];
131         
132         /** The user's away message.
133          * If this string is empty, the user is not marked as away.
134          */
135         char awaymsg[512];
136         
137         /** Stores the result of the last GetFullHost or GetRealHost call.
138          * You may use this to increase the speed of use of this class.
139          */
140         char result[256];
141         
142         userrec();
143         
144         virtual ~userrec() {  }
145         
146         /** Returns the full displayed host of the user
147          * This member function returns the hostname of the user as seen by other users
148          * on the server, in nick!ident&at;host form.
149          */
150         virtual char* GetFullHost();
151         
152         /** Returns the full real host of the user
153          * This member function returns the hostname of the user as seen by other users
154          * on the server, in nick!ident&at;host form. If any form of hostname cloaking is in operation,
155          * e.g. through a module, then this method will ignore it and return the true hostname.
156          */
157         virtual char* GetFullRealHost();
158         
159         /** Returns true if a user is invited to a channel.
160          */
161         virtual bool IsInvited(char* channel);
162         
163         /** Adds a channel to a users invite list (invites them to a channel)
164          */
165         virtual void InviteTo(char* channel);
166         
167         /** Removes a channel from a users invite list.
168          * This member function is called on successfully joining an invite only channel
169          * to which the user has previously been invited, to clear the invitation.
170          */
171         virtual void RemoveInvite(char* channel);
172         
173 };
174
175
176 #endif