6 #include "inspircd_config.h"
8 #include "connection.h"
17 #define STATUS_VOICE 1
18 #define STATUS_NORMAL 0
23 /** Holds a channel name to which a user has been invited.
25 class Invited : public classbase
28 char channel[CHANMAX];
32 /** Holds information relevent to <connect allow> and <connect deny> tags in the config file.
34 class ConnectClass : public classbase
37 /** Type of line, either CC_ALLOW or CC_DENY
40 /** Max time to register the connection in seconds
42 int registration_timeout;
43 /** Number of lines in buffer before excess flood is triggered
46 /** Host mask for this line
49 /** (Optional) Password for this line
55 registration_timeout = 0;
62 /** Holds a complete list of all channels to which a user has been invited and has not yet joined.
64 typedef std::vector<Invited> InvitedList;
68 /** Holds a complete list of all allow and deny tags from the configuration file (connection classes)
70 typedef std::vector<ConnectClass> ClassVector;
72 /** Holds all information about a user
73 * This class stores all information about a user connected to the irc server. Everything about a
74 * connection is stored here primarily, from the user's socket ID (file descriptor) through to the
75 * user's nickname and hostname. Use the Find method of the server class to locate a specific user
78 class userrec : public connection
82 /** A list of channels the user has a pending invite to.
87 /** The users nickname.
88 * An invalid nickname indicates an unregistered connection prior to the NICK command.
93 /** The users ident reply.
97 /** The host displayed to non-opers (used for cloaking etc).
98 * This usually matches the value of userrec::host.
102 /** The users full name.
106 /** The user's mode string.
107 * This may contain any of the following RFC characters: o, w, s, i
108 * Your module may define other mode characters as it sees fit.
112 ucrec chans[MAXCHANS];
114 /** The server the user is connected to.
118 /** The user's away message.
119 * If this string is empty, the user is not marked as away.
123 /** Stores the result of the last GetFullHost or GetRealHost call.
124 * You may use this to increase the speed of use of this class.
128 /** Number of lines the user can place into the buffer
129 * (up to the global NetBufferSize bytes) before they
130 * are disconnected for excess flood
134 /** Number of seconds this user is given to send USER/NICK
135 * If they do not send their details in this time limit they
136 * will be disconnected
138 unsigned long timeout;
140 /** The oper type they logged in as, if they are an oper.
141 * This is used to check permissions in operclasses, so that
142 * we can say 'yay' or 'nay' to any commands they issue.
143 * The value of this is the value of a valid 'type name=' tag.
149 virtual ~userrec() { }
151 /** Returns the full displayed host of the user
152 * This member function returns the hostname of the user as seen by other users
153 * on the server, in nick!ident&at;host form.
155 virtual char* GetFullHost();
157 /** Returns the full real host of the user
158 * This member function returns the hostname of the user as seen by other users
159 * on the server, in nick!ident&at;host form. If any form of hostname cloaking is in operation,
160 * e.g. through a module, then this method will ignore it and return the true hostname.
162 virtual char* GetFullRealHost();
164 /** Returns true if a user is invited to a channel.
166 virtual bool IsInvited(char* channel);
168 /** Adds a channel to a users invite list (invites them to a channel)
170 virtual void InviteTo(char* channel);
172 /** Removes a channel from a users invite list.
173 * This member function is called on successfully joining an invite only channel
174 * to which the user has previously been invited, to clear the invitation.
176 virtual void RemoveInvite(char* channel);
178 /** Returns true or false for if a user can execute a privilaged oper command.
179 * This is done by looking up their oper type from userrec::oper, then referencing
180 * this to their oper classes and checking the commands they can execute.
182 bool HasPermission(char* command);