From 9b3a357193a020c53624b29f84e0bca4795722f0 Mon Sep 17 00:00:00 2001 From: "trystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b" Date: Sun, 6 Feb 2005 19:18:15 +0000 Subject: BUILD : 1.7.8 (565) BUGS : 293 NOTES : Merge of Win32 branch into the main, support for Unreal +I, German language updated, fixed bug vidents not updating, Setting and Removal of sqlines on forbid or drop git-svn-id: svn://svn.anope.org/anope/trunk@567 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@417 5417fbe8-f217-4b02-8779-1006273d7864 --- Changes | 10 ++ docs/WIN32.txt | 149 ++++++++++++++++++++++++++++ include/commands.h | 4 +- include/datafiles.h | 2 + include/extern.h | 28 ++++-- include/makefile.win32 | 25 +++++ include/modules.h | 133 ++++++++++++++++--------- include/resource.h | 20 ++++ include/services.h | 65 ++++++++++++- include/sockets.h | 47 +++++++++ include/sysconf.h.win32 | 51 ++++++++++ include/threads.h | 67 +++++++++++++ include/version.sh.c | 215 +++++++++++++++++++++++++++++++++++++++++ lang/Makefile.win32 | 75 ++++++++++++++ lang/de.l | 75 +++++++------- lang/langcomp.c | 3 + lang/langtool.c | 14 ++- makefile.inc.win32 | 174 +++++++++++++++++++++++++++++++++ makefile.win32 | 156 ++++++++++++++++++++++++++++++ src/anope-icon.ico | Bin 0 -> 7406 bytes src/bahamut.c | 4 + src/base64.c | 2 +- src/channels.c | 16 +-- src/chanserv.c | 8 ++ src/compat.c | 35 +++++++ src/datafiles.c | 89 +++++++++++++++-- src/dreamforge.c | 4 + src/hybrid.c | 4 + src/init.c | 45 ++++++--- src/language.c | 4 + src/log.c | 49 ++++++++++ src/main.c | 29 +++--- src/makefile.win32 | 107 ++++++++++++++++++++ src/memory.c | 16 +++ src/modules.c | 47 ++++++--- src/modules/makefile.inc.win32 | 2 + src/modules/makefile.win32 | 24 +++++ src/mypasql.c | 122 +++++++++++++++++++++++ src/mypasql.def | 10 ++ src/nickserv.c | 9 ++ src/plexus.c | 4 + src/proxy.c | 101 +++++++++++-------- src/ptlink.c | 4 + src/rageircd.c | 13 +++ src/ratbox.c | 9 ++ src/sockutil.c | 177 +++++++++++++++++++++++++-------- src/solidircd.c | 4 + src/tools/anopesmtp.c | 17 ++++ src/tools/smtp.h | 33 ++++++- src/ultimate2.c | 4 + src/ultimate3.c | 6 +- src/unreal31.c | 6 +- src/unreal32.c | 15 ++- src/users.c | 6 +- src/viagra.c | 6 +- src/win32.rc | 91 +++++++++++++++++ version.log | 7 +- 57 files changed, 2186 insertions(+), 256 deletions(-) create mode 100644 docs/WIN32.txt create mode 100644 include/makefile.win32 create mode 100644 include/resource.h create mode 100644 include/sockets.h create mode 100644 include/sysconf.h.win32 create mode 100644 include/threads.h create mode 100644 include/version.sh.c create mode 100644 lang/Makefile.win32 create mode 100644 makefile.inc.win32 create mode 100644 makefile.win32 create mode 100644 src/anope-icon.ico create mode 100644 src/makefile.win32 create mode 100644 src/modules/makefile.inc.win32 create mode 100644 src/modules/makefile.win32 create mode 100644 src/mypasql.c create mode 100644 src/mypasql.def create mode 100644 src/win32.rc diff --git a/Changes b/Changes index 7abe77cb3..d71de8a2e 100644 --- a/Changes +++ b/Changes @@ -1,10 +1,20 @@ Anope Version S V N ------------------- Provided by Anope Dev. - 2005 +02/05 A Support for Unreal 3.2 +I channel mode. [ #00] +02/03 A Merged anope-win32 branch into the main, now Win32 ready [ #00] +02/05 F Change Ident function did not update the vident [#293] 01/30 F ChanServ help to reflect the avaiable commands. [ #00] 01/30 F ChanServ still used some commands that were not valid on all ircd [ #00] 01/30 F Compiling modules under Mac OSX. [#285] +Provided by crazytoon - 2005 +02/05 A Updated German language file [ #00] + +Provided by BarkerJr - 2005 +02/05 A Setting and Removal of SQLINEs on forbid of Channels and Nicks [ #00] + + Anope Version 1.7.8 ------------------- Provided by Anope Dev. - 2005 diff --git a/docs/WIN32.txt b/docs/WIN32.txt new file mode 100644 index 000000000..21adb7e41 --- /dev/null +++ b/docs/WIN32.txt @@ -0,0 +1,149 @@ +Anope for Windows + +1. Building the source +2. Installation +3. Compiling modules +4. Credits + +========================================================================= += 1. Building from the ground up = +========================================================================= + + If you want to build Anope on the Win32 system you will need to obtain +the following items. + +1. Download the files required + +- Current Anope source: + http://zero.org:7467/viewcvs/trunk.tar.gz + +If you have Visual C++ 6, 7 or .NET skip ahead to step 2, else download +the following free components from Microsoft. Once downloaded install these packages + +- VCToolKit: + http://download.microsoft.com/download/3/9/b/39bac755-0a1e-4d0b-b72c-3a158b7444c4/VCToolkitSetup.exe + +- .NET Framework 1.1 Redistributable: + http://download.microsoft.com/download/a/a/c/aac39226-8825-44ce-90e3-bf8203e74006/dotnetfx.exe + +- .NET Framework SDK 1.1: + http://download.microsoft.com/download/5/2/0/5202f918-306e-426d-9637-d7ee26fbe507/setup.exe + +- Core SDK for the needed libraries: + http://www.microsoft.com/msdownload/platformsdk/sdkupdate/ + +- MySQL for Windows - needed if building for mysql + http://www.mysql.com + + +2. Unpack the Anope tarball with your favorite uncompression program (winzip or winrar) + +3. Open Makefile.inc.win32 in the main directory with a text editor (notepad or notepad clones) + + A. change the line "IRCD=" to match the ircd that you want to build, and place that number + after the = so if your building Unreal 3.2 (#10), you would change the line to read + "IRCD=10" + + B. If you are building for MySQL change USE_MYSQL to equal 1 (ie.. USE_MYSQL=1), the next + two lines you must enter the path to the MySQL installation. MYSQL_INC, and MYSQL_LIB, + You can define the path one of two ways, either with \ or / if you use \ you must add + a secondary \ so c:\mysql would be c:\\mysql + + C. To use Anope build in Proxy scan you can change PROXY_SCANNER to be equal to 1 + (ie.. PROXY_SCANNER=1), note the proxy scan is not the best and its recommended to use + another thrid party scanner. + + D. If you are using Visual Studio 6, this next line can be very important. If you are an + error during compile about "unresolved external symbol __ftol2", remove the # in front + of VC6=/QIfist and attempt to compile again. + + E. When compiling if you get an error about 'Cannot find wsock32.lib' or 'Cannot find + msvcrt.lib' You need to define the libpath, in the LIBPATH directive. You can define + the path one of two ways, either with \ or / if you use \ you must add a secondary \ + so c:\mysql would be c:\\sdk\lib be sure to remove the # in front of LFLAGS + + F. Most import is to set the DATDEST to be the folder name where data will be stored. + This does not need to be the full path just the folder under the main executable + in which data will exist. In our example we will use "data" + +4. You are now ready to compile, bring up the Visual C++ toolkit command prompt, this + will launch a dos command prompt like window, which will set the enviroment properties + need to make Anope. Change directories to where you unpacked the source code in step 2. + At the prompt type + + nmake -f Makefile.win32 + + Once you are back at the command prompt again, if there have been no + errors, you are ready to go, should you encounter errors check how to adjust + the makefile.inc.win32 to help resolve the issue. + +5. Anope will install the files where the belong. The only thing you need to do + is rename "data/example.conf" to be "services.conf" + +You have now complete the building phase of Anope for Windows. Move to the +section related to setting up Anope. + +========================================================================= += 2. Installation = +========================================================================= + + Since Anope for Windows does not use a visual interface, you must do +the configuration before getting to far into this. + +Open services.conf, and make the following edits + +A. RemoteServer : this is the address to your ircd, along with the port + and password. You should consult your ircd documentation + on how to link ircds. +B. ServicesRoot : Remove the # and change the names to your nick so you + can take control of services once they are online. + +If you are unsure of the settings, You can go to the dos command prompt +and run "anope.exe -nofork -debug" and watch the information as it +attempts to connect. + +To launch services you can do it one of two ways, if you are sure that the +configuration information is correct, simply double clicking on it will +cause it to start, no window will come up. You can start at the dos prompt +and type in "anope.exe" if services are successful in starting up +the dos prompt will seem to hang, at this point you can close the dos +window + +========================================================================= += 3. Compiling Modules = +========================================================================= + + If you want to build other modules. You will need to modify the +Makefile.inc.win32 + + A. When compiling if you get an error about 'Cannot find wsock32.lib' + or 'Cannot find msvcrt.lib' You need to define the libpath, in the + LIBPATH directive. You can define the path one of two ways, either + with \ or / if you use \ you must add a secondary \ so c:\mysql + would be c:\\sdk\lib be sure to remove the # in front of LFLAGS + + B. Add modules fine the line of "SRCS=" add the name of the file to + the end of the line. So if you have two files + + "SRCS=file.c file2.c" + +When that is done, use the same command prompt you set up in Part 1, +change directores to the src/modules folder and type + +nmake -f Makefile.win32 + +Copy the *.dll files that get created to the "data/modules/runtime" +folder. + +========================================================================= += 4. Credits = +========================================================================= + + Anope is based on the code of Epona and IRCServices see README for +full list of developers. + + Anope Winodws code is provided by + + Dominick Meglio + Trystan Scott Lee + Chris Hogben \ No newline at end of file diff --git a/include/commands.h b/include/commands.h index 703842690..ec08a44a9 100644 --- a/include/commands.h +++ b/include/commands.h @@ -27,8 +27,8 @@ extern void help_cmd(char *service, User *u, Command *list, char *name); extern void do_run_cmd(char *service, User * u, Command *c,const char *cmd); extern void do_help_cmd(char *service, User * u, Command *c,const char *cmd); -extern void mod_help_cmd(char *service, User *u, CommandHash *cmdTable[],const char *cmd); -extern void mod_run_cmd(char *service, User *u, CommandHash *cmdTable[],const char *cmd); +extern MDE void mod_help_cmd(char *service, User *u, CommandHash *cmdTable[],const char *cmd); +extern MDE void mod_run_cmd(char *service, User *u, CommandHash *cmdTable[],const char *cmd); extern char *mod_current_module_name; /*************************************************************************/ diff --git a/include/datafiles.h b/include/datafiles.h index 32f168ca1..e25b3416a 100644 --- a/include/datafiles.h +++ b/include/datafiles.h @@ -15,7 +15,9 @@ #ifndef DATAFILES_H #define DATAFILES_H +#ifndef _WIN32 #include +#endif /*************************************************************************/ diff --git a/include/extern.h b/include/extern.h index 410236363..40e275da2 100644 --- a/include/extern.h +++ b/include/extern.h @@ -17,7 +17,15 @@ #include "slist.h" +#ifndef _WIN32 #define E extern +#else +#ifndef MODULE_COMPILE +#define E extern __declspec(dllexport) +#else +#define E extern __declspec(dllimport) +#endif +#endif E char *uplink; @@ -200,7 +208,9 @@ E char *strerror(int errnum); #if !HAVE_STRSIGNAL char *strsignal(int signum); #endif - +#ifdef _WIN32 +char *sockstrerror(int error); +#endif /**** config.c ****/ @@ -660,7 +670,7 @@ E int process_numlist(const char *numstr, int *count_ret, range_callback_t callback, User * u, ...); E int isValidHost(const char *host, int type); -E int isvalidchar(char c); +E int isvalidchar(const char c); E char *myStrGetToken(const char *str, const char dilim, int token_number); E char *myStrGetOnlyToken(const char *str, const char dilim, @@ -877,14 +887,14 @@ E int32 total_read, total_written; E int32 read_buffer_len(void); E int32 write_buffer_len(void); -E int sgetc(int s); -E char *sgets(char *buf, int len, int s); -E char *sgets2(char *buf, int len, int s); -E int sread(int s, char *buf, int len); -E int sputs(char *str, int s); -E int sockprintf(int s, char *fmt, ...); +E int sgetc(ano_socket_t s); +E char *sgets(char *buf, int len, ano_socket_t s); +E char *sgets2(char *buf, int len, ano_socket_t s); +E int sread(ano_socket_t s, char *buf, int len); +E int sputs(char *str, ano_socket_t s); +E int sockprintf(ano_socket_t s, char *fmt, ...); E int conn(const char *host, int port, const char *lhost, int lport); -E void disconn(int s); +E void disconn(ano_socket_t s); /**** users.c ****/ diff --git a/include/makefile.win32 b/include/makefile.win32 new file mode 100644 index 000000000..b186c578c --- /dev/null +++ b/include/makefile.win32 @@ -0,0 +1,25 @@ +# Make file for Win32 +# +# (C) 2003-2005 Anope Team +# 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. +# +# $Id:$ +# + +########################################################################### + +clean: + -@erase language.h + +spotless: clean + -@erase sysconf.h version.h + +distclean: spotless + + +FRC: diff --git a/include/modules.h b/include/modules.h index 2a3025586..91bdb7a88 100644 --- a/include/modules.h +++ b/include/modules.h @@ -18,6 +18,34 @@ #include "services.h" #include +/* Cross OS compatibility macros */ +#ifdef _WIN32 +typedef HMODULE ano_module_t; + +#define ano_modopen(file) LoadLibrary(file) +/* ano_moderr in modules.c */ +#define ano_modsym(file, symbol) (void *)GetProcAddress(file, symbol) +#define ano_modclose(file) FreeLibrary(file) ? 0 : 1 +#define ano_modclearerr() SetLastError(0) +#define MODULE_EXT ".dll" + +#else +typedef void * ano_module_t; + +#ifdef HAS_RTLD_LOCAL +#define ano_modopen(file) dlopen(file, RTLD_LAZY|RTLD_LOCAL) +#else +#define ano_modopen(file) dlopen(file, RTLD_LAZY) +#endif +#define ano_moderr() dlerror() +#define ano_modsym(file, symbol) dlsym(file, DL_PREFIX symbol) +#define ano_modclose(file) dlclose(file) +#define ano_modclearerr() errno = 0 +#define MODULE_EXT ".so" + +#endif + + /*************************************************************************/ #define CMD_HASH(x) (((x)[0]&31)<<5 | ((x)[1]&31)) /* Will gen a hash from a string :) */ #define MAX_CMD_HASH 1024 @@ -53,7 +81,18 @@ #define MOD_ERR_NOSERVICE 12 #define MOD_ERR_NO_MOD_NAME 13 - /*************************************************************************/ +/*************************************************************************/ +/* Macros to export the Module API functions/variables */ +#ifndef _WIN32 +#define MDE +#else +#ifndef MODULE_COMPILE +#define MDE __declspec(dllexport) +#else +#define MDE __declspec(dllimport) +#endif +#endif +/*************************************************************************/ /* Structure for information about a *Serv command. */ @@ -66,14 +105,14 @@ typedef struct MessageHash_ MessageHash; typedef struct ModuleCallBack_ ModuleCallBack; -extern CommandHash *HOSTSERV[MAX_CMD_HASH]; -extern CommandHash *BOTSERV[MAX_CMD_HASH]; -extern CommandHash *MEMOSERV[MAX_CMD_HASH]; -extern CommandHash *NICKSERV[MAX_CMD_HASH]; -extern CommandHash *CHANSERV[MAX_CMD_HASH]; -extern CommandHash *HELPSERV[MAX_CMD_HASH]; -extern CommandHash *OPERSERV[MAX_CMD_HASH]; -extern MessageHash *IRCD[MAX_CMD_HASH]; +extern MDE CommandHash *HOSTSERV[MAX_CMD_HASH]; +extern MDE CommandHash *BOTSERV[MAX_CMD_HASH]; +extern MDE CommandHash *MEMOSERV[MAX_CMD_HASH]; +extern MDE CommandHash *NICKSERV[MAX_CMD_HASH]; +extern MDE CommandHash *CHANSERV[MAX_CMD_HASH]; +extern MDE CommandHash *HELPSERV[MAX_CMD_HASH]; +extern MDE CommandHash *OPERSERV[MAX_CMD_HASH]; +extern MDE MessageHash *IRCD[MAX_CMD_HASH]; struct Module_ { char *name; @@ -173,62 +212,62 @@ Module *findModule(char *name); /* Find a module */ int loadModule(Module *m,User *u); /* Load the given module into the program */ int unloadModule(Module *m, User *u); /* Unload the given module from the pro */ int prepForUnload(Module *m); /* Prepare the module for unload */ -void moduleAddVersion(char *version); -void moduleAddAuthor(char *author); +MDE void moduleAddVersion(char *version); +MDE void moduleAddAuthor(char *author); void modules_init(void); void modules_delayed_init(void); void moduleCallBackPrepForUnload(char *mod_name); -void moduleCallBackDeleteEntry(ModuleCallBack * prev); -char *moduleGetLastBuffer(void); -void moduleSetHelpHelp(void (*func) (User * u)); -void moduleDisplayHelp(int service, User *u); -void moduleSetHostHelp(void (*func) (User * u)); -void moduleSetOperHelp(void (*func) (User * u)); -void moduleSetBotHelp(void (*func) (User * u)); -void moduleSetMemoHelp(void (*func) (User * u)); -void moduleSetChanHelp(void (*func) (User * u)); -void moduleSetNickHelp(void (*func) (User * u)); -int moduleAddHelp(Command * c, int (*func) (User * u)); -int moduleAddRegHelp(Command * c, int (*func) (User * u)); -int moduleAddOperHelp(Command * c, int (*func) (User * u)); -int moduleAddAdminHelp(Command * c, int (*func) (User * u)); -int moduleAddRootHelp(Command * c, int (*func) (User * u)); +MDE void moduleCallBackDeleteEntry(ModuleCallBack * prev); +MDE char *moduleGetLastBuffer(void); +MDE void moduleSetHelpHelp(void (*func) (User * u)); +MDE void moduleDisplayHelp(int service, User *u); +MDE void moduleSetHostHelp(void (*func) (User * u)); +MDE void moduleSetOperHelp(void (*func) (User * u)); +MDE void moduleSetBotHelp(void (*func) (User * u)); +MDE void moduleSetMemoHelp(void (*func) (User * u)); +MDE void moduleSetChanHelp(void (*func) (User * u)); +MDE void moduleSetNickHelp(void (*func) (User * u)); +MDE int moduleAddHelp(Command * c, int (*func) (User * u)); +MDE int moduleAddRegHelp(Command * c, int (*func) (User * u)); +MDE int moduleAddOperHelp(Command * c, int (*func) (User * u)); +MDE int moduleAddAdminHelp(Command * c, int (*func) (User * u)); +MDE int moduleAddRootHelp(Command * c, int (*func) (User * u)); /*************************************************************************/ /*************************************************************************/ /* Command Managment Functions */ -Command *createCommand(const char *name,int (*func)(User *u),int (*has_priv)(User *u),int help_all, int help_reg, int help_oper, int help_admin,int help_root); -int destroyCommand(Command *c); /* destroy a command */ -int addCoreCommand(CommandHash *cmdTable[], Command *c); /* Add a command to a command table */ -int moduleAddCommand(CommandHash *cmdTable[], Command *c, int pos); -int addCommand(CommandHash *cmdTable[], Command *c,int pos); -int delCommand(CommandHash *cmdTable[], Command *c,char *mod_name); /* Del a command from a cmd table */ -int moduleDelCommand(CommandHash *cmdTable[],char *name); /* Del a command from a cmd table */ +MDE Command *createCommand(const char *name,int (*func)(User *u),int (*has_priv)(User *u),int help_all, int help_reg, int help_oper, int help_admin,int help_root); +MDE int destroyCommand(Command *c); /* destroy a command */ +MDE int addCoreCommand(CommandHash *cmdTable[], Command *c); /* Add a command to a command table */ +MDE int moduleAddCommand(CommandHash *cmdTable[], Command *c, int pos); +MDE int addCommand(CommandHash *cmdTable[], Command *c,int pos); +MDE int delCommand(CommandHash *cmdTable[], Command *c,char *mod_name); /* Del a command from a cmd table */ +MDE int moduleDelCommand(CommandHash *cmdTable[],char *name); /* Del a command from a cmd table */ Command *findCommand(CommandHash *cmdTable[], const char *name); /* Find a command */ /*************************************************************************/ /*************************************************************************/ /* Message Managment Functions */ -Message *createMessage(char *name,int (*func)(char *source, int ac, char **av)); +MDE Message *createMessage(char *name,int (*func)(char *source, int ac, char **av)); Message *findMessage(MessageHash *msgTable[], const char *name); /* Find a Message */ -int addMessage(MessageHash *msgTable[], Message *m, int pos); /* Add a Message to a Message table */ +MDE int addMessage(MessageHash *msgTable[], Message *m, int pos); /* Add a Message to a Message table */ int addCoreMessage(MessageHash *msgTable[], Message *m); /* Add a Message to a Message table */ -int moduleAddMessage(Message *m, int pos); +MDE int moduleAddMessage(Message *m, int pos); int delMessage(MessageHash *msgTable[], Message *m, char *mod_name); /* Del a Message from a msg table */ -int moduleDelMessage(char *name); +MDE int moduleDelMessage(char *name); int destroyMessage(Message *m); /* destroy a Message*/ Message *findMessage(MessageHash *msgTable[], const char *name); /*************************************************************************/ -int moduleAddCallback(char *name,time_t when,int (*func)(int argc, char *argv[]),int argc, char **argv); -void moduleDelCallback(char *name); -void moduleCallBackRun(void); - -char *moduleGetData(ModuleData **md, char *key); /* Get the value for this key from this struct */ -int moduleAddData(ModuleData **md, char *key, char *value); /* Set the value for this key for this struct */ -void moduleDelData(ModuleData **md, char *key); /* Delete this key/value pair */ -void moduleDelAllData(ModuleData **md); /* Delete all key/value pairs for this module for this struct */ -void moduleCleanStruct(ModuleData **moduleData); /* Clean a moduleData hash */ +MDE int moduleAddCallback(char *name,time_t when,int (*func)(int argc, char *argv[]),int argc, char **argv); +MDE void moduleDelCallback(char *name); +MDE void moduleCallBackRun(void); + +MDE char *moduleGetData(ModuleData **md, char *key); /* Get the value for this key from this struct */ +MDE int moduleAddData(ModuleData **md, char *key, char *value); /* Set the value for this key for this struct */ +MDE void moduleDelData(ModuleData **md, char *key); /* Delete this key/value pair */ +MDE void moduleDelAllData(ModuleData **md); /* Delete all key/value pairs for this module for this struct */ +MDE void moduleCleanStruct(ModuleData **moduleData); /* Clean a moduleData hash */ void moduleDelAllDataMod(Module *m); /* remove all module data from all structs for this module */ int moduleDataDebug(ModuleData **md); /* Allow for debug output of a moduleData struct */ -boolean moduleMinVersion(int major,int minor,int patch,int build); /* Checks if the current version of anope is before or after a given verison */ +MDE boolean moduleMinVersion(int major,int minor,int patch,int build); /* Checks if the current version of anope is before or after a given verison */ /*************************************************************************/ diff --git a/include/resource.h b/include/resource.h new file mode 100644 index 000000000..2f3b54bfc --- /dev/null +++ b/include/resource.h @@ -0,0 +1,20 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by Win32GUI.rc +// +#define VER_ANOPE 1 +#define MANIFEST_RESOURCE_ID 2 +#define ICON_APP 129 + + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 152 +#define _APS_NEXT_COMMAND_VALUE 40061 +#define _APS_NEXT_CONTROL_VALUE 1167 +#define _APS_NEXT_SYMED_VALUE 104 +#endif +#endif diff --git a/include/services.h b/include/services.h index 4523e2e34..730c04f3d 100644 --- a/include/services.h +++ b/include/services.h @@ -37,24 +37,60 @@ #include #include #include + +/* Windows does not have: + * unistd.h, grp.h, + * netdb.h, netinet/in.h, + * sys/socket.h, sys/time.h + * Windows requires: + * winsock.h + * -- codemastr + */ + +#ifndef _WIN32 #include +#endif + #include #include #include + +#ifndef _WIN32 #include +#endif + #include + +#ifndef _WIN32 #include #include #include #include +#else +#include +#include +#endif + #include /* for umask() on some systems */ #include + +#ifndef _WIN32 #include +#endif + +#ifdef _WIN32 +#include +#include +#include +#endif + #include +#ifndef _WIN32 #ifdef HAVE_BACKTRACE #include #endif +#endif #ifdef USE_RDB # define MAX_SQL_BUF 4096 @@ -81,9 +117,14 @@ #endif #ifdef USE_THREADS -# include + #ifndef _WIN32 + #include + #endif +#include "threads.h" #endif +#include "sockets.h" + #ifdef _AIX /* Some AIX boxes seem to have bogus includes that don't have these * prototypes. */ @@ -119,6 +160,14 @@ extern int toupper(char), tolower(char); #define encrypt encrypt_ +#ifdef __WINS__ +#ifndef BKCHECK +#define BKCHECK + extern "C" void __pfnBkCheck() {} +#endif +#endif + + #if INTTYPE_WORKAROUND # undef int16 # undef int32 @@ -162,7 +211,20 @@ typedef struct uid_ Uid; /*************************************************************************/ +/* Windows defines a boolean type as an + * unsigned char. It does however need + * true/false. -- codemastr + */ +#ifndef _WIN32 typedef enum { false, true } boolean; +#else + #ifndef true + #define true 1 + #endif + #ifndef false + #define false 0 + #endif +#endif /* _WIN32 */ /*************************************************************************/ @@ -263,6 +325,7 @@ struct ircdvars_ { int invitemode; /* +I */ int sjoinbanchar; /* use single quotes to define it */ int sjoinexchar; /* use single quotes to define it */ + int sjoininvchar; /* use single quotes to define it */ int svsmode_ucmode; /* Can remove User Channel Modes with SVSMODE */ int sglineenforce; char *vhostchar; /* char used for vhosting */ diff --git a/include/sockets.h b/include/sockets.h new file mode 100644 index 000000000..e5ae27c58 --- /dev/null +++ b/include/sockets.h @@ -0,0 +1,47 @@ +/* + * + * (C) 2004 Anope Team + * Contact us at info@anope.org + * + * Please read COPYING and README for furhter details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * + */ + +#ifndef SOCKETS_H +#define SOCKETS_H + +#ifdef _WIN32 +typedef SOCKET ano_socket_t; +#define ano_sockread(fd, buf, len) recv(fd, buf, len, 0) +#define ano_sockwrite(fd, buf, len) send(fd, buf, len, 0) +#define ano_sockclose(fd) closesocket(fd) +#define ano_sockgeterr() WSAGetLastError() +#define ano_sockseterr(err) WSASetLastError(err) +/* ano_sockstrerror in sockutil.c */ +/* ano_socksetnonb in sockutil.c */ +#define ano_sockerrnonb(err) (err == WSAEINPROGRESS || err == WSAEWOULDBLOCK) +#define SOCKERR_EBADF WSAENOTSOCK +#define SOCKERR_EINTR WSAEINTR +#define SOCKERR_EINVAL WSAEINVAL +#define SOCKERR_EINPROGRESS WSAEINPROGRESS +#else +typedef int ano_socket_t; +#define ano_sockread(fd, buf, len) read(fd, buf, len) +#define ano_sockwrite(fd, buf, len) write(fd, buf, len) +#define ano_sockclose(fd) close(fd) +#define ano_sockgeterr() errno +#define ano_sockseterr(err) errno = err +#define ano_sockstrerror(err) strerror(err) +#define ano_socksetnonb(fd) fcntl(fd, F_SETFL, O_NONBLOCK) +#define ano_sockerrnonb(err) (err == EINPROGRESS) +#define SOCKERR_EBADF EBADF +#define SOCKERR_EINTR EINTR +#define SOCKERR_EINVAL EINVAL +#define SOCKERR_EINPROGRESS EINPROGRESS +#endif + +#endif diff --git a/include/sysconf.h.win32 b/include/sysconf.h.win32 new file mode 100644 index 000000000..e408f463f --- /dev/null +++ b/include/sysconf.h.win32 @@ -0,0 +1,51 @@ + +#define SERVICES_DIR "data" +#define SERVICES_BIN "services.exe" + +typedef signed __int16 int16; +typedef signed __int16 int16_t; +typedef unsigned __int16 uint16; +typedef unsigned __int16 u_int16_t; +typedef signed __int32 int32; +typedef signed __int32 int32_t; +typedef unsigned __int32 uint32; +typedef unsigned __int32 u_int32_t; +typedef unsigned __int8 u_int8_t; + +#define HAVE_STRINGS_H 0 +#define HAVE_SYS_SELECT_H 0 +#define HAVE_SYS_SYSPROTO_H 0 + +#define HAVE_STRERROR 1 +#define HAVE_SYS_ERRLIST 0 +#define HAVE_SNPRINTF 1 +#define BAD_SNPRINTF 0 +#define HAVE_STRICMP 1 +#define HAVE_STRCASECMP 0 +#define HAVE_STRDUP 1 +#define HAVE_STRSPN 1 +#define HAVE_STRSIGNAL 0 +#define HAVE_GETTIMEOFDAY 0 +#define HAVE_SETGRENT 0 +#define HAVE_UMASK 0 +#define HAVE_FORK 0 +#define HAVE_GETHOSTBYNAME 1 +#define HAVE_BACKTRACE 0 + +/* Enable Module support */ +#define USE_MODULES +#define MODULE_PATH ".\\modules\\" + +/* Windows/MSVC likes to name things differently */ +#define snprintf _snprintf +#define vsnprintf _vsnprintf +#define popen _popen +#define pclose _pclose +#define ftruncate _chsize +#define PATH_MAX MAX_PATH +#define MAXPATHLEN MAX_PATH +#define bzero(buf, size) memset(buf, 0, size) +#define strcasecmp stricmp +#define sleep(x) Sleep(x*1000) + + diff --git a/include/threads.h b/include/threads.h new file mode 100644 index 000000000..90694a625 --- /dev/null +++ b/include/threads.h @@ -0,0 +1,67 @@ +/* + * + * (C) 2004 Anope Team + * Contact us at info@anope.org + * + * Please read COPYING and README for furhter details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * + */ + +#ifndef THREADS_H +#define THREADS_H + +#ifdef _WIN32 +typedef long ano_thread_t; +typedef HANDLE ano_mutex_t; +typedef HANDLE ano_cond_t; +typedef unsigned (__stdcall *ano_thread_start) (void *); +typedef struct +{ + ano_thread_start func; + void *arg; +} ano_cleanup_t; + +extern ano_thread_start __declspec(thread) cleanup_func; + +#define ano_thread_create(thread,start,arg) !_beginthreadex(NULL, 0, (ano_thread_start)start, arg, 0, &thread) +#define ano_thread_self() GetCurrentThreadId() +#define ano_thread_detach(thread) 0 +#define ano_mutex_lock(mutex) WaitForSingleObject(mutex, INFINITE) +#define ano_mutex_unlock(mutex) ReleaseMutex(mutex) + +/* ano_cond_wait is in compat.c */ +#define ano_cond_signal(cond) SetEvent(cond) + +/* very minimalistic implementation */ +#define ano_cleanup_push(func, arg) cleanup_func = (ano_thread_start)func +#define ano_cleanup_pop(execute) cleanup_func(NULL) + +#else + +typedef pthread_t ano_thread_t; +typedef pthread_mutex_t ano_mutex_t; +typedef pthread_cond_t ano_cond_t; +typedef void *(*ano_thread_start) (void *); + +#define ano_thread_create(thread,start,arg) pthread_create(&thread, NULL, start, arg) +#define ano_thread_self() pthread_self() +#define ano_thread_detach(thread) pthread_detach(thread) + +#define ano_mutex_lock(mutex) pthread_mutex_lock(&mutex) +#define ano_mutex_unlock(mutex) pthread_mutex_unlock(&mutex) + +#define ano_cond_wait(cond, mutex) pthread_cond_wait(&cond, &mutex) +#define ano_cond_signal(cond) pthread_cond_signal(&cond) + +#define ano_cleanup_push(func, arg) pthread_cleanup_push(func, arg) +#define ano_cleanup_pop(execute) pthread_cleanup_pop(execute) + +#define ano_thread_cancel(thread) pthread_cancel(thread) + +#endif + +#endif diff --git a/include/version.sh.c b/include/version.sh.c new file mode 100644 index 000000000..0332fddfe --- /dev/null +++ b/include/version.sh.c @@ -0,0 +1,215 @@ +/* version file handler for win32. + * + * (C) 2003 Anope Team + * Contact us at info@anope.org + * + * Please read COPYING and README for furhter details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * Written by Dominick Meglio + * + */ + +/* Needed due to Windows lack of a decent interpreter */ + +#include +#include + +#define CTRL "version.log" + +long version_major, version_minor, version_patch, version_build, build; +char *version_extra; +char version[1024]; + + +void load_ctrl(FILE *); +long get_value(char *); +char *get_value_str(char *); +char *strip(char *); +void parse_version(FILE *); +void write_version(FILE *); +void parse_line(FILE *, char *); + +int main() +{ + FILE *fd = fopen(CTRL, "r"); + + + if (!fd) { + fprintf(stderr, "Error: Unable to find control file: " CTRL "\n"); + exit(0); + } + + load_ctrl(fd); + fclose(fd); + + _snprintf(version, 1024, "%d.%d.%d%s", version_major, version_minor, + version_patch, version_extra ? version_extra : ""); + + + fd = fopen("version.h", "r"); + + if (fd) { + parse_version(fd); + fclose(fd); + } else + build = 1; + + + fd = fopen("version.h", "w"); + write_version(fd); + fclose(fd); +} + +void load_ctrl(FILE * fd) +{ + char buf[512]; + while (fgets(buf, 511, fd)) { + char *var; + + strip(buf); + + var = strtok(buf, "="); + if (!var) + continue; + if (!strcmp(var, "VERSION_MAJOR")) + version_major = get_value(strtok(NULL, "")); + else if (!strcmp(var, "VERSION_MINOR")) + version_minor = get_value(strtok(NULL, "")); + else if (!strcmp(var, "VERSION_PATCH")) + version_patch = get_value(strtok(NULL, "")); + else if (!strcmp(var, "VERSION_BUILD")) + version_build = get_value(strtok(NULL, "")); + else if (!strcmp(var, "VERSION_EXTRA")) + version_extra = get_value_str(strtok(NULL, "")); + + } +} + +char *strip(char *str) +{ + char *c; + if ((c = strchr(str, '\n'))) + *c = 0; + if ((c = strchr(str, '\r'))) + *c = 0; + return str; +} + +long get_value(char *string) +{ + return atol(get_value_str(string)); +} + +char *get_value_str(char *string) +{ + int len; + + if (*string == '"') + string++; + + len = strlen(string); + + if (string[len - 1] == '"') + string[len - 1] = 0; + if (!*string) + return NULL; + return string; +} + +void parse_version(FILE * fd) +{ + char buf[1024]; + + while (fgets(buf, 1023, fd)) { + char *para1; + + strip(buf); + para1 = strtok(buf, " \t"); + + if (!para1) + continue; + + if (!strcmp(para1, "#define")) { + char *para2 = strtok(NULL, " \t"); + + if (!para2) + continue; + + if (!strcmp(para2, "BUILD")) { + char *value = strtok(NULL, ""); + build = get_value(value); + build++; + return; + } + } + } + build = 1; +} + +void write_version(FILE * fd) +{ + FILE *fdin = fopen("include\\version.sh", "r"); + char buf[1024]; + short until_eof = 0; + + while (fgets(buf, 1023, fdin)) { + strip(buf); + + if (until_eof) + if (!strcmp(buf, "EOF")) + break; + else + parse_line(fd, buf); + + if (!strcmp(buf, "cat >version.h < + * + */ #include #include diff --git a/makefile.inc.win32 b/makefile.inc.win32 new file mode 100644 index 000000000..5c6e4717b --- /dev/null +++ b/makefile.inc.win32 @@ -0,0 +1,174 @@ +# +# Anope IRC Services 1.7.7 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 which IRCd to compile for +# 1 DreamForge 4.6.7 [dated IRCd, upgrade to a current one] +# 2 Bahamut 1.4.27 [or later] +# 3 UnrealIRCd 3.1.1 [or later] +# 4 UltimateIRCd 2.8.2 [or later] +# 5 UltimateIRCd 3.0.0 [alpha26 or later] +# 6 Hybrid IRCd 7.0 [experimental] +# 7 ViagraIRCd 1.3.x [or later] +# 8 PTlink 6.15.0 [experimental] +# 9 RageIRCd 2.0 [beta-3 or later] +# 10 Unreal 3.2 [Unreal 3.2 beta19 or later] (default) +# 11 Solid IRCD 3.4.x [Solid IRCD 3.4.6 or later] +# 12 Plexus 2.0 [or later] +# 13 Ratbox 2.0.6 [or later] + +IRCD=10 + + +# 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 the proxy scanner +PROXY_SCANNER=0 + +# If you want to change the names/locations of files/folders, you +# can do that here. +PROGRAM=anope.exe +BINDEST=bin +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. +#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= + +!IFNDEF IRCTYPE +!IF $(IRCD) == 1 +IRCTYPE=IRC_DREAMFORGE +CAPAB_C=dreamforge.c +CAPAB_O=dreamforge.obj +!ELSEIF $(IRCD) == 2 +IRCTYPE=/D IRC_BAHAMUT +CAPAB_C=bahamut.c +CAPAB_O=bahamut.obj +!ELSEIF $(IRCD) == 3 +IRCTYPE=/D IRC_UNREAL31 +CAPAB_C=unreal31.c +CAPAB_O=unreal31.obj +!ELSEIF $(IRCD) == 4 +IRCTYPE=/D IRC_ULTIMATE2 +CAPAB_C=ultimate2.c +CAPAB_O=ultimate2.obj +!ELSEIF $(IRCD) == 5 +IRCTYPE=/D IRC_ULTIMATE33 +CAPAB_C=ultimate3.c +CAPAB_O=ultimate3.obj +!ELSEIF $(IRCD) == 6 +IRCTYPE=/D IRC_HYBRID +CAPAB_C=hybrid.c +CAPAB_O=hybrid.obj +!ELSEIF $(IRCD) == 7 +IRCTYPE=/D IRC_VIAGRA +CAPAB_C=hybrid.c +CAPAB_O=hybrid.obj +!ELSEIF $(IRCD) == 8 +IRCTYPE=/D IRC_PTLINK +CAPAB_C=ptlink.c +CAPAB_O=ptlink.obj +!ELSEIF $(IRCD) == 9 +IRCTYPE=/D IRC_RAGE2 +CAPAB_C=rageircd.c +CAPAB_O=rageircd.obj +!ELSEIF $(IRCD) == 10 +IRCTYPE=/D IRC_UNREAL32 +CAPAB_C=unreal32.c +CAPAB_O=unreal32.obj +!ELSEIF $(IRCD) == 11 +IRCTYPE=/D IRC_SOLID +CAPAB_C=solidircd.c +CAPAB_O=solidircd.obj +!ELSEIF $(IRCD) == 12 +IRCTYPE=/D IRC_PLEXUS +CAPAB_C=plexus.c +CAPAB_O=plexus.obj +!ELSEIF $(IRCD) == 13 +IRCTYPE=/D IRC_RATBOX +CAPAB_C=ratbox.c +CAPAB_O=ratbox.obj +!ELSE +!ERROR Invalid IRCd +!ENDIF +!ENDIF + +!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 +RDB_C=rdb.c +RDB_O=rdb.obj + +MYSQL_C=mysql.c +MYSQL_O=mysql.obj +BASE_CFLAGS=/D USE_MYSQL /D USE_RDB $(BASE_CFLAGS) /D HAVE_MYSQL_MYSQL_H + +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 $(PROXY_SCANNER) == 1 +BASE_CFLAGS=/D USE_THREADS $(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) +# -DSTREAMLINED Leave out "fancy" options to enhance 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) diff --git a/makefile.win32 b/makefile.win32 new file mode 100644 index 000000000..457297e37 --- /dev/null +++ b/makefile.win32 @@ -0,0 +1,156 @@ +# Makefile for Epona. +# +# Epona (c) 2000-2002 PegSoft +# Contact us at epona@pegsoft.net +# +# This program is free but copyrighted software; see the file COPYING for +# details. +# +# Based on the original code of Services by Andy Church. + +include Makefile.inc.win32 + +########################################################################### + +all: src languages anopesmtp modules install + +src: include\version.h include\sysconf.h include\language.h include\sysconf.h + cd src && $(MAKE) && cd .. + +install: + -@mkdir $(DATDEST)\backups + -@mkdir $(DATDEST)\logs + -@mkdir $(DATDEST)\languages + cd lang && $(MAKE) install && cd .. + cd src && $(MAKE) install && cd .. + cd src\modules && $(MAKE) install && cd .. + -@echo --- + -@echo Anope has been insalled successfully! + -@echo --- + +clean: + cd src && $(MAKE) spotless && cd .. + cd lang && $(MAKE) spotless && cd .. + -@erase src\*.exe + -@erase *.exe version.h *.obj + cd src/modules && $(MAKE) spotless && cd ../.. + +spotless: + cd lang && $(MAKE) spotless && cd .. + cd src && $(MAKE) spotless && cd .. + cd src/modules && $(MAKE) spotless && cd ../.. + -@erase include\language.h include\version.h *~ services.exe version.sh.exe *.obj anopesmtp.exe + +mypasql: + $(MYPASQL_BUILD) + +distclean: spotless + +dist: + $(MAKE) clean +#Compile dreamforge + echo Compiling Dreamforge build + $(MAKE) IRCTYPE=/DIRC_DREAMFORGE CAPAB_C=dreamforge.c CAPAB_O=dreamforge.obj + -@copy src\$(PROGRAM) services-dreamforge.exe + $(MAKE) clean +#Compile bahamut + echo Compiling Bahamut build + $(MAKE) IRCTYPE=/DIRC_BAHAMUT CAPAB_C=bahamut.c CAPAB_O=bahamut.obj + -@copy src\$(PROGRAM) services-bahamut.exe + $(MAKE) clean +#Compile unreal + echo Compiling UnrealIRCd3.1 build + $(MAKE) IRCTYPE=/DIRC_UNREAL31 CAPAB_C=unreal31.c CAPAB_O=unreal31.obj + -@copy src\$(PROGRAM) services-unreal31.exe + $(MAKE) clean +#Compile ultimate2 + echo Compiling UltimateIRCd2 build + $(MAKE) IRCTYPE=/DIRC_ULTIMATE2 CAPAB_C=ultimate2.c CAPAB_O=ultimate2.obj + -@copy src\$(PROGRAM) services-ultimate2.exe + $(MAKE) clean +#Compile ultimate3 + echo Compiling UltimateIRCd 3.x build + $(MAKE) IRCTYPE=/DIRC_ULTIMATE3 CAPAB_C=ultimate3.c CAPAB_O=ultimate3.obj + -@copy src\$(PROGRAM) services-ultimate3.exe + $(MAKE) clean +#Compile hybrid + echo Compiling Hybrid build + $(MAKE) IRCTYPE=/DIRC_HYBRID CAPAB_C=hybrid.c CAPAB_O=hybrid.obj + -@copy src\$(PROGRAM) services-hybrid.exe + $(MAKE) clean +#Compile viagra + echo Compiling ViagraIRCd build + $(MAKE) IRCTYPE=/DIRC_VIAGRA CAPAB_C=viagra.c CAPAB_O=viagra.obj + -@copy src\$(PROGRAM) services-viagra.exe + $(MAKE) clean +#Compile ptlink + echo Compiling PTLink IRCd build + $(MAKE) IRCTYPE=/DIRC_PTLINK CAPAB_C=ptlink.c CAPAB_O=ptlink.obj + -@copy src\$(PROGRAM) services-ptlink.exe + $(MAKE) clean +#Compile rage2 + echo Compiling Rage2 IRCd build + $(MAKE) IRCTYPE=/DIRC_RAGE2 CAPAB_C=rageircd.c CAPAB_O=rageircd.obj + -@copy src\$(PROGRAM) services-rage2.exe + $(MAKE) clean +#Compile UnrealIRCD3.2 + echo Compiling UnrealIRCD3.2 IRCd build + $(MAKE) IRCTYPE=/DIRC_UNREAL32 CAPAB_C=unreal32.c CAPAB_O=unreal32.obj + -@copy src\$(PROGRAM) services-unreal32.exe + $(MAKE) clean +#Compile SolidIRCD + echo Compiling SolidIRCD IRCd build + $(MAKE) IRCTYPE=/DIRC_SOLID CAPAB_C=solidircd.c CAPAB_O=solidircd.obj + -@copy src\$(PROGRAM) services-solid.exe + $(MAKE) clean +#Compile PlexusIRCD + echo Compiling Plexus IRCd build + $(MAKE) IRCTYPE=/DIRC_PLEXUS CAPAB_C=plexus.c CAPAB_O=plexus.obj + -@copy src\$(PROGRAM) services-plexus.exe + $(MAKE) clean +#Compile Ratbox + echo Compiling Ratbox IRCd build + $(MAKE) IRCTYPE=/DIRC_RATBOX CAPAB_C=ratbox.c CAPAB_O=ratbox.obj + -@copy src\$(PROGRAM) services-ratbox.exe + +#Compile mypasql + $(MYPASQL_BUILD) + +#Cleanup + $(MAKE) spotless + + +########################################################################### + + +languages: FRC + cd lang && $(MAKE) && cd .. + +anopesmtp: FRC + $(CC) src/tools/anopesmtp.c /link wsock32.lib $(LFLAGS) + +modules: FRC + cd src\modules && $(MAKE) && cd ..\.. + +########################################################################### + +include\sysconf.h: + copy include\sysconf.h.win32 include\sysconf.h + +lang/language.h: lang/Makefile lang/index + cd lang && $(MAKE) language.h && cd .. + +lang/index: + cd lang && $(MAKE) index && cd .. + +include/language.h: lang/language.h + cd lang && copy language.h ..\include\language.h && cd .. + +include\version.h: version.sh.exe version.log include\services.h include\pseudo.h include\messages.h include\pseudo.h include\messages.h + version.sh.exe + copy version.h include\version.h + +version.sh.exe: + $(CC) include/version.sh.c + +FRC: diff --git a/src/anope-icon.ico b/src/anope-icon.ico new file mode 100644 index 000000000..b60a7994c Binary files /dev/null and b/src/anope-icon.ico differ diff --git a/src/bahamut.c b/src/bahamut.c index 5e40a7266..36bd28f6d 100644 --- a/src/bahamut.c +++ b/src/bahamut.c @@ -102,6 +102,7 @@ IRCDVar ircd[] = { 1, /* +I support */ 0, /* SJOIN ban char */ 0, /* SJOIN except char */ + 0, /* SJOIN invite char */ 0, /* Can remove User Channel Modes with SVSMODE */ 0, /* Sglines are not enforced until user reconnects */ NULL, /* vhost char */ @@ -856,6 +857,9 @@ void anope_cmd_pong(char *servname, char *who) void anope_cmd_connect(int servernum) { + me_server = + new_server(NULL, ServerName, ServerDesc, SERVER_ISME, NULL); + if (servernum == 1) { anope_cmd_pass(RemotePassword); } else if (servernum == 2) { diff --git a/src/base64.c b/src/base64.c index 68fa80b96..0056822bc 100644 --- a/src/base64.c +++ b/src/base64.c @@ -1,6 +1,6 @@ /* base64 routines. * - * (C) 2003-1005 Anope Team + * (C) 2003-2005 Anope Team * Contact us at info@anope.org * * Please read COPYING and README for further details. diff --git a/src/channels.c b/src/channels.c index 78bdbb045..b9ab710ac 100644 --- a/src/channels.c +++ b/src/channels.c @@ -777,14 +777,14 @@ void do_sjoin(const char *source, int ac, char **av) } } - /* Unreal plans to add +I - for now add the hook to allow - 1.7.6 to work with it and not cause problems - TSL */ - if (*s == '\'') { - add_invite(c, myStrGetToken(s, '\'', 1)); - if (!end) - break; - s = end + 1; - continue; + if (ircd->sjoininvchar) { + if (*s == ircd->sjoininvchar) { + add_invite(c, myStrGetToken(s, ircd->sjoininvchar, 1)); + if (!end) + break; + s = end + 1; + continue; + } } while (csmodes[(int) *s] != 0) diff --git a/src/chanserv.c b/src/chanserv.c index affa29519..ce8863133 100644 --- a/src/chanserv.c +++ b/src/chanserv.c @@ -2925,6 +2925,10 @@ static int do_drop(User * u) } } + if (ircd->chansqline && (ci->flags & CI_VERBOTEN)) { + anope_cmd_unsqline(ci->name); + } + alog("%s: Channel %s dropped by %s!%s@%s (founder: %s)", s_ChanServ, ci->name, u->nick, u->username, common_get_vhost(u), @@ -6360,6 +6364,10 @@ static int do_forbid(User * u) "\2%s\2 used FORBID on channel \2%s\2", u->nick, ci->name); + if (ircd->chansqline) { + anope_cmd_sqline(ci->name, ((reason) ? reason : "Forbidden")); + } + alog("%s: %s set FORBID for channel %s", s_ChanServ, u->nick, ci->name); notice_lang(s_ChanServ, u, CHAN_FORBID_SUCCEEDED, chan); diff --git a/src/compat.c b/src/compat.c index 9db98fc0f..b9931ced9 100644 --- a/src/compat.c +++ b/src/compat.c @@ -136,19 +136,27 @@ char *strerror(int errnum) /*************************************************************************/ #if !HAVE_STRSIGNAL +/* Windows only supports 6 signals: + * SIGINT, SIGILL, SIGABRT, SIGFPE, SIGSEGV, SIGTERM + * -- codemastr + */ char *strsignal(int signum) { static char buf[32]; switch (signum) { +#ifndef _WIN32 case SIGHUP: strscpy(buf, "Hangup", sizeof(buf)); break; +#endif case SIGINT: strscpy(buf, "Interrupt", sizeof(buf)); break; +#ifndef _WIN32 case SIGQUIT: strscpy(buf, "Quit", sizeof(buf)); break; +#endif #ifdef SIGILL case SIGILL: strscpy(buf, "Illegal instruction", sizeof(buf)); @@ -172,15 +180,18 @@ char *strsignal(int signum) case SIGFPE: strscpy(buf, "Floating point exception", sizeof(buf)); break; +#ifndef _WIN32 case SIGKILL: strscpy(buf, "Killed", sizeof(buf)); break; case SIGUSR1: strscpy(buf, "User signal 1", sizeof(buf)); break; +#endif case SIGSEGV: strscpy(buf, "Segmentation fault", sizeof(buf)); break; +#ifndef _WIN32 case SIGUSR2: strscpy(buf, "User signal 2", sizeof(buf)); break; @@ -190,9 +201,11 @@ char *strsignal(int signum) case SIGALRM: strscpy(buf, "Alarm clock", sizeof(buf)); break; +#endif case SIGTERM: strscpy(buf, "Terminated", sizeof(buf)); break; +#ifndef _WIN32 case SIGSTOP: st