Core/Misc: Prefix all preprocessor defines from CompilerDefs with TRINITY_ to avoid conflicts (PLATFORM_WINDOWS is used/defined by CascLib)
(cherry picked from commit b8db320bf14e327bcd12279871b914d8635ef122)
This commit is contained in:
1 parent
496bb4b105
commit
d8b9d2a9da
17 files changed
+65
-67
No files matched your search
+4
-4
@@ -53,14 +53,14 @@
|
||||
|
||||
#include "Threading/LockedQueue.h"
|
||||
|
||||
#if PLATFORM == PLATFORM_WINDOWS
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
# include <ws2tcpip.h>
|
||||
|
||||
# if defined(__INTEL_COMPILER)
|
||||
# if TRINITY_COMPILER == TRINITY_COMPILER_INTEL
|
||||
# if !defined(BOOST_ASIO_HAS_MOVE)
|
||||
# define BOOST_ASIO_HAS_MOVE
|
||||
# endif // !defined(BOOST_ASIO_HAS_MOVE)
|
||||
# endif // if defined(__INTEL_COMPILER)
|
||||
# endif // if TRINITY_COMPILER == TRINITY_COMPILER_INTEL
|
||||
|
||||
#else
|
||||
# include <sys/types.h>
|
||||
@@ -71,7 +71,7 @@
|
||||
# include <netdb.h>
|
||||
#endif
|
||||
|
||||
#if COMPILER == COMPILER_MICROSOFT
|
||||
#if TRINITY_COMPILER == TRINITY_COMPILER_MICROSOFT
|
||||
|
||||
#include <float.h>
|
||||
|
||||
|
||||
+17
-17
@@ -19,37 +19,37 @@
|
||||
#ifndef TRINITY_COMPILERDEFS_H
|
||||
#define TRINITY_COMPILERDEFS_H
|
||||
|
||||
#define PLATFORM_WINDOWS 0
|
||||
#define PLATFORM_UNIX 1
|
||||
#define PLATFORM_APPLE 2
|
||||
#define PLATFORM_INTEL 3
|
||||
#define TRINITY_PLATFORM_WINDOWS 0
|
||||
#define TRINITY_PLATFORM_UNIX 1
|
||||
#define TRINITY_PLATFORM_APPLE 2
|
||||
#define TRINITY_PLATFORM_INTEL 3
|
||||
|
||||
// must be first (win 64 also define _WIN32)
|
||||
#if defined( _WIN64 )
|
||||
# define PLATFORM PLATFORM_WINDOWS
|
||||
# define TRINITY_PLATFORM TRINITY_PLATFORM_WINDOWS
|
||||
#elif defined( __WIN32__ ) || defined( WIN32 ) || defined( _WIN32 )
|
||||
# define PLATFORM PLATFORM_WINDOWS
|
||||
# define TRINITY_PLATFORM TRINITY_PLATFORM_WINDOWS
|
||||
#elif defined( __APPLE_CC__ )
|
||||
# define PLATFORM PLATFORM_APPLE
|
||||
# define TRINITY_PLATFORM TRINITY_PLATFORM_APPLE
|
||||
#elif defined( __INTEL_COMPILER )
|
||||
# define PLATFORM PLATFORM_INTEL
|
||||
# define TRINITY_PLATFORM TRINITY_PLATFORM_INTEL
|
||||
#else
|
||||
# define PLATFORM PLATFORM_UNIX
|
||||
# define TRINITY_PLATFORM TRINITY_PLATFORM_UNIX
|
||||
#endif
|
||||
|
||||
#define COMPILER_MICROSOFT 0
|
||||
#define COMPILER_GNU 1
|
||||
#define COMPILER_BORLAND 2
|
||||
#define COMPILER_INTEL 3
|
||||
#define TRINITY_COMPILER_MICROSOFT 0
|
||||
#define TRINITY_COMPILER_GNU 1
|
||||
#define TRINITY_COMPILER_BORLAND 2
|
||||
#define TRINITY_COMPILER_INTEL 3
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# define COMPILER COMPILER_MICROSOFT
|
||||
# define TRINITY_COMPILER TRINITY_COMPILER_MICROSOFT
|
||||
#elif defined( __BORLANDC__ )
|
||||
# define COMPILER COMPILER_BORLAND
|
||||
# define TRINITY_COMPILER TRINITY_COMPILER_BORLAND
|
||||
#elif defined( __INTEL_COMPILER )
|
||||
# define COMPILER COMPILER_INTEL
|
||||
# define TRINITY_COMPILER TRINITY_COMPILER_INTEL
|
||||
#elif defined( __GNUC__ )
|
||||
# define COMPILER COMPILER_GNU
|
||||
# define TRINITY_COMPILER TRINITY_COMPILER_GNU
|
||||
# define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
|
||||
#else
|
||||
# error "FATAL ERROR: Unknown compiler."
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Trinity
|
||||
|
||||
} // namespace Trinity
|
||||
|
||||
#if COMPILER == COMPILER_MICROSOFT
|
||||
#if TRINITY_COMPILER == TRINITY_COMPILER_MICROSOFT
|
||||
#define ASSERT_BEGIN __pragma(warning(push)) __pragma(warning(disable: 4127))
|
||||
#define ASSERT_END __pragma(warning(pop))
|
||||
#else
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
//==========================================
|
||||
#include "CompilerDefs.h"
|
||||
|
||||
#if PLATFORM == PLATFORM_WINDOWS && !defined(__MINGW32__)
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS && !defined(__MINGW32__)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#pragma warning(disable:4996)
|
||||
#pragma warning(disable:4312)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef _WHEATYEXCEPTIONREPORT_
|
||||
#define _WHEATYEXCEPTIONREPORT_
|
||||
|
||||
#if PLATFORM == PLATFORM_WINDOWS && !defined(__MINGW32__)
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS && !defined(__MINGW32__)
|
||||
|
||||
#include <winnt.h>
|
||||
#include <winternl.h>
|
||||
|
||||
+9
-9
@@ -21,7 +21,7 @@
|
||||
|
||||
#include "CompilerDefs.h"
|
||||
|
||||
#if COMPILER == COMPILER_GNU
|
||||
#if TRINITY_COMPILER == TRINITY_COMPILER_GNU
|
||||
# if !defined(__STDC_FORMAT_MACROS)
|
||||
# define __STDC_FORMAT_MACROS
|
||||
# endif
|
||||
@@ -55,7 +55,7 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if PLATFORM == PLATFORM_WINDOWS
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
# define TRINITY_PATH_MAX MAX_PATH
|
||||
# define _USE_MATH_DEFINES
|
||||
# ifndef DECLSPEC_NORETURN
|
||||
@@ -64,11 +64,11 @@
|
||||
# ifndef DECLSPEC_DEPRECATED
|
||||
# define DECLSPEC_DEPRECATED __declspec(deprecated)
|
||||
# endif //DECLSPEC_DEPRECATED
|
||||
#else //PLATFORM != PLATFORM_WINDOWS
|
||||
#else // TRINITY_PLATFORM != TRINITY_PLATFORM_WINDOWS
|
||||
# define TRINITY_PATH_MAX PATH_MAX
|
||||
# define DECLSPEC_NORETURN
|
||||
# define DECLSPEC_DEPRECATED
|
||||
#endif //PLATFORM
|
||||
#endif // TRINITY_PLATFORM
|
||||
|
||||
#if !defined(COREDEBUG)
|
||||
# define TRINITY_INLINE inline
|
||||
@@ -79,21 +79,21 @@
|
||||
# define TRINITY_INLINE
|
||||
#endif //!COREDEBUG
|
||||
|
||||
#if COMPILER == COMPILER_GNU
|
||||
#if TRINITY_COMPILER == TRINITY_COMPILER_GNU
|
||||
# define ATTR_NORETURN __attribute__((__noreturn__))
|
||||
# define ATTR_PRINTF(F, V) __attribute__ ((__format__ (__printf__, F, V)))
|
||||
# define ATTR_DEPRECATED __attribute__((__deprecated__))
|
||||
#else //COMPILER != COMPILER_GNU
|
||||
#else //TRINITY_COMPILER != TRINITY_COMPILER_GNU
|
||||
# define ATTR_NORETURN
|
||||
# define ATTR_PRINTF(F, V)
|
||||
# define ATTR_DEPRECATED
|
||||
#endif //COMPILER == COMPILER_GNU
|
||||
#endif //TRINITY_COMPILER == TRINITY_COMPILER_GNU
|
||||
|
||||
#ifdef TRINITY_API_USE_DYNAMIC_LINKING
|
||||
# if COMPILER == COMPILER_MICROSOFT
|
||||
# if TRINITY_COMPILER == TRINITY_COMPILER_MICROSOFT
|
||||
# define TC_API_EXPORT __declspec(dllexport)
|
||||
# define TC_API_IMPORT __declspec(dllimport)
|
||||
# elif COMPILER == COMPILER_GNU
|
||||
# elif TRINITY_COMPILER == TRINITY_COMPILER_GNU
|
||||
# define TC_API_EXPORT __attribute__((visibility("default")))
|
||||
# define TC_API_IMPORT
|
||||
# else
|
||||
|
||||
@@ -41,17 +41,17 @@ char const* GitRevision::GetFullDatabase()
|
||||
return _FULL_DATABASE;
|
||||
}
|
||||
|
||||
#if PLATFORM == PLATFORM_WINDOWS
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
# ifdef _WIN64
|
||||
# define TRINITY_PLATFORM_STR "Win64"
|
||||
# else
|
||||
# define TRINITY_PLATFORM_STR "Win32"
|
||||
# endif
|
||||
#elif PLATFORM == PLATFORM_APPLE
|
||||
#elif TRINITY_PLATFORM == TRINITY_PLATFORM_APPLE
|
||||
# define TRINITY_PLATFORM_STR "MacOSX"
|
||||
#elif PLATFORM == PLATFORM_INTEL
|
||||
#elif TRINITY_PLATFORM == TRINITY_PLATFORM_INTEL
|
||||
# define TRINITY_PLATFORM_STR "Intel"
|
||||
#else // PLATFORM_UNIX
|
||||
#else // TRINITY_PLATFORM_UNIX
|
||||
# define TRINITY_PLATFORM_STR "Unix"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "Config.h"
|
||||
#include "Util.h"
|
||||
|
||||
#if PLATFORM == PLATFORM_WINDOWS
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
@@ -66,7 +66,7 @@ void AppenderConsole::InitColors(std::string const& str)
|
||||
|
||||
void AppenderConsole::SetColor(bool stdout_stream, ColorTypes color)
|
||||
{
|
||||
#if PLATFORM == PLATFORM_WINDOWS
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
static WORD WinColorFG[MaxColors] =
|
||||
{
|
||||
0, // BLACK
|
||||
@@ -153,7 +153,7 @@ void AppenderConsole::SetColor(bool stdout_stream, ColorTypes color)
|
||||
|
||||
void AppenderConsole::ResetColor(bool stdout_stream)
|
||||
{
|
||||
#if PLATFORM == PLATFORM_WINDOWS
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
HANDLE hConsole = GetStdHandle(stdout_stream ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE);
|
||||
SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
|
||||
#else
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "StringFormat.h"
|
||||
#include "Log.h"
|
||||
|
||||
#if PLATFORM == PLATFORM_WINDOWS
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
# include <Windows.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ inline bool Log::ShouldLog(std::string const& type, LogLevel level) const
|
||||
} \
|
||||
}
|
||||
|
||||
#if PLATFORM != PLATFORM_WINDOWS
|
||||
#if TRINITY_PLATFORM != TRINITY_PLATFORM_WINDOWS
|
||||
void check_args(const char*, ...) ATTR_PRINTF(1, 2);
|
||||
void check_args(std::string const&, ...);
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ public:
|
||||
|
||||
#define sMetric Metric::instance()
|
||||
|
||||
#if PLATFORM != PLATFORM_WINDOWS
|
||||
#if TRINITY_PLATFORM != TRINITY_PLATFORM_WINDOWS
|
||||
#define TC_METRIC_EVENT(category, title, description) \
|
||||
do { \
|
||||
if (sMetric->IsEnabled()) \
|
||||
|
||||
@@ -28,11 +28,6 @@
|
||||
|
||||
void SetProcessPriority(const std::string& logChannel)
|
||||
{
|
||||
// Suppresses Mac OS X Warning since logChannel isn't used.
|
||||
#if PLATFORM_APPLE
|
||||
(void)logChannel;
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) || defined(__linux__)
|
||||
|
||||
///- Handle affinity for multiple processors and process priority
|
||||
@@ -99,6 +94,9 @@ void SetProcessPriority(const std::string& logChannel)
|
||||
}
|
||||
|
||||
#endif
|
||||
#else
|
||||
// Suppresses unused argument warning for all other platforms
|
||||
(void)logChannel;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <stdarg.h>
|
||||
#include <boost/algorithm/string/case_conv.hpp>
|
||||
|
||||
#if COMPILER == COMPILER_GNU
|
||||
#if TRINITY_COMPILER == TRINITY_COMPILER_GNU
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
@@ -421,7 +421,7 @@ std::wstring GetMainPartOfName(std::wstring const& wname, uint32 declension)
|
||||
|
||||
bool utf8ToConsole(const std::string& utf8str, std::string& conStr)
|
||||
{
|
||||
#if PLATFORM == PLATFORM_WINDOWS
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
std::wstring wstr;
|
||||
if (!Utf8toWStr(utf8str, wstr))
|
||||
return false;
|
||||
@@ -438,7 +438,7 @@ bool utf8ToConsole(const std::string& utf8str, std::string& conStr)
|
||||
|
||||
bool consoleToUtf8(const std::string& conStr, std::string& utf8str)
|
||||
{
|
||||
#if PLATFORM == PLATFORM_WINDOWS
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
std::wstring wstr;
|
||||
wstr.resize(conStr.size());
|
||||
OemToCharBuffW(&conStr[0], &wstr[0], uint32(conStr.size()));
|
||||
@@ -477,7 +477,7 @@ void utf8printf(FILE* out, const char *str, ...)
|
||||
|
||||
void vutf8printf(FILE* out, const char *str, va_list* ap)
|
||||
{
|
||||
#if PLATFORM == PLATFORM_WINDOWS
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
char temp_buf[32 * 1024];
|
||||
wchar_t wtemp_buf[32 * 1024];
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace fs = boost::filesystem;
|
||||
# define _TRINITY_REALM_CONFIG "authserver.conf"
|
||||
#endif
|
||||
|
||||
#if PLATFORM == PLATFORM_WINDOWS
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
#include "ServiceWin32.h"
|
||||
char serviceName[] = "authserver";
|
||||
char serviceLongName[] = "TrinityCore auth service";
|
||||
@@ -90,7 +90,7 @@ int main(int argc, char** argv)
|
||||
if (vm.count("help") || vm.count("version"))
|
||||
return 0;
|
||||
|
||||
#if PLATFORM == PLATFORM_WINDOWS
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
if (configService.compare("install") == 0)
|
||||
return WinServiceInstall() == true ? 0 : 1;
|
||||
else if (configService.compare("uninstall") == 0)
|
||||
@@ -163,7 +163,7 @@ int main(int argc, char** argv)
|
||||
|
||||
// Set signal handlers
|
||||
boost::asio::signal_set signals(*_ioService, SIGINT, SIGTERM);
|
||||
#if PLATFORM == PLATFORM_WINDOWS
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
signals.add(SIGBREAK);
|
||||
#endif
|
||||
signals.async_wait(SignalHandler);
|
||||
@@ -182,7 +182,7 @@ int main(int argc, char** argv)
|
||||
_banExpiryCheckTimer->expires_from_now(boost::posix_time::seconds(_banExpiryCheckInterval));
|
||||
_banExpiryCheckTimer->async_wait(BanExpiryHandler);
|
||||
|
||||
#if PLATFORM == PLATFORM_WINDOWS
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
if (m_ServiceStatus != -1)
|
||||
{
|
||||
_serviceStatusWatchTimer = new boost::asio::deadline_timer(*_ioService);
|
||||
@@ -271,7 +271,7 @@ void BanExpiryHandler(boost::system::error_code const& error)
|
||||
}
|
||||
}
|
||||
|
||||
#if PLATFORM == PLATFORM_WINDOWS
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
void ServiceStatusWatcher(boost::system::error_code const& error)
|
||||
{
|
||||
if (!error)
|
||||
@@ -299,7 +299,7 @@ variables_map GetConsoleArguments(int argc, char** argv, fs::path& configFile, s
|
||||
("config,c", value<fs::path>(&configFile)->default_value(fs::absolute(_TRINITY_REALM_CONFIG)),
|
||||
"use <arg> as configuration file")
|
||||
;
|
||||
#if PLATFORM == PLATFORM_WINDOWS
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
options_description win("Windows platform specific options");
|
||||
win.add_options()
|
||||
("service,s", value<std::string>(&configService)->default_value(""), "Windows service options: [install | uninstall]")
|
||||
|
||||
@@ -1227,7 +1227,7 @@ void World::LoadConfigSettings(bool reload)
|
||||
if (dataPath.empty() || (dataPath.at(dataPath.length()-1) != '/' && dataPath.at(dataPath.length()-1) != '\\'))
|
||||
dataPath.push_back('/');
|
||||
|
||||
#if PLATFORM == PLATFORM_UNIX || PLATFORM == PLATFORM_APPLE
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_UNIX || TRINITY_PLATFORM == TRINITY_PLATFORM_APPLE
|
||||
if (dataPath[0] == '~')
|
||||
{
|
||||
const char* home = getenv("HOME");
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "Log.h"
|
||||
#include "Util.h"
|
||||
|
||||
#if PLATFORM != PLATFORM_WINDOWS
|
||||
#if TRINITY_PLATFORM != TRINITY_PLATFORM_WINDOWS
|
||||
#include <readline/readline.h>
|
||||
#include <readline/history.h>
|
||||
#include "Chat.h"
|
||||
@@ -86,7 +86,7 @@ int cli_hook_func()
|
||||
|
||||
void utf8print(void* /*arg*/, const char* str)
|
||||
{
|
||||
#if PLATFORM == PLATFORM_WINDOWS
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
wchar_t wtemp_buf[6000];
|
||||
size_t wtemp_len = 6000-1;
|
||||
if (!Utf8toWStr(str, strlen(str), wtemp_buf, wtemp_len))
|
||||
@@ -129,7 +129,7 @@ void CliThread()
|
||||
{
|
||||
///- Display the list of available CLI functions then beep
|
||||
//TC_LOG_INFO("server.worldserver", "");
|
||||
#if PLATFORM != PLATFORM_WINDOWS
|
||||
#if TRINITY_PLATFORM != TRINITY_PLATFORM_WINDOWS
|
||||
rl_attempted_completion_function = cli_completion;
|
||||
rl_event_hook = cli_hook_func;
|
||||
#endif
|
||||
@@ -148,7 +148,7 @@ void CliThread()
|
||||
|
||||
char *command_str ; // = fgets(commandbuf, sizeof(commandbuf), stdin);
|
||||
|
||||
#if PLATFORM == PLATFORM_WINDOWS
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
char commandbuf[256];
|
||||
command_str = fgets(commandbuf, sizeof(commandbuf), stdin);
|
||||
#else
|
||||
@@ -167,7 +167,7 @@ void CliThread()
|
||||
|
||||
if (!*command_str)
|
||||
{
|
||||
#if PLATFORM == PLATFORM_WINDOWS
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
printf("TC>");
|
||||
#else
|
||||
free(command_str);
|
||||
@@ -178,7 +178,7 @@ void CliThread()
|
||||
std::string command;
|
||||
if (!consoleToUtf8(command_str, command)) // convert from console encoding to utf8
|
||||
{
|
||||
#if PLATFORM == PLATFORM_WINDOWS
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
printf("TC>");
|
||||
#else
|
||||
free(command_str);
|
||||
@@ -188,7 +188,7 @@ void CliThread()
|
||||
|
||||
fflush(stdout);
|
||||
sWorld->QueueCliCommand(new CliCommandHolder(NULL, command.c_str(), &utf8print, &commandFinished));
|
||||
#if PLATFORM != PLATFORM_WINDOWS
|
||||
#if TRINITY_PLATFORM != TRINITY_PLATFORM_WINDOWS
|
||||
add_history(command.c_str());
|
||||
free(command_str);
|
||||
#endif
|
||||
|
||||
@@ -168,7 +168,7 @@ extern int main(int argc, char** argv)
|
||||
|
||||
// Set signal handlers (this must be done before starting io_service threads, because otherwise they would unblock and exit)
|
||||
boost::asio::signal_set signals(_ioService, SIGINT, SIGTERM);
|
||||
#if PLATFORM == PLATFORM_WINDOWS
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
signals.add(SIGBREAK);
|
||||
#endif
|
||||
signals.async_wait(SignalHandler);
|
||||
|
||||
Reference in new issue
Block a user