Add "--debug-irc" command-line option to Core and Monolithic to log
raw IRC messages to the log at Debug level.
Check for raw IRC logging in CoreNetwork and IrcParser, logging
anything sent and received with the Network ID and "<<" for received,
">>" for sent.
Add "--debug-irc-id" to limit raw logging to a specific Network ID,
handy for cores with multiple networks. This option automatically
applies "--debug-irc".
These usually should be combined with "--loglevel Debug", though the
Monolithic build can show raw IRC messages in the "Debug Log" GUI
without setting that parameter.
CAUTION: "--debug-irc" will leak all IRC passwords in plain text via
any configured logging receivers (file, syslog, etc) and should not
be used on production servers without taking special care to limit
access to logging output.
Note: The ideal approach is to have the core maintain the most recent
raw IRC logs on a rotating basis, allowing any client to request this
portion of logs on demand. However, there's a lot more changes
involved, which might not be wise with the goal of stabilizing 0.13.
We should revisit this in the future.
cliParser->addOption("ssl-cert", 0, "Specify the path to the SSL Certificate", "path", "configdir/quasselCert.pem");
cliParser->addOption("ssl-key", 0, "Specify the path to the SSL key", "path", "ssl-cert-path");
#endif
cliParser->addOption("ssl-cert", 0, "Specify the path to the SSL Certificate", "path", "configdir/quasselCert.pem");
cliParser->addOption("ssl-key", 0, "Specify the path to the SSL key", "path", "ssl-cert-path");
#endif
+ cliParser->addSwitch("debug-irc", 0,
+ "Enable logging of all raw IRC messages to debug log, including "
+ "passwords! In most cases you should also set --loglevel Debug");
+ cliParser->addOption("debug-irc-id", 0,
+ "Limit raw IRC logging to this network ID. Implies --debug-irc",
+ "database network ID", "-1");
cliParser->addSwitch("enable-experimental-dcc", 0, "Enable highly experimental and unfinished support for CTCP DCC (DANGEROUS)");
#endif
cliParser->addSwitch("enable-experimental-dcc", 0, "Enable highly experimental and unfinished support for CTCP DCC (DANGEROUS)");
#endif
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
+#include <QDebug>
+#include <QHostInfo>
+
#include "core.h"
#include "coreidentity.h"
#include "corenetworkconfig.h"
#include "core.h"
#include "coreidentity.h"
#include "corenetworkconfig.h"
_requestedUserModes('-')
{
_requestedUserModes('-')
{
+ // Check if raw IRC logging is enabled
+ _debugLogRawIrc = (Quassel::isOptionSet("debug-irc") || Quassel::isOptionSet("debug-irc-id"));
+ _debugLogRawNetId = Quassel::optionValue("debug-irc-id").toInt();
+
_autoReconnectTimer.setSingleShot(true);
connect(&_socketCloseTimer, SIGNAL(timeout()), this, SLOT(socketCloseTimeout()));
_autoReconnectTimer.setSingleShot(true);
connect(&_socketCloseTimer, SIGNAL(timeout()), this, SLOT(socketCloseTimeout()));
void CoreNetwork::writeToSocket(const QByteArray &data)
{
void CoreNetwork::writeToSocket(const QByteArray &data)
{
+ // Log the message if enabled and network ID matches or allows all
+ if (_debugLogRawIrc
+ && (_debugLogRawNetId == -1 || networkId().toInt() == _debugLogRawNetId)) {
+ // Include network ID
+ qDebug() << "IRC net" << networkId() << ">>" << data;
+ }
socket.write(data);
socket.write("\r\n");
if (!_skipMessageRates) {
socket.write(data);
socket.write("\r\n");
if (!_skipMessageRates) {
private:
CoreSession *_coreSession;
private:
CoreSession *_coreSession;
+ bool _debugLogRawIrc; ///< If true, include raw IRC socket messages in the debug log
+ qint32 _debugLogRawNetId; ///< Network ID for logging raw IRC socket messages, or -1 for all
+
#ifdef HAVE_SSL
QSslSocket socket;
#else
#ifdef HAVE_SSL
QSslSocket socket;
#else
#include "corenetwork.h"
#include "eventmanager.h"
#include "ircevent.h"
#include "corenetwork.h"
#include "eventmanager.h"
#include "ircevent.h"
QObject(session),
_coreSession(session)
{
QObject(session),
_coreSession(session)
{
+ // Check if raw IRC logging is enabled
+ _debugLogRawIrc = (Quassel::isOptionSet("debug-irc") || Quassel::isOptionSet("debug-irc-id"));
+ _debugLogRawNetId = Quassel::optionValue("debug-irc-id").toInt();
+
connect(this, SIGNAL(newEvent(Event *)), coreSession()->eventManager(), SLOT(postEvent(Event *)));
}
connect(this, SIGNAL(newEvent(Event *)), coreSession()->eventManager(), SLOT(postEvent(Event *)));
}
+ // Log the message if enabled and network ID matches or allows all
+ if (_debugLogRawIrc
+ && (_debugLogRawNetId == -1 || net->networkId().toInt() == _debugLogRawNetId)) {
+ // Include network ID
+ qDebug() << "IRC net" << net->networkId() << "<<" << msg;
+ }
+
// Now we split the raw message into its various parts...
QString prefix;
QByteArray trailing;
// Now we split the raw message into its various parts...
QString prefix;
QByteArray trailing;
private:
CoreSession *_coreSession;
private:
CoreSession *_coreSession;
+
+ bool _debugLogRawIrc; ///< If true, include raw IRC socket messages in the debug log
+ qint32 _debugLogRawNetId; ///< Network ID for logging raw IRC socket messages, or -1 for all