<commit_before>/*
    kopetemessagefilter.cpp - Kopete Message Filtering

    Copyright (c) 2004      by <NAME>         <<EMAIL>>
    Kopete    (c) 2002-2004 by the Kopete developers <<EMAIL>>

    *************************************************************************
    *                                                                       *
    * This library is free software; you can redistribute it and/or         *
    * modify it under the terms of the GNU Lesser General Public            *
    * License as published by the Free Software Foundation; either          *
    * version 2 of the License, or (at your option) any later version.      *
    *                                                                       *
    *************************************************************************
*/

#include "kopetemessagehandler.h"
#include "kopetemessageevent.h"

namespace Kopete
{

class MessageHandler::Private
{
public:
	Private() : next(0) {}
	MessageHandler *next;
};

MessageHandler::MessageHandler()
 : QObject( 0 ), d( new Private )
{
}

MessageHandler::~MessageHandler()
{
	delete d;
}

MessageHandler *MessageHandler::next()
{
	return d->next;
}

void MessageHandler::setNext( MessageHandler *next )
{
	d->next = next;
}

int MessageHandler::capabilities()
{
	return d->next->capabilities();
}

void MessageHandler::handleMessage( MessageEvent *event )
{
	d->next->handleMessage(event);
}


class MessageHandlerFactory::Private
{
public:
	static FactoryList factories;
	FactoryList::Iterator iterator;
};
MessageHandlerFactory::FactoryList MessageHandlerFactory::Private::factories;

MessageHandlerFactory::MessageHandlerFactory()
	: d( new Private )
{
	d->iterator = Private::factories.append(this);
}

MessageHandlerFactory::~MessageHandlerFactory()
{
	Private::factories.remove( d->iterator );
	delete d;
}

MessageHandlerFactory::FactoryList MessageHandlerFactory::messageHandlerFactories()
{
	return Private::factories;<commit_msg>Turn a crash on startup for some into a crash on shutdown for all. Will fix the crash on shutdown next.<commit_after>/*
    kopetemessagefilter.cpp - Kopete Message Filtering

    Copyright (c) 2004      by <NAME>         <<EMAIL>>
    Kopete    (c) 2002-2004 by the Kopete developers <<EMAIL>>

    *************************************************************************
    *                                                                       *
    * This library is free software; you can redistribute it and/or         *
    * modify it under the terms of the GNU Lesser General Public            *
    * License as published by the Free Software Foundation; either          *
    * version 2 of the License, or (at your option) any later version.      *
    *                                                                       *
    *************************************************************************
*/

#include "kopetemessagehandler.h"
#include "kopetemessageevent.h"

#include <kstaticdeleter.h>

namespace Kopete
{

class MessageHandler::Private
{
public:
	Private() : next(0) {}
	MessageHandler *next;
};

MessageHandler::MessageHandler()
 : QObject( 0 ), d( new Private )
{
}

MessageHandler::~MessageHandler()
{
	delete d;
}

MessageHandler *MessageHandler::next()
{
	return d->next;
}

void MessageHandler::setNext( MessageHandler *next )
{
	d->next = next;
}

int MessageHandler::capabilities()
{
	return d->next->capabilities();
}

void MessageHandler::handleMessage( MessageEvent *event )
{
	d->next->handleMessage(event);
}


class MessageHandlerFactory::Private
{
public:
	static FactoryList &factories();
	FactoryList::Iterator iterator;
};

MessageHandlerFactory::FactoryList &MessageHandlerFactory::Private::factories()
{
	static KStaticDeleter<FactoryList> deleter;
	static FactoryList *list = 0;
	if( !list )
		deleter.setObject( list, new FactoryList );
	return *list;
}

MessageHandlerFactory::MessageHandlerFactory()
	: d( new Private )
{
	d->iterator = Private::factories().append(this);
}

MessageHandlerFactory::~MessageHandlerFactory()
{
	Private::factories().remove( d->iterator );
	delete d;
}

MessageHandlerFactory::FactoryList MessageHandlerFactory::messageHandlerFactories()
{
	return Private::factories();
{'fraction_non_alphanumeric': 0.17001655237644833, 'fraction_numerical': 0.007330338141404587, 'mean_word_length': 3.3473792394655706, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2995698', 'n_tokens_mistral': 1151, 'n_tokens_neox': 1099, 'n_words': 290}