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