summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure4
-rw-r--r--include/base.h6
-rw-r--r--include/channels.h2
-rw-r--r--include/command_parse.h2
-rw-r--r--include/commands/cmd_stats.h2
-rw-r--r--include/commands/cmd_whois.h2
-rw-r--r--include/commands/cmd_whowas.h8
-rw-r--r--include/configreader.h4
-rw-r--r--include/connection.h2
-rw-r--r--include/ctables.h2
-rw-r--r--include/cull_list.h4
-rw-r--r--include/dns.h16
-rw-r--r--include/dynamic.h6
-rw-r--r--include/exitcodes.h20
-rw-r--r--include/hash_map.h6
-rw-r--r--include/hashcomp.h145
-rw-r--r--include/inspircd.h14
-rw-r--r--include/inspsocket.h4
-rw-r--r--include/inspstring.h16
-rw-r--r--include/mode.h6
-rw-r--r--include/modules.h25
-rw-r--r--include/snomasks.h2
-rw-r--r--include/socket.h36
-rw-r--r--include/socketengine.h23
-rw-r--r--include/timer.h4
-rw-r--r--include/typedefs.h7
-rw-r--r--include/users.h12
-rw-r--r--include/wildcard.h8
-rw-r--r--include/xline.h14
-rw-r--r--src/cmd_admin.cpp2
-rw-r--r--src/cmd_away.cpp2
-rw-r--r--src/cmd_clearcache.cpp2
-rw-r--r--src/cmd_commands.cpp2
-rw-r--r--src/cmd_connect.cpp2
-rw-r--r--src/cmd_die.cpp2
-rw-r--r--src/cmd_eline.cpp2
-rw-r--r--src/cmd_gline.cpp2
-rw-r--r--src/cmd_info.cpp4
-rw-r--r--src/cmd_invite.cpp2
-rw-r--r--src/cmd_ison.cpp2
-rw-r--r--src/cmd_join.cpp2
-rw-r--r--src/cmd_kick.cpp2
-rw-r--r--src/cmd_kill.cpp2
-rw-r--r--src/cmd_kline.cpp2
-rw-r--r--src/cmd_links.cpp2
-rw-r--r--src/cmd_list.cpp2
-rw-r--r--src/cmd_loadmodule.cpp2
-rw-r--r--src/cmd_lusers.cpp2
-rw-r--r--src/cmd_map.cpp2
-rw-r--r--src/cmd_mode.cpp2
-rw-r--r--src/cmd_modules.cpp2
-rw-r--r--src/cmd_motd.cpp2
-rw-r--r--src/cmd_names.cpp2
-rw-r--r--src/cmd_nick.cpp2
-rw-r--r--src/cmd_notice.cpp2
-rw-r--r--src/cmd_oper.cpp2
-rw-r--r--src/cmd_part.cpp2
-rw-r--r--src/cmd_pass.cpp2
-rw-r--r--src/cmd_ping.cpp2
-rw-r--r--src/cmd_pong.cpp2
-rw-r--r--src/cmd_privmsg.cpp2
-rw-r--r--src/cmd_qline.cpp2
-rw-r--r--src/cmd_quit.cpp2
-rw-r--r--src/cmd_rehash.cpp2
-rw-r--r--src/cmd_reloadmodule.cpp2
-rw-r--r--src/cmd_restart.cpp2
-rw-r--r--src/cmd_rules.cpp2
-rw-r--r--src/cmd_server.cpp2
-rw-r--r--src/cmd_squit.cpp2
-rw-r--r--src/cmd_stats.cpp20
-rw-r--r--src/cmd_summon.cpp2
-rw-r--r--src/cmd_time.cpp2
-rw-r--r--src/cmd_topic.cpp4
-rw-r--r--src/cmd_trace.cpp2
-rw-r--r--src/cmd_unloadmodule.cpp2
-rw-r--r--src/cmd_user.cpp2
-rw-r--r--src/cmd_userhost.cpp2
-rw-r--r--src/cmd_users.cpp2
-rw-r--r--src/cmd_version.cpp2
-rw-r--r--src/cmd_wallops.cpp2
-rw-r--r--src/cmd_who.cpp2
-rw-r--r--src/cmd_whois.cpp2
-rw-r--r--src/cmd_whowas.cpp8
-rw-r--r--src/cmd_zline.cpp2
-rw-r--r--src/command_parse.cpp8
-rw-r--r--src/configreader.cpp5
-rw-r--r--src/dns.cpp18
-rw-r--r--src/dynamic.cpp3
-rw-r--r--src/hashcomp.cpp76
-rw-r--r--src/helperfuncs.cpp6
-rw-r--r--src/inspircd.cpp160
-rw-r--r--src/inspsocket.cpp32
-rw-r--r--src/inspstring.cpp9
-rw-r--r--src/modules.cpp2
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp10
-rw-r--r--src/modules/extra/m_ssl_openssl.cpp15
-rw-r--r--src/modules/m_alias.cpp4
-rw-r--r--src/modules/m_alltime.cpp4
-rw-r--r--src/modules/m_antibear.cpp4
-rw-r--r--src/modules/m_antibottler.cpp4
-rw-r--r--src/modules/m_auditorium.cpp4
-rw-r--r--src/modules/m_banexception.cpp4
-rw-r--r--src/modules/m_banredirect.cpp4
-rw-r--r--src/modules/m_blockamsg.cpp4
-rw-r--r--src/modules/m_blockcaps.cpp4
-rw-r--r--src/modules/m_blockcolor.cpp4
-rw-r--r--src/modules/m_botmode.cpp4
-rw-r--r--src/modules/m_cban.cpp4
-rw-r--r--src/modules/m_censor.cpp4
-rw-r--r--src/modules/m_cgiirc.cpp12
-rw-r--r--src/modules/m_chancreate.cpp4
-rw-r--r--src/modules/m_chanfilter.cpp4
-rw-r--r--src/modules/m_chanprotect.cpp4
-rw-r--r--src/modules/m_check.cpp4
-rw-r--r--src/modules/m_chghost.cpp4
-rw-r--r--src/modules/m_chgident.cpp4
-rw-r--r--src/modules/m_cloaking.cpp4
-rw-r--r--src/modules/m_clones.cpp4
-rw-r--r--src/modules/m_conn_join.cpp4
-rw-r--r--src/modules/m_conn_umodes.cpp7
-rw-r--r--src/modules/m_conn_waitpong.cpp4
-rw-r--r--src/modules/m_connflood.cpp4
-rw-r--r--src/modules/m_dccallow.cpp4
-rw-r--r--src/modules/m_deaf.cpp4
-rw-r--r--src/modules/m_denychans.cpp4
-rw-r--r--src/modules/m_devoice.cpp4
-rw-r--r--src/modules/m_dnsbl.cpp17
-rw-r--r--src/modules/m_filter.cpp4
-rw-r--r--src/modules/m_filter.h2
-rw-r--r--src/modules/m_foobar.cpp4
-rw-r--r--src/modules/m_globalload.cpp4
-rw-r--r--src/modules/m_globops.cpp4
-rw-r--r--src/modules/m_helpop.cpp4
-rw-r--r--src/modules/m_hidechans.cpp4
-rw-r--r--src/modules/m_hideoper.cpp4
-rw-r--r--src/modules/m_hostchange.cpp4
-rw-r--r--src/modules/m_http_client.cpp4
-rw-r--r--src/modules/m_httpd.cpp4
-rw-r--r--src/modules/m_httpd_stats.cpp4
-rw-r--r--src/modules/m_ident.cpp4
-rw-r--r--src/modules/m_invisible.cpp4
-rw-r--r--src/modules/m_inviteexception.cpp2
-rw-r--r--src/modules/m_joinflood.cpp4
-rw-r--r--src/modules/m_jumpserver.cpp4
-rw-r--r--src/modules/m_kicknorejoin.cpp4
-rw-r--r--src/modules/m_knock.cpp4
-rw-r--r--src/modules/m_lockserv.cpp4
-rw-r--r--src/modules/m_md5.cpp4
-rw-r--r--src/modules/m_messageflood.cpp4
-rw-r--r--src/modules/m_namesx.cpp4
-rw-r--r--src/modules/m_nicklock.cpp4
-rw-r--r--src/modules/m_noctcp.cpp4
-rw-r--r--src/modules/m_noinvite.cpp4
-rw-r--r--src/modules/m_nokicks.cpp4
-rw-r--r--src/modules/m_nonicks.cpp4
-rw-r--r--src/modules/m_nonotice.cpp4
-rw-r--r--src/modules/m_oper_hash.cpp4
-rw-r--r--src/modules/m_operchans.cpp4
-rw-r--r--src/modules/m_operjoin.cpp4
-rw-r--r--src/modules/m_operlevels.cpp4
-rw-r--r--src/modules/m_operlog.cpp4
-rw-r--r--src/modules/m_opermodes.cpp9
-rw-r--r--src/modules/m_opermotd.cpp4
-rw-r--r--src/modules/m_override.cpp4
-rw-r--r--src/modules/m_randquote.cpp4
-rw-r--r--src/modules/m_redirect.cpp4
-rw-r--r--src/modules/m_regonlycreate.cpp4
-rw-r--r--src/modules/m_remove.cpp4
-rw-r--r--src/modules/m_restrictbanned.cpp4
-rw-r--r--src/modules/m_restrictchans.cpp4
-rw-r--r--src/modules/m_restrictmsg.cpp4
-rw-r--r--src/modules/m_safelist.cpp4
-rw-r--r--src/modules/m_sajoin.cpp4
-rw-r--r--src/modules/m_samode.cpp4
-rw-r--r--src/modules/m_sanick.cpp4
-rw-r--r--src/modules/m_sapart.cpp4
-rw-r--r--src/modules/m_saquit.cpp4
-rw-r--r--src/modules/m_securelist.cpp4
-rw-r--r--src/modules/m_seenicks.cpp4
-rw-r--r--src/modules/m_services.cpp4
-rw-r--r--src/modules/m_services_account.cpp4
-rw-r--r--src/modules/m_sethost.cpp4
-rw-r--r--src/modules/m_setident.cpp4
-rw-r--r--src/modules/m_setidle.cpp4
-rw-r--r--src/modules/m_setname.cpp4
-rw-r--r--src/modules/m_sha256.cpp14
-rw-r--r--src/modules/m_showwhois.cpp4
-rw-r--r--src/modules/m_silence.cpp4
-rw-r--r--src/modules/m_silence_ext.cpp4
-rw-r--r--src/modules/m_spanningtree/main.cpp4
-rw-r--r--src/modules/m_spanningtree/treesocket1.cpp6
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp16
-rw-r--r--src/modules/m_spanningtree/utils.h4
-rw-r--r--src/modules/m_spy.cpp4
-rw-r--r--src/modules/m_ssl_dummy.cpp4
-rw-r--r--src/modules/m_sslmodes.cpp4
-rw-r--r--src/modules/m_stripcolor.cpp4
-rw-r--r--src/modules/m_svshold.cpp4
-rw-r--r--src/modules/m_swhois.cpp4
-rw-r--r--src/modules/m_taxonomy.cpp4
-rw-r--r--src/modules/m_testcommand.cpp4
-rw-r--r--src/modules/m_timedbans.cpp4
-rw-r--r--src/modules/m_tline.cpp4
-rw-r--r--src/modules/m_uhnames.cpp4
-rw-r--r--src/modules/m_uninvite.cpp4
-rw-r--r--src/modules/m_userip.cpp4
-rw-r--r--src/modules/m_vhost.cpp4
-rw-r--r--src/modules/m_watch.cpp8
-rw-r--r--src/modules/m_xmlsocket.cpp7
-rw-r--r--src/socket.cpp24
-rw-r--r--src/socketengine.cpp2
-rw-r--r--src/users.cpp20
-rw-r--r--src/wildcard.cpp10
213 files changed, 872 insertions, 576 deletions
diff --git a/configure b/configure
index 57eeb61ba..e1bcc153d 100755
--- a/configure
+++ b/configure
@@ -965,6 +965,10 @@ sub writefiles {
#ifndef __CONFIGURATION_AUTO__
#define __CONFIGURATION_AUTO__
+/* this is for windows support. */
+#define CoreExport /**/
+#define DllExport /**/
+
#define CONFIG_FILE "$config{CONFIG_DIR}/inspircd.conf"
#define MOD_PATH "$config{MODULE_DIR}"
#define VERSION "$version"
diff --git a/include/base.h b/include/base.h
index bea7075a0..2259953b8 100644
--- a/include/base.h
+++ b/include/base.h
@@ -27,7 +27,7 @@ class InspIRCd;
/** The base class for all inspircd classes
*/
-class classbase
+class CoreExport classbase
{
public:
/** Time that the object was instantiated (used for TS calculation etc)
@@ -48,7 +48,7 @@ class classbase
* a flags variable, and each module defining bits within the flag as 'theirs' as it is less prone to conflict and
* supports arbitary data storage).
*/
-class Extensible : public classbase
+class CoreExport Extensible : public classbase
{
/** Private data store
*/
@@ -153,7 +153,7 @@ public:
* Use BoolSet::Set and BoolSet::Get to set and get bools in the bitmask,
* and Unset and Invert for special operations upon them.
*/
-class BoolSet : public classbase
+class CoreExport BoolSet : public classbase
{
char bits;
diff --git a/include/channels.h b/include/channels.h
index f68f83889..8cee75b9c 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -110,7 +110,7 @@ typedef std::map<userrec*, std::vector<prefixtype> > prefixlist;
* This class represents a channel, and contains its name, modes, time created, topic, topic set time,
* etc, and an instance of the BanList type.
*/
-class chanrec : public Extensible
+class CoreExport chanrec : public Extensible
{
private:
diff --git a/include/command_parse.h b/include/command_parse.h
index 5750416db..2ffb30ee6 100644
--- a/include/command_parse.h
+++ b/include/command_parse.h
@@ -28,7 +28,7 @@ typedef std::map<std::string, void*> SharedObjectList;
* call command handlers by name, and chop up comma seperated
* parameters into multiple calls.
*/
-class CommandParser : public classbase
+class CoreExport CommandParser : public classbase
{
private:
/** The creator of this class
diff --git a/include/commands/cmd_stats.h b/include/commands/cmd_stats.h
index 6b090ef60..0aa98e359 100644
--- a/include/commands/cmd_stats.h
+++ b/include/commands/cmd_stats.h
@@ -23,7 +23,7 @@
#include "users.h"
#include "channels.h"
-void DoStats(InspIRCd* Instance, char statschar, userrec* user, string_list &results);
+DllExport void DoStats(InspIRCd* Instance, char statschar, userrec* user, string_list &results);
/** Handle /STATS
*/
diff --git a/include/commands/cmd_whois.h b/include/commands/cmd_whois.h
index ab6778877..cd1f75c51 100644
--- a/include/commands/cmd_whois.h
+++ b/include/commands/cmd_whois.h
@@ -23,7 +23,7 @@
#include "channels.h"
const char* Spacify(char* n);
-void do_whois(InspIRCd* Instance, userrec* user, userrec* dest,unsigned long signon, unsigned long idle, const char* nick);
+DllExport void do_whois(InspIRCd* Instance, userrec* user, userrec* dest,unsigned long signon, unsigned long idle, const char* nick);
/** Handle /WHOIS
*/
diff --git a/include/commands/cmd_whowas.h b/include/commands/cmd_whowas.h
index ccbe40493..8b31c3e7a 100644
--- a/include/commands/cmd_whowas.h
+++ b/include/commands/cmd_whowas.h
@@ -33,14 +33,14 @@ enum Internals
};
/* Forward ref for timer */
-class MaintainTimer;
+class WhoWasMaintainTimer;
/* Forward ref for typedefs */
class WhoWasGroup;
/** InspTimer that is used to maintain the whowas list, called once an hour
*/
-MaintainTimer* timer;
+extern WhoWasMaintainTimer* timer;
/** A group of users related by nickname
*/
@@ -110,12 +110,12 @@ class WhoWasGroup : public classbase
~WhoWasGroup();
};
-class MaintainTimer : public InspTimer
+class WhoWasMaintainTimer : public InspTimer
{
private:
InspIRCd* ServerInstance;
public:
- MaintainTimer(InspIRCd* Instance, long interval)
+ WhoWasMaintainTimer(InspIRCd* Instance, long interval)
: InspTimer(interval, Instance->Time(), true), ServerInstance(Instance)
{
}
diff --git a/include/configreader.h b/include/configreader.h
index 772de2177..096d1843a 100644
--- a/include/configreader.h
+++ b/include/configreader.h
@@ -180,7 +180,7 @@ typedef std::map<irc::string,char*> operclass_t;
* and storage of the configuration data needed to run the ircd, such as
* the servername, connect classes, /ADMIN data, MOTDs and filenames etc.
*/
-class ServerConfig : public Extensible
+class CoreExport ServerConfig : public Extensible
{
private:
/** Creator/owner
@@ -663,7 +663,7 @@ class ServerConfig : public Extensible
};
-bool InitializeDisabledCommands(const char* data, InspIRCd* ServerInstance);
+CoreExport bool InitializeDisabledCommands(const char* data, InspIRCd* ServerInstance);
bool InitTypes(ServerConfig* conf, const char* tag);
bool InitClasses(ServerConfig* conf, const char* tag);
diff --git a/include/connection.h b/include/connection.h
index 5f72fbde0..65d342447 100644
--- a/include/connection.h
+++ b/include/connection.h
@@ -22,7 +22,7 @@
/** connection is the base class of userrec, and holds basic user properties.
* This can be extended for holding other user-like objects in the future.
*/
-class connection : public EventHandler
+class CoreExport connection : public EventHandler
{
public:
/** Hostname of connection.
diff --git a/include/ctables.h b/include/ctables.h
index 92a0659af..affef58d9 100644
--- a/include/ctables.h
+++ b/include/ctables.h
@@ -44,7 +44,7 @@ enum CmdResult
/** A structure that defines a command. Every command available
* in InspIRCd must be defined as derived from command_t.
*/
-class command_t : public Extensible
+class CoreExport command_t : public Extensible
{
protected:
/** Owner/Creator object
diff --git a/include/cull_list.h b/include/cull_list.h
index bea75c86d..8901c5ea4 100644
--- a/include/cull_list.h
+++ b/include/cull_list.h
@@ -29,7 +29,7 @@ class InspIRCd;
* a list of users which are to be culled when a long
* operation (such as a netsplit) has completed.
*/
-class CullItem : public classbase
+class CoreExport CullItem : public classbase
{
private:
/** Holds a pointer to the user,
@@ -84,7 +84,7 @@ class CullItem : public classbase
* you attempt to add the same user twice, then the second
* attempt will be ignored.
*/
-class CullList : public classbase
+class CoreExport CullList : public classbase
{
private:
/** Creator of this CullList
diff --git a/include/dns.h b/include/dns.h
index f12dbdb1e..d823a04a8 100644
--- a/include/dns.h
+++ b/include/dns.h
@@ -52,7 +52,7 @@ class Module;
/**
* Result status, used internally
*/
-class DNSResult : public classbase
+class CoreExport DNSResult : public classbase
{
public:
/** Result ID
@@ -84,7 +84,7 @@ typedef std::pair<unsigned char*, std::string> DNSInfo;
/** Cached item stored in the query cache.
*/
-class CachedQuery
+class CoreExport CachedQuery
{
public:
/** The cached result data, an IP or hostname
@@ -108,14 +108,18 @@ class CachedQuery
*/
int CalcTTLRemaining()
{
- int n = expires - time(NULL);
+ int n = (int)expires - (int)time(NULL);
return (n < 0 ? 0 : n);
}
};
/** DNS cache information. Holds IPs mapped to hostnames, and hostnames mapped to IPs.
*/
+#ifndef WIN32
typedef nspace::hash_map<irc::string, CachedQuery, nspace::hash<irc::string> > dnscache;
+#else
+typedef nspace::hash_map<irc::string, CachedQuery, nspace::hash_compare<irc::string> > dnscache;
+#endif
/**
* Error types that class Resolver can emit to its error method.
@@ -144,7 +148,7 @@ class DNSHeader;
/**
* A DNS Resource Record (rr)
*/
-class ResourceRecord;
+struct ResourceRecord;
/**
* Query and resource record types
@@ -189,7 +193,7 @@ enum ForceProtocol
* can occur by calling virtual methods, one is a success situation, and the other
* an error situation.
*/
-class Resolver : public Extensible
+class CoreExport Resolver : public Extensible
{
protected:
/**
@@ -319,7 +323,7 @@ class Resolver : public Extensible
* back to Resolver objects, based upon the request ID. You
* should never use this class yourself.
*/
-class DNS : public EventHandler
+class CoreExport DNS : public EventHandler
{
private:
diff --git a/include/dynamic.h b/include/dynamic.h
index f2efce0f0..e4d1b4a05 100644
--- a/include/dynamic.h
+++ b/include/dynamic.h
@@ -27,7 +27,7 @@ class InspIRCd;
/** The DLLManager class is able to load a module file by filename,
* and locate its init_module symbol.
*/
-class DLLManager
+class CoreExport DLLManager
{
public:
/** This constructor loads the module using dlopen()
@@ -82,7 +82,7 @@ class DLLManager
/** This class is a specialized form of DLLManager designed to load InspIRCd modules.
* It's job is to call the init_module function and receive a factory pointer.
*/
-class DLLFactoryBase : public DLLManager
+class CoreExport DLLFactoryBase : public DLLManager
{
public:
/** Default constructor.
@@ -111,7 +111,7 @@ class DLLFactoryBase : public DLLManager
* This template is a container for ModuleFactory itself, so that it may 'plug' into ModuleFactory
* and provide module loading capabilities transparently.
*/
-template <class T> class DLLFactory : public DLLFactoryBase
+template <class T> class CoreExport DLLFactory : public DLLFactoryBase
{
public:
/** Default constructor.
diff --git a/include/exitcodes.h b/include/exitcodes.h
index 65329c47c..692e731e0 100644
--- a/include/exitcodes.h
+++ b/include/exitcodes.h
@@ -38,24 +38,6 @@ enum ExitStatus
/** Array that maps exit codes (ExitStatus types) to
* human-readable strings to be shown on shutdown.
*/
-const char* ExitCodes[] =
-{
- "No error", /* 0 */
- "DIE command", /* 1 */
- "execv() failed", /* 2 */
- "Internal error", /* 3 */
- "Config file error", /* 4 */
- "Logfile error", /* 5 */
- "Fork failed", /* 6 */
- "Bad commandline parameters", /* 7 */
- "No ports could be bound", /* 8 */
- "Can't write PID file", /* 9 */
- "SocketEngine could not initialize", /* 10 */
- "Refusing to start up as root", /* 11 */
- "Found a <die> tag!", /* 12 */
- "Couldn't load module on startup", /* 13 */
- "", /* 14 */
- "Received SIGTERM", /* 15 */
-};
+extern const char * ExitCodes[];
#endif
diff --git a/include/hash_map.h b/include/hash_map.h
index 01646d71a..ad38d426a 100644
--- a/include/hash_map.h
+++ b/include/hash_map.h
@@ -16,7 +16,13 @@
#include "inspircd_config.h"
+#ifndef WIN32
#include <ext/hash_map>
#define nspace __gnu_cxx
+#else
+#include <hash_map>
+#define nspace stdext
+using stdext::hash_map;
+#endif
#endif
diff --git a/include/hashcomp.h b/include/hashcomp.h
index b903f7748..aa3504994 100644
--- a/include/hashcomp.h
+++ b/include/hashcomp.h
@@ -58,28 +58,6 @@ unsigned const char lowermap[256] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
};
#endif
-/** Because of weirdness in g++, before 3.x this was namespace std. It's now __gnu_cxx.
- * This is a #define'd alias.
- */
-namespace nspace
-{
- /** Convert a string to lower case respecting RFC1459
- * @param n A string to lowercase
- */
- void strlower(char *n);
-
- /** Hashing function to hash std::string without respect to case
- */
- template<> struct hash<std::string>
- {
- /** Hash a std::string using RFC1459 case sensitivity rules
- * @param s A string to hash
- * @return The hash value
- */
- size_t operator()(const string &s) const;
- };
-}
-
/** The irc namespace contains a number of helper classes.
*/
namespace irc
@@ -103,7 +81,7 @@ namespace irc
* std::string, or a const char** array, using overloaded
* constructors.
*/
- class stringjoiner
+ class CoreExport stringjoiner
{
private:
/** Output string
@@ -142,7 +120,7 @@ namespace irc
* It can then reproduce this list, clamped to a maximum of MAXMODES
* values per line.
*/
- class modestacker
+ class CoreExport modestacker
{
private:
/** The mode sequence and its parameters
@@ -213,7 +191,7 @@ namespace irc
* list will be ":item". This is to allow for parsing 'source' fields
* from data.
*/
- class tokenstream
+ class CoreExport tokenstream
{
private:
/** Original string
@@ -245,7 +223,7 @@ namespace irc
* the next token, until none remain, at which point the method returns
* an empty string.
*/
- class sepstream : public classbase
+ class CoreExport sepstream : public classbase
{
private:
/** Original string
@@ -284,7 +262,7 @@ namespace irc
/** A derived form of sepstream, which seperates on commas
*/
- class commasepstream : public sepstream
+ class CoreExport commasepstream : public sepstream
{
public:
commasepstream(const std::string &source) : sepstream(source, ',')
@@ -294,7 +272,7 @@ namespace irc
/** A derived form of sepstream, which seperates on spaces
*/
- class spacesepstream : public sepstream
+ class CoreExport spacesepstream : public sepstream
{
public:
spacesepstream(const std::string &source) : sepstream(source, ' ')
@@ -310,7 +288,7 @@ namespace irc
* start or end < 0) then GetToken() will return the first element
* of the pair of numbers.
*/
- class portparser : public classbase
+ class CoreExport portparser : public classbase
{
private:
/** Used to split on commas
@@ -414,7 +392,7 @@ namespace irc
* };
* \endcode
*/
- class dynamicbitmask : public classbase
+ class CoreExport dynamicbitmask : public classbase
{
private:
/** Data bits. We start with four of these,
@@ -503,48 +481,129 @@ namespace irc
/** Compare two strings of size n
*/
- static int compare(const char* str1, const char* str2, size_t n);
+ static CoreExport int compare(const char* str1, const char* str2, size_t n);
/** Find a char within a string up to position n
*/
- static const char* find(const char* s1, int n, char c);
+ static CoreExport const char* find(const char* s1, int n, char c);
};
- std::string hex(const unsigned char *raw, size_t rawsz);
+ CoreExport std::string hex(const unsigned char *raw, size_t rawsz);
/** This typedef declares irc::string based upon irc_char_traits
*/
typedef basic_string<char, irc_char_traits, allocator<char> > string;
- const char* Spacify(const char* n);
+ CoreExport const char* Spacify(const char* n);
}
/* Define operators for using >> and << with irc::string to an ostream on an istream. */
/* This was endless fun. No. Really. */
/* It was also the first core change Ommeh made, if anyone cares */
-std::ostream& operator<<(std::ostream &os, const irc::string &str);
-std::istream& operator>>(std::istream &is, irc::string &str);
+inline std::ostream& operator<<(std::ostream &os, const irc::string &str) { return os << str.c_str(); }
+inline std::istream& operator>>(std::istream &is, irc::string &str)
+{
+ std::string tmp;
+ is >> tmp;
+ str = tmp.c_str();
+ return is;
+}
/* Define operators for + and == with irc::string to std::string for easy assignment
* and comparison - Brain
*/
-std::string operator+ (std::string& leftval, irc::string& rightval);
-irc::string operator+ (irc::string& leftval, std::string& rightval);
-bool operator== (const std::string& leftval, const irc::string& rightval);
-bool operator== (const irc::string& leftval, const std::string& rightval);
+inline std::string operator+ (std::string& leftval, irc::string& rightval)
+{
+ return leftval + std::string(rightval.c_str());
+}
+
+inline irc::string operator+ (irc::string& leftval, std::string& rightval)
+{
+ return leftval + irc::string(rightval.c_str());
+}
+
+inline bool operator== (const std::string& leftval, const irc::string& rightval)
+{
+ return (leftval.c_str() == rightval);
+}
+
+inline bool operator== (const irc::string& leftval, const std::string& rightval)
+{
+ return (leftval == rightval.c_str());
+}
+
+inline std::string assign(const irc::string &other) { return other.c_str(); }
+inline irc::string assign(const std::string &other) { return other.c_str(); }
+inline std::string& trim(std::string &str)
+{
+ std::string::size_type start = str.find_first_not_of(" ");
+ std::string::size_type end = str.find_last_not_of(" ");
+ if (start == std::string::npos || end == std::string::npos)
+ str = "";
+ else
+ str = str.substr(start, end-start+1);
+
+ return str;
+}
-std::string assign(const irc::string &other);
-irc::string assign(const std::string &other);
-std::string& trim(std::string &str);
+/* Hashing stuff is totally different on vc++'s hash_map implementation, so to save a buttload of #ifdefs we'll just
+ do it all at once - Burlex */
namespace nspace
{
/** Hashing function to hash irc::string
*/
+#ifdef WINDOWS
+ template<> class CoreExport hash_compare<irc::string, std::less<irc::string> >
+ {
+ public:
+ enum { bucket_size = 4, min_buckets = 8 }; // Got these numbers from the CRT source,
+ // if anyone wants to change them feel free.
+ bool operator()(const irc::string & s1, const irc::string & s2) const
+ {
+ if(s1.length() != s2.length()) return true;
+ return (irc::irc_char_traits::compare(s1.c_str(), s2.c_str(), s1.length()) < 0);
+ }
+
+ size_t operator()(const irc::string & s) const;
+ };
+
+ template<> class CoreExport hash_compare<std::string, std::less<std::string> >
+ {
+ public:
+ enum { bucket_size = 4, min_buckets = 8 };
+ bool operator()(const std::string & s1, const std::string & s2) const
+ {
+ if(s1.length() != s2.length()) return true;
+ return (irc::irc_char_traits::compare(s1.c_str(), s2.c_str(), s1.length()) < 0);
+ }
+
+ /** Hash a std::string using RFC1459 case sensitivity rules
+ * @param s A string to hash
+ * @return The hash value
+ */
+ size_t operator()(const std::string & s) const;
+ };
+#else
template<> struct hash<irc::string>
{
size_t operator()(const irc::string &s) const;
};
+
+ template<> struct hash<std::string>
+ {
+ /** Hash a std::string using RFC1459 case sensitivity rules
+ * @param s A string to hash
+ * @return The hash value
+ */
+ size_t operator()(const string &s) const;
+ };
+#endif
+
+ /** Convert a string to lower case respecting RFC1459
+ * @param n A string to lowercase
+ */
+ void strlower(char *n);
}
#endif
diff --git a/include/inspircd.h b/include/inspircd.h
index d81116a1d..fa9b8ed56 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -14,6 +14,16 @@
#ifndef __INSPIRCD_H__
#define __INSPIRCD_H__
+#ifndef WIN32
+#define DllExport
+#define CoreExport
+#define printf_c printf
+#else
+#include "inspircd_win32wrapper.h"
+#undef DELETE
+#undef ERROR
+#endif
+
#include <time.h>
#include <string>
#include <sstream>
@@ -216,7 +226,7 @@ class InspIRCd;
* I/O (linux seems to, as does freebsd) this will default to
* blocking behaviour.
*/
-class FileLogger : public EventHandler
+class CoreExport FileLogger : public EventHandler
{
protected:
/** The creator/owner of this object
@@ -284,7 +294,7 @@ class XLineManager;
* program in terms of ram usage (basically, you could create
* an obese forkbomb built from recursively spawning irc servers!)
*/
-class InspIRCd : public classbase
+class CoreExport InspIRCd : public classbase
{
private:
/** Holds a string describing the last module error to occur
diff --git a/include/inspsocket.h b/include/inspsocket.h
index 03b674b7a..03acad4a1 100644
--- a/include/inspsocket.h
+++ b/include/inspsocket.h
@@ -43,7 +43,7 @@ using irc::sockets::insp_aton;
/** Used to time out socket connections
*/
-class SocketTimeout : public InspTimer
+class CoreExport SocketTimeout : public InspTimer
{
private:
InspSocket* sock;
@@ -65,7 +65,7 @@ class SocketTimeout : public InspTimer
* and use the InspSocket constructors to establish connections
* and bindings.
*/
-class InspSocket : public EventHandler
+class CoreExport InspSocket : public EventHandler
{
public:
diff --git a/include/inspstring.h b/include/inspstring.h
index 5562b3d77..1e6ba68e6 100644
--- a/include/inspstring.h
+++ b/include/inspstring.h
@@ -15,14 +15,22 @@
#define __IN_INSPSTRING_H
#include "inspircd_config.h"
+#include <string.h>
#include <cstddef>
#ifndef HAS_STRLCPY
-size_t strlcpy(char *dst, const char *src, size_t siz);
-size_t strlcat(char *dst, const char *src, size_t siz);
+CoreExport size_t strlcpy(char *dst, const char *src, size_t siz);
+CoreExport size_t strlcat(char *dst, const char *src, size_t siz);
#endif
-int charlcat(char* x,char y,int z);
-bool charremove(char* mp, char remove);
+CoreExport int charlcat(char* x,char y,int z);
+CoreExport bool charremove(char* mp, char remove);
+inline char * strnewdup(const char * s1)
+{
+ size_t len = strlen(s1) + 1;
+ char * p = new char[len];
+ memcpy(p, s1, len);
+ return p;
+}
#endif
diff --git a/include/mode.h b/include/mode.h
index 2875d853e..8e5c105ce 100644
--- a/include/mode.h
+++ b/include/mode.h
@@ -90,7 +90,7 @@ typedef std::pair<bool,std::string> ModePair;
* mode is expected to have a parameter, then this is
* equivalent to returning MODEACTION_DENY.
*/
-class ModeHandler : public Extensible
+class CoreExport ModeHandler : public Extensible
{
protected:
InspIRCd* ServerInstance;
@@ -279,7 +279,7 @@ class ModeHandler : public Extensible
* and attach it to the mode using Server::AddModeWatcher and Server::DelModeWatcher.
* A ModeWatcher will be called both before and after the mode change.
*/
-class ModeWatcher : public Extensible
+class CoreExport ModeWatcher : public Extensible
{
protected:
InspIRCd* ServerInstance;
@@ -347,7 +347,7 @@ typedef std::vector<ModeWatcher*>::iterator ModeWatchIter;
* parses client to server MODE strings for user and channel modes, and performs
* processing for the 004 mode list numeric, amongst other things.
*/
-class ModeParser : public classbase
+class CoreExport ModeParser : public classbase
{
private:
InspIRCd* ServerInstance;
diff --git a/include/modules.h b/include/modules.h
index c873111ad..bba71365d 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -187,8 +187,11 @@ typedef std::map<std::string, std::pair<int, modulelist> > interfacelist;
#define FD_MAGIC_NUMBER -42
// useful macros
-
+#ifdef WINDOWS
+#define IS_LOCAL(x) ((x->GetFd() > -1))
+#else
#define IS_LOCAL(x) ((x->GetFd() > -1) && (x->GetFd() <= MAX_DESCRIPTORS))
+#endif
#define IS_REMOTE(x) (x->GetFd() < 0)
#define IS_MODULE_CREATED(x) (x->GetFd() == FD_MAGIC_NUMBER)
#define IS_OPER(x) (*x->oper)
@@ -198,7 +201,7 @@ typedef std::map<std::string, std::pair<int, modulelist> > interfacelist;
* The four members (set by the constructor only) indicate details as to the version number
* of a module. A class of type Version is returned by the GetVersion method of the Module class.
*/
-class Version : public classbase
+class CoreExport Version : public classbase
{
public:
const int Major, Minor, Revision, Build, Flags, API;
@@ -209,7 +212,7 @@ class Version : public classbase
* This class is used to represent a basic data structure which is passed
* between modules for safe inter-module communications.
*/
-class ModuleMessage : public Extensible
+class CoreExport ModuleMessage : public Extensible
{
public:
virtual ~ModuleMessage() {};
@@ -220,7 +223,7 @@ class ModuleMessage : public Extensible
* using the Send() method, which will call the given module's OnRequest
* method with this class as its parameter.
*/
-class Request : public ModuleMessage
+class CoreExport Request : public ModuleMessage
{
protected:
/** This member holds a pointer to arbitary data set by the emitter of the message
@@ -282,7 +285,7 @@ class Request : public ModuleMessage
* using the Send() method, which will trigger the OnEvent method in
* all modules passing the object as its parameter.
*/
-class Event : public ModuleMessage
+class CoreExport Event : public ModuleMessage
{
protected:
/** This member holds a pointer to arbitary data set by the emitter of the message
@@ -324,7 +327,7 @@ class Event : public ModuleMessage
* be loaded. If this happens, the error message returned by ModuleException::GetReason will be displayed to the user
* attempting to load the module, or dumped to the console if the ircd is currently loading for the first time.
*/
-class CoreException : public std::exception
+class CoreExport CoreException : public std::exception
{
protected:
/** Holds the error message to be displayed
@@ -361,7 +364,7 @@ class CoreException : public std::exception
}
};
-class ModuleException : public CoreException
+class CoreExport ModuleException : public CoreException
{
public:
/** Default constructor, just uses the error mesage 'Module threw an exception'.
@@ -403,7 +406,7 @@ enum Implementation { I_OnUserConnect, I_OnUserQuit, I_OnUserDisconnect, I_OnUse
* its methods will be called when irc server events occur. class inherited from module must be
* instantiated by the ModuleFactory class (see relevent section) for the module to be initialised.
*/
-class Module : public Extensible
+class CoreExport Module : public Extensible
{
protected:
InspIRCd* ServerInstance;
@@ -1389,7 +1392,7 @@ class Module : public Extensible
* Constructing the class using one parameter allows you to specify a path to your own configuration
* file, otherwise, inspircd.conf is read.
*/
-class ConfigReader : public classbase
+class CoreExport ConfigReader : public classbase
{
protected:
InspIRCd* ServerInstance;
@@ -1506,7 +1509,7 @@ class ConfigReader : public classbase
* Either use the constructor type with one parameter to load a file into memory
* at construction, or use the LoadFile method to load a file.
*/
-class FileReader : public classbase
+class CoreExport FileReader : public classbase
{
InspIRCd* ServerInstance;
/** The file contents
@@ -1577,7 +1580,7 @@ class FileReader : public classbase
* In most cases, the simple class shown in the example module m_foobar.so will suffice for most
* modules.
*/
-class ModuleFactory : public classbase
+class CoreExport ModuleFactory : public classbase
{
public:
/** The default constructor does nothing.
diff --git a/include/snomasks.h b/include/snomasks.h
index 676309541..db8be55f8 100644
--- a/include/snomasks.h
+++ b/include/snomasks.h
@@ -28,7 +28,7 @@ typedef std::map<char, std::string> SnoList;
* Modules and the core can enable and disable snomask characters. If they do,
* then sending snomasks using these characters becomes possible.
*/
-class SnomaskManager : public Extensible
+class CoreExport SnomaskManager : public Extensible
{
private:
/** Creator/owner
diff --git a/include/socket.h b/include/socket.h
index 88478f2e3..de0b0510b 100644
--- a/include/socket.h
+++ b/include/socket.h
@@ -14,6 +14,8 @@
#ifndef INSPIRCD_SOCKET_H
#define INSPIRCD_SOCKET_H
+#ifndef WIN32
+
#include <arpa/inet.h>
#include <sys/time.h>
#include <sys/resource.h>
@@ -24,10 +26,26 @@
#include <unistd.h>
#include <fcntl.h>
#include <netdb.h>
+
+#else
+
+#include "inspircd_win32wrapper.h"
+
+#endif
+
#include <errno.h>
#include "inspircd_config.h"
#include "socketengine.h"
+/* Accept Define */
+#ifdef CONFIG_USE_IOCP
+#define _accept(s, addr, addrlen) __accept_socket(s, addr, addrlen, m_acceptEvent)
+#define _getsockname(fd, sockptr, socklen) __getsockname(fd, sockptr, socklen, m_acceptEvent)
+#else
+#define _accept accept
+#define _getsockname getsockname
+#endif
+
namespace irc
{
/** This namespace contains various protocol-independent helper classes.
@@ -72,7 +90,7 @@ namespace irc
* @returns True if the first mask_bits of address matches the first
* mask_bits of mask.
*/
- bool MatchCIDRBits(unsigned char* address, unsigned char* mask, unsigned int mask_bits);
+ CoreExport bool MatchCIDRBits(unsigned char* address, unsigned char* mask, unsigned int mask_bits);
/** Match CIDR, without matching username/nickname parts.
*
@@ -83,7 +101,7 @@ namespace irc
* @param cidr_mask The human readable mask, e.g. 1.2.0.0/16
* @return True if the mask matches the address
*/
- bool MatchCIDR(const char* address, const char* cidr_mask);
+ CoreExport bool MatchCIDR(const char* address, const char* cidr_mask);
/** Match CIDR, including an optional username/nickname part.
*
@@ -96,7 +114,7 @@ namespace irc
* @param cidr_mask The human readable mask, e.g. *\@1.2.0.0/16
* @return True if the mask matches the address
*/
- bool MatchCIDR(const char* address, const char* cidr_mask, bool match_with_username);
+ CoreExport bool MatchCIDR(const char* address, const char* cidr_mask, bool match_with_username);
/** Convert an insp_inaddr into human readable form.
*
@@ -104,7 +122,7 @@ namespace irc
* @return A human-readable address. IPV6 addresses
* will be shortened to remove fields which are 0.
*/
- const char* insp_ntoa(insp_inaddr n);
+ CoreExport const char* insp_ntoa(insp_inaddr n);
/** Convert a human-readable address into an insp_inaddr.
*
@@ -119,24 +137,24 @@ namespace irc
* or any other number upon failure.
*/
- int insp_aton(const char* a, insp_inaddr* n);
+ CoreExport int insp_aton(const char* a, insp_inaddr* n);
/** Make a socket file descriptor a blocking socket
* @param s A valid file descriptor
*/
- void Blocking(int s);
+ CoreExport void Blocking(int s);
/** Make a socket file descriptor into a nonblocking socket
* @param s A valid file descriptor
*/
- void NonBlocking(int s);
+ CoreExport void NonBlocking(int s);
/** Create a new valid file descriptor using socket()
* @return On return this function will return a value >= 0 for success,
* or a negative value upon failure (negative values are invalid file
* descriptors)
*/
- int OpenTCPSocket(char* addr, int socktype = SOCK_STREAM);
+ CoreExport int OpenTCPSocket(char* addr, int socktype = SOCK_STREAM);
};
};
@@ -144,7 +162,7 @@ namespace irc
* It will create a new userrec for every valid connection
* and assign it a file descriptor.
*/
-class ListenSocket : public EventHandler
+class CoreExport ListenSocket : public EventHandler
{
protected:
/** The creator/owner of this object
diff --git a/include/socketengine.h b/include/socketengine.h
index 729f5e090..0ff6e89ed 100644
--- a/include/socketengine.h
+++ b/include/socketengine.h
@@ -54,7 +54,7 @@ class InspIRCd;
* must have a file descriptor. What this file descriptor
* is actually attached to is completely up to you.
*/
-class EventHandler : public Extensible
+class CoreExport EventHandler : public Extensible
{
protected:
/** File descriptor.
@@ -129,6 +129,21 @@ class EventHandler : public Extensible
* and EVENT_WRITE for write events.
*/
virtual void HandleEvent(EventType et, int errornum = 0) = 0;
+
+#ifdef WINDOWS
+
+ /** "Fake" file descriptor. This is windows-specific.
+ */
+ int m_internalFd;
+
+ /** Pointer to read event. We delete this so the buffer can't be used
+ * after the socket is deleted, and so it doesn't leak memory
+ */
+ void * m_readEvent;
+ void * m_writeEvent;
+ void * m_acceptEvent;
+
+#endif
};
/** Provides basic file-descriptor-based I/O support.
@@ -149,7 +164,7 @@ class EventHandler : public Extensible
* have to be aware of which SocketEngine derived
* class they are using.
*/
-class SocketEngine : public Extensible
+class CoreExport SocketEngine : public Extensible
{
protected:
/** Owner/Creator
@@ -242,14 +257,14 @@ public:
* @param fd The event handler to look for
* @return True if this fd has an event handler
*/
- bool HasFd(int fd);
+ virtual bool HasFd(int fd);
/** Returns the EventHandler attached to a specific fd.
* If the fd isnt in the socketengine, returns NULL.
* @param fd The event handler to look for
* @return A pointer to the event handler, or NULL
*/
- EventHandler* GetRef(int fd);
+ virtual EventHandler* GetRef(int fd);
/** Waits for events and dispatches them to handlers.
* Please note that this doesnt wait long, only
diff --git a/include/timer.h b/include/timer.h
index 46ad5f439..3fb2ed32b 100644
--- a/include/timer.h
+++ b/include/timer.h
@@ -26,7 +26,7 @@ class InspIRCd;
* your object (which you should override) will be called
* at the given time.
*/
-class InspTimer : public Extensible
+class CoreExport InspTimer : public Extensible
{
private:
/** The triggering time
@@ -104,7 +104,7 @@ class InspTimer : public Extensible
* This will ensure timers are not missed, as well as removing timers that have
* expired and allowing the addition of new ones.
*/
-class TimerManager : public Extensible
+class CoreExport TimerManager : public Extensible
{
protected:
/** A group of timers all set to trigger at the same time
diff --git a/include/typedefs.h b/include/typedefs.h
index 840c840cf..d59c6ad7f 100644
--- a/include/typedefs.h
+++ b/include/typedefs.h
@@ -25,10 +25,15 @@
#include "modules.h"
#include "globals.h"
+#ifndef WIN32
typedef nspace::hash_map<std::string, userrec*, nspace::hash<string>, irc::StrHashComp> user_hash;
typedef nspace::hash_map<std::string, chanrec*, nspace::hash<string>, irc::StrHashComp> chan_hash;
+#else
+typedef nspace::hash_map<std::string, userrec*, nspace::hash_compare<string, less<string> > > user_hash;
+typedef nspace::hash_map<std::string, chanrec*, nspace::hash_compare<string, less<string> > > chan_hash;
+#endif
-typedef std::vector<std::string> servernamelist;
+typedef std::vector<std::string*> servernamelist;
typedef std::deque<std::string> file_cache;
#endif
diff --git a/include/users.h b/include/users.h
index e12079315..e76c88676 100644
--- a/include/users.h
+++ b/include/users.h
@@ -46,7 +46,11 @@ enum UserModes {
};
enum RegistrationState {
+
+#ifndef WIN32 // Burlex: This is already defined in win32, luckily it is still 0.
REG_NONE = 0, /* Has sent nothing */
+#endif
+
REG_USER = 1, /* Has sent USER */
REG_NICK = 2, /* Has sent NICK */
REG_NICKUSER = 3, /* Bitwise combination of REG_NICK and REG_USER */
@@ -57,7 +61,7 @@ class InspIRCd;
/** Derived from Resolver, and performs user forward/reverse lookups.
*/
-class UserResolver : public Resolver
+class CoreExport UserResolver : public Resolver
{
private:
/** User this class is 'attached' to.
@@ -75,7 +79,7 @@ class UserResolver : public Resolver
/** Holds information relevent to &lt;connect allow&gt; and &lt;connect deny&gt; tags in the config file.
*/
-class ConnectClass : public classbase
+class CoreExport ConnectClass : public classbase
{
private:
/** Type of line, either CC_ALLOW or CC_DENY
@@ -249,7 +253,7 @@ typedef UserChanList::iterator UCListIter;
class userrec;
-class VisData
+class CoreExport VisData
{
public:
VisData();
@@ -264,7 +268,7 @@ class VisData
* by nickname, or the FindDescriptor method of the InspIRCd class to find a specific user by their
* file descriptor value.
*/
-class userrec : public connection
+class CoreExport userrec : public connection
{
private:
/** Pointer to creator.
diff --git a/include/wildcard.h b/include/wildcard.h
index 90660c6ef..196350134 100644
--- a/include/wildcard.h
+++ b/include/wildcard.h
@@ -13,7 +13,7 @@
#include "inspircd_config.h"
-bool match(const char *str, const char *mask);
-bool match(const char *str, const char *mask, bool use_cidr_match);
-bool match(bool case_sensitive, const char *str, const char *mask);
-bool match(bool case_sensitive, const char *str, const char *mask, bool use_cidr_match);
+CoreExport bool match(const char *str, const char *mask);
+CoreExport bool match(const char *str, const char *mask, bool use_cidr_match);
+CoreExport bool match(bool case_sensitive, const char *str, const char *mask);
+CoreExport bool match(bool case_sensitive, const char *str, const char *mask, bool use_cidr_match);
diff --git a/include/xline.h b/include/xline.h
index 0aa831670..0b4ef6e12 100644
--- a/include/xline.h
+++ b/include/xline.h
@@ -31,7 +31,7 @@ const int APPLY_ALL = APPLY_GLINES | APPLY_KLINES | APPLY_QLINES | APPLY_ZLINES
/** XLine is the base class for ban lines such as G lines and K lines.
*/
-class XLine : public classbase
+class CoreExport XLine : public classbase
{
public:
@@ -71,7 +71,7 @@ class XLine : public classbase
/** KLine class
*/
-class KLine : public XLine
+class CoreExport KLine : public XLine
{
public:
/** Hostmask (ident@host) to match against
@@ -95,7 +95,7 @@ class KLine : public XLine
/** GLine class
*/
-class GLine : public XLine
+class CoreExport GLine : public XLine
{
public:
/** Hostmask (ident@host) to match against
@@ -119,7 +119,7 @@ class GLine : public XLine
/** ELine class
*/
-class ELine : public XLine
+class CoreExport ELine : public XLine
{
public:
/** Hostmask (ident@host) to match against
@@ -143,7 +143,7 @@ class ELine : public XLine
/** ZLine class
*/
-class ZLine : public XLine
+class CoreExport ZLine : public XLine
{
public:
/** IP Address (xx.yy.zz.aa) to match against
@@ -164,7 +164,7 @@ class ZLine : public XLine
/** QLine class
*/
-class QLine : public XLine
+class CoreExport QLine : public XLine
{
public:
/** Nickname to match against.
@@ -202,7 +202,7 @@ typedef std::pair<std::string, std::string> IdentHostPair;
/** XLineManager is a class used to manage glines, klines, elines, zlines and qlines.
*/
-class XLineManager
+class CoreExport XLineManager
{
protected:
/** The owner/creator of this class
diff --git a/src/cmd_admin.cpp b/src/cmd_admin.cpp
index 24f91ed53..bbd4e0287 100644
--- a/src/cmd_admin.cpp
+++ b/src/cmd_admin.cpp
@@ -16,7 +16,7 @@
#include "commands/cmd_admin.h"
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_admin(Instance);
}
diff --git a/src/cmd_away.cpp b/src/cmd_away.cpp
index 7a780c5a5..874881119 100644
--- a/src/cmd_away.cpp
+++ b/src/cmd_away.cpp
@@ -16,7 +16,7 @@
#include "modules.h"
#include "commands/cmd_away.h"
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_away(Instance);
}
diff --git a/src/cmd_clearcache.cpp b/src/cmd_clearcache.cpp
index df1bd5342..eecf3267f 100644
--- a/src/cmd_clearcache.cpp
+++ b/src/cmd_clearcache.cpp
@@ -15,7 +15,7 @@
#include "users.h"
#include "commands/cmd_clearcache.h"
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_clearcache(Instance);
}
diff --git a/src/cmd_commands.cpp b/src/cmd_commands.cpp
index 848070e40..fc95de5f1 100644
--- a/src/cmd_commands.cpp
+++ b/src/cmd_commands.cpp
@@ -17,7 +17,7 @@
/** Handle /COMMANDS
*/
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_commands(Instance);
}
diff --git a/src/cmd_connect.cpp b/src/cmd_connect.cpp
index ac62b0bd1..1a04e7713 100644
--- a/src/cmd_connect.cpp
+++ b/src/cmd_connect.cpp
@@ -18,7 +18,7 @@
* This is handled by the server linking module, if necessary. Do not remove this stub.
*/
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_connect(Instance);
}
diff --git a/src/cmd_die.cpp b/src/cmd_die.cpp
index 95df4ab56..12311480d 100644
--- a/src/cmd_die.cpp
+++ b/src/cmd_die.cpp
@@ -16,7 +16,7 @@
#include "commands/cmd_die.h"
#include "exitcodes.h"
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_die(Instance);
}
diff --git a/src/cmd_eline.cpp b/src/cmd_eline.cpp
index ed7525e05..f7031a108 100644
--- a/src/cmd_eline.cpp
+++ b/src/cmd_eline.cpp
@@ -17,7 +17,7 @@
#include "xline.h"
#include "commands/cmd_eline.h"
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_eline(Instance);
}
diff --git a/src/cmd_gline.cpp b/src/cmd_gline.cpp
index 98f088c8b..a171fca85 100644
--- a/src/cmd_gline.cpp
+++ b/src/cmd_gline.cpp
@@ -17,7 +17,7 @@
#include "xline.h"
#include "commands/cmd_gline.h"
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_gline(Instance);
}
diff --git a/src/cmd_info.cpp b/src/cmd_info.cpp
index 16030df7c..4b359607c 100644
--- a/src/cmd_info.cpp
+++ b/src/cmd_info.cpp
@@ -16,7 +16,7 @@
#include "modules.h"
#include "commands/cmd_info.h"
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_info(Instance);
}
@@ -41,7 +41,7 @@ CmdResult cmd_info::Handle (const char** parameters, int pcnt, userrec *user)
user->WriteServ( "371 %s : typobox43 Jazza", user->nick);
user->WriteServ( "371 %s : jamie LeaChim", user->nick);
user->WriteServ( "371 %s : satmd nenolod", user->nick);
- user->WriteServ( "371 %s : HiroP", user->nick);
+ user->WriteServ( "371 %s : HiroP Burlex", user->nick);
user->WriteServ( "371 %s : ", user->nick);
user->WriteServ( "371 %s :\2Quality Assurance\2:", user->nick);
user->WriteServ( "371 %s : Bricker owine", user->nick);
diff --git a/src/cmd_invite.cpp b/src/cmd_invite.cpp
index 21f9e91cc..c9d4b2d8a 100644
--- a/src/cmd_invite.cpp
+++ b/src/cmd_invite.cpp
@@ -16,7 +16,7 @@
#include "modules.h"
#include "commands/cmd_invite.h"
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_invite(Instance);
}
diff --git a/src/cmd_ison.cpp b/src/cmd_ison.cpp
index fde8666ff..5ab03ba27 100644
--- a/src/cmd_ison.cpp
+++ b/src/cmd_ison.cpp
@@ -15,7 +15,7 @@
#include "inspircd.h"
#include "commands/cmd_ison.h"
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_ison(Instance);
}
diff --git a/src/cmd_join.cpp b/src/cmd_join.cpp
index 8c24c7bcb..218e0f7b8 100644
--- a/src/cmd_join.cpp
+++ b/src/cmd_join.cpp
@@ -15,7 +15,7 @@
#include "users.h"
#include "commands/cmd_join.h"
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_join(Instance);
}
diff --git a/src/cmd_kick.cpp b/src/cmd_kick.cpp
index c11d934f9..27552f66c 100644
--- a/src/cmd_kick.cpp
+++ b/src/cmd_kick.cpp
@@ -15,7 +15,7 @@
#include "inspircd.h"
#include "commands/cmd_kick.h"
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_kick(Instance);
}
diff --git a/src/cmd_kill.cpp b/src/cmd_kill.cpp
index 00d584ddf..82ca97440 100644
--- a/src/cmd_kill.cpp
+++ b/src/cmd_kill.cpp
@@ -18,7 +18,7 @@
#include "wildcard.h"
#include "commands/cmd_kill.h"
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_kill(Instance);
}
diff --git a/src/cmd_kline.cpp b/src/cmd_kline.cpp
index e7ec7b617..670cb2950 100644
--- a/src/cmd_kline.cpp
+++ b/src/cmd_kline.cpp
@@ -17,7 +17,7 @@
#include "xline.h"
#include "commands/cmd_kline.h"
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_kline(Instance);
}
diff --git a/src/cmd_links.cpp b/src/cmd_links.cpp
index 81a6b0b02..1fe1bdcc0 100644
--- a/src/cmd_links.cpp
+++ b/src/cmd_links.cpp
@@ -16,7 +16,7 @@
#include "modules.h"
#include "commands/cmd_links.h"
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_links(Instance);
}
diff --git a/src/cmd_list.cpp b/src/cmd_list.cpp
index 78e586aab..d89def24f 100644
--- a/src/cmd_list.cpp
+++ b/src/cmd_list.cpp
@@ -18,7 +18,7 @@
/** Handle /LIST
*/
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_list(Instance);
}
diff --git a/src/cmd_loadmodule.cpp b/src/cmd_loadmodule.cpp
index 2462cf463..08179d120 100644
--- a/src/cmd_loadmodule.cpp
+++ b/src/cmd_loadmodule.cpp
@@ -15,7 +15,7 @@
#include "users.h"
#include "commands/cmd_loadmodule.h"
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_loadmodule(Instance);
}
diff --git a/src/cmd_lusers.cpp b/src/cmd_lusers.cpp
index 8a1d64c0f..c2ad9de49 100644
--- a/src/cmd_lusers.cpp
+++ b/src/cmd_lusers.cpp
@@ -15,7 +15,7 @@
#include "inspircd.h"
#include "commands/cmd_lusers.h"
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_lusers(Instance);
}
diff --git a/src/cmd_map.cpp b/src/cmd_map.cpp
index 83ff89d6d..0b7132c8f 100644
--- a/src/cmd_map.cpp
+++ b/src/cmd_map.cpp
@@ -15,7 +15,7 @@
#include "users.h"
#include "commands/cmd_map.h"
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_map(Instance);
}
diff --git a/src/cmd_mode.cpp b/src/cmd_mode.cpp
index 31309549c..f48b81e3e 100644
--- a/src/cmd_mode.cpp
+++ b/src/cmd_mode.cpp
@@ -15,7 +15,7 @@
#include "users.h"
#include "commands/cmd_mode.h"
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_mode(Instance);
}
diff --git a/src/cmd_modules.cpp b/src/cmd_modules.cpp
index 916f480fd..be236fcd9 100644
--- a/src/cmd_modules.cpp
+++ b/src/cmd_modules.cpp
@@ -34,7 +34,7 @@ char* itab[] = {
"OnPostCommand", "OnPostJoin", "OnWhoisLine", "OnBuildExemptList", "OnRawSocketConnect", "OnGarbageCollect", NULL
};
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_modules(Instance);
}
diff --git a/src/cmd_motd.cpp b/src/cmd_motd.cpp
index 48edaec5e..0691e1aba 100644
--- a/src/cmd_motd.cpp
+++ b/src/cmd_motd.cpp
@@ -14,7 +14,7 @@
#include "users.h"
#include "commands/cmd_motd.h"
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_motd(Instance);
}
diff --git a/src/cmd_names.cpp b/src/cmd_names.cpp
index b07e43f3f..fe61c4dea 100644
--- a/src/cmd_names.cpp
+++ b/src/cmd_names.cpp
@@ -15,7 +15,7 @@
#include "users.h"
#include "commands/cmd_names.h"
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_names(Instance);
}
diff --git a/src/cmd_nick.cpp b/src/cmd_nick.cpp
index 05a66cbfc..55ad50ec6 100644
--- a/src/cmd_nick.cpp
+++ b/src/cmd_nick.cpp
@@ -18,7 +18,7 @@
#include "xline.h"
#include "commands/cmd_nick.h"
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_nick(Instance);
}
diff --git a/src/cmd_notice.cpp b/src/cmd_notice.cpp
index d2834d2ff..0f084ffc3 100644
--- a/src/cmd_notice.cpp
+++ b/src/cmd_notice.cpp
@@ -19,7 +19,7 @@
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_notice(Instance);
}
diff --git a/src/cmd_oper.cpp b/src/cmd_oper.cpp
index 59b35deba..8e3520d6c 100644
--- a/src/cmd_oper.cpp
+++ b/src/cmd_oper.cpp
@@ -33,7 +33,7 @@ bool OneOfMatches(const char* host, const char* ip, const char* hostlist)
return false;
}
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_oper(Instance);
}
diff --git a/src/cmd_part.cpp b/src/cmd_part.cpp
index 9741cd4fc..7152a3c17 100644
--- a/src/cmd_part.cpp
+++ b/src/cmd_part.cpp
@@ -17,7 +17,7 @@
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_part(Instance);
}
diff --git a/src/cmd_pass.cpp b/src/cmd_pass.cpp
index 05f9114e0..22cea2c0f 100644
--- a/src/cmd_pass.cpp
+++ b/src/cmd_pass.cpp
@@ -16,7 +16,7 @@
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_pass(Instance);
}
diff --git a/src/cmd_ping.cpp b/src/cmd_ping.cpp
index 1f6e2bdfa..cb09f68be 100644
--- a/src/cmd_ping.cpp
+++ b/src/cmd_ping.cpp
@@ -17,7 +17,7 @@
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_ping(Instance);
}
diff --git a/src/cmd_pong.cpp b/src/cmd_pong.cpp
index bd75d1c18..fee5f1d48 100644
--- a/src/cmd_pong.cpp
+++ b/src/cmd_pong.cpp
@@ -16,7 +16,7 @@
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_pong(Instance);
}
diff --git a/src/cmd_privmsg.cpp b/src/cmd_privmsg.cpp
index 6eedf5276..a99f8a594 100644
--- a/src/cmd_privmsg.cpp
+++ b/src/cmd_privmsg.cpp
@@ -20,7 +20,7 @@
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_privmsg(Instance);
}
diff --git a/src/cmd_qline.cpp b/src/cmd_qline.cpp
index fdb714b97..2fea4cbd6 100644
--- a/src/cmd_qline.cpp
+++ b/src/cmd_qline.cpp
@@ -19,7 +19,7 @@
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_qline(Instance);
}
diff --git a/src/cmd_quit.cpp b/src/cmd_quit.cpp
index 5e2c023b7..a859c1790 100644
--- a/src/cmd_quit.cpp
+++ b/src/cmd_quit.cpp
@@ -19,7 +19,7 @@
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_quit(Instance);
}
diff --git a/src/cmd_rehash.cpp b/src/cmd_rehash.cpp
index 4d4b97c8e..8298aa020 100644
--- a/src/cmd_rehash.cpp
+++ b/src/cmd_rehash.cpp
@@ -18,7 +18,7 @@
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_rehash(Instance);
}
diff --git a/src/cmd_reloadmodule.cpp b/src/cmd_reloadmodule.cpp
index 067dee4a2..41da0c40d 100644
--- a/src/cmd_reloadmodule.cpp
+++ b/src/cmd_reloadmodule.cpp
@@ -15,7 +15,7 @@
#include "users.h"
#include "commands/cmd_reloadmodule.h"
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_reloadmodule(Instance);
}
diff --git a/src/cmd_restart.cpp b/src/cmd_restart.cpp
index 106531e79..80ad49184 100644
--- a/src/cmd_restart.cpp
+++ b/src/cmd_restart.cpp
@@ -17,7 +17,7 @@
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_restart(Instance);
}
diff --git a/src/cmd_rules.cpp b/src/cmd_rules.cpp
index 60a5bf0a8..2a45a728b 100644
--- a/src/cmd_rules.cpp
+++ b/src/cmd_rules.cpp
@@ -16,7 +16,7 @@
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_rules(Instance);
}
diff --git a/src/cmd_server.cpp b/src/cmd_server.cpp
index acc68a605..4c644861a 100644
--- a/src/cmd_server.cpp
+++ b/src/cmd_server.cpp
@@ -17,7 +17,7 @@
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_server(Instance);
}
diff --git a/src/cmd_squit.cpp b/src/cmd_squit.cpp
index f2c9c01ef..3ddb60161 100644
--- a/src/cmd_squit.cpp
+++ b/src/cmd_squit.cpp
@@ -19,7 +19,7 @@
*/
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_squit(Instance);
}
diff --git a/src/cmd_stats.cpp b/src/cmd_stats.cpp
index 24fa7e7ec..55b7e68eb 100644
--- a/src/cmd_stats.cpp
+++ b/src/cmd_stats.cpp
@@ -13,7 +13,9 @@
#include "inspircd.h"
#include "configreader.h"
+#ifndef WIN32
#include <sys/resource.h>
+#endif
#include "users.h"
#include "modules.h"
#include "xline.h"
@@ -21,7 +23,7 @@
#include "commands/cmd_whowas.h"
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_stats(Instance);
}
@@ -39,7 +41,7 @@ CmdResult cmd_stats::Handle (const char** parameters, int pcnt, userrec *user)
return CMD_SUCCESS;
}
-void DoStats(InspIRCd* ServerInstance, char statschar, userrec* user, string_list &results)
+DllExport void DoStats(InspIRCd* ServerInstance, char statschar, userrec* user, string_list &results)
{
std::string sn = ServerInstance->Config->ServerName;
@@ -171,12 +173,18 @@ void DoStats(InspIRCd* ServerInstance, char statschar, userrec* user, string_lis
/* stats z (debug and memory info) */
case 'z':
{
- rusage R;
+#ifndef WIN32
+ rusage R;
results.push_back(sn+" 240 "+user->nick+" :InspIRCd(CLASS) "+ConvToStr(sizeof(InspIRCd))+" bytes");
results.push_back(sn+" 249 "+user->nick+" :Users(HASH_MAP) "+ConvToStr(ServerInstance->clientlist->size())+" ("+ConvToStr(ServerInstance->clientlist->size()*sizeof(userrec))+" bytes, "+ConvToStr(ServerInstance->clientlist->bucket_count())+" buckets)");
results.push_back(sn+" 249 "+user->nick+" :Channels(HASH_MAP) "+ConvToStr(ServerInstance->chanlist->size())+" ("+ConvToStr(ServerInstance->chanlist->size()*sizeof(chanrec))+" bytes, "+ConvToStr(ServerInstance->chanlist->bucket_count())+" buckets)");
results.push_back(sn+" 249 "+user->nick+" :Commands(VECTOR) "+ConvToStr(ServerInstance->Parser->cmdlist.size())+" ("+ConvToStr(ServerInstance->Parser->cmdlist.size()*sizeof(command_t))+" bytes)");
-
+#else
+ results.push_back(sn+" 240 "+user->nick+" :InspIRCd(CLASS) "+ConvToStr(sizeof(InspIRCd))+" bytes");
+ results.push_back(sn+" 249 "+user->nick+" :Users(HASH_MAP) "+ConvToStr(ServerInstance->clientlist->size())+" ("+ConvToStr(ServerInstance->clientlist->size()*sizeof(userrec))+" bytes)");
+ results.push_back(sn+" 249 "+user->nick+" :Channels(HASH_MAP) "+ConvToStr(ServerInstance->chanlist->size())+" ("+ConvToStr(ServerInstance->chanlist->size()*sizeof(chanrec))+" bytes)");
+ results.push_back(sn+" 249 "+user->nick+" :Commands(VECTOR) "+ConvToStr(ServerInstance->Parser->cmdlist.size())+" ("+ConvToStr(ServerInstance->Parser->cmdlist.size()*sizeof(command_t))+" bytes)");
+#endif
if (!ServerInstance->Config->WhoWasGroupSize == 0 && !ServerInstance->Config->WhoWasMaxGroups == 0)
{
command_t* whowas_command = ServerInstance->Parser->GetHandler("WHOWAS");
@@ -199,7 +207,8 @@ void DoStats(InspIRCd* ServerInstance, char statschar, userrec* user, string_lis
results.push_back(sn+" 249 "+user->nick+" :Modules(VECTOR) "+ConvToStr(ServerInstance->modules.size())+" ("+ConvToStr(ServerInstance->modules.size()*sizeof(Module))+" bytes)");
results.push_back(sn+" 249 "+user->nick+" :ClassFactories(VECTOR) "+ConvToStr(ServerInstance->factory.size())+" ("+ConvToStr(ServerInstance->factory.size()*sizeof(ircd_module))+" bytes)");
- if (!getrusage(0,&R)) /* RUSAGE_SELF */
+#ifndef WIN32
+ if (!getrusage(0,&R)) /* RUSAGE_SELF */
{
results.push_back(sn+" 249 "+user->nick+" :Total allocation: "+ConvToStr(R.ru_maxrss)+"K");
results.push_back(sn+" 249 "+user->nick+" :Signals: "+ConvToStr(R.ru_nsignals));
@@ -218,6 +227,7 @@ void DoStats(InspIRCd* ServerInstance, char statschar, userrec* user, string_lis
snprintf(percent, 30, "%03.5f%%", per);
results.push_back(sn+" 249 "+user->nick+" :CPU Usage: "+percent);
}
+#endif
}
break;
diff --git a/src/cmd_summon.cpp b/src/cmd_summon.cpp
index 840f6dd02..a136bcc15 100644
--- a/src/cmd_summon.cpp
+++ b/src/cmd_summon.cpp
@@ -16,7 +16,7 @@
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_summon(Instance);
}
diff --git a/src/cmd_time.cpp b/src/cmd_time.cpp
index 535bf48a5..ca6369345 100644
--- a/src/cmd_time.cpp
+++ b/src/cmd_time.cpp
@@ -17,7 +17,7 @@
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_time(Instance);
}
diff --git a/src/cmd_topic.cpp b/src/cmd_topic.cpp
index dfd03a651..06036fe01 100644
--- a/src/cmd_topic.cpp
+++ b/src/cmd_topic.cpp
@@ -15,10 +15,10 @@
#include "users.h"
#include "modules.h"
#include "commands/cmd_topic.h"
+#include "inspircd.h"
-
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_topic(Instance);
}
diff --git a/src/cmd_trace.cpp b/src/cmd_trace.cpp
index 158238579..a80a19b04 100644
--- a/src/cmd_trace.cpp
+++ b/src/cmd_trace.cpp
@@ -17,7 +17,7 @@
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_trace(Instance);
}
diff --git a/src/cmd_unloadmodule.cpp b/src/cmd_unloadmodule.cpp
index 715ff4fcb..44c2133e7 100644
--- a/src/cmd_unloadmodule.cpp
+++ b/src/cmd_unloadmodule.cpp
@@ -17,7 +17,7 @@
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_unloadmodule(Instance);
}
diff --git a/src/cmd_user.cpp b/src/cmd_user.cpp
index c0195f56e..386d0e5e8 100644
--- a/src/cmd_user.cpp
+++ b/src/cmd_user.cpp
@@ -17,7 +17,7 @@
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_user(Instance);
}
diff --git a/src/cmd_userhost.cpp b/src/cmd_userhost.cpp
index 6f31ad6a7..b05bfd6f6 100644
--- a/src/cmd_userhost.cpp
+++ b/src/cmd_userhost.cpp
@@ -17,7 +17,7 @@
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_userhost(Instance);
}
diff --git a/src/cmd_users.cpp b/src/cmd_users.cpp
index d9382d066..e49abccb2 100644
--- a/src/cmd_users.cpp
+++ b/src/cmd_users.cpp
@@ -16,7 +16,7 @@
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_users(Instance);
}
diff --git a/src/cmd_version.cpp b/src/cmd_version.cpp
index c6b156652..599b7bf75 100644
--- a/src/cmd_version.cpp
+++ b/src/cmd_version.cpp
@@ -18,7 +18,7 @@
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_version(Instance);
}
diff --git a/src/cmd_wallops.cpp b/src/cmd_wallops.cpp
index 909dfb2ba..7c1c25f55 100644
--- a/src/cmd_wallops.cpp
+++ b/src/cmd_wallops.cpp
@@ -17,7 +17,7 @@
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_wallops(Instance);
}
diff --git a/src/cmd_who.cpp b/src/cmd_who.cpp
index de504faf2..028ce3121 100644
--- a/src/cmd_who.cpp
+++ b/src/cmd_who.cpp
@@ -110,7 +110,7 @@ bool cmd_who::whomatch(userrec* user, const char* matchtext)
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_who(Instance);
}
diff --git a/src/cmd_whois.cpp b/src/cmd_whois.cpp
index a634e5967..897ec60ac 100644
--- a/src/cmd_whois.cpp
+++ b/src/cmd_whois.cpp
@@ -89,7 +89,7 @@ void do_whois(InspIRCd* ServerInstance, userrec* user, userrec* dest,unsigned lo
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_whois(Instance);
}
diff --git a/src/cmd_whowas.cpp b/src/cmd_whowas.cpp
index 4886c9800..4bf6df8ca 100644
--- a/src/cmd_whowas.cpp
+++ b/src/cmd_whowas.cpp
@@ -15,7 +15,9 @@
#include "users.h"
#include "commands/cmd_whowas.h"
-extern "C" command_t* init_command(InspIRCd* Instance)
+WhoWasMaintainTimer * timer;
+
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_whowas(Instance);
}
@@ -24,7 +26,7 @@ cmd_whowas::cmd_whowas(InspIRCd* Instance)
: command_t(Instance, "WHOWAS", 0, 1)
{
syntax = "<nick>{,<nick>}";
- timer = new MaintainTimer(Instance, 3600);
+ timer = new WhoWasMaintainTimer(Instance, 3600);
Instance->Timers->AddTimer(timer);
}
@@ -326,7 +328,7 @@ WhoWasGroup::~WhoWasGroup()
}
/* every hour, run this function which removes all entries older than Config->WhoWasMaxKeep */
-void MaintainTimer::Tick(time_t t)
+void WhoWasMaintainTimer::Tick(time_t t)
{
command_t* whowas_command = ServerInstance->Parser->GetHandler("WHOWAS");
if (whowas_command)
diff --git a/src/cmd_zline.cpp b/src/cmd_zline.cpp
index 70ca81664..1f8076a77 100644
--- a/src/cmd_zline.cpp
+++ b/src/cmd_zline.cpp
@@ -20,7 +20,7 @@
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
{
return new cmd_zline(Instance);
}
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index 444e6f78b..be94c0995 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -14,8 +14,6 @@
#include "inspircd.h"
#include "configreader.h"
#include <algorithm>
-#include <dirent.h>
-#include <dlfcn.h>
#include "users.h"
#include "modules.h"
#include "wildcard.h"
@@ -24,6 +22,12 @@
#include "socket.h"
#include "command_parse.h"
+/* Directory Searching for Unix-Only */
+#ifndef WIN32
+#include <dirent.h>
+#include <dlfcn.h>
+#endif
+
bool InspIRCd::ULine(const char* server)
{
if (!server)
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 6e728c311..392c7eb29 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -1538,6 +1538,10 @@ char* ServerConfig::CleanFilename(char* name)
bool ServerConfig::DirValid(const char* dirandfile)
{
+#ifdef WINDOWS
+ return true;
+#endif
+
char work[1024];
char buffer[1024];
char otherdir[1024];
@@ -1576,7 +1580,6 @@ bool ServerConfig::DirValid(const char* dirandfile)
if (strlen(otherdir) >= t)
{
otherdir[t] = '\0';
-
if (!strcmp(otherdir,work))
{
return true;
diff --git a/src/dns.cpp b/src/dns.cpp
index c04ab4cc1..df79eba24 100644
--- a/src/dns.cpp
+++ b/src/dns.cpp
@@ -21,11 +21,16 @@ Please do not assume that firedns works like this,
looks like this, walks like this or tastes like this.
*/
+#ifndef WIN32
#include <sys/types.h>
#include <sys/socket.h>
#include <errno.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#else
+#include "inspircd_win32wrapper.h"
+#endif
+
#include "dns.h"
#include "inspircd.h"
#include "socketengine.h"
@@ -238,7 +243,7 @@ int DNSRequest::SendRequests(const DNSHeader *header, const int length, QueryTyp
memcpy(&addr.sin_addr.s_addr, &dnsobj->myserver4, sizeof(addr.sin_addr));
addr.sin_family = AF_INET;
addr.sin_port = htons(DNS::QUERY_PORT);
- if (sendto(dnsobj->GetFd(), payload, length + 12, 0, (sockaddr *) &addr, sizeof(addr)) != length+12)
+ if (sendto(dnsobj->GetFd(), (const char*)payload, length + 12, 0, (sockaddr *) &addr, sizeof(addr)) != length+12)
return -1;
#endif
@@ -619,7 +624,7 @@ DNSResult DNS::GetResult()
const char* ipaddr_from;
unsigned short int port_from = 0;
- int length = recvfrom(this->GetFd(),buffer,sizeof(DNSHeader),0,from,&x);
+ int length = recvfrom(this->GetFd(),(char*)buffer,sizeof(DNSHeader),0,from,&x);
/* Did we get the whole header? */
if (length < 12)
@@ -1146,6 +1151,7 @@ void DNS::CleanResolvers(Module* module)
/** Generate pseudo-random number */
unsigned long DNS::PRNG()
{
+#ifndef WIN32
unsigned long val = 0;
timeval n;
serverstats* s = ServerInstance->stats;
@@ -1154,5 +1160,13 @@ unsigned long DNS::PRNG()
val = val + s->statsCollisions ^ s->statsDnsGood - s->statsDnsBad;
val += (s->statsConnects ^ (unsigned long)s->statsSent ^ (unsigned long)s->statsRecv) - ServerInstance->Config->ports.size();
return val;
+#else
+ unsigned long val = 0;
+ serverstats* s = ServerInstance->stats;
+ val = (time(NULL) ^ GetCurrentProcessId() ^ GetCurrentThreadId() ^ (this->currid++)) ^ s->statsAccept + time(NULL);
+ val = val + s->statsCollisions ^ s->statsDnsGood - s->statsDnsBad;
+ val += (s->statsConnects ^ (unsigned long)s->statsSent ^ (unsigned long)s->statsRecv);
+ return val;
+#endif
}
diff --git a/src/dynamic.cpp b/src/dynamic.cpp
index 0d719755a..ab1e6fa9b 100644
--- a/src/dynamic.cpp
+++ b/src/dynamic.cpp
@@ -13,7 +13,10 @@
#include "configreader.h"
#include "dynamic.h"
+#ifndef WIN32
#include <dlfcn.h>
+#endif
+
#include "inspircd.h"
DLLManager::DLLManager(InspIRCd* ServerInstance, const char *fname)
diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp
index 8212dcaa3..a0394b0f9 100644
--- a/src/hashcomp.cpp
+++ b/src/hashcomp.cpp
@@ -13,8 +13,14 @@
#include "inspircd.h"
#include "hashcomp.h"
+#ifndef WIN32
#include <ext/hash_map>
#define nspace __gnu_cxx
+#else
+#include <hash_map>
+#define nspace stdext
+using stdext::hash_map;
+#endif
/******************************************************
*
@@ -61,7 +67,11 @@ void nspace::strlower(char *n)
}
}
+#ifndef WIN32
size_t nspace::hash<string>::operator()(const string &s) const
+#else
+size_t nspace::hash_compare<string, std::less<string> >::operator()(const string &s) const
+#endif
{
/* XXX: NO DATA COPIES! :)
* The hash function here is practically
@@ -75,7 +85,11 @@ size_t nspace::hash<string>::operator()(const string &s) const
return t;
}
+#ifndef WIN32
size_t nspace::hash<irc::string>::operator()(const irc::string &s) const
+#else
+size_t nspace::hash_compare<irc::string, std::less<irc::string> >::operator()(const irc::string &s) const
+#endif
{
register size_t t = 0;
for (irc::string::const_iterator x = s.begin(); x != s.end(); ++x) /* ++x not x++, as its faster */
@@ -138,26 +152,6 @@ int irc::irc_char_traits::compare(const char* str1, const char* str2, size_t n)
return 0;
}
-std::string operator+ (std::string& leftval, irc::string& rightval)
-{
- return leftval + std::string(rightval.c_str());
-}
-
-irc::string operator+ (irc::string& leftval, std::string& rightval)
-{
- return leftval + irc::string(rightval.c_str());
-}
-
-bool operator== (const std::string& leftval, const irc::string& rightval)
-{
- return (leftval.c_str() == rightval);
-}
-
-bool operator== (const irc::string& leftval, const std::string& rightval)
-{
- return (leftval == rightval.c_str());
-}
-
const char* irc::irc_char_traits::find(const char* s1, int n, char c)
{
while(n-- > 0 && lowermap[(unsigned char)*s1] != lowermap[(unsigned char)c])
@@ -165,20 +159,6 @@ const char* irc::irc_char_traits::find(const char* s1, int n, char c)
return s1;
}
-/* See hashcomp.h if you care about these... */
-std::ostream& operator<<(std::ostream &os, const irc::string &str)
-{
- return os << str.c_str();
-}
-
-std::istream& operator>>(std::istream &is, irc::string &str)
-{
- std::string tmp;
- is >> tmp;
- str = tmp.c_str();
- return is;
-}
-
irc::tokenstream::tokenstream(const std::string &source) : tokens(source), last_pushed(false)
{
/* Record starting position and current position */
@@ -286,8 +266,9 @@ std::string irc::hex(const unsigned char *raw, size_t rawsz)
/* EWW! This used to be using sprintf, which is WAY inefficient. -Special */
const char *hex = "0123456789abcdef";
-
- char buf[rawsz*2+1];
+
+ std::string buf;
+ buf.reserve(rawsz * 2 + 1);
size_t i, j;
for (i = 0, j = 0; j < rawsz; ++j)
@@ -300,7 +281,7 @@ std::string irc::hex(const unsigned char *raw, size_t rawsz)
return buf;
}
-const char* irc::Spacify(const char* n)
+CoreExport const char* irc::Spacify(const char* n)
{
static char x[MAXBUF];
strlcpy(x,n,MAXBUF);
@@ -614,24 +595,3 @@ unsigned char irc::dynamicbitmask::GetSize()
return bits_size;
}
-std::string assign(const irc::string &other)
-{
- return other.c_str();
-}
-
-irc::string assign(const std::string &other)
-{
- return other.c_str();
-}
-
-std::string& trim(std::string &str)
-{
- std::string::size_type start = str.find_first_not_of(" ");
- std::string::size_type end = str.find_last_not_of(" ");
- if (start == std::string::npos || end == std::string::npos)
- str = "";
- else
- str = str.substr(start, end-start+1);
-
- return str;
-}
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index 6e5f616bd..d79b18c9d 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -486,16 +486,16 @@ void InspIRCd::LoadAllModules()
for (int count = 0; count < Config->ConfValueEnum(Config->config_data, "module"); count++)
{
Config->ConfValue(Config->config_data, "module", "name", count, configToken, MAXBUF);
- printf("[\033[1;32m*\033[0m] Loading module:\t\033[1;32m%s\033[0m\n",configToken);
+ printf_c("[\033[1;32m*\033[0m] Loading module:\t\033[1;32m%s\033[0m\n",configToken);
if (!this->LoadModule(configToken))
{
this->Log(DEFAULT,"There was an error loading the module '%s': %s", configToken, this->ModuleError());
- printf("\n[\033[1;31m*\033[0m] There was an error loading the module '%s': %s\n\n", configToken, this->ModuleError());
+ printf_c("\n[\033[1;31m*\033[0m] There was an error loading the module '%s': %s\n\n", configToken, this->ModuleError());
Exit(EXIT_STATUS_MODULE);
}
}
- printf("\nA total of \033[1;32m%d\033[0m module%s been loaded.\n", this->ModCount+1, this->ModCount+1 == 1 ? " has" : "s have");
+ printf_c("\nA total of \033[1;32m%d\033[0m module%s been loaded.\n", this->ModCount+1, this->ModCount+1 == 1 ? " has" : "s have");
this->Log(DEFAULT,"Total loaded modules: %d", this->ModCount+1);
}
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 069c8634d..ade05f3ef 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -14,10 +14,12 @@
#include "inspircd.h"
#include "configreader.h"
#include <signal.h>
+#ifndef WIN32
#include <dirent.h>
+#include <unistd.h>
+#endif
#include <exception>
#include <fstream>
-#include <unistd.h>
#include "modules.h"
#include "mode.h"
#include "xline.h"
@@ -27,9 +29,11 @@
#include "typedefs.h"
#include "command_parse.h"
#include "exitcodes.h"
+
+#ifndef WIN32
#include <dlfcn.h>
#include <getopt.h>
-
+#endif
using irc::sockets::NonBlocking;
using irc::sockets::Blocking;
@@ -39,32 +43,64 @@ using irc::sockets::insp_sockaddr;
InspIRCd* SI = NULL;
+/* Burlex: Moved from exitcodes.h -- due to duplicate symbols */
+const char* ExitCodes[] =
+{
+ "No error", /* 0 */
+ "DIE command", /* 1 */
+ "execv() failed", /* 2 */
+ "Internal error", /* 3 */
+ "Config file error", /* 4 */
+ "Logfile error", /* 5 */
+ "Fork failed", /* 6 */
+ "Bad commandline parameters", /* 7 */
+ "No ports could be bound", /* 8 */
+ "Can't write PID file", /* 9 */
+ "SocketEngine could not initialize", /* 10 */
+ "Refusing to start up as root", /* 11 */
+ "Found a <die> tag!", /* 12 */
+ "Couldn't load module on startup", /* 13 */
+ "", /* 14 */
+ "Received SIGTERM", /* 15 */
+};
+
void InspIRCd::AddServerName(const std::string &servername)
{
- if(find(servernames.begin(), servernames.end(), servername) == servernames.end())
- servernames.push_back(servername); /* Wasn't already there. */
+ servernamelist::iterator itr = servernames.begin();
+ for(; itr != servernames.end(); ++itr)
+ if(**itr == servername)
+ return;
+
+ string * ns = new string(servername);
+ servernames.push_back(ns);
}
const char* InspIRCd::FindServerNamePtr(const std::string &servername)
{
- servernamelist::iterator iter = find(servernames.begin(), servernames.end(), servername);
-
- if(iter == servernames.end())
- {
- AddServerName(servername);
- iter = --servernames.end();
- }
-
- return iter->c_str();
+ servernamelist::iterator itr = servernames.begin();
+ for(; itr != servernames.end(); ++itr)
+ if(**itr == servername)
+ return (*itr)->c_str();
+
+ servernames.push_back(new string(servername));
+ itr = --servernames.end();
+ return (*itr)->c_str();
}
bool InspIRCd::FindServerName(const std::string &servername)
{
- return (find(servernames.begin(), servernames.end(), servername) != servernames.end());
+ servernamelist::iterator itr = servernames.begin();
+ for(; itr != servernames.end(); ++itr)
+ if(**itr == servername)
+ return true;
+ return false;
}
void InspIRCd::Exit(int status)
{
+#ifdef WINDOWS
+ CloseIPC();
+#endif
if (SI)
{
SI->SendError("Exiting with status " + ConvToStr(status) + " (" + std::string(ExitCodes[status]) + ")");
@@ -112,6 +148,15 @@ void InspIRCd::Cleanup()
/* Close logging */
this->Logger->Close();
+
+ /* Cleanup Server Names */
+ for(servernamelist::iterator itr = servernames.begin(); itr != servernames.end(); ++itr)
+ delete (*itr);
+
+#ifdef WINDOWS
+ /* WSACleanup */
+ WSACleanup();
+#endif
}
void InspIRCd::Restart(const std::string &reason)
@@ -124,7 +169,11 @@ void InspIRCd::Restart(const std::string &reason)
this->Cleanup();
/* Figure out our filename (if theyve renamed it, we're boned) */
+#ifdef WINDOWS
+ std::string me = Config->MyDir + "inspircd.exe";
+#else
std::string me = Config->MyDir + "/inspircd";
+#endif
if (execv(me.c_str(), Config->argv) == -1)
{
@@ -135,10 +184,10 @@ void InspIRCd::Restart(const std::string &reason)
void InspIRCd::Start()
{
- printf("\033[1;32mInspire Internet Relay Chat Server, compiled %s at %s\n",__DATE__,__TIME__);
- printf("(C) InspIRCd Development Team.\033[0m\n\n");
- printf("Developers:\t\t\033[1;32mBrain, FrostyCoolSlug, w00t, Om, Special, pippijn, peavey\033[0m\n");
- printf("Others:\t\t\t\033[1;32mSee /INFO Output\033[0m\n");
+ printf_c("\033[1;32mInspire Internet Relay Chat Server, compiled %s at %s\n",__DATE__,__TIME__);
+ printf_c("(C) InspIRCd Development Team.\033[0m\n\n");
+ printf_c("Developers:\t\t\033[1;32mBrain, FrostyCoolSlug, w00t, Om, Special, pippijn, peavey\033[0m\n");
+ printf_c("Others:\t\t\t\033[1;32mSee /INFO Output\033[0m\n");
}
void InspIRCd::Rehash(int status)
@@ -195,11 +244,13 @@ void InspIRCd::CloseLog()
void InspIRCd::SetSignals()
{
+#ifndef WIN32
signal(SIGALRM, SIG_IGN);
signal(SIGHUP, InspIRCd::Rehash);
signal(SIGPIPE, SIG_IGN);
- signal(SIGTERM, InspIRCd::Exit);
signal(SIGCHLD, SIG_IGN);
+#endif
+ signal(SIGTERM, InspIRCd::Exit);
}
void InspIRCd::QuickExit(int status)
@@ -209,6 +260,29 @@ void InspIRCd::QuickExit(int status)
bool InspIRCd::DaemonSeed()
{
+#ifdef WINDOWS
+ // Create process, with argument --service
+ STARTUPINFO si;
+ PROCESS_INFORMATION pi;
+ memset(&si, 0, sizeof(si));
+ memset(&pi, 0, sizeof(pi));
+ SHELLEXECUTEINFO sh = {0};
+ sh.cbSize = sizeof(sh);
+ sh.fMask = SEE_MASK_NOCLOSEPROCESS;
+ sh.hwnd = 0;
+ sh.lpVerb = 0;
+ sh.lpDirectory = 0;
+ sh.hInstApp = 0;
+ sh.nShow = SW_SHOW;
+ sh.lpFile = "inspircd.exe";
+ sh.lpParameters = "--service";
+ if(!ShellExecuteEx(&sh))
+ return false;
+
+ CloseHandle(sh.hProcess);
+ exit(0);
+ return true;
+#else
signal(SIGTERM, InspIRCd::QuickExit);
int childpid;
@@ -247,6 +321,7 @@ bool InspIRCd::DaemonSeed()
}
return true;
+#endif
}
void InspIRCd::WritePID(const std::string &filename)
@@ -284,13 +359,20 @@ std::string InspIRCd::GetRevision()
InspIRCd::InspIRCd(int argc, char** argv)
: ModCount(-1), duration_m(60), duration_h(60*60), duration_d(60*60*24), duration_w(60*60*24*7), duration_y(60*60*24*365), GlobalCulls(this)
{
+#ifdef WINDOWS
+ WSADATA wsadata;
+ WSAStartup(MAKEWORD(2,0), &wsadata);
+#endif
+
int found_ports = 0;
FailedPortList pl;
- int do_version = 0, do_nofork = 0, do_debug = 0, do_nolog = 0, do_root = 0; /* flag variables */
+ int do_version = 0, do_nofork = 0, do_debug = 0, do_nolog = 0, do_root = 0, is_service = 0; /* flag variables */
char c = 0;
modules.resize(255);
factory.resize(255);
+ memset(&server, 0, sizeof(server));
+ memset(&client, 0, sizeof(client));
this->unregistered_count = 0;
@@ -322,6 +404,7 @@ InspIRCd::InspIRCd(int argc, char** argv)
{ "nolog", no_argument, &do_nolog, 1 },
{ "runasroot", no_argument, &do_root, 1 },
{ "version", no_argument, &do_version, 1 },
+ { "service", no_argument, &is_service, 1 },
{ 0, 0, 0, 0 }
};
@@ -350,6 +433,11 @@ InspIRCd::InspIRCd(int argc, char** argv)
}
}
+#ifdef WINDOWS
+ if(is_service)
+ FreeConsole();
+#endif
+
if (do_version)
{
printf("\n%s r%s\n", VERSION, REVISION);
@@ -400,7 +488,7 @@ InspIRCd::InspIRCd(int argc, char** argv)
if (!Config->nofork)
{
- if (!this->DaemonSeed())
+ if (!is_service && !this->DaemonSeed())
{
printf("ERROR: could not go into daemon mode. Shutting down.\n");
Log(DEFAULT,"ERROR: could not go into daemon mode. Shutting down.");
@@ -452,7 +540,7 @@ InspIRCd::InspIRCd(int argc, char** argv)
printf("%d.\tIP: %s\tPort: %lu\n", j, i->first.empty() ? "<all>" : i->first.c_str(), (unsigned long)i->second);
}
}
-
+#ifndef WINDOWS
if (!Config->nofork)
{
if (kill(getppid(), SIGTERM) == -1)
@@ -479,11 +567,15 @@ InspIRCd::InspIRCd(int argc, char** argv)
Log(DEFAULT,"Keeping pseudo-tty open as we are running in the foreground.");
}
}
-
+#endif
printf("\nInspIRCd is now running!\n");
Log(DEFAULT,"Startup complete.");
this->WritePID(Config->PID);
+
+#ifdef WINDOWS
+ InitIPC();
+#endif
}
std::string InspIRCd::GetVersionString()
@@ -857,7 +949,9 @@ bool InspIRCd::LoadModule(const char* filename)
void InspIRCd::DoOneIteration(bool process_module_sockets)
{
- static rusage ru;
+#ifndef WIN32
+ static rusage ru;
+#endif
/* time() seems to be a pretty expensive syscall, so avoid calling it too much.
* Once per loop iteration is pleanty.
@@ -888,12 +982,15 @@ void InspIRCd::DoOneIteration(bool process_module_sockets)
FOREACH_MOD_I(this,I_OnBackgroundTimer,OnBackgroundTimer(TIME));
Timers->TickMissedTimers(TIME);
}
-
+#ifndef WIN32
if (!getrusage(0, &ru))
{
gettimeofday(&this->stats->LastSampled, NULL);
this->stats->LastCPU = ru.ru_utime;
}
+#else
+ CheckIPC(this);
+#endif
}
/* Call the socket engine to wait on the active
@@ -1026,6 +1123,9 @@ void FileLogger::WriteLogLine(const std::string &line)
if (log)
{
int written = fprintf(log,"%s",buffer.c_str());
+#ifdef WINDOWS
+ buffer = "";
+#else
if ((written >= 0) && (written < (int)buffer.length()))
{
buffer.erase(0, buffer.length());
@@ -1041,7 +1141,7 @@ void FileLogger::WriteLogLine(const std::string &line)
/* Wrote the whole buffer, and no need for write callback */
buffer = "";
}
-
+#endif
if (writeops++ % 20)
{
fflush(log);
@@ -1053,12 +1153,18 @@ void FileLogger::Close()
{
if (log)
{
- int flags = fcntl(fileno(log), F_GETFL, 0);
+ /* Burlex: Windows assumes nonblocking on FILE* pointers anyway, and also "file" fd's aren't the same
+ as socket fd's. */
+#ifndef WIN32
+ int flags = fcntl(fileno(log), F_GETFL, 0);
fcntl(fileno(log), F_SETFL, flags ^ O_NONBLOCK);
+#endif
if (buffer.size())
fprintf(log,"%s",buffer.c_str());
+#ifndef WINDOWS
ServerInstance->SE->DelFd(this);
+#endif
fflush(log);
fclose(log);
diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp
index 3face10f6..43eaec04a 100644
--- a/src/inspsocket.cpp
+++ b/src/inspsocket.cpp
@@ -152,8 +152,8 @@ void InspSocket::SetQueues(int nfd)
// attempt to increase socket sendq and recvq as high as its possible
int sendbuf = 32768;
int recvbuf = 32768;
- setsockopt(nfd,SOL_SOCKET,SO_SNDBUF,(const void *)&sendbuf,sizeof(sendbuf));
- setsockopt(nfd,SOL_SOCKET,SO_RCVBUF,(const void *)&recvbuf,sizeof(sendbuf));
+ setsockopt(nfd,SOL_SOCKET,SO_SNDBUF,(const char *)&sendbuf,sizeof(sendbuf));
+ setsockopt(nfd,SOL_SOCKET,SO_RCVBUF,(const char *)&recvbuf,sizeof(sendbuf));
}
/* Most irc servers require you to specify the ip you want to bind to.
@@ -335,10 +335,13 @@ bool InspSocket::DoConnect()
((sockaddr_in*)addr)->sin_port = htons(this->port);
}
#endif
-
+#ifndef WIN32
int flags = fcntl(this->fd, F_GETFL, 0);
fcntl(this->fd, F_SETFL, flags | O_NONBLOCK);
-
+#else
+ unsigned long flags = 0;
+ ioctlsocket(this->fd, FIONBIO, &flags);
+#endif
if (connect(this->fd, (sockaddr*)addr, size) == -1)
{
if (errno != EINPROGRESS)
@@ -402,7 +405,11 @@ std::string InspSocket::GetIP()
char* InspSocket::Read()
{
+#ifdef WINDOWS
+ if ((fd < 0) || (m_internalFd > MAX_DESCRIPTORS))
+#else
if ((fd < 0) || (fd > MAX_DESCRIPTORS))
+#endif
return NULL;
int n = 0;
@@ -515,7 +522,11 @@ bool InspSocket::FlushWriteBuffer()
while (outbuffer.size() && (errno != EAGAIN))
{
/* Send a line */
+#ifndef WIN32
int result = write(this->fd,outbuffer[0].c_str(),outbuffer[0].length());
+#else
+ int result = send(this->fd,outbuffer[0].c_str(),outbuffer[0].length(), 0);
+#endif
if (result > 0)
{
if ((unsigned int)result >= outbuffer[0].length())
@@ -589,6 +600,11 @@ void SocketTimeout::Tick(time_t now)
bool InspSocket::Poll()
{
+#ifdef WINDOWS
+ if(Instance->SE->GetRef(this->fd) != this)
+ return false;
+ int incoming = -1;
+#else
if (this->Instance->SE->GetRef(this->fd) != this)
return false;
@@ -596,13 +612,14 @@ bool InspSocket::Poll()
if ((fd < 0) || (fd > MAX_DESCRIPTORS))
return false;
-
+#endif
switch (this->state)
{
case I_CONNECTING:
/* Our socket was in write-state, so delete it and re-add it
* in read-state.
*/
+#ifndef WINDOWS
if (this->fd > -1)
{
this->Instance->SE->DelFd(this);
@@ -610,6 +627,9 @@ bool InspSocket::Poll()
if (!this->Instance->SE->AddFd(this))
return false;
}
+#else
+ this->SetState(I_CONNECTED);
+#endif
if (Instance->Config->GetIOHook(this))
{
try
@@ -632,7 +652,7 @@ bool InspSocket::Poll()
if ((!*this->host) || strchr(this->host, ':'))
length = sizeof(sockaddr_in6);
#endif
- incoming = accept (this->fd, client, &length);
+ incoming = _accept (this->fd, client, &length);
#ifdef IPV6
if ((!*this->host) || strchr(this->host, ':'))
{
diff --git a/src/inspstring.cpp b/src/inspstring.cpp
index d8df39e18..f5f607609 100644
--- a/src/inspstring.cpp
+++ b/src/inspstring.cpp
@@ -12,7 +12,6 @@
*/
#include "inspstring.h"
-#include <string.h>
/*
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -42,7 +41,7 @@
*/
#ifndef HAS_STRLCPY
-size_t strlcat(char *dst, const char *src, size_t siz)
+CoreExport size_t strlcat(char *dst, const char *src, size_t siz)
{
char *d = dst;
const char *s = src;
@@ -72,7 +71,7 @@ size_t strlcat(char *dst, const char *src, size_t siz)
return(dlen + (s - src)); /* count does not include NUL */
}
-size_t strlcpy(char *dst, const char *src, size_t siz)
+CoreExport size_t strlcpy(char *dst, const char *src, size_t siz)
{
char *d = dst;
const char *s = src;
@@ -101,7 +100,7 @@ size_t strlcpy(char *dst, const char *src, size_t siz)
}
#endif
-int charlcat(char* x,char y,int z)
+CoreExport int charlcat(char* x,char y,int z)
{
char* x__n = x;
int v = 0;
@@ -118,7 +117,7 @@ int charlcat(char* x,char y,int z)
return v;
}
-bool charremove(char* mp, char remove)
+CoreExport bool charremove(char* mp, char remove)
{
char* mptr = mp;
bool shift_down = false;
diff --git a/src/modules.cpp b/src/modules.cpp
index c2adb1575..cc334d4f7 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -378,7 +378,7 @@ bool InspIRCd::MatchText(const std::string &sliteral, const std::string &spatter
bool InspIRCd::CallCommandHandler(const std::string &commandname, const char** parameters, int pcnt, userrec* user)
{
- return this->Parser->CallHandler(commandname,parameters,pcnt,user);
+ return (this->Parser->CallHandler(commandname,parameters,pcnt,user) != CMD_INVALID);
}
bool InspIRCd::IsValidModuleCommand(const std::string &commandname, int pcnt, userrec* user)
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index 5d95e75cf..436b0f364 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -29,6 +29,12 @@
#include "transport.h"
+#ifdef WINDOWS
+#pragma comment(lib, "libgnutls-13.lib")
+#undef MAX_DESCRIPTORS
+#define MAX_DESCRIPTORS 10000
+#endif
+
/* $ModDesc: Provides SSL support for clients */
/* $CompileFlags: exec("libgnutls-config --cflags") */
/* $LinkerFlags: rpath("libgnutls-config --libs") exec("libgnutls-config --libs") */
@@ -85,7 +91,7 @@ class ModuleSSLGnuTLS : public Module
public:
ModuleSSLGnuTLS(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
ServerInstance->PublishInterface("InspSocketHook", this);
@@ -837,7 +843,7 @@ class ModuleSSLGnuTLSFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleSSLGnuTLSFactory;
}
diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp
index e073eba81..90e9c9ab6 100644
--- a/src/modules/extra/m_ssl_openssl.cpp
+++ b/src/modules/extra/m_ssl_openssl.cpp
@@ -17,6 +17,10 @@
#include <openssl/ssl.h>
#include <openssl/err.h>
+#ifdef WINDOWS
+#include <openssl/applink.c>
+#endif
+
#include "inspircd_config.h"
#include "configreader.h"
#include "users.h"
@@ -29,6 +33,13 @@
#include "transport.h"
+#ifdef WINDOWS
+#pragma comment(lib, "libeay32MTd")
+#pragma comment(lib, "ssleay32MTd")
+#undef MAX_DESCRIPTORS
+#define MAX_DESCRIPTORS 10000
+#endif
+
/* $ModDesc: Provides SSL support for clients */
/* $CompileFlags: pkgconfversion("openssl","0.9.7") pkgconfincludes("openssl","/openssl/ssl.h","") */
/* $LinkerFlags: rpath("pkg-config --libs openssl") pkgconflibs("openssl","/libssl.so","-lssl -lcrypto -ldl") */
@@ -122,7 +133,7 @@ class ModuleSSLOpenSSL : public Module
InspIRCd* PublicInstance;
ModuleSSLOpenSSL(InspIRCd* Me)
- : Module::Module(Me), PublicInstance(Me)
+ : Module(Me), PublicInstance(Me)
{
ServerInstance->PublishInterface("InspSocketHook", this);
@@ -855,7 +866,7 @@ class ModuleSSLOpenSSLFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleSSLOpenSSLFactory;
}
diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp
index a901ab165..827aeaf30 100644
--- a/src/modules/m_alias.cpp
+++ b/src/modules/m_alias.cpp
@@ -75,7 +75,7 @@ class ModuleAlias : public Module
public:
ModuleAlias(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
ReadAliases();
pars.resize(127);
@@ -289,7 +289,7 @@ class ModuleAliasFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleAliasFactory;
}
diff --git a/src/modules/m_alltime.cpp b/src/modules/m_alltime.cpp
index 04ae63b17..a24e3c979 100644
--- a/src/modules/m_alltime.cpp
+++ b/src/modules/m_alltime.cpp
@@ -64,7 +64,7 @@ class Modulealltime : public Module
cmd_alltime *mycommand;
public:
Modulealltime(InspIRCd *Me)
- : Module::Module(Me)
+ : Module(Me)
{
mycommand = new cmd_alltime(ServerInstance);
ServerInstance->AddCommand(mycommand);
@@ -99,7 +99,7 @@ class ModulealltimeFactory : public ModuleFactory
};
-extern "C" void *init_module(void)
+extern "C" DllExport void *init_module(void)
{
return new ModulealltimeFactory;
}
diff --git a/src/modules/m_antibear.cpp b/src/modules/m_antibear.cpp
index 90e515d33..f0affea7e 100644
--- a/src/modules/m_antibear.cpp
+++ b/src/modules/m_antibear.cpp
@@ -24,7 +24,7 @@ class ModuleAntiBear : public Module
private:
public:
- ModuleAntiBear(InspIRCd* Me) : Module::Module(Me)
+ ModuleAntiBear(InspIRCd* Me) : Module(Me)
{
}
@@ -99,7 +99,7 @@ class ModuleAntiBearFactory : public ModuleFactory
// class for this library
//
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleAntiBearFactory;
}
diff --git a/src/modules/m_antibottler.cpp b/src/modules/m_antibottler.cpp
index 27225edac..93a5691ef 100644
--- a/src/modules/m_antibottler.cpp
+++ b/src/modules/m_antibottler.cpp
@@ -22,7 +22,7 @@ class ModuleAntiBottler : public Module
{
public:
ModuleAntiBottler(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
}
@@ -116,7 +116,7 @@ class ModuleAntiBottlerFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleAntiBottlerFactory;
}
diff --git a/src/modules/m_auditorium.cpp b/src/modules/m_auditorium.cpp
index 166d1bcc4..15ef1943e 100644
--- a/src/modules/m_auditorium.cpp
+++ b/src/modules/m_auditorium.cpp
@@ -54,7 +54,7 @@ class ModuleAuditorium : public Module
CUList except_list;
public:
ModuleAuditorium(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
aum = new AuditoriumMode(ServerInstance);
if (!ServerInstance->AddMode(aum, 'u'))
@@ -206,7 +206,7 @@ class ModuleAuditoriumFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleAuditoriumFactory;
}
diff --git a/src/modules/m_banexception.cpp b/src/modules/m_banexception.cpp
index a340a5ce7..3fc192cb5 100644
--- a/src/modules/m_banexception.cpp
+++ b/src/modules/m_banexception.cpp
@@ -49,7 +49,7 @@ class ModuleBanException : public Module
public:
ModuleBanException(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
be = new BanException(ServerInstance);
if (!ServerInstance->AddMode(be, 'e'))
@@ -170,7 +170,7 @@ class ModuleBanExceptionFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleBanExceptionFactory;
}
diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp
index 2d9deedc6..ffe7724e2 100644
--- a/src/modules/m_banredirect.cpp
+++ b/src/modules/m_banredirect.cpp
@@ -191,7 +191,7 @@ class ModuleBanRedirect : public Module
public:
ModuleBanRedirect(InspIRCd* Me)
- : Module::Module(Me), Srv(Me)
+ : Module(Me), Srv(Me)
{
re = new BanRedirect(Me);
nofollow = false;
@@ -337,7 +337,7 @@ class ModuleBanRedirectFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleBanRedirectFactory;
}
diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp
index 39e3c16b1..f1a388890 100644
--- a/src/modules/m_blockamsg.cpp
+++ b/src/modules/m_blockamsg.cpp
@@ -45,7 +45,7 @@ class ModuleBlockAmsg : public Module
int ForgetDelay;
BlockAction action;
public:
- ModuleBlockAmsg(InspIRCd* Me) : Module::Module(Me)
+ ModuleBlockAmsg(InspIRCd* Me) : Module(Me)
{
this->OnRehash(NULL,"");
@@ -192,7 +192,7 @@ class ModuleBlockAmsgFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleBlockAmsgFactory;
}
diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp
index e984087d8..a3991177b 100644
--- a/src/modules/m_blockcaps.cpp
+++ b/src/modules/m_blockcaps.cpp
@@ -58,7 +58,7 @@ class ModuleBlockCAPS : public Module
char capsmap[256];
public:
- ModuleBlockCAPS(InspIRCd* Me) : Module::Module(Me)
+ ModuleBlockCAPS(InspIRCd* Me) : Module(Me)
{
OnRehash(NULL,"");
bc = new BlockCaps(ServerInstance);
@@ -160,7 +160,7 @@ class ModuleBlockCAPSFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleBlockCAPSFactory;
}
diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp
index 219637fb9..c63a44ea7 100644
--- a/src/modules/m_blockcolor.cpp
+++ b/src/modules/m_blockcolor.cpp
@@ -56,7 +56,7 @@ class ModuleBlockColour : public Module
BlockColor *bc;
public:
- ModuleBlockColour(InspIRCd* Me) : Module::Module(Me)
+ ModuleBlockColour(InspIRCd* Me) : Module(Me)
{
bc = new BlockColor(ServerInstance);
if (!ServerInstance->AddMode(bc, 'c'))
@@ -137,7 +137,7 @@ class ModuleBlockColourFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleBlockColourFactory;
}
diff --git a/src/modules/m_botmode.cpp b/src/modules/m_botmode.cpp
index ea6d1e60a..a4cebc4c7 100644
--- a/src/modules/m_botmode.cpp
+++ b/src/modules/m_botmode.cpp
@@ -57,7 +57,7 @@ class ModuleBotMode : public Module
BotMode* bm;
public:
ModuleBotMode(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
bm = new BotMode(ServerInstance);
@@ -112,7 +112,7 @@ class ModuleBotModeFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleBotModeFactory;
}
diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp
index e6e3b92b0..9aaf5fc6d 100644
--- a/src/modules/m_cban.cpp
+++ b/src/modules/m_cban.cpp
@@ -127,7 +127,7 @@ class ModuleCBan : public Module
public:
- ModuleCBan(InspIRCd* Me) : Module::Module(Me)
+ ModuleCBan(InspIRCd* Me) : Module(Me)
{
mycommand = new cmd_cban(Me);
@@ -266,7 +266,7 @@ class ModuleCBanFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleCBanFactory;
}
diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp
index c378080a5..ae254a120 100644
--- a/src/modules/m_censor.cpp
+++ b/src/modules/m_censor.cpp
@@ -92,7 +92,7 @@ class ModuleCensor : public Module
public:
ModuleCensor(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
/* Read the configuration file on startup.
*/
@@ -213,7 +213,7 @@ class ModuleCensorFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleCensorFactory;
}
diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp
index b3cc24839..671588d18 100644
--- a/src/modules/m_cgiirc.cpp
+++ b/src/modules/m_cgiirc.cpp
@@ -14,13 +14,15 @@
#include <vector>
#include <string>
#include <stdlib.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
#include "users.h"
#include "modules.h"
#include "dns.h"
#include "inspircd.h"
+#ifndef WINDOWS
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#endif
/* $ModDesc: Change user's hosts connecting from known CGI:IRC hosts */
@@ -127,7 +129,7 @@ class ModuleCgiIRC : public Module
bool NotifyOpers;
CGIHostlist Hosts;
public:
- ModuleCgiIRC(InspIRCd* Me) : Module::Module(Me)
+ ModuleCgiIRC(InspIRCd* Me) : Module(Me)
{
OnRehash(NULL,"");
@@ -518,7 +520,7 @@ class ModuleCgiIRCFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleCgiIRCFactory;
}
diff --git a/src/modules/m_chancreate.cpp b/src/modules/m_chancreate.cpp
index e9e95a924..1efdf2996 100644
--- a/src/modules/m_chancreate.cpp
+++ b/src/modules/m_chancreate.cpp
@@ -23,7 +23,7 @@ class ModuleChanCreate : public Module
private:
public:
ModuleChanCreate(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
ServerInstance->SNO->EnableSnomask('j', "CHANCREATE");
}
@@ -70,7 +70,7 @@ class ModuleChanCreateFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleChanCreateFactory;
}
diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp
index 3c16b013d..4008eb349 100644
--- a/src/modules/m_chanfilter.cpp
+++ b/src/modules/m_chanfilter.cpp
@@ -67,7 +67,7 @@ class ModuleChanFilter : public Module
public:
ModuleChanFilter(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
cf = new ChanFilter(ServerInstance);
if (!ServerInstance->AddMode(cf, 'g'))
@@ -172,7 +172,7 @@ class ModuleChanFilterFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleChanFilterFactory;
}
diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp
index 81cf34c0c..5ba18a2bf 100644
--- a/src/modules/m_chanprotect.cpp
+++ b/src/modules/m_chanprotect.cpp
@@ -303,7 +303,7 @@ class ModuleChanProtect : public Module
public:
ModuleChanProtect(InspIRCd* Me)
- : Module::Module(Me), FirstInGetsFounder(false), QAPrefixes(false), DeprivSelf(false), DeprivOthers(false), booting(true)
+ : Module(Me), FirstInGetsFounder(false), QAPrefixes(false), DeprivSelf(false), DeprivOthers(false), booting(true)
{
/* Load config stuff */
OnRehash(NULL,"");
@@ -548,7 +548,7 @@ class ModuleChanProtectFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleChanProtectFactory;
}
diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp
index 7a7fe570b..d12513af9 100644
--- a/src/modules/m_check.cpp
+++ b/src/modules/m_check.cpp
@@ -162,7 +162,7 @@ class ModuleCheck : public Module
private:
cmd_check *mycommand;
public:
- ModuleCheck(InspIRCd* Me) : Module::Module(Me)
+ ModuleCheck(InspIRCd* Me) : Module(Me)
{
mycommand = new cmd_check(ServerInstance);
@@ -205,7 +205,7 @@ class ModuleCheckFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleCheckFactory;
}
diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp
index 45eaaa378..f3f7f6387 100644
--- a/src/modules/m_chghost.cpp
+++ b/src/modules/m_chghost.cpp
@@ -78,7 +78,7 @@ class ModuleChgHost : public Module
char hostmap[256];
public:
ModuleChgHost(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
OnRehash(NULL,"");
mycommand = new cmd_chghost(ServerInstance, hostmap);
@@ -134,7 +134,7 @@ class ModuleChgHostFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleChgHostFactory;
}
diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp
index 43bb34b31..8c251b2bc 100644
--- a/src/modules/m_chgident.cpp
+++ b/src/modules/m_chgident.cpp
@@ -60,7 +60,7 @@ class ModuleChgIdent : public Module
public:
- ModuleChgIdent(InspIRCd* Me) : Module::Module(Me)
+ ModuleChgIdent(InspIRCd* Me) : Module(Me)
{
mycommand = new cmd_chgident(ServerInstance);
ServerInstance->AddCommand(mycommand);
@@ -98,7 +98,7 @@ class ModuleChgIdentFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleChgIdentFactory;
}
diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp
index e53124aa0..1b6888426 100644
--- a/src/modules/m_cloaking.cpp
+++ b/src/modules/m_cloaking.cpp
@@ -271,7 +271,7 @@ class ModuleCloaking : public Module
public:
ModuleCloaking(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
ServerInstance->UseInterface("HashRequest");
@@ -336,7 +336,7 @@ class ModuleCloakingFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleCloakingFactory;
}
diff --git a/src/modules/m_clones.cpp b/src/modules/m_clones.cpp
index e51680a7f..afb0c3a4b 100644
--- a/src/modules/m_clones.cpp
+++ b/src/modules/m_clones.cpp
@@ -74,7 +74,7 @@ class ModuleClones : public Module
private:
cmd_clones *mycommand;
public:
- ModuleClones(InspIRCd* Me) : Module::Module(Me)
+ ModuleClones(InspIRCd* Me) : Module(Me)
{
mycommand = new cmd_clones(ServerInstance);
@@ -117,7 +117,7 @@ class ModuleClonesFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleClonesFactory;
}
diff --git a/src/modules/m_conn_join.cpp b/src/modules/m_conn_join.cpp
index a2c45641c..b125a772b 100644
--- a/src/modules/m_conn_join.cpp
+++ b/src/modules/m_conn_join.cpp
@@ -46,7 +46,7 @@ class ModuleConnJoin : public Module
public:
ModuleConnJoin(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
OnRehash(NULL, "");
}
@@ -104,7 +104,7 @@ class ModuleConnJoinFactory : public ModuleFactory
}
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleConnJoinFactory;
}
diff --git a/src/modules/m_conn_umodes.cpp b/src/modules/m_conn_umodes.cpp
index 2226f9776..1973820cd 100644
--- a/src/modules/m_conn_umodes.cpp
+++ b/src/modules/m_conn_umodes.cpp
@@ -29,7 +29,7 @@ class ModuleModesOnConnect : public Module
public:
ModuleModesOnConnect(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
Conf = new ConfigReader(ServerInstance);
@@ -79,7 +79,7 @@ class ModuleModesOnConnect : public Module
tokens.push_back(buf);
int size = tokens.size() + 1;
- const char* modes[size];
+ const char** modes = new const char*[size];
modes[0] = user->nick;
modes[1] = tokens[0].c_str();
@@ -95,6 +95,7 @@ class ModuleModesOnConnect : public Module
}
ServerInstance->Parser->CallHandler("MODE", modes, size, user);
+ delete [] modes;
}
break;
}
@@ -123,7 +124,7 @@ class ModuleModesOnConnectFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleModesOnConnectFactory;
}
diff --git a/src/modules/m_conn_waitpong.cpp b/src/modules/m_conn_waitpong.cpp
index 1c2632125..9370b9931 100644
--- a/src/modules/m_conn_waitpong.cpp
+++ b/src/modules/m_conn_waitpong.cpp
@@ -29,7 +29,7 @@ class ModuleWaitPong : public Module
public:
ModuleWaitPong(InspIRCd* Me)
- : Module::Module(Me), Instance(Me), extenstr("waitpong_pingstr")
+ : Module(Me), Instance(Me), extenstr("waitpong_pingstr")
{
OnRehash(NULL,"");
}
@@ -166,7 +166,7 @@ class ModuleWaitPongFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleWaitPongFactory;
}
diff --git a/src/modules/m_connflood.cpp b/src/modules/m_connflood.cpp
index c834605b0..1cfacf480 100644
--- a/src/modules/m_connflood.cpp
+++ b/src/modules/m_connflood.cpp
@@ -31,7 +31,7 @@ private:
public:
- ModuleConnFlood(InspIRCd* Me) : Module::Module(Me)
+ ModuleConnFlood(InspIRCd* Me) : Module(Me)
{
InitConf();
@@ -137,7 +137,7 @@ public:
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleConnFloodFactory;
}
diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp
index 23d259f6c..367a3769e 100644
--- a/src/modules/m_dccallow.cpp
+++ b/src/modules/m_dccallow.cpp
@@ -254,7 +254,7 @@ class ModuleDCCAllow : public Module
public:
ModuleDCCAllow(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
Conf = new ConfigReader(ServerInstance);
mycommand = new cmd_dccallow(ServerInstance);
@@ -507,7 +507,7 @@ class ModuleDCCAllowFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleDCCAllowFactory;
}
diff --git a/src/modules/m_deaf.cpp b/src/modules/m_deaf.cpp
index 0be919e65..109916881 100644
--- a/src/modules/m_deaf.cpp
+++ b/src/modules/m_deaf.cpp
@@ -53,7 +53,7 @@ class ModuleDeaf : public Module
User_d* m1;
public:
ModuleDeaf(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
m1 = new User_d(ServerInstance);
if (!ServerInstance->AddMode(m1, 'd'))
@@ -152,7 +152,7 @@ class ModuleDeafFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleDeafFactory;
}
diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp
index db42ab43a..d143bffbf 100644
--- a/src/modules/m_denychans.cpp
+++ b/src/modules/m_denychans.cpp
@@ -28,7 +28,7 @@ class ModuleDenyChannels : public Module
ConfigReader *Conf;
public:
- ModuleDenyChannels(InspIRCd* Me) : Module::Module(Me)
+ ModuleDenyChannels(InspIRCd* Me) : Module(Me)
{
Conf = new ConfigReader(ServerInstance);
@@ -98,7 +98,7 @@ class ModuleDenyChannelsFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleDenyChannelsFactory;
}
diff --git a/src/modules/m_devoice.cpp b/src/modules/m_devoice.cpp
index 7400d2212..3c21a64f6 100644
--- a/src/modules/m_devoice.cpp
+++ b/src/modules/m_devoice.cpp
@@ -62,7 +62,7 @@ class ModuleDeVoice : public Module
{
cmd_devoice *mycommand;
public:
- ModuleDeVoice(InspIRCd* Me) : Module::Module(Me)
+ ModuleDeVoice(InspIRCd* Me) : Module(Me)
{
mycommand = new cmd_devoice(ServerInstance);
@@ -99,7 +99,7 @@ class ModuleDeVoiceFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleDeVoiceFactory;
}
diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp
index 3c6260a72..d53706af3 100644
--- a/src/modules/m_dnsbl.cpp
+++ b/src/modules/m_dnsbl.cpp
@@ -11,11 +11,6 @@
* ---------------------------------------------------
*/
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <stdint.h>
#include "inspircd.h"
#include "xline.h"
#include "dns.h"
@@ -23,6 +18,14 @@
#include "channels.h"
#include "modules.h"
+#ifndef WINDOWS
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <stdint.h>
+#endif
+
/* $ModDesc: Provides handling of DNS blacklists */
/* Class holding data for a single entry */
@@ -167,7 +170,7 @@ class ModuleDNSBL : public Module
return DNSBLConfEntry::I_UNKNOWN;
}
public:
- ModuleDNSBL(InspIRCd *Me) : Module::Module(Me)
+ ModuleDNSBL(InspIRCd *Me) : Module(Me)
{
ReadConf();
}
@@ -360,7 +363,7 @@ class ModuleDNSBLFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleDNSBLFactory;
}
diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp
index 133406ccb..b0c932ada 100644
--- a/src/modules/m_filter.cpp
+++ b/src/modules/m_filter.cpp
@@ -31,7 +31,7 @@ class ModuleFilter : public FilterBase
public:
ModuleFilter(InspIRCd* Me)
- : FilterBase::FilterBase(Me, "m_filter.so")
+ : FilterBase(Me, "m_filter.so")
{
OnRehash(NULL,"");
}
@@ -155,7 +155,7 @@ class ModuleFilterFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleFilterFactory;
}
diff --git a/src/modules/m_filter.h b/src/modules/m_filter.h
index 5797cc310..dbe8b4342 100644
--- a/src/modules/m_filter.h
+++ b/src/modules/m_filter.h
@@ -148,7 +148,7 @@ class cmd_filter : public command_t
}
};
-FilterBase::FilterBase(InspIRCd* Me, const std::string &source) : Module::Module(Me)
+FilterBase::FilterBase(InspIRCd* Me, const std::string &source) : Module(Me)
{
filtcommand = new cmd_filter(this, Me, source);
ServerInstance->AddCommand(filtcommand);
diff --git a/src/modules/m_foobar.cpp b/src/modules/m_foobar.cpp
index a42275127..cd0b15bd9 100644
--- a/src/modules/m_foobar.cpp
+++ b/src/modules/m_foobar.cpp
@@ -34,7 +34,7 @@ class ModuleFoobar : public Module
public:
ModuleFoobar(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
// The constructor just makes a copy of the server class
@@ -124,7 +124,7 @@ class ModuleFoobarFactory : public ModuleFactory
// class for this library
//
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleFoobarFactory;
}
diff --git a/src/modules/m_globalload.cpp b/src/modules/m_globalload.cpp
index ca945b496..7cc38eaa1 100644
--- a/src/modules/m_globalload.cpp
+++ b/src/modules/m_globalload.cpp
@@ -117,7 +117,7 @@ class ModuleGlobalLoad : public Module
cmd_greloadmodule *mycommand3;
public:
- ModuleGlobalLoad(InspIRCd* Me) : Module::Module(Me)
+ ModuleGlobalLoad(InspIRCd* Me) : Module(Me)
{
mycommand = new cmd_gloadmodule(ServerInstance);
@@ -158,7 +158,7 @@ class ModuleGlobalLoadFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleGlobalLoadFactory;
}
diff --git a/src/modules/m_globops.cpp b/src/modules/m_globops.cpp
index 7e4d88d94..4dbe8dfb5 100644
--- a/src/modules/m_globops.cpp
+++ b/src/modules/m_globops.cpp
@@ -52,7 +52,7 @@ class ModuleGlobops : public Module
cmd_globops* mycommand;
public:
ModuleGlobops(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
mycommand = new cmd_globops(ServerInstance);
ServerInstance->AddCommand(mycommand);
@@ -94,7 +94,7 @@ class ModuleGlobopsFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleGlobopsFactory;
}
diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp
index f82004f16..5a02f2bf0 100644
--- a/src/modules/m_helpop.cpp
+++ b/src/modules/m_helpop.cpp
@@ -116,7 +116,7 @@ class ModuleHelpop : public Module
public:
ModuleHelpop(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
ReadConfig();
ho = new Helpop(ServerInstance);
@@ -206,7 +206,7 @@ class ModuleHelpopFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleHelpopFactory;
}
diff --git a/src/modules/m_hidechans.cpp b/src/modules/m_hidechans.cpp
index a2bc4aa54..cf7c95c0f 100644
--- a/src/modules/m_hidechans.cpp
+++ b/src/modules/m_hidechans.cpp
@@ -58,7 +58,7 @@ class ModuleHideChans : public Module
HideChans* hm;
public:
ModuleHideChans(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
hm = new HideChans(ServerInstance);
@@ -110,7 +110,7 @@ class ModuleHideChansFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleHideChansFactory;
}
diff --git a/src/modules/m_hideoper.cpp b/src/modules/m_hideoper.cpp
index ce627f448..afc2e6cfa 100644
--- a/src/modules/m_hideoper.cpp
+++ b/src/modules/m_hideoper.cpp
@@ -57,7 +57,7 @@ class ModuleHideOper : public Module
HideOper* hm;
public:
ModuleHideOper(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
hm = new HideOper(ServerInstance);
@@ -109,7 +109,7 @@ class ModuleHideOperFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleHideOperFactory;
}
diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp
index 473a35d12..d2e51a187 100644
--- a/src/modules/m_hostchange.cpp
+++ b/src/modules/m_hostchange.cpp
@@ -41,7 +41,7 @@ class ModuleHostChange : public Module
public:
ModuleHostChange(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
Conf = new ConfigReader(ServerInstance);
OnRehash(NULL,"");
@@ -160,7 +160,7 @@ class ModuleHostChangeFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleHostChangeFactory;
}
diff --git a/src/modules/m_http_client.cpp b/src/modules/m_http_client.cpp
index e3c50ef82..2cb890a1e 100644
--- a/src/modules/m_http_client.cpp
+++ b/src/modules/m_http_client.cpp
@@ -75,7 +75,7 @@ class ModuleHTTPClient : public Module
HTTPList sockets;
ModuleHTTPClient(InspIRCd *Me)
- : Module::Module(Me)
+ : Module(Me)
{
}
@@ -360,7 +360,7 @@ class ModuleHTTPClientFactory : public ModuleFactory
}
};
-extern "C" void *init_module(void)
+extern "C" DllExport void *init_module(void)
{
return new ModuleHTTPClientFactory;
}
diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp
index 3342ba37d..49c8d8803 100644
--- a/src/modules/m_httpd.cpp
+++ b/src/modules/m_httpd.cpp
@@ -378,7 +378,7 @@ class ModuleHttpServer : public Module
}
}
- ModuleHttpServer(InspIRCd* Me) : Module::Module(Me)
+ ModuleHttpServer(InspIRCd* Me) : Module(Me)
{
ReadConfig();
}
@@ -437,7 +437,7 @@ class ModuleHttpServerFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleHttpServerFactory;
}
diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp
index a72c94c47..e800b3d98 100644
--- a/src/modules/m_httpd_stats.cpp
+++ b/src/modules/m_httpd_stats.cpp
@@ -45,7 +45,7 @@ class ModuleHttpStats : public Module
this->stylesheet = c.ReadValue("httpstats", "stylesheet", 0);
}
- ModuleHttpStats(InspIRCd* Me) : Module::Module(Me)
+ ModuleHttpStats(InspIRCd* Me) : Module(Me)
{
ReadConfig();
@@ -258,7 +258,7 @@ class ModuleHttpStatsFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleHttpStatsFactory;
}
diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp
index cf0f41383..00d12b8ec 100644
--- a/src/modules/m_ident.cpp
+++ b/src/modules/m_ident.cpp
@@ -205,7 +205,7 @@ class ModuleIdent : public Module
}
ModuleIdent(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
ReadSettings();
@@ -349,7 +349,7 @@ class ModuleIdentFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleIdentFactory;
}
diff --git a/src/modules/m_invisible.cpp b/src/modules/m_invisible.cpp
index 0f9578666..30a20f2ed 100644
--- a/src/modules/m_invisible.cpp
+++ b/src/modules/m_invisible.cpp
@@ -147,7 +147,7 @@ class ModuleInvisible : public Module
InvisibleDeOper* ido;
public:
ModuleInvisible(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
conf = new ConfigReader(ServerInstance);
qm = new InvisibleMode(ServerInstance);
@@ -292,7 +292,7 @@ class ModuleInvisibleFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleInvisibleFactory;
}
diff --git a/src/modules/m_inviteexception.cpp b/src/modules/m_inviteexception.cpp
index 8cca13b1e..88c2c507f 100644
--- a/src/modules/m_inviteexception.cpp
+++ b/src/modules/m_inviteexception.cpp
@@ -168,7 +168,7 @@ class ModuleInviteExceptionFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleInviteExceptionFactory;
}
diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp
index 358f3e08c..f6b5f4b90 100644
--- a/src/modules/m_joinflood.cpp
+++ b/src/modules/m_joinflood.cpp
@@ -218,7 +218,7 @@ class ModuleJoinFlood : public Module
public:
ModuleJoinFlood(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
jf = new JoinFlood(ServerInstance);
@@ -305,7 +305,7 @@ class ModuleJoinFloodFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleJoinFloodFactory;
}
diff --git a/src/modules/m_jumpserver.cpp b/src/modules/m_jumpserver.cpp
index d48223ffb..f21fb8e3a 100644
--- a/src/modules/m_jumpserver.cpp
+++ b/src/modules/m_jumpserver.cpp
@@ -128,7 +128,7 @@ class ModuleJumpServer : public Module
cmd_jumpserver* js;
public:
ModuleJumpServer(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
js = new cmd_jumpserver(ServerInstance);
@@ -181,7 +181,7 @@ class ModuleJumpServerFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleJumpServerFactory;
}
diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp
index 87e8646ec..a38d260bb 100644
--- a/src/modules/m_kicknorejoin.cpp
+++ b/src/modules/m_kicknorejoin.cpp
@@ -129,7 +129,7 @@ class ModuleKickNoRejoin : public Module
public:
ModuleKickNoRejoin(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
kr = new KickRejoin(ServerInstance);
@@ -245,7 +245,7 @@ class ModuleKickNoRejoinFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleKickNoRejoinFactory;
}
diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp
index 70480e188..a725844b7 100644
--- a/src/modules/m_knock.cpp
+++ b/src/modules/m_knock.cpp
@@ -103,7 +103,7 @@ class ModuleKnock : public Module
cmd_knock* mycommand;
Knock* kn;
public:
- ModuleKnock(InspIRCd* Me) : Module::Module(Me)
+ ModuleKnock(InspIRCd* Me) : Module(Me)
{
kn = new Knock(ServerInstance);
@@ -150,7 +150,7 @@ class ModuleKnockFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleKnockFactory;
}
diff --git a/src/modules/m_lockserv.cpp b/src/modules/m_lockserv.cpp
index f3ac93347..8a8471aa5 100644
--- a/src/modules/m_lockserv.cpp
+++ b/src/modules/m_lockserv.cpp
@@ -84,7 +84,7 @@ private:
}
public:
- ModuleLockserv(InspIRCd* Me) : Module::Module(Me)
+ ModuleLockserv(InspIRCd* Me) : Module(Me)
{
ResetLocked();
lockcommand = new cmd_lockserv(ServerInstance, locked);
@@ -146,7 +146,7 @@ public:
}
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleLockservFactory;
}
diff --git a/src/modules/m_md5.cpp b/src/modules/m_md5.cpp
index d43204b99..19b351e0c 100644
--- a/src/modules/m_md5.cpp
+++ b/src/modules/m_md5.cpp
@@ -270,7 +270,7 @@ class ModuleMD5 : public Module
public:
ModuleMD5(InspIRCd* Me)
- : Module::Module(Me), key(NULL), chars(NULL)
+ : Module(Me), key(NULL), chars(NULL)
{
ServerInstance->PublishInterface("HashRequest", this);
}
@@ -341,7 +341,7 @@ class ModuleMD5Factory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleMD5Factory;
}
diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp
index 6f3beb512..ae458a0d6 100644
--- a/src/modules/m_messageflood.cpp
+++ b/src/modules/m_messageflood.cpp
@@ -196,7 +196,7 @@ class ModuleMsgFlood : public Module
public:
ModuleMsgFlood(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
mf = new MsgFlood(ServerInstance);
@@ -309,7 +309,7 @@ class ModuleMsgFloodFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleMsgFloodFactory;
}
diff --git a/src/modules/m_namesx.cpp b/src/modules/m_namesx.cpp
index db8270cb9..f078aa8bf 100644
--- a/src/modules/m_namesx.cpp
+++ b/src/modules/m_namesx.cpp
@@ -25,7 +25,7 @@ class ModuleNamesX : public Module
public:
ModuleNamesX(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
}
@@ -143,7 +143,7 @@ class ModuleNamesXFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleNamesXFactory;
}
diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp
index dd51be1cc..f80bff5b1 100644
--- a/src/modules/m_nicklock.cpp
+++ b/src/modules/m_nicklock.cpp
@@ -112,7 +112,7 @@ class ModuleNickLock : public Module
char* n;
public:
ModuleNickLock(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
cmd1 = new cmd_nicklock(ServerInstance);
@@ -181,7 +181,7 @@ class ModuleNickLockFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleNickLockFactory;
}
diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp
index 029a95065..7ac9e0824 100644
--- a/src/modules/m_noctcp.cpp
+++ b/src/modules/m_noctcp.cpp
@@ -56,7 +56,7 @@ class ModuleNoCTCP : public Module
public:
ModuleNoCTCP(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
nc = new NoCTCP(ServerInstance);
@@ -126,7 +126,7 @@ class ModuleNoCTCPFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleNoCTCPFactory;
}
diff --git a/src/modules/m_noinvite.cpp b/src/modules/m_noinvite.cpp
index 0b4e1723b..db3ae400f 100644
--- a/src/modules/m_noinvite.cpp
+++ b/src/modules/m_noinvite.cpp
@@ -51,7 +51,7 @@ class ModuleNoInvite : public Module
NoInvite *ni;
public:
- ModuleNoInvite(InspIRCd* Me) : Module::Module(Me)
+ ModuleNoInvite(InspIRCd* Me) : Module(Me)
{
ni = new NoInvite(ServerInstance);
if (!ServerInstance->AddMode(ni, 'V'))
@@ -104,7 +104,7 @@ class ModuleNoInviteFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleNoInviteFactory;
}
diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp
index c5ad179e8..975d86e3b 100644
--- a/src/modules/m_nokicks.cpp
+++ b/src/modules/m_nokicks.cpp
@@ -57,7 +57,7 @@ class ModuleNoKicks : public Module
public:
ModuleNoKicks(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
nk = new NoKicks(ServerInstance);
@@ -124,7 +124,7 @@ class ModuleNoKicksFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleNoKicksFactory;
}
diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp
index 103d07c2a..1ac82ed29 100644
--- a/src/modules/m_nonicks.cpp
+++ b/src/modules/m_nonicks.cpp
@@ -53,7 +53,7 @@ class ModuleNoNickChange : public Module
NoNicks* nn;
public:
ModuleNoNickChange(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
nn = new NoNicks(ServerInstance);
@@ -120,7 +120,7 @@ class ModuleNoNickChangeFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleNoNickChangeFactory;
}
diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp
index 31d423996..528eeb0f4 100644
--- a/src/modules/m_nonotice.cpp
+++ b/src/modules/m_nonotice.cpp
@@ -53,7 +53,7 @@ class ModuleNoNotice : public Module
public:
ModuleNoNotice(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
nt = new NoNotice(ServerInstance);
@@ -120,7 +120,7 @@ class ModuleNoNoticeFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleNoNoticeFactory;
}
diff --git a/src/modules/m_oper_hash.cpp b/src/modules/m_oper_hash.cpp
index 8c9ca0556..80869898c 100644
--- a/src/modules/m_oper_hash.cpp
+++ b/src/modules/m_oper_hash.cpp
@@ -79,7 +79,7 @@ class ModuleOperHash : public Module
public:
ModuleOperHash(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
/* Read the config file first */
@@ -182,7 +182,7 @@ class ModuleOperHashFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleOperHashFactory;
}
diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp
index 6b89332be..15ef0faf9 100644
--- a/src/modules/m_operchans.cpp
+++ b/src/modules/m_operchans.cpp
@@ -53,7 +53,7 @@ class ModuleOperChans : public Module
OperChans* oc;
public:
ModuleOperChans(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
oc = new OperChans(ServerInstance);
@@ -114,7 +114,7 @@ class ModuleOperChansFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleOperChansFactory;
}
diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp
index c733bd3a1..12c17745a 100644
--- a/src/modules/m_operjoin.cpp
+++ b/src/modules/m_operjoin.cpp
@@ -44,7 +44,7 @@ class ModuleOperjoin : public Module
}
public:
- ModuleOperjoin(InspIRCd* Me) : Module::Module(Me)
+ ModuleOperjoin(InspIRCd* Me) : Module(Me)
{
OnRehash(NULL, "");
}
@@ -104,7 +104,7 @@ class ModuleOperjoinFactory : public ModuleFactory
}
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleOperjoinFactory;
}
diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp
index 1291b28de..8832596f6 100644
--- a/src/modules/m_operlevels.cpp
+++ b/src/modules/m_operlevels.cpp
@@ -33,7 +33,7 @@ class ModuleOperLevels : public Module
public:
ModuleOperLevels(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
@@ -117,7 +117,7 @@ class ModuleOperLevelsFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleOperLevelsFactory;
}
diff --git a/src/modules/m_operlog.cpp b/src/modules/m_operlog.cpp
index 195415340..ce6e7aea4 100644
--- a/src/modules/m_operlog.cpp
+++ b/src/modules/m_operlog.cpp
@@ -24,7 +24,7 @@ class ModuleOperLog : public Module
private:
public:
- ModuleOperLog(InspIRCd* Me) : Module::Module(Me)
+ ModuleOperLog(InspIRCd* Me) : Module(Me)
{
}
@@ -94,7 +94,7 @@ class ModuleOperLogFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleOperLogFactory;
}
diff --git a/src/modules/m_opermodes.cpp b/src/modules/m_opermodes.cpp
index 43c271c3d..30f6fef9c 100644
--- a/src/modules/m_opermodes.cpp
+++ b/src/modules/m_opermodes.cpp
@@ -29,7 +29,7 @@ class ModuleModesOnOper : public Module
public:
ModuleModesOnOper(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
Conf = new ConfigReader(ServerInstance);
@@ -82,7 +82,7 @@ class ModuleModesOnOper : public Module
tokens.push_back(buf);
int size = tokens.size() + 1;
- const char* modes[size];
+ char** modes = new char*[size];
modes[0] = user->nick;
modes[1] = (char*)tokens[0].c_str();
@@ -103,7 +103,8 @@ class ModuleModesOnOper : public Module
n.push_back(modes[j]);
}
rmode.Send(ServerInstance);
- ServerInstance->SendMode(modes, size, user);
+ ServerInstance->SendMode((const char**)modes, size, user);
+ delete [] modes;
}
break;
}
@@ -132,7 +133,7 @@ class ModuleModesOnOperFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleModesOnOperFactory;
}
diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp
index 447468caf..f08b287bd 100644
--- a/src/modules/m_opermotd.cpp
+++ b/src/modules/m_opermotd.cpp
@@ -81,7 +81,7 @@ class ModuleOpermotd : public Module
}
ModuleOpermotd(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
opermotd = NULL;
mycommand = new cmd_opermotd(ServerInstance);
@@ -132,7 +132,7 @@ class ModuleOpermotdFactory : public ModuleFactory
}
};
-extern "C" void* init_module(void)
+extern "C" DllExport void* init_module(void)
{
return new ModuleOpermotdFactory;
}
diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp
index 31b52e853..e7f424194 100644
--- a/src/modules/m_override.cpp
+++ b/src/modules/m_override.cpp
@@ -33,7 +33,7 @@ class ModuleOverride : public Module
public:
ModuleOverride(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
// read our config options (main config file)
OnRehash(NULL,"");
@@ -311,7 +311,7 @@ class ModuleOverrideFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleOverrideFactory;
}
diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp
index 2eb5539b8..701e5da91 100644
--- a/src/modules/m_randquote.cpp
+++ b/src/modules/m_randquote.cpp
@@ -81,7 +81,7 @@ class ModuleRandQuote : public Module
ConfigReader *conf;
public:
ModuleRandQuote(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
conf = new ConfigReader(ServerInstance);
@@ -157,7 +157,7 @@ class ModuleRandQuoteFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleRandQuoteFactory;
}
diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp
index e09c9b33b..492d39e58 100644
--- a/src/modules/m_redirect.cpp
+++ b/src/modules/m_redirect.cpp
@@ -104,7 +104,7 @@ class ModuleRedirect : public Module
public:
ModuleRedirect(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
re = new Redirect(ServerInstance);
@@ -177,7 +177,7 @@ class ModuleRedirectFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleRedirectFactory;
}
diff --git a/src/modules/m_regonlycreate.cpp b/src/modules/m_regonlycreate.cpp
index 9874936d8..f4738ef08 100644
--- a/src/modules/m_regonlycreate.cpp
+++ b/src/modules/m_regonlycreate.cpp
@@ -22,7 +22,7 @@ class ModuleRegOnlyCreate : public Module
{
public:
ModuleRegOnlyCreate(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
}
@@ -78,7 +78,7 @@ class ModuleRegOnlyCreateFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleRegOnlyCreateFactory;
}
diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp
index e5c433b84..56a54fc37 100644
--- a/src/modules/m_remove.cpp
+++ b/src/modules/m_remove.cpp
@@ -249,7 +249,7 @@ class ModuleRemove : public Module
public:
ModuleRemove(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
mycommand = new cmd_remove(ServerInstance, supportnokicks);
mycommand2 = new cmd_fpart(ServerInstance, supportnokicks);
@@ -308,7 +308,7 @@ class ModuleRemoveFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleRemoveFactory;
}
diff --git a/src/modules/m_restrictbanned.cpp b/src/modules/m_restrictbanned.cpp
index b891d5659..6f0e991e5 100644
--- a/src/modules/m_restrictbanned.cpp
+++ b/src/modules/m_restrictbanned.cpp
@@ -23,7 +23,7 @@ class ModuleRestrictBanned : public Module
{
private:
public:
- ModuleRestrictBanned(InspIRCd* Me) : Module::Module(Me)
+ ModuleRestrictBanned(InspIRCd* Me) : Module(Me)
{
}
@@ -116,7 +116,7 @@ class ModuleRestrictBannedFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleRestrictBannedFactory;
}
diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp
index 68fb73577..eab419c46 100644
--- a/src/modules/m_restrictchans.cpp
+++ b/src/modules/m_restrictchans.cpp
@@ -43,7 +43,7 @@ class ModuleRestrictChans : public Module
public:
ModuleRestrictChans(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
ReadConfig();
@@ -105,7 +105,7 @@ class ModuleRestrictChansFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleRestrictChansFactory;
}
diff --git a/src/modules/m_restrictmsg.cpp b/src/modules/m_restrictmsg.cpp
index ce62296ac..e04366b59 100644
--- a/src/modules/m_restrictmsg.cpp
+++ b/src/modules/m_restrictmsg.cpp
@@ -29,7 +29,7 @@ class ModuleRestrictMsg : public Module
public:
ModuleRestrictMsg(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
}
@@ -96,7 +96,7 @@ class ModuleRestrictMsgFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleRestrictMsgFactory;
}
diff --git a/src/modules/m_safelist.cpp b/src/modules/m_safelist.cpp
index 424d01256..2bcb77a91 100644
--- a/src/modules/m_safelist.cpp
+++ b/src/modules/m_safelist.cpp
@@ -43,7 +43,7 @@ class ModuleSafeList : public Module
int global_listing;
int LimitList;
public:
- ModuleSafeList(InspIRCd* Me) : Module::Module(Me)
+ ModuleSafeList(InspIRCd* Me) : Module(Me)
{
OnRehash(NULL, "");
}
@@ -285,7 +285,7 @@ class ModuleSafeListFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleSafeListFactory;
}
diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp
index b91b1a2f0..decce5aef 100644
--- a/src/modules/m_sajoin.cpp
+++ b/src/modules/m_sajoin.cpp
@@ -96,7 +96,7 @@ class ModuleSajoin : public Module
cmd_sajoin* mycommand;
public:
ModuleSajoin(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
mycommand = new cmd_sajoin(ServerInstance);
@@ -135,7 +135,7 @@ class ModuleSajoinFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleSajoinFactory;
}
diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp
index ddce91d51..89956a17d 100644
--- a/src/modules/m_samode.cpp
+++ b/src/modules/m_samode.cpp
@@ -79,7 +79,7 @@ class ModuleSaMode : public Module
cmd_samode* mycommand;
public:
ModuleSaMode(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
mycommand = new cmd_samode(ServerInstance);
@@ -116,7 +116,7 @@ class ModuleSaModeFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleSaModeFactory;
}
diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp
index 43cb9e6da..34d9f9ab5 100644
--- a/src/modules/m_sanick.cpp
+++ b/src/modules/m_sanick.cpp
@@ -78,7 +78,7 @@ class ModuleSanick : public Module
cmd_sanick* mycommand;
public:
ModuleSanick(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
mycommand = new cmd_sanick(ServerInstance);
@@ -117,7 +117,7 @@ class ModuleSanickFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleSanickFactory;
}
diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp
index 01df5c1be..680b4b4d4 100644
--- a/src/modules/m_sapart.cpp
+++ b/src/modules/m_sapart.cpp
@@ -93,7 +93,7 @@ class ModuleSapart : public Module
cmd_sapart* mycommand;
public:
ModuleSapart(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
mycommand = new cmd_sapart(ServerInstance);
@@ -132,7 +132,7 @@ class ModuleSapartFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleSapartFactory;
}
diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp
index 5806f43bf..a7cacac5c 100644
--- a/src/modules/m_saquit.cpp
+++ b/src/modules/m_saquit.cpp
@@ -63,7 +63,7 @@ class ModuleSaquit : public Module
cmd_saquit* mycommand;
public:
ModuleSaquit(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
mycommand = new cmd_saquit(ServerInstance);
@@ -102,7 +102,7 @@ class ModuleSaquitFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleSaquitFactory;
}
diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp
index 8be50dffe..319b58603 100644
--- a/src/modules/m_securelist.cpp
+++ b/src/modules/m_securelist.cpp
@@ -26,7 +26,7 @@ class ModuleSecureList : public Module
std::vector<std::string> allowlist;
time_t WaitTime;
public:
- ModuleSecureList(InspIRCd* Me) : Module::Module(Me)
+ ModuleSecureList(InspIRCd* Me) : Module(Me)
{
OnRehash(NULL,"");
}
@@ -118,7 +118,7 @@ class ModuleSecureListFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleSecureListFactory;
}
diff --git a/src/modules/m_seenicks.cpp b/src/modules/m_seenicks.cpp
index 2e632a5ba..959a62b31 100644
--- a/src/modules/m_seenicks.cpp
+++ b/src/modules/m_seenicks.cpp
@@ -24,7 +24,7 @@ class ModuleSeeNicks : public Module
{
public:
ModuleSeeNicks(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
ServerInstance->SNO->EnableSnomask('n',"NICK");
ServerInstance->SNO->EnableSnomask('N',"REMOTENICK");
@@ -71,7 +71,7 @@ class ModuleSeeNicksFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleSeeNicksFactory;
}
diff --git a/src/modules/m_services.cpp b/src/modules/m_services.cpp
index 7e6e3121c..b8638d94a 100644
--- a/src/modules/m_services.cpp
+++ b/src/modules/m_services.cpp
@@ -173,7 +173,7 @@ class ModuleServices : public Module
User_R* m5;
public:
ModuleServices(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
m1 = new Channel_r(ServerInstance);
@@ -326,7 +326,7 @@ class ModuleServicesFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleServicesFactory;
}
diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp
index 6defa1e2e..17c0b2bd9 100644
--- a/src/modules/m_services_account.cpp
+++ b/src/modules/m_services_account.cpp
@@ -116,7 +116,7 @@ class ModuleServicesAccount : public Module
AChannel_M* m2;
AUser_R* m3;
public:
- ModuleServicesAccount(InspIRCd* Me) : Module::Module(Me)
+ ModuleServicesAccount(InspIRCd* Me) : Module(Me)
{
m1 = new AChannel_R(ServerInstance);
@@ -349,7 +349,7 @@ class ModuleServicesAccountFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleServicesAccountFactory;
}
diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp
index 6e984a62e..62b6bda83 100644
--- a/src/modules/m_sethost.cpp
+++ b/src/modules/m_sethost.cpp
@@ -67,7 +67,7 @@ class ModuleSetHost : public Module
char hostmap[256];
public:
ModuleSetHost(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
OnRehash(NULL,"");
mycommand = new cmd_sethost(ServerInstance, hostmap);
@@ -122,7 +122,7 @@ class ModuleSetHostFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleSetHostFactory;
}
diff --git a/src/modules/m_setident.cpp b/src/modules/m_setident.cpp
index a56aec0d1..f46c7112c 100644
--- a/src/modules/m_setident.cpp
+++ b/src/modules/m_setident.cpp
@@ -58,7 +58,7 @@ class ModuleSetIdent : public Module
cmd_setident* mycommand;
public:
- ModuleSetIdent(InspIRCd* Me) : Module::Module(Me)
+ ModuleSetIdent(InspIRCd* Me) : Module(Me)
{
mycommand = new cmd_setident(ServerInstance);
@@ -97,7 +97,7 @@ class ModuleSetIdentFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleSetIdentFactory;
}
diff --git a/src/modules/m_setidle.cpp b/src/modules/m_setidle.cpp
index 76a1ea3e5..6539bbdc8 100644
--- a/src/modules/m_setidle.cpp
+++ b/src/modules/m_setidle.cpp
@@ -55,7 +55,7 @@ class ModuleSetIdle : public Module
cmd_setidle* mycommand;
public:
ModuleSetIdle(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
mycommand = new cmd_setidle(ServerInstance);
@@ -93,7 +93,7 @@ class ModuleSetIdleFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleSetIdleFactory;
}
diff --git a/src/modules/m_setname.cpp b/src/modules/m_setname.cpp
index bb78d6a0f..8661d9f2c 100644
--- a/src/modules/m_setname.cpp
+++ b/src/modules/m_setname.cpp
@@ -52,7 +52,7 @@ class ModuleSetName : public Module
cmd_setname* mycommand;
public:
ModuleSetName(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
mycommand = new cmd_setname(ServerInstance);
@@ -91,7 +91,7 @@ class ModuleSetNameFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleSetNameFactory;
}
diff --git a/src/modules/m_sha256.cpp b/src/modules/m_sha256.cpp
index 6ba625a41..6e1ac0e56 100644
--- a/src/modules/m_sha256.cpp
+++ b/src/modules/m_sha256.cpp
@@ -139,7 +139,7 @@ uint32_t sha256_k[64] =
class ModuleSHA256 : public Module
{
- void SHA256Init(struct SHA256Context *ctx, const unsigned int* key)
+ void SHA256Init(SHA256Context *ctx, const unsigned int* key)
{
if (key)
{
@@ -155,7 +155,7 @@ class ModuleSHA256 : public Module
ctx->tot_len = 0;
}
- void SHA256Transform(struct SHA256Context *ctx, unsigned char *message, unsigned int block_nb)
+ void SHA256Transform(SHA256Context *ctx, unsigned char *message, unsigned int block_nb)
{
uint32_t w[64];
uint32_t wv[8];
@@ -189,7 +189,7 @@ class ModuleSHA256 : public Module
}
}
- void SHA256Update(struct SHA256Context *ctx, unsigned char *message, unsigned int len)
+ void SHA256Update(SHA256Context *ctx, unsigned char *message, unsigned int len)
{
unsigned int rem_len = SHA256_BLOCK_SIZE - ctx->len;
memcpy(&ctx->block[ctx->len], message, rem_len);
@@ -209,7 +209,7 @@ class ModuleSHA256 : public Module
ctx->tot_len += (block_nb + 1) << 6;
}
- void SHA256Final(struct SHA256Context *ctx, unsigned char *digest)
+ void SHA256Final(SHA256Context *ctx, unsigned char *digest)
{
unsigned int block_nb = (1 + ((SHA256_BLOCK_SIZE - 9) < (ctx->len % SHA256_BLOCK_SIZE)));
unsigned int len_b = (ctx->tot_len + ctx->len) << 3;
@@ -226,7 +226,7 @@ class ModuleSHA256 : public Module
{
// Generate the hash
unsigned char bytehash[SHA256_DIGEST_SIZE];
- struct SHA256Context ctx;
+ SHA256Context ctx;
SHA256Init(&ctx, key);
SHA256Update(&ctx, (unsigned char *)src, (unsigned int)len);
SHA256Final(&ctx, bytehash);
@@ -244,7 +244,7 @@ class ModuleSHA256 : public Module
public:
- ModuleSHA256(InspIRCd* Me) : Module::Module(Me), key(NULL), chars(NULL)
+ ModuleSHA256(InspIRCd* Me) : Module(Me), key(NULL), chars(NULL)
{
ServerInstance->PublishInterface("HashRequest", this);
}
@@ -313,7 +313,7 @@ public:
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleSHA256Factory;
}
diff --git a/src/modules/m_showwhois.cpp b/src/modules/m_showwhois.cpp
index 2b83243c1..70c9865e1 100644
--- a/src/modules/m_showwhois.cpp
+++ b/src/modules/m_showwhois.cpp
@@ -59,7 +59,7 @@ class ModuleShowwhois : public Module
public:
- ModuleShowwhois(InspIRCd* Me) : Module::Module(Me)
+ ModuleShowwhois(InspIRCd* Me) : Module(Me)
{
sw = new SeeWhois(ServerInstance);
@@ -124,7 +124,7 @@ class ModuleShowwhoisFactory : public ModuleFactory
};
-extern "C" void* init_module()
+extern "C" DllExport void* init_module()
{
return new ModuleShowwhoisFactory;
}
diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp
index 42b7f96e9..773d28ece 100644
--- a/src/modules/m_silence.cpp
+++ b/src/modules/m_silence.cpp
@@ -136,7 +136,7 @@ class ModuleSilence : public Module
public:
ModuleSilence(InspIRCd* Me)
- : Module::Module(Me), maxsilence(32)
+ : Module(Me), maxsilence(32)
{
OnRehash(NULL, "");
mycommand = new cmd_silence(ServerInstance, maxsilence);
@@ -235,7 +235,7 @@ class ModuleSilenceFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleSilenceFactory;
}
diff --git a/src/modules/m_silence_ext.cpp b/src/modules/m_silence_ext.cpp
index e58e626c7..8b7ac9fbe 100644
--- a/src/modules/m_silence_ext.cpp
+++ b/src/modules/m_silence_ext.cpp
@@ -243,7 +243,7 @@ class ModuleSilence : public Module
public:
ModuleSilence(InspIRCd* Me)
- : Module::Module(Me), maxsilence(32)
+ : Module(Me), maxsilence(32)
{
OnRehash(NULL, "");
mycommand = new cmd_silence(ServerInstance,maxsilence);
@@ -393,7 +393,7 @@ class ModuleSilenceFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleSilenceFactory;
}
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index d037b7101..50de7da64 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -37,7 +37,7 @@
/* $ModDep: m_spanningtree/timesynctimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h m_spanningtree/rconnect.h */
ModuleSpanningTree::ModuleSpanningTree(InspIRCd* Me)
- : Module::Module(Me), max_local(0), max_global(0)
+ : Module(Me), max_local(0), max_global(0)
{
ServerInstance->UseInterface("InspSocketHook");
Utils = new SpanningTreeUtilities(Me, this);
@@ -1379,7 +1379,7 @@ class ModuleSpanningTreeFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleSpanningTreeFactory;
}
diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp
index b858061cb..27737c7ff 100644
--- a/src/modules/m_spanningtree/treesocket1.cpp
+++ b/src/modules/m_spanningtree/treesocket1.cpp
@@ -294,12 +294,18 @@ std::string TreeSocket::RandString(unsigned int length)
{
char* randombuf = new char[length+1];
std::string out;
+#ifdef WINDOWS
+ int fd = -1;
+#else
int fd = open("/dev/urandom", O_RDONLY, 0);
+#endif
if (fd >= 0)
{
+#ifndef WINDOWS
read(fd, randombuf, length);
close(fd);
+#endif
}
else
{
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index afba5b96a..da4dd5d4c 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -1496,19 +1496,13 @@ bool TreeSocket::ProcessLine(std::string &line)
{
strparams[q] = params[q].c_str();
}
- switch (this->Instance->CallCommandHandler(command.c_str(), strparams, params.size(), who))
+ if(!this->Instance->CallCommandHandler(command.c_str(), strparams, params.size(), who))
{
- case CMD_INVALID:
- this->SendError("Unrecognised command '"+std::string(command.c_str())+"' -- possibly loaded mismatched modules");
- return false;
- break;
- case CMD_FAILURE:
- return true;
- break;
- default:
- /* CMD_SUCCESS and CMD_USER_DELETED fall through here */
- break;
+ this->SendError("Unrecognised command '"+std::string(command.c_str())+"' -- possibly loaded mismatched modules");
+ return false;
}
+ else
+ return true;
}
else
{
diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h
index 1c94e264f..cb783a81a 100644
--- a/src/modules/m_spanningtree/utils.h
+++ b/src/modules/m_spanningtree/utils.h
@@ -29,7 +29,11 @@ class ModuleSpanningTree;
/* This hash_map holds the hash equivalent of the server
* tree, used for rapid linear lookups.
*/
+#ifdef WINDOWS
+typedef nspace::hash_map<std::string, TreeServer*, nspace::hash_compare<string, less<string> > > server_hash;
+#else
typedef nspace::hash_map<std::string, TreeServer*, nspace::hash<string>, irc::StrHashComp> server_hash;
+#endif
typedef std::map<TreeServer*,TreeServer*> TreeServerList;
diff --git a/src/modules/m_spy.cpp b/src/modules/m_spy.cpp
index f0c361d82..356000f97 100644
--- a/src/modules/m_spy.cpp
+++ b/src/modules/m_spy.cpp
@@ -142,7 +142,7 @@ class ModuleSpy : public Module
cmd_spylist *mycommand;
cmd_spynames *mycommand2;
public:
- ModuleSpy(InspIRCd* Me) : Module::Module(Me)
+ ModuleSpy(InspIRCd* Me) : Module(Me)
{
mycommand = new cmd_spylist(ServerInstance);
@@ -181,7 +181,7 @@ class ModuleSpyFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleSpyFactory;
}
diff --git a/src/modules/m_ssl_dummy.cpp b/src/modules/m_ssl_dummy.cpp
index 6f1ee4789..9995e7524 100644
--- a/src/modules/m_ssl_dummy.cpp
+++ b/src/modules/m_ssl_dummy.cpp
@@ -24,7 +24,7 @@ class ModuleSSLDummy : public Module
char* dummy;
public:
- ModuleSSLDummy(InspIRCd* Me) : Module::Module(Me)
+ ModuleSSLDummy(InspIRCd* Me) : Module(Me)
{
}
@@ -100,7 +100,7 @@ class ModuleSSLDummyFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleSSLDummyFactory;
}
diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp
index 36f1e428a..92f623fe1 100644
--- a/src/modules/m_sslmodes.cpp
+++ b/src/modules/m_sslmodes.cpp
@@ -73,7 +73,7 @@ class ModuleSSLModes : public Module
public:
ModuleSSLModes(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
@@ -139,7 +139,7 @@ class ModuleSSLModesFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleSSLModesFactory;
}
diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp
index 76bc56ef5..e3ee3fe2f 100644
--- a/src/modules/m_stripcolor.cpp
+++ b/src/modules/m_stripcolor.cpp
@@ -90,7 +90,7 @@ class ModuleStripColor : public Module
UserStripColor *usc;
public:
- ModuleStripColor(InspIRCd* Me) : Module::Module(Me)
+ ModuleStripColor(InspIRCd* Me) : Module(Me)
{
usc = new UserStripColor(ServerInstance);
csc = new ChannelStripColor(ServerInstance);
@@ -224,7 +224,7 @@ class ModuleStripColorFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleStripColorFactory;
}
diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp
index abef3d713..5e0f072f8 100644
--- a/src/modules/m_svshold.cpp
+++ b/src/modules/m_svshold.cpp
@@ -153,7 +153,7 @@ class ModuleSVSHold : public Module
public:
- ModuleSVSHold(InspIRCd* Me) : Module::Module(Me)
+ ModuleSVSHold(InspIRCd* Me) : Module(Me)
{
mycommand = new cmd_svshold(Me);
ServerInstance->AddCommand(mycommand);
@@ -290,7 +290,7 @@ class ModuleSVSHoldFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleSVSHoldFactory;
}
diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp
index a79b1d10a..193191ab5 100644
--- a/src/modules/m_swhois.cpp
+++ b/src/modules/m_swhois.cpp
@@ -81,7 +81,7 @@ class ModuleSWhois : public Module
ConfigReader* Conf;
public:
- ModuleSWhois(InspIRCd* Me) : Module::Module(Me)
+ ModuleSWhois(InspIRCd* Me) : Module(Me)
{
Conf = new ConfigReader(ServerInstance);
@@ -275,7 +275,7 @@ class ModuleSWhoisFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleSWhoisFactory;
}
diff --git a/src/modules/m_taxonomy.cpp b/src/modules/m_taxonomy.cpp
index c573e7761..9fb38d98e 100644
--- a/src/modules/m_taxonomy.cpp
+++ b/src/modules/m_taxonomy.cpp
@@ -62,7 +62,7 @@ class ModuleTaxonomy : public Module
bool claimed;
public:
ModuleTaxonomy(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
// Create a new command
@@ -116,7 +116,7 @@ class ModuleTaxonomyFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleTaxonomyFactory;
}
diff --git a/src/modules/m_testcommand.cpp b/src/modules/m_testcommand.cpp
index 015c8b1df..e32e5f846 100644
--- a/src/modules/m_testcommand.cpp
+++ b/src/modules/m_testcommand.cpp
@@ -80,7 +80,7 @@ class ModuleTestCommand : public Module
cmd_woot* newcommand;
public:
ModuleTestCommand(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
// Create a new command
@@ -123,7 +123,7 @@ class ModuleTestCommandFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleTestCommandFactory;
}
diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp
index ec257d1e1..a1fb41439 100644
--- a/src/modules/m_timedbans.cpp
+++ b/src/modules/m_timedbans.cpp
@@ -115,7 +115,7 @@ class ModuleTimedBans : public Module
cmd_tban* mycommand;
public:
ModuleTimedBans(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
mycommand = new cmd_tban(ServerInstance);
@@ -224,7 +224,7 @@ class ModuleTimedBansFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleTimedBansFactory;
}
diff --git a/src/modules/m_tline.cpp b/src/modules/m_tline.cpp
index 801218377..b5017ea2d 100644
--- a/src/modules/m_tline.cpp
+++ b/src/modules/m_tline.cpp
@@ -73,7 +73,7 @@ class ModuleTLine : public Module
cmd_tline* newcommand;
public:
ModuleTLine(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
newcommand = new cmd_tline(ServerInstance);
@@ -114,7 +114,7 @@ class ModuleTLineFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleTLineFactory;
}
diff --git a/src/modules/m_uhnames.cpp b/src/modules/m_uhnames.cpp
index 3663ab4ca..a3caf7082 100644
--- a/src/modules/m_uhnames.cpp
+++ b/src/modules/m_uhnames.cpp
@@ -26,7 +26,7 @@ class ModuleUHNames : public Module
public:
ModuleUHNames(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
}
@@ -113,7 +113,7 @@ class ModuleUHNamesFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleUHNamesFactory;
}
diff --git a/src/modules/m_uninvite.cpp b/src/modules/m_uninvite.cpp
index a81952f10..babc4dc9f 100644
--- a/src/modules/m_uninvite.cpp
+++ b/src/modules/m_uninvite.cpp
@@ -87,7 +87,7 @@ class ModuleUninvite : public Module
public:
- ModuleUninvite(InspIRCd* Me) : Module::Module(Me)
+ ModuleUninvite(InspIRCd* Me) : Module(Me)
{
mycommand = new cmd_uninvite(ServerInstance);
@@ -124,7 +124,7 @@ class ModuleUninviteFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleUninviteFactory;
}
diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp
index beab03e7e..b623c39ba 100644
--- a/src/modules/m_userip.cpp
+++ b/src/modules/m_userip.cpp
@@ -56,7 +56,7 @@ class ModuleUserIP : public Module
cmd_userip* mycommand;
public:
ModuleUserIP(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
mycommand = new cmd_userip(ServerInstance);
@@ -105,7 +105,7 @@ class ModuleUserIPFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleUserIPFactory;
}
diff --git a/src/modules/m_vhost.cpp b/src/modules/m_vhost.cpp
index 0a08c7194..02926dbfa 100644
--- a/src/modules/m_vhost.cpp
+++ b/src/modules/m_vhost.cpp
@@ -61,7 +61,7 @@ class ModuleVHost : public Module
cmd_vhost* mycommand;
public:
- ModuleVHost(InspIRCd* Me) : Module::Module(Me)
+ ModuleVHost(InspIRCd* Me) : Module(Me)
{
Conf = new ConfigReader(ServerInstance);
@@ -113,7 +113,7 @@ class ModuleVHostFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleVHostFactory;
}
diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp
index b46d80b54..ef0f897d2 100644
--- a/src/modules/m_watch.cpp
+++ b/src/modules/m_watch.cpp
@@ -61,7 +61,11 @@
* of users using WATCH.
*/
+#ifdef WINDOWS
+typedef nspace::hash_map<irc::string, std::deque<userrec*>, nspace::hash_compare<irc::string, less<irc::string> > > watchentries;
+#else
typedef nspace::hash_map<irc::string, std::deque<userrec*>, nspace::hash<irc::string> > watchentries;
+#endif
typedef std::map<irc::string, std::string> watchlist;
/* Who's watching each nickname.
@@ -301,7 +305,7 @@ class Modulewatch : public Module
public:
Modulewatch(InspIRCd* Me)
- : Module::Module(Me), maxwatch(32)
+ : Module(Me), maxwatch(32)
{
OnRehash(NULL, "");
whos_watching_me = new watchentries();
@@ -480,7 +484,7 @@ class ModulewatchFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModulewatchFactory;
}
diff --git a/src/modules/m_xmlsocket.cpp b/src/modules/m_xmlsocket.cpp
index 1cf9fafa2..3603f2fb5 100644
--- a/src/modules/m_xmlsocket.cpp
+++ b/src/modules/m_xmlsocket.cpp
@@ -29,7 +29,7 @@ class ModuleXMLSocket : public Module
public:
ModuleXMLSocket(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
OnRehash(NULL,"");
}
@@ -146,7 +146,7 @@ class ModuleXMLSocket : public Module
return -1;
/* We want to alter the buffer, so we have to make a copy */
- char tmpbuffer[count+1];
+ char * tmpbuffer = new char[count + 1];
memcpy(tmpbuffer, buffer, count);
/* XXX: This will actually generate lines "looking\0\0like\0\0this"
@@ -160,6 +160,7 @@ class ModuleXMLSocket : public Module
tmpbuffer[n] = 0;
user->AddWriteBuf(std::string(tmpbuffer,count));
+ delete [] tmpbuffer;
return 1;
}
@@ -184,7 +185,7 @@ class ModuleXMLSocketFactory : public ModuleFactory
};
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
{
return new ModuleXMLSocketFactory;
}
diff --git a/src/socket.cpp b/src/socket.cpp
index 2e7d04fdf..5882a1c0f 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -25,7 +25,7 @@ using namespace irc::sockets;
* ((-1) << (8 - (mask % 8)))
* But imho, it sucks in comparison to a nice neat lookup table.
*/
-const char inverted_bits[8] = { 0x00, /* 00000000 - 0 bits - never actually used */
+const unsigned char inverted_bits[8] = { 0x00, /* 00000000 - 0 bits - never actually used */
0x80, /* 10000000 - 1 bits */
0xC0, /* 11000000 - 2 bits */
0xE0, /* 11100000 - 3 bits */
@@ -89,9 +89,9 @@ void ListenSocket::HandleEvent(EventType et, int errornum)
uslen = sizeof(sockaddr_in);
length = sizeof(sockaddr_in);
#endif
- incomingSockfd = accept (this->GetFd(), (sockaddr*)client, &length);
+ incomingSockfd = _accept (this->GetFd(), (sockaddr*)client, &length);
- if ((incomingSockfd > -1) && (!getsockname(incomingSockfd, sock_us, &uslen)))
+ if ((incomingSockfd > -1) && (!_getsockname(incomingSockfd, sock_us, &uslen)))
{
char buf[MAXBUF];
#ifdef IPV6
@@ -303,14 +303,24 @@ bool irc::sockets::MatchCIDR(const char* address, const char* cidr_mask, bool ma
void irc::sockets::Blocking(int s)
{
- int flags = fcntl(s, F_GETFL, 0);
+#ifndef WIN32
+ int flags = fcntl(s, F_GETFL, 0);
fcntl(s, F_SETFL, flags ^ O_NONBLOCK);
+#else
+ unsigned long opt = 0;
+ ioctlsocket(s, FIONBIO, &opt);
+#endif
}
void irc::sockets::NonBlocking(int s)
{
- int flags = fcntl(s, F_GETFL, 0);
+#ifndef WIN32
+ int flags = fcntl(s, F_GETFL, 0);
fcntl(s, F_SETFL, flags | O_NONBLOCK);
+#else
+ unsigned long opt = 1;
+ ioctlsocket(s, FIONBIO, &opt);
+#endif
}
/** This will bind a socket to a port. It works for UDP/TCP.
@@ -458,11 +468,11 @@ int irc::sockets::OpenTCPSocket(char* addr, int socktype)
}
else
{
- setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
+ setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (char*)&on, sizeof(on));
/* This is BSD compatible, setting l_onoff to 0 is *NOT* http://web.irc.org/mla/ircd-dev/msg02259.html */
linger.l_onoff = 1;
linger.l_linger = 1;
- setsockopt(sockfd, SOL_SOCKET, SO_LINGER, &linger,sizeof(linger));
+ setsockopt(sockfd, SOL_SOCKET, SO_LINGER, (char*)&linger,sizeof(linger));
return (sockfd);
}
}
diff --git a/src/socketengine.cpp b/src/socketengine.cpp
index 668335e6b..48f7e11bf 100644
--- a/src/socketengine.cpp
+++ b/src/socketengine.cpp
@@ -62,7 +62,7 @@ bool SocketEngine::HasFd(int fd)
EventHandler* SocketEngine::GetRef(int fd)
{
if ((fd < 0) || (fd > MAX_DESCRIPTORS))
- return false;
+ return 0;
return ref[fd];
}
diff --git a/src/users.cpp b/src/users.cpp
index 645e07046..e79d27c8b 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -61,7 +61,7 @@ bool DoType(ServerConfig* conf, const char* tag, char** entries, ValueList &valu
const char* TypeName = values[0].GetString();
const char* Classes = values[1].GetString();
- conf->opertypes[TypeName] = strdup(Classes);
+ conf->opertypes[TypeName] = strnewdup(Classes);
return true;
}
@@ -70,7 +70,7 @@ bool DoClass(ServerConfig* conf, const char* tag, char** entries, ValueList &val
const char* ClassName = values[0].GetString();
const char* CommandList = values[1].GetString();
- conf->operclass[ClassName] = strdup(CommandList);
+ conf->operclass[ClassName] = strnewdup(CommandList);
return true;
}
@@ -473,7 +473,11 @@ int userrec::ReadData(void* buffer, size_t size)
{
if (IS_LOCAL(this))
{
+#ifndef WIN32
return read(this->fd, buffer, size);
+#else
+ return recv(this->fd, (char*)buffer, size, 0);
+#endif
}
else
return 0;
@@ -714,7 +718,11 @@ void userrec::FlushWriteBuf()
if ((sendq.length()) && (this->fd != FD_MAGIC_NUMBER))
{
int old_sendq_length = sendq.length();
- int n_sent = write(this->fd, this->sendq.data(), this->sendq.length());
+#ifndef WIN32
+ int n_sent = write(this->fd, this->sendq.data(), this->sendq.length());
+#else
+ int n_sent = send(this->fd, (const char*)this->sendq.data(), this->sendq.length(), 0);
+#endif
if (n_sent == -1)
{
if (errno == EAGAIN)
@@ -934,11 +942,13 @@ void userrec::AddClient(InspIRCd* Instance, int socket, int port, bool iscached,
* which for the time being is a physical impossibility (even the largest networks dont have more
* than about 10,000 users on ONE server!)
*/
+#ifndef WINDOWS
if ((unsigned int)socket >= MAX_DESCRIPTORS)
{
userrec::QuitUser(Instance, New, "Server is full");
return;
}
+#endif
New->exempt = (Instance->XLines->matches_exception(New) != NULL);
if (!New->exempt)
@@ -1336,7 +1346,11 @@ const char* userrec::GetIPString(char* buf)
*/
void userrec::Write(std::string text)
{
+#ifdef WINDOWS
+ if ((this->fd < 0) || (this->m_internalFd > MAX_DESCRIPTORS))
+#else
if ((this->fd < 0) || (this->fd > MAX_DESCRIPTORS))
+#endif
return;
try
diff --git a/src/wildcard.cpp b/src/wildcard.cpp
index f888b68cf..3ea64bd2c 100644
--- a/src/wildcard.cpp
+++ b/src/wildcard.cpp
@@ -28,7 +28,7 @@ using irc::sockets::MatchCIDR;
// (unattributed to any author) all over the 'net.
// For now, we'll just consider this public domain.
-bool csmatch(const char *str, const char *mask)
+CoreExport bool csmatch(const char *str, const char *mask)
{
unsigned char *cp = NULL, *mp = NULL;
unsigned char* string = (unsigned char*)str;
@@ -77,7 +77,7 @@ bool csmatch(const char *str, const char *mask)
return !*wild;
}
-bool match(const char *str, const char *mask)
+CoreExport bool match(const char *str, const char *mask)
{
unsigned char *cp = NULL, *mp = NULL;
unsigned char* string = (unsigned char*)str;
@@ -127,21 +127,21 @@ bool match(const char *str, const char *mask)
}
/* Overloaded function that has the option of using cidr */
-bool match(const char *str, const char *mask, bool use_cidr_match)
+CoreExport bool match(const char *str, const char *mask, bool use_cidr_match)
{
if (use_cidr_match && MatchCIDR(str, mask, true))
return true;
return match(str, mask);
}
-bool match(bool case_sensitive, const char *str, const char *mask, bool use_cidr_match)
+CoreExport bool match(bool case_sensitive, const char *str, const char *mask, bool use_cidr_match)
{
if (use_cidr_match && MatchCIDR(str, mask, true))
return true;
return csmatch(str, mask);
}
-bool match(bool case_sensitive, const char *str, const char *mask)
+CoreExport bool match(bool case_sensitive, const char *str, const char *mask)
{
return case_sensitive ? csmatch(str, mask) : match(str, mask);
}