1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * Inspire is copyright (C) 2002-2004 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
17 #include "inspircd_config.h"
19 #include "connection.h"
20 #include "inspstring.h"
28 #define STATUS_VOICE 1
29 #define STATUS_NORMAL 0
34 /** Holds a channel name to which a user has been invited.
36 class Invited : public classbase
39 char channel[CHANMAX];
43 /** Holds information relevent to <connect allow> and <connect deny> tags in the config file.
45 class ConnectClass : public classbase
48 /** Type of line, either CC_ALLOW or CC_DENY
51 /** Max time to register the connection in seconds
53 int registration_timeout;
54 /** Number of lines in buffer before excess flood is triggered
57 /** Host mask for this line
60 /** Number of seconds between pings for this line
63 /** (Optional) Password for this line
69 registration_timeout = 0;
72 strlcpy(host,"",MAXBUF);
73 strlcpy(pass,"",MAXBUF);
77 /** Holds a complete list of all channels to which a user has been invited and has not yet joined.
79 typedef std::vector<Invited> InvitedList;
83 /** Holds a complete list of all allow and deny tags from the configuration file (connection classes)
85 typedef std::vector<ConnectClass> ClassVector;
87 /** Holds all information about a user
88 * This class stores all information about a user connected to the irc server. Everything about a
89 * connection is stored here primarily, from the user's socket ID (file descriptor) through to the
90 * user's nickname and hostname. Use the Find method of the server class to locate a specific user
93 class userrec : public connection
97 /** A list of channels the user has a pending invite to.
102 /** The users nickname.
103 * An invalid nickname indicates an unregistered connection prior to the NICK command.
108 /** The users ident reply.
112 /** The host displayed to non-opers (used for cloaking etc).
113 * This usually matches the value of userrec::host.
117 /** The users full name.
121 /** The user's mode string.
122 * This may contain any of the following RFC characters: o, w, s, i
123 * Your module may define other mode characters as it sees fit.
127 ucrec chans[MAXCHANS];
129 /** The server the user is connected to.
133 /** The user's away message.
134 * If this string is empty, the user is not marked as away.
138 /** Stores the result of the last GetFullHost or GetRealHost call.
139 * You may use this to increase the speed of use of this class.
143 /** Number of lines the user can place into the buffer
144 * (up to the global NetBufferSize bytes) before they
145 * are disconnected for excess flood
149 /** Number of seconds this user is given to send USER/NICK
150 * If they do not send their details in this time limit they
151 * will be disconnected
153 unsigned long timeout;
155 /** The oper type they logged in as, if they are an oper.
156 * This is used to check permissions in operclasses, so that
157 * we can say 'yay' or 'nay' to any commands they issue.
158 * The value of this is the value of a valid 'type name=' tag.
162 /** True when DNS lookups are completed.
166 /** Number of seconds between PINGs for this user (set from <connect:allow> tag
168 unsigned long pingmax;
172 virtual ~userrec() { }
174 /** Returns the full displayed host of the user
175 * This member function returns the hostname of the user as seen by other users
176 * on the server, in nick!ident&at;host form.
178 virtual char* GetFullHost();
180 /** Returns the full real host of the user
181 * This member function returns the hostname of the user as seen by other users
182 * on the server, in nick!ident&at;host form. If any form of hostname cloaking is in operation,
183 * e.g. through a module, then this method will ignore it and return the true hostname.
185 virtual char* GetFullRealHost();
187 /** Returns true if a user is invited to a channel.
189 virtual bool IsInvited(char* channel);
191 /** Adds a channel to a users invite list (invites them to a channel)
193 virtual void InviteTo(char* channel);
195 /** Removes a channel from a users invite list.
196 * This member function is called on successfully joining an invite only channel
197 * to which the user has previously been invited, to clear the invitation.
199 virtual void RemoveInvite(char* channel);
201 /** Returns true or false for if a user can execute a privilaged oper command.
202 * This is done by looking up their oper type from userrec::oper, then referencing
203 * this to their oper classes and checking the commands they can execute.
205 bool HasPermission(char* command);