]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/users.h
Fix for bug ID #5 (PING, PONG And other matters)
[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         int registration_timeout;
39         char host[MAXBUF];
40         char pass[MAXBUF];
41         
42         ConnectClass()
43         {
44                 registration_timeout = 0;
45                 strcpy(host,"");
46                 strcpy(pass,"");
47         }
48 };
49
50 /** Holds a complete list of all channels to which a user has been invited and has not yet joined.
51  */
52 typedef std::vector<Invited> InvitedList;
53
54
55
56 /** Holds a complete list of all allow and deny tags from the configuration file (connection classes)
57  */
58 typedef std::vector<ConnectClass> ClassVector;
59
60 /** Holds all information about a user
61  * This class stores all information about a user connected to the irc server. Everything about a
62  * connection is stored here primarily, from the user's socket ID (file descriptor) through to the
63  * user's nickname and hostname. Use the Find method of the server class to locate a specific user
64  * by nickname.
65  */
66 class userrec : public connection
67 {
68  private:
69
70         /** A list of channels the user has a pending invite to.
71          */
72         InvitedList invites;
73  public:
74         
75         /** The users nickname.
76          * An invalid nickname indicates an unregistered connection prior to the NICK command.
77          */
78         
79         char nick[NICKMAX];
80         
81         /** The users ident reply.
82          */
83         char ident[64];
84
85         /** The host displayed to non-opers (used for cloaking etc).
86          * This usually matches the value of userrec::host.
87          */
88         char dhost[256];
89         
90         /** The users full name.
91          */
92         char fullname[128];
93         
94         /** The user's mode string.
95          * This may contain any of the following RFC characters: o, w, s, i
96          * Your module may define other mode characters as it sees fit.
97          */
98         char modes[MAXBUF];
99         
100         ucrec chans[MAXCHANS];
101         
102         /** The server the user is connected to.
103          */
104         char server[256];
105         
106         /** The user's away message.
107          * If this string is empty, the user is not marked as away.
108          */
109         char awaymsg[512];
110         
111         /** Stores the result of the last GetFullHost or GetRealHost call.
112          * You may use this to increase the speed of use of this class.
113          */
114         char result[256];
115         
116         unsigned long timeout;
117
118         userrec();
119         
120         virtual ~userrec() {  }
121         
122         /** Returns the full displayed host of the user
123          * This member function returns the hostname of the user as seen by other users
124          * on the server, in nick!ident&at;host form.
125          */
126         virtual char* GetFullHost();
127         
128         /** Returns the full real host of the user
129          * This member function returns the hostname of the user as seen by other users
130          * on the server, in nick!ident&at;host form. If any form of hostname cloaking is in operation,
131          * e.g. through a module, then this method will ignore it and return the true hostname.
132          */
133         virtual char* GetFullRealHost();
134         
135         /** Returns true if a user is invited to a channel.
136          */
137         virtual bool IsInvited(char* channel);
138         
139         /** Adds a channel to a users invite list (invites them to a channel)
140          */
141         virtual void InviteTo(char* channel);
142         
143         /** Removes a channel from a users invite list.
144          * This member function is called on successfully joining an invite only channel
145          * to which the user has previously been invited, to clear the invitation.
146          */
147         virtual void RemoveInvite(char* channel);
148         
149 };
150
151
152 #endif