1
0
mirror of https://github.com/anope/anope.git synced 2026-06-26 15:36:38 +02:00

Various fixes for compiling under Windows.

Also updated ms_* modules to use std::vector Memo struct from earlier commit.

git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1797 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
cyberbotx
2008-11-26 01:41:39 +00:00
parent 90f6431603
commit c5b9eaeda0
25 changed files with 731 additions and 786 deletions
+1 -1
View File
@@ -15,7 +15,7 @@
* --lara
*/
class BotInfo
class CoreExport BotInfo
{
public:
BotInfo *next, *prev;
+1 -1
View File
@@ -420,7 +420,7 @@ class ConfigException : public std::exception
* Constructing the class using one parameter allows you to specify a path to your own configuration
* file, otherwise, inspircd.conf is read.
*/
class ConfigReader
class CoreExport ConfigReader
{
protected:
/** The contents of the configuration file
+3 -3
View File
@@ -150,7 +150,7 @@ struct ModuleLang_ {
/** Every module in Anope is actually a class.
*/
CoreExport class Module
class CoreExport Module
{
private:
bool permanent;
@@ -163,7 +163,7 @@ CoreExport class Module
*/
std::string filename;
void *handle;
ano_module_t handle;
time_t created;
std::string version;
std::string author;
@@ -285,7 +285,7 @@ CoreExport class Module
/** Used to manage modules.
*/
CoreExport class ModuleManager
class CoreExport ModuleManager
{
public:
/** Load up a list of modules.
+13 -5
View File
@@ -178,10 +178,18 @@ extern int strncasecmp(const char *, const char *, size_t);
#define MARK_DEPRECATED
#endif
/** XXX: we need to grab these from inspircd -- w00t
*/
#define DllExport
#define CoreExport
#ifdef _WIN32
# ifdef MODULE_COMPILE
# define CoreExport __declspec(dllimport)
# define DllExport __declspec(dllexport)
# else
# define CoreExport __declspec(dllexport)
# define DllExport __declspec(dllimport)
# endif
#else
# define DllExport
# define CoreExport
#endif
/** This definition is used as shorthand for the various classes
* and functions needed to make a module loadable by the OS.
@@ -203,7 +211,7 @@ extern int strncasecmp(const char *, const char *, size_t);
} \
return TRUE; \
} \
extern "C" DllExport void *destroy_module(y *m) \
extern "C" DllExport void destroy_module(y *m) \
{ \
delete m; \
}
+1
View File
@@ -22,6 +22,7 @@ typedef SOCKET ano_socket_t;
#define ano_sockgeterr() WSAGetLastError()
#define ano_sockseterr(err) WSASetLastError(err)
/* ano_sockstrerror in sockutil.c */
extern char *ano_sockstrerror(int);
/* ano_socksetnonb in sockutil.c */
#define ano_sockerrnonb(err) (err == WSAEINPROGRESS || err == WSAEWOULDBLOCK)
#define SOCKERR_EBADF WSAENOTSOCK
+1 -1
View File
@@ -20,7 +20,7 @@ struct u_chaninfolist {
};
/* Online user and channel data. */
class User : public Extensible
class CoreExport User : public Extensible
{
public: // XXX: exposing a tiny bit too much
User *next, *prev;
+78 -78
View File
@@ -56,24 +56,24 @@ var installerQuestions = [
f.WriteLine("MYSQL_INC_PATH=/I $(MYSQL_INC)");
f.WriteLine("BASE_CFLAGS=/D $(BASE_CFLAGS)");
f.WriteLine("MYPASQL_BUILD=$(CC) /LD $(MYSQL_INC_PATH) src\\mypasql.c /link $(MYSQL_LIB_PATH) $(LFLAGS) /DEF:src\mypasql.def libmysql.lib zlib.lib ws2_32.lib advapi32.lib /NODEFAULTLIB:LIBCMTD.lib");
f.WriteLine("LIBS=$(LIBS) libmysql.lib zlib.lib");
f.WriteLine("LIBS=$(LIBS) libmysql.lib zlib.lib");
}
else {
f.WriteLine("USE_MYSQL=0");
}
}
}
},
];
var buildPackages = [
{
'name' : 'Microsoft Visual Studio 2008 (New PSDK)',
'libpaths' : [
'libpaths' : [
'Program Files\\Microsoft Visual Studio 9.0\\VC\\Lib',
'Program Files\\Microsoft Platform SDK for Windows Server 2003 R2\\Lib'
],
'incpaths' : [
'incpaths' : [
'Program Files\\Microsoft Visual Studio 9.0\\VC\\Include',
'Program Files\\Microsoft Platform SDK for Windows Server 2003 R2\\Include'
],
@@ -99,7 +99,7 @@ var buildPackages = [
'additional_switches' : [ '/w' ],
'installedDrive' : 'C'
},
{
'name' : 'Microsoft Visual Studio 2005 (New PSDK)',
'libpaths' : [
@@ -119,7 +119,7 @@ var buildPackages = [
],
'installedDrive' : 'C'
},
{
{
'name' : 'Microsoft Visual Studio 2005 (Old PSDK)',
'libpaths' : [
'Program Files\\Microsoft Visual Studio 8\\VC\\Lib',
@@ -138,7 +138,7 @@ var buildPackages = [
],
'installedDrive' : 'C'
},
{
'name' : 'Microsoft Visual Studio .NET 2003',
'libpaths' : [
@@ -152,7 +152,7 @@ var buildPackages = [
'nmake' : [
'Program Files\\Microsoft Visual Studio .NET 2003\\VC7\\Bin',
''
],
],
'additional_switches' : false,
'installedDrive' : 'C'
},
@@ -174,10 +174,10 @@ var buildPackages = [
],
'installedDrive' : 'C'
}
];
];
var mysqlVersions = [
{
'name' : 'MySQL 5.1',
@@ -199,10 +199,10 @@ var buildPackages = [
'incpaths' : [
'Program Files\\MySQL\\MySQL Server 5.0\\Include'
],
'dllfile' : 'Program Files\\MySQL\\MySQL Server 5.0\\Bin\\libmysql.dll',
'dllfile' : 'Program Files\\MySQL\\MySQL Server 5.0\\Bin\\libmysql.dll',
'installedDrive' : 'C'
},
{
'name' : 'MySQL 4.1',
'libpaths' : [
@@ -211,10 +211,10 @@ var buildPackages = [
'incpaths' : [
'Program Files\\MySQL\\MySQL Server 4.1\\Include'
],
'dllfile' : 'Program Files\\MySQL\\MySQL Server 4.1\\Bin\\libmysql.dll',
'dllfile' : 'Program Files\\MySQL\\MySQL Server 4.1\\Bin\\libmysql.dll',
'installedDrive' : 'C'
},
},
{
'name' : 'MySQL 4.0',
'libpaths' : [
@@ -225,8 +225,8 @@ var buildPackages = [
],
'dllfile' : 'Program Files\\MySQL\\MySQL Server 4.0\\Bin\\libmysql.dll',
'installedDrive' : 'C'
},
},
{
'name' : 'MySQL 3.23 or older (or other default path)',
'libpaths' : [
@@ -236,11 +236,11 @@ var buildPackages = [
'mysql\\include'
],
'dllfile' : 'mysql\\Bin\\libmysql.dll',
'installedDrive' : 'C'
'installedDrive' : 'C'
}
];
];
var bannerReplacements = [
{
'findtext' : /CURVER/g,
@@ -250,32 +250,32 @@ var buildPackages = [
'findtext' : / For more options type .\/Config --help/g,
'replacement' : function() { return ''; }
}
];
var fso = WScript.CreateObject("Scripting.FileSystemObject");
];
var fso = WScript.CreateObject("Scripting.FileSystemObject");
var x, y, z;
if (fso.FileExists('.BANNER')) {
var bannerStream = fso.OpenTextFile(".BANNER");
var bannerText = bannerStream.ReadAll();
var bannerText = bannerStream.ReadAll();
bannerStream.close();
for (x in bannerReplacements) {
var thisReplacement = bannerReplacements[x];
bannerText = bannerText.replace(thisReplacement['findtext'], thisReplacement['replacement']);
}
WScript.Echo(bannerText+"\n");
}
}
else {
WScript.Echo("ERROR: Cannot find banner file!\n");
}
WScript.Echo("Press Enter to Begin...");
InstallerInput();
InstallerInput();
WScript.Echo("");
for (x in installerQuestions) {
var thisQuestion = installerQuestions[x];
var validResponse = false;
@@ -305,10 +305,10 @@ var buildPackages = [
else if (thisQuestion.store_answer(inputValue)) {
validResponse = true;
}
}
}
WScript.Echo("");
}
if (!findCompiler()) {
WScript.Echo("\nERROR: No suitable build tools were found!");
WScript.Echo("Please ensure you have downloaded and installed a version of Visual C++ and/or PlatformSDK.\n");
@@ -320,7 +320,7 @@ var buildPackages = [
for (x in installerResponses) {
var thisResponse = installerResponses[x];
WScript.Echo("\t"+x+":\t\t["+thisResponse.toUpperCase()+"]");
}
}
for (x in softwareVersions) {
var thisVer = softwareVersions[x];
if (!thisVer) {
@@ -328,12 +328,12 @@ var buildPackages = [
}
else {
WScript.Echo("\t"+x+" Version:\t\t"+thisVer.name);
}
}
}
WScript.Echo("\tAnope Version:\t\t\t"+anopeVersion);
WScript.Echo("\nTo continue, please press Enter...");
InstallerInput();
InstallerInput();
var f = fso.OpenTextFile("Makefile.inc.win32", 2);
f.WriteLine("#");
f.WriteLine("# Generated by install.js");
@@ -364,47 +364,47 @@ var buildPackages = [
f.WriteLine("CC=cl");
f.WriteLine("RC=rc");
f.WriteLine("MAKE=nmake -f Makefile.win32");
f.WriteLine("BASE_CFLAGS=$(VC6) /O2 /MD /TP /EHsc $(INCFLAGS)");
f.WriteLine("BASE_CFLAGS=$(VC6) /O2 /MD /TP /GR /EHsc $(INCFLAGS)");
f.WriteLine("RC_FLAGS="+path_line_rc);
f.WriteLine("LIBS=wsock32.lib advapi32.lib /NODEFAULTLIB:libcmtd.lib");
f.WriteLine("LFLAGS=$(LIBPATH)");
f.WriteLine("LFLAGS=$(LIBPATH)");
for (x in installerQuestions) {
var thisQuestion = installerQuestions[x];
thisQuestion.commit_config();
}
}
f.WriteLine("MORE_CFLAGS = /I\"../include\"");
f.WriteLine("CFLAGS = /nologo $(CDEFS) $(BASE_CFLAGS) $(MORE_CFLAGS)");
f.close();
generateRC();
WScript.Echo("\nConfiguration Complete!");
WScript.Echo("-----------------------\n");
WScript.Echo("Anope has been configured to your system. To compile, simply type:");
WScript.Echo("nmake -f Makefile.win32\n");
WScript.Echo("If you update Anope, you should run this script again to ensure\nall available options are set.\n");
}
}
// Fin.
// -----------------------------------------------------------------
// Functions
function FindAnopeVersion() {
if (!fso.FileExists('version.log')) {
anopeVersion = 'Unknown';
return;
}
}
var versionLog = fso.OpenTextFile("version.log");
while (!versionLog.atEndOfStream) {
var versionLine = versionLog.readline();
var thisMatch = versionLine.replace('\n', '');
while (thisMatch.match(/\"/g)) {
thisMatch = thisMatch.replace('"', '');
thisMatch = thisMatch.replace('"', '');
}
versionLine = thisMatch;
if (versionLine.match(/VERSION_MAJOR=/g)) {
@@ -414,30 +414,30 @@ var buildPackages = [
if (versionLine.match(/VERSION_MINOR=/g)) {
vMin = versionLine.replace('VERSION_MINOR=', '');
continue;
}
}
if (versionLine.match(/VERSION_PATCH=/g)) {
vPat = versionLine.replace('VERSION_PATCH=', '');
continue;
}
}
if (versionLine.match(/VERSION_EXTRA=/g)) {
vExtra = versionLine.replace('VERSION_EXTRA=', '');
continue;
}
}
if (versionLine.match(/VERSION_BUILD=/g)) {
vBuild = versionLine.replace('VERSION_BUILD=', '');
continue;
}
}
}
versionLog.close();
anopeVersion = vMaj+"."+vMin+"."+vPat+"."+vBuild+vExtra;
return;
}
function InstallerInput() {
var input = WScript.StdIn.Readline();
return input;
return input;
}
function findMySQL() {
WScript.Echo("\nLooking for MySQL...\n");
var installedDrive = "";
@@ -459,11 +459,11 @@ var buildPackages = [
}
return false;
}
function findCompiler() {
WScript.Echo("\nLooking for a suitable compiler...\n");
var noPSDK = false;
var installedDrive = "";
var installedDrive = "";
for (x in buildPackages) {
var thisPack = buildPackages[x];
WScript.Echo("Looking for: "+thisPack.name+"...");
@@ -478,7 +478,7 @@ var buildPackages = [
}
if (!findFile("advapi32.lib", thisPack.libpaths)) {
WScript.Echo("ERROR: Cannot find advapi32.lib - Probably missing PlatformSDK...\n");
noPSDK = true;
noPSDK = true;
continue;
}
if (!findFile("stdio.h", thisPack.incpaths)) {
@@ -487,7 +487,7 @@ var buildPackages = [
}
if (!findFile("windows.h", thisPack.incpaths)) {
WScript.Echo("ERROR: Cannot find windows.h - Probably missing PlatformSDK headers...\n");
noPSDK = true;
noPSDK = true;
continue;
}
if (!findFile("nmake.exe", thisPack.nmake)) {
@@ -497,7 +497,7 @@ var buildPackages = [
WScript.Echo("nmake.exe is also available in the PlatformSDK which can be freely downloaded from Microsoft.\n");
WScript.Echo("nmake.exe:\nhttp://download.microsoft.com/download/vc15/patch/1.52/w95/en-us/nmake15.exe\n");
break;
}
}
WScript.Echo("SUCCESS: "+thisPack.name+" was found, and is complete!");
thisPack.installedDrive = installedDrive;
softwareVersions.Compiler = thisPack;
@@ -507,11 +507,11 @@ var buildPackages = [
WScript.Echo("Some of the build tools were detected on your computer, but the essential PlatformSDK components were missing.");
WScript.Echo("You will need to download the PlatformSDK from the URL below, ensuring that the Core Windows files, and Debugging Tools are installed.");
WScript.Echo("For more details on installing the PlatformSDK, visit http://windows.anope.org\n");
WScript.Echo("PSDK: http://download.microsoft.com/download/a/5/f/a5f0d781-e201-4ab6-8c6a-9bb4efed1e1a/PSDK-x86.exe\n");
WScript.Echo("PSDK: http://download.microsoft.com/download/a/5/f/a5f0d781-e201-4ab6-8c6a-9bb4efed1e1a/PSDK-x86.exe\n");
}
return false;
}
function findFile(fileName, arrayOfPaths) {
for (z in arrayOfPaths) {
var thisPath = arrayOfPaths[z];
@@ -522,27 +522,27 @@ var buildPackages = [
}
}
}
return false;
return false;
}
function generateRC() {
var version_matches = [
{
'find' : /VERSION_COMMA/g,
'replacement' : vMaj+","+vMin+","+vPat+","+vBuild
},
{
'find' : /VERSION_FULL/g,
'replacement' : anopeVersion
},
{
'find' : /VERSION_DOTTED/g,
'replacement' : vMaj+"."+vMin+"."+vPat+"."+vBuild
}
];
var template = fso.OpenTextFile("src/win32.rc.template", 1);
var output = fso.OpenTextFile("src/win32.rc", 2, true);
if (!template) {
@@ -553,15 +553,15 @@ var buildPackages = [
}
var templateText = template.ReadAll();
template.close();
for (x in version_matches) {
var thisVerStr = version_matches[x];
while (templateText.match(thisVerStr.find)) {
templateText = templateText.replace(thisVerStr.find, thisVerStr.replacement);
}
}
output.WriteLine(templateText);
output.close();
}
+18 -93
View File
@@ -1,93 +1,18 @@
#
# Anope IRC Services 1.7.9 for Windows
#
# Contact us at info@anope.org
#
# Please read COPYING and README for further details.
#
# Based on the original code of Epona by Lara.
# Based on the original code of Services by Andy Church.
#
# Please read and edit the configurations options below.
# Set this to 1 to enable MySQL support
USE_MYSQL=0
# Set this to the path where the MySQL includes can be found
#MYSQL_INC="c:\\mysql\\include\\"
# Set this to the path where the MySQL libraries can be found
#MYSQL_LIB="c:\\mysql\\lib\\opt\\"
# Set this to 1 to enable database encryption
DB_ENCRYPTION=0
# If you want to change the names/locations of files/folders, you
# can do that here.
PROGRAM=anope.exe
DATDEST=data
# If you are compiling using VC6, or get __ftol2 errors, please uncomment
# the following line:
#VC6=/QIfist
# If you are getting errors such as 'Cannot find wsock32.lib', then change
# the following line to the path where the library files can be found.
#
# Eg: LIBPATH=C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\lib
#
LIBPATH=
# If you edited the line above, uncomment the next line.
#LFLAGS=/LIBPATH:"$(LIBPATH)"
###############################################################
#Don't touch anything below unless you know what you are doing#
###############################################################
CC=cl
RC=rc
MAKE=nmake -f Makefile.win32
BASE_CFLAGS=/O2 /MD
LIBS=wsock32.lib advapi32.lib /NODEFAULTLIB:libcmtd.lib
ELIBS=
MLIBS=
!IF $(USE_MYSQL) == 1
!IF $(MYSQL_LIB) != ""
LIBS=$(LIBS) /LIBPATH:$(MYSQL_LIB)
MYSQL_LIB_PATH=/LIBPATH:$(MYSQL_LIB)
!ENDIF
!IF $(MYSQL_INC) != ""
BASE_CFLAGS=$(BASE_CFLAGS) /I $(MYSQL_INC)
MYSQL_INC_PATH=/I $(MYSQL_INC)
!ENDIF
BASE_CFLAGS=$(BASE_CFLAGS)
MYPASQL_BUILD=$(CC) /LD $(MYSQL_INC_PATH) src\mypasql.c /link $(MYSQL_LIB_PATH) $(LFLAGS) \
/DEF:src\mypasql.def libmysql.lib zlib.lib ws2_32.lib advapi32.lib /NODEFAULTLIB:LIBCMTD.lib
LIBS=$(LIBS) libmysql.lib zlib.lib
!ENDIF
!IF $(DB_ENCRYPTION) == 1
BASE_CFLAGS=/D USE_ENCRYPTION /D ENCRYPT_MD5 $(BASE_CFLAGS)
!ENDIF
# Note that changing any of these options (or, in fact, anything in this
# file) will automatically cause a full rebuild of Services.
# Compilation options:
# -DCLEAN_COMPILE Attempt to compile without any warnings (note that
# this may reduce performance)
CDEFS =
# Add any extra flags you want here. The default line enables warnings and
# debugging symbols on GCC. If you have a non-GCC compiler, you may want
# to comment it out or change it.
MORE_CFLAGS = /I"../include"
CFLAGS = /nologo $(VC6) $(CDEFS) $(BASE_CFLAGS) $(MORE_CFLAGS)
#
# Generated by install.js
#
LIBPATH=/LIBPATH:"C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\Lib" /LIBPATH:"C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\PlatformSDK\Lib"
INCFLAGS=/I "C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\Include" /I "C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\PlatformSDK\Include"
VERSION=1.9.0.0-git
PROGRAM=anope.exe
DATDEST=data
CC=cl
RC=rc
MAKE=nmake -f Makefile.win32
BASE_CFLAGS=$(VC6) /O2 /MD /TP /GR /EHsc $(INCFLAGS)
RC_FLAGS=/i "C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\Include" /i "C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\PlatformSDK\Include"
LIBS=wsock32.lib advapi32.lib /NODEFAULTLIB:libcmtd.lib
LFLAGS=$(LIBPATH)
USE_MYSQL=0
MORE_CFLAGS = /I"../include"
CFLAGS = /nologo $(CDEFS) $(BASE_CFLAGS) $(MORE_CFLAGS)
+1 -1
View File
@@ -3,7 +3,7 @@ include ../../Makefile.inc.win32
SRCS=bs_act.c bs_assign.c bs_badwords.c bs_bot.c bs_botlist.c bs_fantasy.c bs_fantasy_kick.c bs_fantasy_kickban.c bs_fantasy_owner.c bs_fantasy_seen.c bs_help.c bs_info.c bs_kick.c bs_say.c bs_set.c bs_unassign.c cs_access.c cs_akick.c cs_ban.c cs_clear.c cs_drop.c cs_forbid.c cs_getkey.c cs_getpass.c cs_help.c cs_identify.c cs_info.c cs_invite.c cs_kick.c cs_list.c cs_logout.c cs_modes.c cs_register.c cs_sendpass.c cs_set.c cs_status.c cs_suspend.c cs_topic.c cs_xop.c enc_none.c enc_md5.c enc_old.c he_help.c hs_del.c hs_delall.c hs_group.c hs_help.c hs_list.c hs_off.c hs_on.c hs_set.c hs_setall.c ms_cancel.c ms_check.c ms_del.c ms_help.c ms_info.c ms_list.c ms_read.c ms_rsend.c ms_send.c ms_sendall.c ms_set.c ms_staff.c ns_access.c ns_alist.c ns_drop.c ns_forbid.c ns_getemail.c ns_getpass.c ns_ghost.c ns_group.c ns_help.c ns_identify.c ns_info.c ns_list.c ns_logout.c ns_recover.c ns_register.c ns_release.c ns_sendpass.c ns_set.c ns_saset.c ns_status.c ns_suspend.c ns_update.c os_admin.c os_akill.c os_chankill.c os_chanlist.c os_clearmodes.c os_defcon.c os_global.c os_help.c os_ignore.c os_jupe.c os_kick.c os_logonnews.c os_mode.c os_modinfo.c os_modlist.c os_modload.c os_modunload.c os_noop.c os_oline.c os_oper.c os_opernews.c os_quit.c os_randomnews.c os_raw.c os_reload.c os_restart.c os_session.c os_set.c os_sgline.c os_shutdown.c os_sqline.c os_staff.c os_stats.c os_svsnick.c os_szline.c os_umode.c os_update.c os_userlist.c
OBJECTS= $(SRCS:.c=.dll)
CFLAGS=/LD /MD /D MODULE_COMPILE $(CFLAGS) /I"../../include"
LFLAGS=/link ../anope.lib wsock32.lib $(LIBS) $(LFLAGS) $(MYSQL_LIB_PATH) /export:AnopeInit /export:AnopeFini /VERSION:$(VERSION)
LFLAGS=/link ../anope.lib wsock32.lib $(LIBS) $(LFLAGS) $(MYSQL_LIB_PATH) /export:init_module /export:destroy_module /VERSION:$(VERSION)
all: $(OBJECTS)
+5 -5
View File
@@ -76,11 +76,11 @@ int do_cancel(User * u)
} else {
int i;
for (i = mi->memocount - 1; i >= 0; i--) {
if ((mi->memos[i].flags & MF_UNREAD)
&& !stricmp(mi->memos[i].sender, u->na->nc->display)
&& (!(mi->memos[i].flags & MF_NOTIFYS))) {
delmemo(mi, mi->memos[i].number);
for (i = mi->memos.size() - 1; i >= 0; i--) {
if ((mi->memos[i]->flags & MF_UNREAD)
&& !stricmp(mi->memos[i]->sender, u->na->nc->display)
&& (!(mi->memos[i]->flags & MF_NOTIFYS))) {
delmemo(mi, mi->memos[i]->number);
notice_lang(s_MemoServ, u, MEMO_CANCELLED, name);
return MOD_CONT;
}
+4 -4
View File
@@ -80,15 +80,15 @@ int do_memocheck(User * u)
/* Okay, I know this looks strange but we wanna get the LAST memo, so we
have to loop backwards */
for (i = (mi->memocount - 1); i >= 0; i--) {
if (!stricmp(mi->memos[i].sender, u->na->nc->display)) {
for (i = (mi->memos.size() - 1); i >= 0; i--) {
if (!stricmp(mi->memos[i]->sender, u->na->nc->display)) {
found = 1; /* Yes, we've found the memo */
tm = localtime(&mi->memos[i].time);
tm = localtime(&mi->memos[i]->time);
strftime_lang(timebuf, sizeof(timebuf), u,
STRFTIME_DATE_TIME_FORMAT, tm);
if (mi->memos[i].flags & MF_UNREAD)
if (mi->memos[i]->flags & MF_UNREAD)
notice_lang(s_MemoServ, u, MEMO_CHECK_NOT_READ, na->nick,
timebuf);
else
+9 -10
View File
@@ -88,7 +88,7 @@ int do_del(User * u)
|| (!isdigit(*numstr) && stricmp(numstr, "ALL") != 0
&& stricmp(numstr, "LAST") != 0)) {
syntax_error(s_MemoServ, u, "DEL", MEMO_DEL_SYNTAX);
} else if (mi->memocount == 0) {
} else if (mi->memos.size() == 0) {
if (chan)
notice_lang(s_MemoServ, u, MEMO_X_HAS_NO_MEMOS, chan);
else
@@ -128,18 +128,17 @@ int do_del(User * u)
}
} else if (stricmp(numstr, "LAST") == 0) {
/* Delete last memo. */
for (i = 0; i < mi->memocount; i++)
last = mi->memos[i].number;
for (i = 0; i < mi->memos.size(); i++)
last = mi->memos[i]->number;
delmemo(mi, last);
notice_lang(s_MemoServ, u, MEMO_DELETED_ONE, last);
} else {
/* Delete all memos. */
for (i = 0; i < mi->memocount; i++) {
delete [] mi->memos[i].text;
for (i = 0; i < mi->memos.size(); i++) {
delete [] mi->memos[i]->text;
delete mi->memos[i];
}
free(mi->memos);
mi->memos = NULL;
mi->memocount = 0;
mi->memos.clear();
if (chan)
notice_lang(s_MemoServ, u, MEMO_CHAN_DELETED_ALL, chan);
else
@@ -147,8 +146,8 @@ int do_del(User * u)
}
/* Reset the order */
for (i = 0; i < mi->memocount; i++)
mi->memos[i].number = i + 1;
for (i = 0; i < mi->memos.size(); i++)
mi->memos[i]->number = i + 1;
}
return MOD_CONT;
}
+18 -18
View File
@@ -98,31 +98,31 @@ int do_info(User * u)
if (name && (ci || na->nc != u->na->nc)) {
if (!mi->memocount) {
if (mi->memos.empty()) {
notice_lang(s_MemoServ, u, MEMO_INFO_X_NO_MEMOS, name);
} else if (mi->memocount == 1) {
if (mi->memos[0].flags & MF_UNREAD)
} else if (mi->memos.size() == 1) {
if (mi->memos[0]->flags & MF_UNREAD)
notice_lang(s_MemoServ, u, MEMO_INFO_X_MEMO_UNREAD, name);
else
notice_lang(s_MemoServ, u, MEMO_INFO_X_MEMO, name);
} else {
int count = 0, i;
for (i = 0; i < mi->memocount; i++) {
if (mi->memos[i].flags & MF_UNREAD)
for (i = 0; i < mi->memos.size(); i++) {
if (mi->memos[i]->flags & MF_UNREAD)
count++;
}
if (count == mi->memocount)
if (count == mi->memos.size())
notice_lang(s_MemoServ, u, MEMO_INFO_X_MEMOS_ALL_UNREAD,
name, count);
else if (count == 0)
notice_lang(s_MemoServ, u, MEMO_INFO_X_MEMOS, name,
mi->memocount);
mi->memos.size());
else if (count == 1)
notice_lang(s_MemoServ, u, MEMO_INFO_X_MEMOS_ONE_UNREAD,
name, mi->memocount);
name, mi->memos.size());
else
notice_lang(s_MemoServ, u, MEMO_INFO_X_MEMOS_SOME_UNREAD,
name, mi->memocount, count);
name, mi->memos.size(), count);
}
if (mi->memomax == 0) {
if (hardmax)
@@ -161,30 +161,30 @@ int do_info(User * u)
} else { /* !name || (!ci || na->nc == u->na->nc) */
if (!mi->memocount) {
if (mi->memos.empty()) {
notice_lang(s_MemoServ, u, MEMO_INFO_NO_MEMOS);
} else if (mi->memocount == 1) {
if (mi->memos[0].flags & MF_UNREAD)
} else if (mi->memos.size() == 1) {
if (mi->memos[0]->flags & MF_UNREAD)
notice_lang(s_MemoServ, u, MEMO_INFO_MEMO_UNREAD);
else
notice_lang(s_MemoServ, u, MEMO_INFO_MEMO);
} else {
int count = 0, i;
for (i = 0; i < mi->memocount; i++) {
if (mi->memos[i].flags & MF_UNREAD)
for (i = 0; i < mi->memos.size(); i++) {
if (mi->memos[i]->flags & MF_UNREAD)
count++;
}
if (count == mi->memocount)
if (count == mi->memos.size())
notice_lang(s_MemoServ, u, MEMO_INFO_MEMOS_ALL_UNREAD,
count);
else if (count == 0)
notice_lang(s_MemoServ, u, MEMO_INFO_MEMOS, mi->memocount);
notice_lang(s_MemoServ, u, MEMO_INFO_MEMOS, mi->memos.size());
else if (count == 1)
notice_lang(s_MemoServ, u, MEMO_INFO_MEMOS_ONE_UNREAD,
mi->memocount);
mi->memos.size());
else
notice_lang(s_MemoServ, u, MEMO_INFO_MEMOS_SOME_UNREAD,
mi->memocount, count);
mi->memos.size(), count);
}
if (mi->memomax == 0) {
+10 -10
View File
@@ -83,7 +83,7 @@ int do_list(User * u)
}
if (param && !isdigit(*param) && stricmp(param, "NEW") != 0) {
syntax_error(s_MemoServ, u, "LIST", MEMO_LIST_SYNTAX);
} else if (mi->memocount == 0) {
} else if (mi->memos.size() == 0) {
if (chan)
notice_lang(s_MemoServ, u, MEMO_X_HAS_NO_MEMOS, chan);
else
@@ -95,11 +95,11 @@ int do_list(User * u)
mi, &sent_header, chan);
} else {
if (param) {
for (i = 0, m = mi->memos; i < mi->memocount; i++, m++) {
if (m->flags & MF_UNREAD)
for (i = 0; i < mi->memos.size(); i++) {
if (mi->memos[i]->flags & MF_UNREAD)
break;
}
if (i == mi->memocount) {
if (i == mi->memos.size()) {
if (chan)
notice_lang(s_MemoServ, u, MEMO_X_HAS_NO_NEW_MEMOS,
chan);
@@ -108,8 +108,8 @@ int do_list(User * u)
return MOD_CONT;
}
}
for (i = 0, m = mi->memos; i < mi->memocount; i++, m++) {
if (param && !(m->flags & MF_UNREAD))
for (i = 0; i < mi->memos.size(); i++) {
if (param && !(mi->memos[i]->flags & MF_UNREAD))
continue;
list_memo(u, i, mi, &sent_header, param != NULL, chan);
}
@@ -132,8 +132,8 @@ int list_memo_callback(User * u, int num, va_list args)
const char *chan = va_arg(args, const char *);
int i;
for (i = 0; i < mi->memocount; i++) {
if (mi->memos[i].number == num)
for (i = 0; i < mi->memos.size(); i++) {
if (mi->memos[i]->number == num)
break;
}
/* Range checking done by list_memo() */
@@ -156,7 +156,7 @@ int list_memo(User * u, int index, MemoInfo * mi, int *sent_header, int newi, co
char timebuf[64];
struct tm tm;
if (index < 0 || index >= mi->memocount)
if (index < 0 || index >= mi->memos.size())
return 0;
if (!*sent_header) {
if (chan) {
@@ -171,7 +171,7 @@ int list_memo(User * u, int index, MemoInfo * mi, int *sent_header, int newi, co
notice_lang(s_MemoServ, u, MEMO_LIST_HEADER);
*sent_header = 1;
}
m = &mi->memos[index];
m = mi->memos[index];
tm = *localtime(&m->time);
strftime_lang(timebuf, sizeof(timebuf),
u, STRFTIME_DATE_TIME_FORMAT, &tm);
+8 -8
View File
@@ -88,7 +88,7 @@ int do_read(User * u)
&& num <= 0)) {
syntax_error(s_MemoServ, u, "READ", MEMO_READ_SYNTAX);
} else if (mi->memocount == 0) {
} else if (mi->memos.empty()) {
if (chan)
notice_lang(s_MemoServ, u, MEMO_X_HAS_NO_MEMOS, chan);
else
@@ -99,8 +99,8 @@ int do_read(User * u)
if (stricmp(numstr, "NEW") == 0) {
int readcount = 0;
for (i = 0; i < mi->memocount; i++) {
if (mi->memos[i].flags & MF_UNREAD) {
for (i = 0; i < mi->memos.size(); i++) {
if (mi->memos[i]->flags & MF_UNREAD) {
read_memo(u, i, mi, chan);
readcount++;
}
@@ -113,7 +113,7 @@ int do_read(User * u)
notice_lang(s_MemoServ, u, MEMO_HAVE_NO_NEW_MEMOS);
}
} else if (stricmp(numstr, "LAST") == 0) {
for (i = 0; i < mi->memocount - 1; i++);
for (i = 0; i < mi->memos.size() - 1; i++);
read_memo(u, i, mi, chan);
} else { /* number[s] */
if (!process_numlist(numstr, &count, read_memo_callback, u,
@@ -143,8 +143,8 @@ int read_memo_callback(User * u, int num, va_list args)
const char *chan = va_arg(args, const char *);
int i;
for (i = 0; i < mi->memocount; i++) {
if (mi->memos[i].number == num)
for (i = 0; i < mi->memos.size(); i++) {
if (mi->memos[i]->number == num)
break;
}
/* Range check done in read_memo */
@@ -165,9 +165,9 @@ int read_memo(User * u, int index, MemoInfo * mi, const char *chan)
char timebuf[64];
struct tm tm;
if (index < 0 || index >= mi->memocount)
if (index < 0 || index >= mi->memos.size())
return 0;
m = &mi->memos[index];
m = mi->memos[index];
tm = *localtime(&m->time);
strftime_lang(timebuf, sizeof(timebuf),
u, STRFTIME_DATE_TIME_FORMAT, &tm);
+4
View File
@@ -317,7 +317,11 @@ static void write_pidfile(void)
pidfile = fopen(PIDFilename, "w");
if (pidfile) {
#ifdef _WIN32
fprintf(pidfile, "%d\n", static_cast<int>(GetCurrentProcessId()));
#else
fprintf(pidfile, "%d\n", static_cast<int>(getpid()));
#endif
fclose(pidfile);
atexit(remove_pidfile);
} else {
+2
View File
@@ -48,6 +48,8 @@ int protocoldebug = 0; /* -protocoldebug */
#ifdef _WIN32
char *binary_dir; /* Used to store base path for win32 restart */
#include <process.h>
#define execve _execve
#endif
/* Set to 1 if we are to quit */
+15 -14
View File
@@ -6,9 +6,9 @@
# Please read COPYING and README for further details.
#
# Based on the original code of Epona by Lara.
# Based on the original code of Services by Andy Church.
#
# $Id:$
# Based on the original code of Services by Andy Church.
#
# $Id:$
#
# Source Makefile
@@ -19,19 +19,19 @@ include ../Makefile.inc.win32
OBJS = actions.obj base64.obj bots.obj botserv.obj channels.obj chanserv.obj commands.obj compat.obj \
config.obj datafiles.obj encrypt.obj events.obj helpserv.obj hostserv.obj \
init.obj ircd.obj language.obj list.obj log.obj mail.obj main.obj memory.obj \
init.obj ircd.obj language.obj log.obj mail.obj main.obj memory.obj \
memoserv.obj messages.obj misc.obj modules.obj mod_version.obj news.obj nickserv.obj operserv.obj \
process.obj send.obj servers.obj sessions.obj slist.obj sockutil.obj \
timeout.obj users.obj module.obj modulemanager.obj
timeout.obj users.obj module.obj modulemanager.obj hashcomp.obj
SRCS = actions.c base64.c botserv.c bots.cpp channels.c chanserv.c commands.c compat.c \
config.c datafiles.c encrypt.c events.c helpserv.c hostserv.c init.c ircd.c \
language.c list.c log.c mail.c main.c memory.c memoserv.c messages.c misc.c \
language.c log.c mail.c main.c memory.c memoserv.c messages.c misc.c \
modules.c mod_version.c news.c nickserv.c operserv.c process.c send.c servers.obj sessions.c \
slist.c sockutil.c timeout.c users.c module.cpp modulemanager.cpp
slist.c sockutil.c timeout.c users.c module.cpp modulemanager.cpp hashcomp.cpp
###########################################################################
.c.obj:
$(CC) $(CFLAGS) -c $<
@@ -46,9 +46,9 @@ $(PROGRAM): $(OBJS) win32.res
spotless:
-@erase *.obj *.exe *.exp *.lib tools\*.exe *.res win32.rc *.manifest
install:
-@copy anope.exe ..\anope.exe
-@copy anope.exe ..\anope.exe
-@mkdir ..\$(DATDEST)\bin
-@copy bin\* ..\$(DATDEST)\bin
-@copy anope.exe.manifest ..\anope.exe.manifest
@@ -56,9 +56,9 @@ install:
win32.res: win32.rc
$(RC) /l 0x409 $(RC_FLAGS) /fowin32.res win32.rc
###########################################################################
# Catch any changes in compilation options at the top of this file
$(OBJS):
@@ -76,6 +76,7 @@ encrypt.obj: encrypt.c ..\include\encrypt.h ..\include\sysconf.h
events.obj: events.c ..\include\modules.h ..\include\language.h ..\include\version.h
init.obj: init.c ..\include\services.h
ircd.obj: ircd.c ..\include\services.h
hashcomp.obj: hashcomp.cpp ..\include\services.h ..\include\hashcomp.h
hostserv.obj: hostserv.c ..\include\services.h ..\include\pseudo.h
language.obj: language.c ..\include\services.h ..\include\language.h
list.obj: list.c ..\include\services.h
@@ -110,7 +111,7 @@ vsnprintf.obj: vsnprintf.c
..\include\extern.h: ..\include\slist.h
..\include\pseudo.h: ..\include\commands.h ..\include\language.h ..\include\timeout.h ..\include\encrypt.h ..\include\datafiles.h ..\include\slist.h
###########################################################################
FRC:
+2
View File
@@ -1336,8 +1336,10 @@ char *GetWindowsVersion(void)
extra = sstrdup("Datacenter Edition");
} else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) {
extra = sstrdup("Enterprise Edition");
#ifdef VER_SUITE_COMPUTE_SERVER
} else if (osvi.wSuiteMask & VER_SUITE_COMPUTE_SERVER) {
extra = sstrdup("Compute Cluster Edition");
#endif
} else if (osvi.wSuiteMask == VER_SUITE_BLADE) {
extra = sstrdup("Web Edition");
} else {
+3 -3
View File
@@ -54,7 +54,7 @@ static int moduleCopyFile(const char *name, const char *output)
if ((srcfp = mkstemp(const_cast<char *>(output))) == -1)
return MOD_ERR_FILE_IO;
#else
if (!mktemp(output))
if (!mktemp(const_cast<char *>(output)))
return MOD_ERR_FILE_IO;
#endif
@@ -152,7 +152,7 @@ int ModuleManager::LoadModule(const std::string &modname, User * u)
ano_modclearerr();
void *handle = ano_modopen(pbuf.c_str());
ano_module_t handle = ano_modopen(pbuf.c_str());
if (handle == NULL && (err = ano_moderr()) != NULL)
{
alog("%s", err);
@@ -253,7 +253,7 @@ void ModuleManager::DeleteModule(Module *m)
{
const char *err;
void (*destroy_func)(Module *m);
void *handle;
ano_module_t handle;
if (!m || !m->handle) /* check m is least possibly valid */
{
+3 -3
View File
@@ -3,7 +3,7 @@ include ./Makefile.inc.win32
OBJECTS= $(SRCS:.c=.dll)
CFLAGS=/LD /MD /D MODULE_COMPILE $(CFLAGS) /I"../../include"
LFLAGS=/link ../anope.lib wsock32.lib $(LIBS) $(LFLAGS) $(MYSQL_LIB_PATH) /export:AnopeInit /export:AnopeFini
LFLAGS=/link ../anope.lib wsock32.lib $(LIBS) $(LFLAGS) $(MYSQL_LIB_PATH) /export:init_module /export:destroy_module
all: $(OBJECTS) subs
@@ -11,7 +11,7 @@ distclean: clean spotless
.c.dll:
$(CC) $(CFLAGS) $(IRCTYPE) $< ..\mod_version.c $(LFLAGS)
subs:
@for %i in ( $(SUBS) ); do \
@if exist %i; @cd %i && $(MAKE) $(MAKEARGS) && cd ..
@@ -29,7 +29,7 @@ spotless: clean subs-spotless
subs-spotless:
@for %i in ( $(SUBS) ); do \
@if exist %i; @cd %i && $(MAKE) $(MAKEARGS) spotless && cd ..
install:
-@mkdir ..\..\$(DATDEST)\modules
-@mkdir ..\..\$(DATDEST)\modules\runtime
+2 -2
View File
@@ -2,10 +2,10 @@ include ../../Makefile.inc.win32
SRCS=bahamut.c inspircd11.c inspircd12.cpp \
ratbox.c unreal32.c
OBJECTS=bahamut.dll inspircd11.dll inspircd12.dll ratbox.dll unreal32.dll
OBJECTS= $(SRCS:.c=.dll)
CFLAGS=/LD /MD /D MODULE_COMPILE $(CFLAGS) /I"../../include"
LFLAGS=/link ../anope.lib wsock32.lib $(LIBS) $(LFLAGS) $(MYSQL_LIB_PATH) /export:AnopeInit /VERSION:$(VERSION)
LFLAGS=/link ../anope.lib wsock32.lib $(LIBS) $(LFLAGS) $(MYSQL_LIB_PATH) /export:init_module /export:destroy_module /VERSION:$(VERSION)
all: $(OBJECTS)
+2 -1
View File
@@ -27,6 +27,7 @@
#else
#include "sysconf.h"
#include <windows.h>
#include <io.h>
#endif
#include <string>
@@ -1079,7 +1080,7 @@ dbFILE *open_db_write(const char *service, const char *filename, int version)
#ifndef _WIN32
fd = open(filename, O_WRONLY | O_CREAT | O_EXCL, 0666);
#else
fd = open(filename, O_WRONLY | O_CREAT | O_EXCL | _O_BINARY, 0666);
fd = _open(filename, O_WRONLY | O_CREAT | O_EXCL | _O_BINARY, 0666);
#endif
f->fp = fdopen(fd, "wb"); /* will fail and return NULL if fd < 0 */
if (!f->fp || !write_file_version(f, version)) {
+2
View File
@@ -57,6 +57,8 @@
#else
#include "sysconf.h"
#include <windows.h>
#include <io.h>
#define open _open
#endif
/* Some SUN fixs */
+525 -525
View File
File diff suppressed because it is too large Load Diff