#ifndef __BANCACHE_H
#define __BANCACHE_H
-#include <string>
-
class CoreExport BanCacheHit : public classbase
{
private:
#ifndef __BASE_H__
#define __BASE_H__
-#include "inspircd_config.h"
-#include <time.h>
#include <map>
#include <deque>
#include <string>
#ifndef __CHANNELS_H__
#define __CHANNELS_H__
-#include "inspircd_config.h"
-#include "base.h"
-#include <time.h>
-#include <vector>
-#include <string>
-#include <map>
-
/** RFC1459 channel modes
*/
enum ChannelModes {
/* Forward declarations - needed */
class User;
-class Channel;
/** Holds an entry for a ban list, exemption list, or invite list.
* This class contains a single element in a channel list, such as a banlist.
#ifndef __COMMAND_PARSE_H
#define __COMMAND_PARSE_H
-#include <string>
-#include "ctables.h"
-
-/** Required forward declaration
- */
-class InspIRCd;
-
/** A list of dll/so files containing the command handlers for the core
*/
typedef std::map<std::string, void*> SharedObjectList;
#ifndef __CTABLES_H__
#define __CTABLES_H__
-
-#include "inspircd_config.h"
-#include "hash_map.h"
-#include "base.h"
-
-/* Forward declarations - required */
-class User;
-class InspIRCd;
-
/** Used to indicate command success codes
*/
enum CmdResult
#ifndef _DNS_H
#define _DNS_H
-#include <string>
-#include "inspircd_config.h"
-#include "base.h"
-#include "socketengine.h"
#include "socket.h"
-#include "hash_map.h"
#include "hashcomp.h"
-using namespace std;
-using irc::sockets::insp_aton;
-using irc::sockets::insp_ntoa;
-using irc::sockets::insp_sockaddr;
-using irc::sockets::insp_inaddr;
-
-class InspIRCd;
class Module;
/**
* e.g. use ipv6 reverse lookup when built for ipv6,
* or ipv4 lookup when built for ipv4.
*/
- int GetName(const insp_inaddr* ip);
+ int GetName(const irc::sockets::insp_inaddr* ip);
/**
* Start lookup of a hostname from an ip, but
#ifndef __DLL_H
#define __DLL_H
-#include "inspircd_config.h"
-
/** The DLLManager class is able to load a module file by filename,
* and locate its init_module symbol.
*/
#ifndef __LOG_H__
#define __LOG_H__
-#include <time.h>
-#include <string>
-#include <sstream>
-#include "socketengine.h"
-
-
/** Debug levels for use with InspIRCd::Log()
* */
enum DebugLevel
#ifndef __WORLD_H
#define __WORLD_H
-#include <string>
-#include <deque>
-#include <map>
-#include <vector>
-
/** A cached text file stored with its contents as lines
*/
typedef std::deque<std::string> file_cache;
#ifndef INSPIRCD_HASHMAP_H
#define INSPIRCD_HASHMAP_H
-#include "inspircd_config.h"
-
/** Where hash_map is varies from compiler to compiler
* as it is not standard.
*/
#ifndef _HASHCOMP_H_
#define _HASHCOMP_H_
-#include "inspircd_config.h"
-#include "socket.h"
+//#include "inspircd_config.h"
+//#include "socket.h"
#include "hash_map.h"
/*******************************************************
* aware of irc::string.
*******************************************************/
-/** Required namespaces and symbols */
-using namespace std;
-
-/** aton() */
-using irc::sockets::insp_aton;
-
-/** nota() */
-using irc::sockets::insp_ntoa;
-
#ifndef LOWERMAP
#define LOWERMAP
/** A mapping of uppercase to lowercase, including scandinavian
/** This typedef declares irc::string based upon irc_char_traits.
*/
- typedef basic_string<char, irc_char_traits, allocator<char> > string;
+ typedef std::basic_string<char, irc_char_traits, std::allocator<char> > string;
/** irc::stringjoiner joins string lists into a string, using
* the given seperator string.
* @param s A string to hash
* @return The hash value
*/
- size_t operator()(const string &s) const;
+ size_t operator()(const std::string &s) const;
};
#endif
#include "uid.h"
#include "users.h"
#include "channels.h"
+#include "timer.h"
#include "hashcomp.h"
#include "typedefs.h"
#include "usermanager.h"
#include "socket.h"
+#include "ctables.h"
+#include "command_parse.h"
#include "mode.h"
#include "socketengine.h"
-#include "command_parse.h"
#include "snomasks.h"
#include "cull_list.h"
#include "filelogger.h"
#include "caller.h"
+//#include "inspsocket.h"
+#include "modules.h"
+#include "configreader.h"
+#include "inspstring.h"
/**
* Used to define the maximum number of parameters a command may have.
/** Used when connecting clients
*/
- insp_sockaddr client, server;
+ irc::sockets::insp_sockaddr client, server;
/** Used when connecting clients
*/
* @param LinePrefix text to prefix each complete line with
* @param TextStream the text to send to the user
*/
- void DumpText(User* User, const std::string &LinePrefix, stringstream &TextStream);
+ void DumpText(User* User, const std::string &LinePrefix, std::stringstream &TextStream);
/** Check if the given nickmask matches too many users, send errors to the given user
* @param nick A nickmask to match against
#ifndef __INSP_SOCKET_H__
#define __INSP_SOCKET_H__
-#include <sstream>
-#include <string>
-#include <deque>
-#include "dns.h"
-#include "inspircd_config.h"
-#include "socket.h"
-#include "inspsocket.h"
#include "timer.h"
/**
#ifndef __IN_INSPSTRING_H
#define __IN_INSPSTRING_H
+// This (inspircd_config) is needed as inspstring doesn't pull in the central header
#include "inspircd_config.h"
#include <string.h>
-#include <cstddef>
+//#include <cstddef>
#ifndef HAS_STRLCPY
/** strlcpy() implementation for systems that don't have it (linux) */
#ifndef __MODE_H
#define __MODE_H
-#include <string>
-#include <deque>
-#include <vector>
-#include "ctables.h"
-
-class InspIRCd;
-
/**
* Holds the values for different type of modes
* that can exist, USER or CHANNEL type.
#ifndef __SNOMASKS_H__
#define __SNOMASKS_H__
-#include <string>
-#include <vector>
-#include <map>
-#include "configreader.h"
-#include "inspircd.h"
-
class Snomask
{
private:
#endif
#include <errno.h>
-#include "inspircd_config.h"
#include "socketengine.h"
/* Contains irc-specific definitions */
#ifndef INSPIRCD_TIMER_H
#define INSPIRCD_TIMER_H
-class InspIRCd;
+//class InspIRCd;
/** Timer class for one-second resolution timers
* Timer provides a facility which allows module
#ifndef WIN32
/** User hash (POSIX systems with GCC)
*/
-typedef nspace::hash_map<std::string, User*, nspace::hash<string>, irc::StrHashComp> user_hash;
+typedef nspace::hash_map<std::string, User*, nspace::hash<std::string>, irc::StrHashComp> user_hash;
/** Channel hash (POSIX systems with GCC)
*/
-typedef nspace::hash_map<std::string, Channel*, nspace::hash<string>, irc::StrHashComp> chan_hash;
+typedef nspace::hash_map<std::string, Channel*, nspace::hash<std::string>, irc::StrHashComp> chan_hash;
#else
/** User hash (windows systems with visual studio)
*/
-typedef nspace::hash_map<std::string, User*, nspace::hash_compare<string, less<string> > > user_hash;
+typedef nspace::hash_map<std::string, User*, nspace::hash_compare<std::string, less<std::string> > > user_hash;
/** Channel hash (windows systems with visual studio)
*/
-typedef nspace::hash_map<std::string, Channel*, nspace::hash_compare<string, less<string> > > chan_hash;
+typedef nspace::hash_map<std::string, Channel*, nspace::hash_compare<std::string, less<std::string> > > chan_hash;
#endif
/** Server name cache
#ifndef INSPIRCD_LISTMODE_PROVIDER
#define INSPIRCD_LISTMODE_PROVIDER
-#include <stdio.h>
-#include <string>
-#include <sstream>
-#include <vector>
-#include "inspircd.h"
-#include "modules.h"
#include "wildcard.h"
/** Get the time as a string
#ifndef __USERS_H__
#define __USERS_H__
-#include <string>
-#include "inspircd_config.h"
#include "socket.h"
-#include "channels.h"
-#include "inspstring.h"
#include "connection.h"
-#include "hashcomp.h"
#include "dns.h"
/** Channel status for a user
};
/* Required forward declaration */
-class InspIRCd;
-
-/** Derived from Resolver, and performs user forward/reverse lookups.
- */
-class CoreExport UserResolver : public Resolver
-{
- private:
- /** User this class is 'attached' to.
- */
- User* bound_user;
- /** File descriptor teh lookup is bound to
- */
- int bound_fd;
- /** True if the lookup is forward, false if is a reverse lookup
- */
- bool fwd;
- public:
- /** Create a resolver.
- * @param Instance The creating instance
- * @param user The user to begin lookup on
- * @param to_resolve The IP or host to resolve
- * @param qt The query type
- * @param cache Modified by the constructor if the result was cached
- */
- UserResolver(InspIRCd* Instance, User* user, std::string to_resolve, QueryType qt, bool &cache);
-
- /** Called on successful lookup
- * @param result Result string
- * @param ttl Time to live for result
- * @param cached True if the result was found in the cache
- * @param resultnum Result number, we are only interested in result 0
- */
- void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached, int resultnum = 0);
-
- /** Called on failed lookup
- * @param e Error code
- * @param errormessage Error message string
- */
- void OnError(ResolverError e, const std::string &errormessage);
-};
-
+class Channel;
+class UserResolver;
/** Holds information relevent to <connect allow> and <connect deny> tags in the config file.
*/
virtual ~User();
};
+/** Derived from Resolver, and performs user forward/reverse lookups.
+ */
+class CoreExport UserResolver : public Resolver
+{
+ private:
+ /** User this class is 'attached' to.
+ */
+ User* bound_user;
+ /** File descriptor teh lookup is bound to
+ */
+ int bound_fd;
+ /** True if the lookup is forward, false if is a reverse lookup
+ */
+ bool fwd;
+ public:
+ /** Create a resolver.
+ * @param Instance The creating instance
+ * @param user The user to begin lookup on
+ * @param to_resolve The IP or host to resolve
+ * @param qt The query type
+ * @param cache Modified by the constructor if the result was cached
+ */
+ UserResolver(InspIRCd* Instance, User* user, std::string to_resolve, QueryType qt, bool &cache);
+
+ /** Called on successful lookup
+ * @param result Result string
+ * @param ttl Time to live for result
+ * @param cached True if the result was found in the cache
+ * @param resultnum Result number, we are only interested in result 0
+ */
+ void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached, int resultnum = 0);
+
+ /** Called on failed lookup
+ * @param e Error code
+ * @param errormessage Error message string
+ */
+ void OnError(ResolverError e, const std::string &errormessage);
+};
+
/* Configuration callbacks */
-class ServerConfig;
+//class ServerConfig;
#endif
* ---------------------------------------------------
*/
-#include "inspircd_config.h"
-
/** Match a string against a mask.
* @param str The string to check
* @param mask the mask to check against
#ifndef __XLINE_H
#define __XLINE_H
-#include <string>
-#include <deque>
-#include <vector>
+//#include <string>
+//#include <deque>
+//#include <vector>
/** XLine is the base class for ban lines such as G lines and K lines.
* Modules may derive from this, and their xlines will automatically be
std::string nameserver;
// attempt to look up their nameserver from /etc/resolv.conf
conf->GetInstance()->Log(DEFAULT,"WARNING: <dns:server> not defined, attempting to find working server in /etc/resolv.conf...");
- ifstream resolv("/etc/resolv.conf");
+ std::ifstream resolv("/etc/resolv.conf");
bool found_server = false;
if (resolv.is_open())
*
******************************************************/
-using namespace irc::sockets;
-
/* convert a string to lowercase. Note following special circumstances
* taken from RFC 1459. Many "official" server branches still hold to this
* rule so i will too;
}
#ifndef WIN32
-size_t nspace::hash<string>::operator()(const string &s) const
+size_t nspace::hash<std::string>::operator()(const std::string &s) const
#else
-size_t nspace::hash_compare<string, std::less<string> >::operator()(const string &s) const
+size_t nspace::hash_compare<string, std::less<std::string> >::operator()(const std::string &s) const
#endif
{
/* XXX: NO DATA COPIES! :)
this->Modes->Process(parameters,pcnt,user,true);
}
-void InspIRCd::DumpText(User* User, const std::string &LinePrefix, stringstream &TextStream)
+void InspIRCd::DumpText(User* User, const std::string &LinePrefix, std::stringstream &TextStream)
{
std::string CompleteLine = LinePrefix;
std::string Word;
int delta = ServerInstance->GetTimeDelta();
- string msg = ":" + string(ServerInstance->Config->ServerName) + " NOTICE " + user->nick + " :System time for " +
+ std::string msg = ":" + std::string(ServerInstance->Config->ServerName) + " NOTICE " + user->nick + " :System time for " +
ServerInstance->Config->ServerName + " is: " + fmtdate + " (delta " + ConvToStr(delta) + " seconds): Time with delta: "+ fmtdate2;
if (IS_LOCAL(user))
}
else
{
- deque<string> params;
+ std::deque<std::string> params;
params.push_back(user->nick);
params.push_back(msg);
Event ev((char *) ¶ms, NULL, "send_push");
std::vector<std::string> Joinchans;
- int tokenize(const string &str, std::vector<std::string> &tokens)
+ int tokenize(const std::string &str, std::vector<std::string> &tokens)
{
// skip delimiters at beginning.
- string::size_type lastPos = str.find_first_not_of(",", 0);
+ std::string::size_type lastPos = str.find_first_not_of(",", 0);
// find first "non-delimiter".
- string::size_type pos = str.find_first_of(",", lastPos);
+ std::string::size_type pos = str.find_first_of(",", lastPos);
- while (string::npos != pos || string::npos != lastPos)
+ while (std::string::npos != pos || std::string::npos != lastPos)
{
// found a token, add it to the vector.
tokens.push_back(str.substr(lastPos, pos - lastPos));
if (!ThisModes.empty())
{
std::string buf;
- stringstream ss(ThisModes);
+ std::stringstream ss(ThisModes);
- vector<string> tokens;
+ std::vector<std::string> tokens;
// split ThisUserModes into modes and mode params
while (ss >> buf)
if (!deaf_bypasschars.empty())
{
is_bypasschar_avail = 1;
- if (deaf_bypasschars.find(text[0], 0) != string::npos)
+ if (deaf_bypasschars.find(text[0], 0) != std::string::npos)
is_bypasschar = 1;
}
if (!deaf_bypasschars_uline.empty())
{
is_bypasschar_uline_avail = 1;
- if (deaf_bypasschars_uline.find(text[0], 0) != string::npos)
+ if (deaf_bypasschars_uline.find(text[0], 0) != std::string::npos)
is_bypasschar_uline = 1;
}
void FilterBase::OnRehash(User* user, const std::string ¶meter)
{
ConfigReader* MyConf = new ConfigReader(ServerInstance);
- vector<std::string>().swap(exemptfromfilter);
+ std::vector<std::string>().swap(exemptfromfilter);
for (int index = 0; index < MyConf->Enumerate("exemptfromfilter"); ++index)
{
std::string chan = MyConf->ReadValue("exemptfromfilter", "channel", index);
HTTPSocket *socket;
std::string orig;
public:
- HTTPResolver(HTTPSocket *s, InspIRCd *Instance, const string &hostname, bool &cached, Module* me) : Resolver(Instance, hostname, DNS_QUERY_FORWARD, cached, me), socket(s)
+ HTTPResolver(HTTPSocket *s, InspIRCd *Instance, const std::string &hostname, bool &cached, Module* me) : Resolver(Instance, hostname, DNS_QUERY_FORWARD, cached, me), socket(s)
{
ServerInstance->Log(DEBUG,">>>>>>>>>>>>>>>>>> HTTPResolver::HTTPResolver <<<<<<<<<<<<<<<");
orig = hostname;
}
- void OnLookupComplete(const string &result, unsigned int ttl, bool cached, int resultnum = 0)
+ void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached, int resultnum = 0)
{
ServerInstance->Log(DEBUG,"************* HTTPResolver::OnLookupComplete ***************");
if (!resultnum)
socket->OnClose();
}
- void OnError(ResolverError e, const string &errmsg)
+ void OnError(ResolverError e, const std::string &errmsg)
{
ServerInstance->Log(DEBUG,"!!!!!!!!!!!!!!!! HTTPResolver::OnError: %s", errmsg.c_str());
socket->OnClose();
}
};
-typedef vector<HTTPSocket*> HTTPList;
+typedef std::vector<HTTPSocket*> HTTPList;
class ModuleHTTPClient : public Module
{
return true;
}
-void HTTPSocket::Connect(const string &ip)
+void HTTPSocket::Connect(const std::string &ip)
{
this->response = new HTTPClientResponse((Module*)Mod, req.GetSource() , url.url, 0, "");
std::string operChan;
std::vector<std::string> operChans;
- int tokenize(const string &str, std::vector<std::string> &tokens)
+ int tokenize(const std::string &str, std::vector<std::string> &tokens)
{
// skip delimiters at beginning.
- string::size_type lastPos = str.find_first_not_of(",", 0);
+ std::string::size_type lastPos = str.find_first_not_of(",", 0);
// find first "non-delimiter".
- string::size_type pos = str.find_first_of(",", lastPos);
+ std::string::size_type pos = str.find_first_of(",", lastPos);
- while (string::npos != pos || string::npos != lastPos)
+ while (std::string::npos != pos || std::string::npos != lastPos)
{
// found a token, add it to the vector.
tokens.push_back(str.substr(lastPos, pos - lastPos));
smodes = "+" + smodes;
std::string buf;
- stringstream ss(smodes);
- vector<string> tokens;
+ std::stringstream ss(smodes);
+ std::vector<std::string> tokens;
// split into modes and mode params
while (ss >> buf)
found = (std::find(Utils->ValidIPs.begin(), Utils->ValidIPs.end(), ip) != Utils->ValidIPs.end());
if (!found)
{
- for (vector<std::string>::iterator i = Utils->ValidIPs.begin(); i != Utils->ValidIPs.end(); i++)
+ for (std::vector<std::string>::iterator i = Utils->ValidIPs.begin(); i != Utils->ValidIPs.end(); i++)
if (irc::sockets::MatchCIDR(ip, (*i).c_str()))
found = true;
* tree, used for rapid linear lookups.
*/
#ifdef WINDOWS
-typedef nspace::hash_map<std::string, TreeServer*, nspace::hash_compare<string, less<string> > > server_hash;
+typedef nspace::hash_map<std::string, TreeServer*, nspace::hash_compare<std::string, less<string> > > server_hash;
#else
-typedef nspace::hash_map<std::string, TreeServer*, nspace::hash<string>, irc::StrHashComp> server_hash;
+typedef nspace::hash_map<std::string, TreeServer*, nspace::hash<std::string>, irc::StrHashComp> server_hash;
#endif
typedef std::map<TreeServer*,TreeServer*> TreeServerList;
if(**itr == servername)
return;
- string * ns = new string(servername);
+ std::string * ns = new std::string(servername);
servernames.push_back(ns);
}
if(**itr == servername)
return (*itr)->c_str();
- servernames.push_back(new string(servername));
+ servernames.push_back(new std::string(servername));
itr = --servernames.end();
return (*itr)->c_str();
}