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