r7944 - in /trunk/licq/src: daemon.cpp daemon.h icq/icq.cpp icq/icq.h
[email protected] Sun, 24 Oct 2010 19:11:13 -0000
Newsgroups
gmane.network.licq.cvs
Message-ID
<20101024191113.37E1C224B83@thejon>
Author: erijo
Date: Mon Oct 25 04:11:12 2010
New Revision: 7944
Log:
Moved error log from icq "plugin" to daemon where it should be
Modified:
trunk/licq/src/daemon.cpp
trunk/licq/src/daemon.h
trunk/licq/src/icq/icq.cpp
trunk/licq/src/icq/icq.h
Modified: trunk/licq/src/daemon.cpp
==============================================================================
--- trunk/licq/src/daemon.cpp (original)
+++ trunk/licq/src/daemon.cpp Mon Oct 25 04:11:12 2010
@@ -31,6 +31,8 @@
#include <sys/stat.h> // chmod
#include <licq/logging/log.h>
+#include <licq/logging/logservice.h>
+#include <licq/logging/logutils.h>
#include <licq/contactlist/owner.h>
#include <licq/contactlist/user.h>
#include <licq/icqdefines.h>
@@ -49,6 +51,7 @@
#include "gpghelper.h"
#include "icq/icq.h"
#include "licq.h"
+#include "logging/filelogsink.h"
#include "plugins/pluginmanager.h"
using namespace std;
@@ -124,6 +127,23 @@
licqConf.get("Rejects", myRejectFile, "log.rejects");
if (myRejectFile == "none")
myRejectFile = "";
+
+ // Error log file
+ licqConf.get("Errors", myErrorFile, "log.errors");
+ licqConf.get("ErrorTypes", myErrorTypes, 0x4 | 0x2); // error and unknown
+ if (!myErrorFile.empty() && myErrorFile != "none")
+ {
+ string errorFile = baseDir() + myErrorFile;
+ boost::shared_ptr<FileLogSink> logSink(new FileLogSink(errorFile));
+ logSink->setLogLevelsFromBitmask(
+ Licq::LogUtils::convertOldBitmaskToNew(myErrorTypes));
+ logSink->setLogPackets(true);
+ if (logSink->isOpen())
+ getLogService().registerLogSink(logSink);
+ else
+ gLog.error("Unable to open %s as error log:\n%s",
+ errorFile.c_str(), strerror(errno));
+ }
// Loading translation table from file
licqConf.get("Translation", temp, "none");
@@ -189,6 +209,9 @@
licqConf.set("Rejects", (myRejectFile.empty() ? "none" : myRejectFile));
+ licqConf.set("Errors", myErrorFile);
+ licqConf.set("ErrorTypes", myErrorTypes);
+
string translation = Licq::gTranslator.getMapName();
if (translation.empty())
translation = "none";
Modified: trunk/licq/src/daemon.h
==============================================================================
--- trunk/licq/src/daemon.h (original)
+++ trunk/licq/src/daemon.h Mon Oct 25 04:11:12 2010
@@ -78,6 +78,8 @@
unsigned long myNextEventId;
Licq::Mutex myNextEventIdMutex;
std::string myRejectFile;
+ unsigned myErrorTypes;
+ std::string myErrorFile;
pthread_t thread_shutdown;
Modified: trunk/licq/src/icq/icq.cpp
==============================================================================
--- trunk/licq/src/icq/icq.cpp (original)
+++ trunk/licq/src/icq/icq.cpp Mon Oct 25 04:11:12 2010
@@ -24,8 +24,6 @@
#include <licq/icqdefines.h>
#include <licq/inifile.h>
#include <licq/logging/log.h>
-#include <licq/logging/logservice.h>
-#include <licq/logging/logutils.h>
#include <licq/statistics.h>
#include <licq/oneventmanager.h>
#include <licq/pluginsignal.h>
@@ -35,7 +33,6 @@
#include "../daemon.h"
#include "../gettext.h"
-#include "../logging/filelogsink.h"
#include "../support.h"
#include "oscarservice.h"
#include "packet.h"
@@ -110,25 +107,6 @@
licqConf.get("BackgroundColor", nColor, 0x00FFFFFF);
Licq::Color::setDefaultBackground(nColor);
- // Error log file
- // TODO: Move this to the daemon
- licqConf.get("Errors", myErrorFile, "log.errors");
- licqConf.get("ErrorTypes", myErrorTypes, 0x4 | 0x2); // error and unknown
- if (myErrorFile != "none")
- {
- string errorFile = Licq::gDaemon.baseDir() + myErrorFile;
- boost::shared_ptr<LicqDaemon::FileLogSink> logSink(
- new LicqDaemon::FileLogSink(errorFile));
- logSink->setLogLevelsFromBitmask(
- Licq::LogUtils::convertOldBitmaskToNew(myErrorTypes));
- logSink->setLogPackets(true);
- if (logSink->isOpen())
- gDaemon.getLogService().registerLogSink(logSink);
- else
- gLog.error("Unable to open %s as error log:\n%s",
- errorFile.c_str(), strerror(errno));
- }
-
// Proxy
m_xProxy = NULL;
@@ -225,9 +203,6 @@
licqConf.set("AutoUpdateStatusPlugins", m_bAutoUpdateStatusPlugins);
licqConf.set("ForegroundColor", Licq::Color::defaultForeground());
licqConf.set("BackgroundColor", Licq::Color::defaultBackground());
-
- licqConf.set("Errors", myErrorFile);
- licqConf.set("ErrorTypes", myErrorTypes);
// Misc
licqConf.set("UseSS", m_bUseSS); // server side list
Modified: trunk/licq/src/icq/icq.h
==============================================================================
--- trunk/licq/src/icq/icq.h (original)
+++ trunk/licq/src/icq/icq.h Mon Oct 25 04:11:12 2010
@@ -355,8 +355,6 @@
unsigned long m_nDesiredStatus;
unsigned short m_nServerSequence;
unsigned myMaxUsersPerPacket;
- unsigned myErrorTypes;
- std::string myErrorFile;
int m_nTCPSrvSocketDesc,
m_nTCPSocketDesc;
bool m_bLoggingOn,