diff --git a/Csocket.h b/Csocket.h index 8c8e4c94..4a5ce147 100644 --- a/Csocket.h +++ b/Csocket.h @@ -85,7 +85,7 @@ #include #include -#include "main.h" // require this as a general rule, most projects have a defines.h or the like +#include "defines.h" // require this as a general rule, most projects have a defines.h or the like #ifndef CS_STRING # ifdef _HAS_CSTRING_ @@ -103,11 +103,13 @@ #endif /* __DEBUG__ */ #endif /* CS_DEBUG */ +#ifndef PERROR #ifdef __DEBUG__ # define PERROR( f ) __Perror( f, __FILE__, __LINE__ ) #else # define PERROR( f ) (void)0 #endif /* __DEBUG__ */ +#endif #ifndef _NO_CSOCKET_NS // some people may not want to use a namespace namespace Csocket diff --git a/defines.h b/defines.h new file mode 100644 index 00000000..5f072e02 --- /dev/null +++ b/defines.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2004-2009 See the AUTHORS file for details. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#ifndef _DEFINES_H +#define _DEFINES_H + +// This header file is just for Csocket + +#include "main.h" +#include "Utils.h" + +#define CS_STRING CString +#define _NO_CSOCKET_NS + +#ifdef _DEBUG +#define __DEBUG__ +#endif + +// Redefine some Csocket debugging mechanisms to use znc's +#define CS_DEBUG(f) DEBUG(__FILE__ << ":" << __LINE__ << " " << f) +#define PERROR(f) DEBUG(__FILE__ << ":" << __LINE__ << " " << f << ": " << strerror(GetSockError())) + + +#endif // !_DEFINES_H diff --git a/main.h b/main.h index 6e1f4df7..4f1ea157 100644 --- a/main.h +++ b/main.h @@ -53,24 +53,9 @@ #define MODULECALL(macFUNC, macUSER, macCLIENT, macEXITER) #endif - -#ifndef CS_STRING -#define CS_STRING CString -#endif - -#ifndef _NO_CSOCKET_NS -#define _NO_CSOCKET_NS -#endif - -#ifdef _DEBUG -#define __DEBUG__ -#endif - #include using std::cout; using std::cerr; using std::endl; -#include "ZNCString.h" - #endif // !_MAIN_H