summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/hashcomp.h10
-rw-r--r--include/inspircd.h54
-rw-r--r--include/modules.h100
-rw-r--r--include/users.h60
4 files changed, 47 insertions, 177 deletions
diff --git a/include/hashcomp.h b/include/hashcomp.h
index 449b367b9..2932f2a48 100644
--- a/include/hashcomp.h
+++ b/include/hashcomp.h
@@ -280,15 +280,7 @@ namespace irc
* mode changes to be obtained.
*/
int GetStackedLine(std::vector<std::string> &result, int max_line_size = 360);
-
- /** deprecated compatability interface - TODO remove */
- int GetStackedLine(std::deque<std::string> &result, int max_line_size = 360) {
- std::vector<std::string> r;
- int n = GetStackedLine(r, max_line_size);
- result.clear();
- result.insert(result.end(), r.begin(), r.end());
- return n;
- }
+
};
/** irc::tokenstream reads a string formatted as per RFC1459 and RFC2812.
diff --git a/include/inspircd.h b/include/inspircd.h
index 9456ce329..13cd92451 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -46,6 +46,15 @@
#define CUSTOM_PRINTF(STRING, FIRST)
#endif
+#if defined __clang__ || defined __GNUC__
+# define DEPRECATED_METHOD(function) function __attribute__((deprecated))
+#elif defined _MSC_VER
+# define DEPRECATED_METHOD(function) __declspec(deprecated) function
+#else
+# pragma message ("Warning! DEPRECATED_METHOD() does not work on your compiler!")
+# define DEPRECATED_METHOD(function) function
+#endif
+
// Required system headers.
#include <ctime>
#include <cstdarg>
@@ -117,11 +126,6 @@ CoreExport extern InspIRCd* ServerInstance;
*/
#define ERROR -1
-/** Support for librodent -
- * see http://www.chatspike.net/index.php?z=64
- */
-#define ETIREDHAMSTERS EAGAIN
-
/** Template function to convert any input type to std::string
*/
template<typename T> inline std::string ConvNumeric(const T &in)
@@ -264,12 +268,10 @@ class serverstats
}
};
-DEFINE_HANDLER2(IsNickHandler, bool, const char*, size_t);
+DEFINE_HANDLER2(IsNickHandler, bool, const std::string&, size_t);
DEFINE_HANDLER2(GenRandomHandler, void, char*, size_t);
-DEFINE_HANDLER1(IsIdentHandler, bool, const char*);
-DEFINE_HANDLER1(FloodQuitUserHandler, void, User*);
-DEFINE_HANDLER2(IsChannelHandler, bool, const char*, size_t);
-DEFINE_HANDLER1(IsSIDHandler, bool, const std::string&);
+DEFINE_HANDLER1(IsIdentHandler, bool, const std::string&);
+DEFINE_HANDLER2(IsChannelHandler, bool, const std::string&, size_t);
DEFINE_HANDLER1(RehashHandler, void, const std::string&);
DEFINE_HANDLER3(OnCheckExemptionHandler, ModResult, User*, Channel*, const std::string&);
@@ -337,10 +339,8 @@ class CoreExport InspIRCd
IsNickHandler HandleIsNick;
IsIdentHandler HandleIsIdent;
- FloodQuitUserHandler HandleFloodQuitUser;
OnCheckExemptionHandler HandleOnCheckExemption;
IsChannelHandler HandleIsChannel;
- IsSIDHandler HandleIsSID;
RehashHandler HandleRehash;
GenRandomHandler HandleGenRandom;
@@ -571,12 +571,12 @@ class CoreExport InspIRCd
* @param chname A channel name to verify
* @return True if the name is valid
*/
- caller2<bool, const char*, size_t> IsChannel;
+ caller2<bool, const std::string&, size_t> IsChannel;
/** Return true if str looks like a server ID
* @param string to check against
*/
- caller1<bool, const std::string&> IsSID;
+ static bool IsSID(const std::string& sid);
/** Rehash the local server
*/
@@ -619,13 +619,13 @@ class CoreExport InspIRCd
* @param n A nickname to verify
* @return True if the nick is valid
*/
- caller2<bool, const char*, size_t> IsNick;
+ caller2<bool, const std::string&, size_t> IsNick;
/** Return true if an ident is valid
* @param An ident to verify
* @return True if the ident is valid
*/
- caller1<bool, const char*> IsIdent;
+ caller1<bool, const std::string&> IsIdent;
/** Add a dns Resolver class to this server's active set
* @param r The resolver to add
@@ -689,22 +689,6 @@ class CoreExport InspIRCd
static bool MatchCIDR(const std::string &str, const std::string &mask, unsigned const char *map = NULL);
static bool MatchCIDR(const char *str, const char *mask, unsigned const char *map = NULL);
- /** Call the handler for a given command.
- * @param commandname The command whos handler you wish to call
- * @param parameters The mode parameters
- * @param user The user to execute the command as
- * @return True if the command handler was called successfully
- */
- CmdResult CallCommandHandler(const std::string &commandname, const std::vector<std::string>& parameters, User* user);
-
- /** Return true if the command is a module-implemented command and the given parameters are valid for it
- * @param commandname The command name to check
- * @param pcnt The parameter count
- * @param user The user to test-execute the command as
- * @return True if the command handler is a module command, and there are enough parameters and the user has permission to the command
- */
- bool IsValidModuleCommand(const std::string &commandname, int pcnt, User* user);
-
/** Return true if the given parameter is a valid nick!user\@host mask
* @param mask A nick!user\@host masak to match against
* @return True i the mask is valid
@@ -817,12 +801,6 @@ class CoreExport InspIRCd
*/
void DoWhois(User* user, User* dest,unsigned long signon, unsigned long idle, const char* nick);
- /** Quit a user for excess flood, and if they are not
- * fully registered yet, temporarily zline their IP.
- * @param current user to quit
- */
- caller1<void, User*> FloodQuitUser;
-
/** Called to check whether a channel restriction mode applies to a user
* @param User that is attempting some action
* @param Channel that the action is being performed on
diff --git a/include/modules.h b/include/modules.h
index 626f6e9b8..d47e3a62e 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -736,8 +736,6 @@ class CoreExport Module : public classbase, public usecountbase
* (see below). This function will be called for every user visible on your side
* of the burst, allowing you to for example set modes, etc.
*
- * For a good example of how to use this function, please see src/modules/m_chanprotect.cpp
- *
* @param chan The channel being syncronized
* @param proto A pointer to the module handling network protocol
* @param opaque An opaque pointer set by the protocol module, should not be modified!
@@ -770,9 +768,6 @@ class CoreExport Module : public classbase, public usecountbase
* down the network link as a broadcast, without a module calling it having to know the format
* of the MODE command before the actual mode string.
*
- * More documentation to follow soon. Please see src/modules/m_chanprotect.cpp for examples
- * of how to use this function.
- *
* @param opaque An opaque pointer set by the protocol module, should not be modified!
* @param target_type The type of item to decode data for, TYPE_USER or TYPE_CHANNEL
* @param target The Channel* or User* that modes should be sent for
@@ -1296,101 +1291,6 @@ class CoreExport Module : public classbase, public usecountbase
virtual void OnSetUserIP(LocalUser* user);
};
-
-#define CONF_NO_ERROR 0x000000
-#define CONF_NOT_A_NUMBER 0x000010
-#define CONF_INT_NEGATIVE 0x000080
-#define CONF_VALUE_NOT_FOUND 0x000100
-#define CONF_FILE_NOT_FOUND 0x000200
-
-
-/** Allows reading of values from configuration files
- * This class allows a module to read from either the main configuration file (inspircd.conf) or from
- * a module-specified configuration file. It may either be instantiated with one parameter or none.
- * Constructing the class using one parameter allows you to specify a path to your own configuration
- * file, otherwise, inspircd.conf is read.
- */
-class CoreExport ConfigReader : public interfacebase
-{
- protected:
- /** Error code
- */
- long error;
-
- public:
- /** Default constructor.
- * This constructor initialises the ConfigReader class to read the inspircd.conf file
- * as specified when running ./configure.
- */
- ConfigReader();
- /** Default destructor.
- * This method destroys the ConfigReader class.
- */
- ~ConfigReader();
-
- /** Retrieves a value from the config file.
- * This method retrieves a value from the config file. Where multiple copies of the tag
- * exist in the config file, index indicates which of the values to retrieve.
- */
- std::string ReadValue(const std::string &tag, const std::string &name, int index, bool allow_linefeeds = false);
- /** Retrieves a value from the config file.
- * This method retrieves a value from the config file. Where multiple copies of the tag
- * exist in the config file, index indicates which of the values to retrieve. If the
- * tag is not found the default value is returned instead.
- */
- std::string ReadValue(const std::string &tag, const std::string &name, const std::string &default_value, int index, bool allow_linefeeds = false);
-
- /** Retrieves a boolean value from the config file.
- * This method retrieves a boolean value from the config file. Where multiple copies of the tag
- * exist in the config file, index indicates which of the values to retrieve. The values "1", "yes"
- * and "true" in the config file count as true to ReadFlag, and any other value counts as false.
- */
- bool ReadFlag(const std::string &tag, const std::string &name, int index);
- /** Retrieves a boolean value from the config file.
- * This method retrieves a boolean value from the config file. Where multiple copies of the tag
- * exist in the config file, index indicates which of the values to retrieve. The values "1", "yes"
- * and "true" in the config file count as true to ReadFlag, and any other value counts as false.
- * If the tag is not found, the default value is used instead.
- */
- bool ReadFlag(const std::string &tag, const std::string &name, const std::string &default_value, int index);
-
- /** Retrieves an integer value from the config file.
- * This method retrieves an integer value from the config file. Where multiple copies of the tag
- * exist in the config file, index indicates which of the values to retrieve. Any invalid integer
- * values in the tag will cause the objects error value to be set, and any call to GetError() will
- * return CONF_INVALID_NUMBER to be returned. need_positive is set if the number must be non-negative.
- * If a negative number is placed into a tag which is specified positive, 0 will be returned and GetError()
- * will return CONF_INT_NEGATIVE. Note that need_positive is not suitable to get an unsigned int - you
- * should cast the result to achieve that effect.
- */
- int ReadInteger(const std::string &tag, const std::string &name, int index, bool need_positive);
- /** Retrieves an integer value from the config file.
- * This method retrieves an integer value from the config file. Where multiple copies of the tag
- * exist in the config file, index indicates which of the values to retrieve. Any invalid integer
- * values in the tag will cause the objects error value to be set, and any call to GetError() will
- * return CONF_INVALID_NUMBER to be returned. needs_unsigned is set if the number must be unsigned.
- * If a signed number is placed into a tag which is specified unsigned, 0 will be returned and GetError()
- * will return CONF_NOT_UNSIGNED. If the tag is not found, the default value is used instead.
- */
- int ReadInteger(const std::string &tag, const std::string &name, const std::string &default_value, int index, bool need_positive);
-
- /** Returns the last error to occur.
- * Valid errors can be found by looking in modules.h. Any nonzero value indicates an error condition.
- * A call to GetError() resets the error flag back to 0.
- */
- long GetError();
-
- /** Counts the number of times a given tag appears in the config file.
- * This method counts the number of times a tag appears in a config file, for use where
- * there are several tags of the same kind, e.g. with opers and connect types. It can be
- * used with the index value of ConfigReader::ReadValue to loop through all copies of a
- * multiple instance tag.
- */
- int Enumerate(const std::string &tag);
-};
-
-
-
/** Caches a text file into memory and can be used to retrieve lines from it.
* This class contains methods for read-only manipulation of a text file in memory.
* Either use the constructor type with one parameter to load a file into memory
diff --git a/include/users.h b/include/users.h
index c79bf7cb8..102e7783f 100644
--- a/include/users.h
+++ b/include/users.h
@@ -267,10 +267,6 @@ class CoreExport User : public Extensible
*/
time_t signon;
- /** Time that the connection last sent a message, used to calculate idle time
- */
- time_t idle_lastmsg;
-
/** Client address that the user is connected from.
* Do not modify this value directly, use SetClientIP() to change it.
* Port is not valid for remote users.
@@ -347,12 +343,6 @@ class CoreExport User : public Extensible
*/
unsigned int registered:3;
- /** True when DNS lookups are completed.
- * The UserResolver classes res_forward and res_reverse will
- * set this value once they complete.
- */
- unsigned int dns_done:1;
-
/** Whether or not to send an snotice about this user's quitting
*/
unsigned int quietquit:1;
@@ -364,20 +354,6 @@ class CoreExport User : public Extensible
*/
unsigned int quitting:1;
- /** Recursion fix: user is out of SendQ and will be quit as soon as possible.
- * This can't be handled normally because QuitUser itself calls Write on other
- * users, which could trigger their SendQ to overrun.
- */
- unsigned int quitting_sendq:1;
-
- /** This is true if the user matched an exception (E:Line). It is used to save time on ban checks.
- */
- unsigned int exempt:1;
-
- /** has the user responded to their previous ping?
- */
- unsigned int lastping:1;
-
/** What type of user is this? */
const unsigned int usertype:2;
@@ -402,12 +378,6 @@ class CoreExport User : public Extensible
*/
User(const std::string &uid, const std::string& srv, int objtype);
- /** Check if the user matches a G or K line, and disconnect them if they do.
- * @param doZline True if ZLines should be checked (if IP has changed since initial connect)
- * Returns true if the user matched a ban, false else.
- */
- bool CheckLines(bool doZline = false);
-
/** Returns the full displayed host of the user
* This member function returns the hostname of the user as seen by other users
* on the server, in nick!ident\@host form.
@@ -792,10 +762,34 @@ class CoreExport LocalUser : public User, public InviteBase
*/
int GetServerPort();
+ /** Recursion fix: user is out of SendQ and will be quit as soon as possible.
+ * This can't be handled normally because QuitUser itself calls Write on other
+ * users, which could trigger their SendQ to overrun.
+ */
+ unsigned int quitting_sendq:1;
+
+ /** True when DNS lookups are completed.
+ * The UserResolver classes res_forward and res_reverse will
+ * set this value once they complete.
+ */
+ unsigned int dns_done:1;
+
+ /** has the user responded to their previous ping?
+ */
+ unsigned int lastping:1;
+
+ /** This is true if the user matched an exception (E:Line). It is used to save time on ban checks.
+ */
+ unsigned int exempt:1;
+
/** Used by PING checking code
*/
time_t nping;
+ /** Time that the connection last sent a message, used to calculate idle time
+ */
+ time_t idle_lastmsg;
+
/** This value contains how far into the penalty threshold the user is.
* This is used either to enable fake lag or for excess flood quits
*/
@@ -814,6 +808,12 @@ class CoreExport LocalUser : public User, public InviteBase
*/
void StartDNSLookup();
+ /** Check if the user matches a G or K line, and disconnect them if they do.
+ * @param doZline True if ZLines should be checked (if IP has changed since initial connect)
+ * Returns true if the user matched a ban, false else.
+ */
+ bool CheckLines(bool doZline = false);
+
/** Use this method to fully connect a user.
* This will send the message of the day, check G/K/E lines, etc.
*/