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"
|
|
|
|
|
2015-02-22 16:15:41 +00:00
|
|
|
#ifdef NL_OS_WINDOWS
|
|
|
|
# ifndef NL_COMP_MINGW
|
|
|
|
# define NOMINMAX
|
|
|
|
# endif
|
|
|
|
# include <windows.h>
|
|
|
|
# include <windowsx.h>
|
|
|
|
# include <winuser.h>
|
|
|
|
#endif // NL_OS_WINDOWS
|
|
|
|
|
|
|
|
#define NL_NO_DEBUG_FILES 1
|
|
|
|
|
2012-05-29 13:31:11 +00:00
|
|
|
using namespace std;
|
|
|
|
|
2015-02-22 16:15:41 +00:00
|
|
|
#ifdef DEBUG_NEW
|
|
|
|
#define new DEBUG_NEW
|
|
|
|
#endif
|
|
|
|
|
2012-05-29 13:31:11 +00:00
|
|
|
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-22 16:20:24 +00:00
|
|
|
#ifndef NL_OS_WINDOWS
|
|
|
|
|
|
|
|
// GNU/Linux, do nothing
|
|
|
|
|
|
|
|
void report ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2015-02-22 16:15:41 +00:00
|
|
|
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)
|
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();
|
2015-02-22 16:15:41 +00:00
|
|
|
|
|
|
|
return ReportQuit;
|
2012-05-29 13:31:11 +00:00
|
|
|
}
|
|
|
|
|
2015-02-22 16:20:24 +00:00
|
|
|
#endif
|
|
|
|
|
2012-05-29 13:31:11 +00:00
|
|
|
|
|
|
|
} // NLMISC
|