<commit_before>/*
    kopetecontact.h - Kopete Contact

    Copyright (c) 2002      by <NAME> <<EMAIL>>
    Copyright (c) 2002-2003 by <NAME>       <<EMAIL>>

    Kopete    (c) 2002-2003 by the Kopete developers  <<EMAIL>>

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

#ifndef __KOPETECONTACT_H__
#define __KOPETECONTACT_H__

#include <qobject.h>
#include <qstringlist.h>

#include <kurl.h>

struct KopeteContactPrivate;

class KActionCollection;
class KPopupMenu;
class KURL;

class KopeteGroup;
class KopeteGroupList;
class KopeteMetaContact;
class KopeteMessageManager;
class KopeteOnlineStatus;
class KopetePlugin;
class KopeteProtocol;
class KopeteAccount;

/**
 * @author <NAME>. <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 *
 * This class abstracts a generic contact/buddie.
 * Use it for inserting contacts in the contact list for example.
 */
class KopeteContact : public QObject
{
	Q_OBJECT

public:
	/**
	 * Create new contact. Supply the parent meta contact!
	 */
	KopeteContact( KopeteAccount *protocol, const QString &id, KopeteMetaContact *parent );
	//obsolete one
	KopeteContact( KopeteProtocol *protocol, const QString &id, KopeteMetaContact *parent );
	~KopeteContact();

	/**
	 * Contact's idle status
	 */
	enum IdleState { Unspecified, Idle, Active };

	/**
	 * Return whether this contact is online or not.
	 * @return bool indicating whhether the contact is online
	 * FIXME: When all plugins support this, make this pure virtual!
	 */
	bool isOnline() const;

	/**
	 * Function used in determining if the contact is able to
	 * recieve messages even if offline, etc.  This function must
	 * be defined by child classes
	 *
	 * @return bool indicating whether or not the contact is reachable (can send a message to it)
	 */
	virtual bool isReachable();

	/**
	 * Accessor function for the contact's MetaContact
	 * @return The contact's metacontact
	 */
	KopeteMetaContact *metaContact() const;

	/**
	 * Serialize the contact for storage in the contact list.
	 *
	 * The provided serializedData contain the contact id in the field
	 * "contactId" and the display name in the field "displayName". If
	 * you don't like this, or don't want to store these fields at all,
	 * you are free to remove them from the list.<commit_msg>CVS_SILENT<commit_after>/*
    kopetecontact.h - Kopete Contact

    Copyright (c) 2002      by <NAME> <<EMAIL>>
    Copyright (c) 2002-2003 by <NAME>       <<EMAIL>>

    Kopete    (c) 2002-2003 by the Kopete developers  <<EMAIL>>

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

#ifndef __KOPETECONTACT_H__
#define __KOPETECONTACT_H__

#include <qobject.h>
#include <qstringlist.h>

#include <kurl.h>

struct KopeteContactPrivate;

class KActionCollection;
class KPopupMenu;
class KURL;

class KopeteGroup;
class KopeteGroupList;
class KopeteMetaContact;
class KopeteMessageManager;
class KopeteOnlineStatus;
class KopetePlugin;
class KopeteProtocol;
class KopeteAccount;

/**
 * @author <NAME>. <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 *
 * This class abstracts a generic contact/buddie.
 * Use it for inserting contacts in the contact list for example.
 */
class KopeteContact : public QObject
{
	Q_OBJECT

public:
	/**
	 * Create new contact. Supply the parent meta contact!
	 */
	KopeteContact( KopeteAccount *protocol, const QString &id, KopeteMetaContact *parent );
	//obsolete one
	KopeteContact( KopeteProtocol *protocol, const QString &id, KopeteMetaContact *parent );
	~KopeteContact();

	/**
	 * Contact's idle status
	 */
	enum IdleState { Unspecified, Idle, Active };

	/**
	 * Return whether this contact is online or not.
	 * @return bool indicating whhether the contact is online
	 */
	bool isOnline() const;

	/**
	 * Function used in determining if the contact is able to
	 * recieve messages even if offline, etc.  This function must
	 * be defined by child classes
	 *
	 * @return bool indicating whether or not the contact is reachable (can send a message to it)
	 */
	virtual bool isReachable();

	/**
	 * Accessor function for the contact's MetaContact
	 * @return The contact's metacontact
	 */
	KopeteMetaContact *metaContact() const;

	/**
	 * Serialize the contact for storage in the contact list.
	 *
	 * The provided serializedData contain the contact id in the field
	 * "contactId" and the display name in the field "displayName". If
	 * you don't like this, or don't want to store these fields at all,
	 * you are free to remove them from the list.
{'fraction_non_alphanumeric': 0.12989801395598496, 'fraction_numerical': 0.007514761137949544, 'mean_word_length': 2.920056100981767, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '484305', 'n_tokens_mistral': 1623, 'n_tokens_neox': 1484, 'n_words': 587}