2012-05-29 13:31:11 +00:00
|
|
|
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
|
|
|
// 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 <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
#include "stdmisc.h"
|
|
|
|
|
|
|
|
#include "nel/misc/common.h"
|
|
|
|
#include "nel/misc/ucstring.h"
|
|
|
|
|
|
|
|
#include "nel/misc/report.h"
|
|
|
|
#include "nel/misc/path.h"
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2015-02-21 21:32:11 +00:00
|
|
|
void report ( const std::string &body )
|
2015-02-17 02:12:26 +00:00
|
|
|
{
|
2015-02-20 01:35:11 +00:00
|
|
|
std::string fname = "rcerrorlog.txt";
|
2012-05-29 13:31:11 +00:00
|
|
|
|
2015-02-17 02:12:26 +00:00
|
|
|
std::ofstream f;
|
|
|
|
f.open( fname.c_str() );
|
|
|
|
if( f.good() )
|
2012-05-29 13:31:11 +00:00
|
|
|
{
|
2015-02-17 02:12:26 +00:00
|
|
|
f << body;
|
|
|
|
f.close();
|
2012-05-29 13:31:11 +00:00
|
|
|
|
2015-02-20 01:03:33 +00:00
|
|
|
#ifdef NL_OS_WINDOWS
|
|
|
|
NLMISC::launchProgram( "rcerror.exe", fname );
|
|
|
|
#else
|
2015-02-17 02:12:26 +00:00
|
|
|
NLMISC::launchProgram( "rcerror", fname );
|
2015-02-20 01:03:33 +00:00
|
|
|
#endif
|
2015-02-17 02:12:26 +00:00
|
|
|
}
|
2012-05-29 13:31:11 +00:00
|
|
|
|
|
|
|
#ifdef NL_OS_WINDOWS
|
2014-06-17 22:28:08 +00:00
|
|
|
#ifndef NL_COMP_MINGW
|
2012-05-29 13:31:11 +00:00
|
|
|
// disable the Windows popup telling that the application aborted and disable the dr watson report.
|
|
|
|
_set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
|
2014-06-17 22:28:08 +00:00
|
|
|
#endif
|
2012-05-29 13:31:11 +00:00
|
|
|
#endif
|
|
|
|
// quit without calling atexit or static object dtors.
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} // NLMISC
|