diff options
Diffstat (limited to 'src')
184 files changed, 612 insertions, 434 deletions
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); } |