<commit_before>/*
    kopetecontact.h - Kopete Contact

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

    Kopete    (c) 2002-2003 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.      *
    *                                                                       *
    *************************************************************************
*/

#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 KopeteMetaContact;
class KopeteMessageManager;
class KopeteOnlineStatus;
class KopetePlugin;
class KopeteProtocol;
class KopeteAccount;
typedef QPtrList<KopeteGroup> KopeteGroupList;

/**
 * @author <NAME>. <<EMAIL>>
 * @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!
	 *
	 * Note: Id is required to be unique per protocol and per account.
	 * Across those boundaries ids may occur multiple times.
	 * The id is solely for comparing items safely (using pointers is
	 * more crash-prone). DO NOT assume anything regarding the id's
	 * value! Even if it may look like an ICQ UIN or an MSN passport,
	 * this is undefined and may change at any time!
	 *
	 * @param account is the parent account. this constructor automaticaly register the contact to the account
	 * @param id is the KopeteContact inique Id (mostly the user's login)
	 */
	KopeteContact( KopeteAccount *account, const QString &id, KopeteMetaContact *parent, const QString &icon = QString::null );
	~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
	 * receive messages even if offline, etc.  This function must
	 * be defined by child classes
	 * if this function return false, the user will be unable to open a chatwindow
	 *
	 * @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;

	/**
	 * @brief 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.
	 *
	 * Most plugins don't need more than these fields, so they only need
	 * to set the address book fields themselves. If you have nothing to
	 * save at all you can clear the QMap, an empty map is treated as
	 * 'nothing to save'.
	 *
	 * The provided addressBookFields QMap contains the index field as
	 * marked with @ref KopetePlugin::addAddressBookField() with the
	 * contact id as value. If no index field is available the QMap is
	 * simply passed as an empty map.
	 */
	virtual void serialize( QMap<QString, QString> &serializedData, QMap<QString, QString> &addressBookData );

	/**
	 * Get the current display name
	 * @return The display name
	 */
	QString displayName() const;

	/**
	 * @brief Return the online status of the contact
	 * @return the online status of the contact
	 */
	const KopeteOnlineStatus& onlineStatus() const;

	/**
	 * Set the contact's online status and status descryption
	 * By default description is set to QString::null, this mean
	 * that it is not used 
	*/
	void setOnlineStatus(const KopeteOnlineStatus &status, 
			const QString &statusDescription=QString::null);

	/**
	 * Returns QString::null if protocol do not use it,
	 * or status description otherwise, empty string (not null), 
	 * if current status does not require description.
	 */
	   
	QString statusDescription() const;
	<commit_msg>Corrected descryption of setOnlineStatus and statusDescryption(). Now null indicates that there is no status or it is unused otherwise status descrytopion will be used instead of static one from kopeteonlinestatus ...... uff. :-)<commit_after>/*
    kopetecontact.h - Kopete Contact

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

    Kopete    (c) 2002-2003 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.      *
    *                                                                       *
    *************************************************************************
*/

#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 KopeteMetaContact;
class KopeteMessageManager;
class KopeteOnlineStatus;
class KopetePlugin;
class KopeteProtocol;
class KopeteAccount;
typedef QPtrList<KopeteGroup> KopeteGroupList;

/**
 * @author <NAME>. <<EMAIL>>
 * @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!
	 *
	 * Note: Id is required to be unique per protocol and per account.
	 * Across those boundaries ids may occur multiple times.
	 * The id is solely for comparing items safely (using pointers is
	 * more crash-prone). DO NOT assume anything regarding the id's
	 * value! Even if it may look like an ICQ UIN or an MSN passport,
	 * this is undefined and may change at any time!
	 *
	 * @param account is the parent account. this constructor automaticaly register the contact to the account
	 * @param id is the KopeteContact inique Id (mostly the user's login)
	 */
	KopeteContact( KopeteAccount *account, const QString &id, KopeteMetaContact *parent, const QString &icon = QString::null );
	~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
	 * receive messages even if offline, etc.  This function must
	 * be defined by child classes
	 * if this function return false, the user will be unable to open a chatwindow
	 *
	 * @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;

	/**
	 * @brief 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.
	 *
	 * Most plugins don't need more than these fields, so they only need
	 * to set the address book fields themselves. If you have nothing to
	 * save at all you can clear the QMap, an empty map is treated as
	 * 'nothing to save'.
	 *
	 * The provided addressBookFields QMap contains the index field as
	 * marked with @ref KopetePlugin::addAddressBookField() with the
	 * contact id as value. If no index field is available the QMap is
	 * simply passed as an empty map.
	 */
	virtual void serialize( QMap<QString, QString> &serializedData, QMap<QString, QString> &addressBookData );

	/**
	 * Get the current display name
	 * @return The display name
	 */
	QString displayName() const;

	/**
	 * @brief Return the online status of the contact
	 * @return the online status of the contact
	 */
	const KopeteOnlineStatus& onlineStatus() const;

	/**
	 * Set the contact's online status and status descryption
	 * When unused description is set to QString::null
	*/
	void setOnlineStatus(const KopeteOnlineStatus &status, 
			const QString &statusDescription=QString::null);

	/**
	 * Returns QString::null if protocol do not use it,
	 * or current status does not require description.
	 */
	   
	QString statusDescription() const;
	
{'fraction_non_alphanumeric': 0.10532837670384139, 'fraction_numerical': 0.005989260636100785, 'mean_word_length': 3.194456474664357, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 55, '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': '4118846', 'n_tokens_mistral': 2787, 'n_tokens_neox': 2519, 'n_words': 1152}