// NeL - MMORPG Framework
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
#include "stdmisc.h"
#include "nel/misc/common.h"
#include "nel/misc/ucstring.h"
#include "nel/misc/report.h"
#include "nel/misc/path.h"
#ifdef NL_OS_WINDOWS
# ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include
# include
# include
#endif // NL_OS_WINDOWS
#define NL_NO_DEBUG_FILES 1
using namespace std;
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
namespace NLMISC
{
//old doesn't work on visual c++ 7.1 due to default parameter typedef bool (*TEmailFunction) (const std::string &smtpServer, const std::string &from, const std::string &to, const std::string &subject, const std::string &body, const std::string &attachedFile = "", bool onlyCheck = false);
typedef bool (*TEmailFunction) (const std::string &smtpServer, const std::string &from, const std::string &to, const std::string &subject, const std::string &body, const std::string &attachedFile, bool onlyCheck);
static TEmailFunction EmailFunction = NULL;
void setReportEmailFunction (void *emailFunction)
{
EmailFunction = (TEmailFunction)emailFunction;
}
TReportResult report (const std::string &title, const std::string &header, const std::string &subject, const std::string &body, bool enableCheckIgnore, uint debugButton, bool ignoreButton, sint quitButton, bool sendReportButton, bool &ignoreNextTime, const string &attachedFile)
{
std::string fname = "rcerrorlog.txt";
std::ofstream f;
f.open( fname.c_str() );
if( f.good() )
{
f << body;
f.close();
#ifdef NL_OS_WINDOWS
NLMISC::launchProgram( "rcerror.exe", fname );
#else
NLMISC::launchProgram( "rcerror", fname );
#endif
}
#ifdef NL_OS_WINDOWS
#ifndef NL_COMP_MINGW
// disable the Windows popup telling that the application aborted and disable the dr watson report.
_set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
#endif
#endif
// quit without calling atexit or static object dtors.
abort();
return ReportQuit;
}
} // NLMISC