<commit_before>/**
 * This file is part of TelepathyQt4
 *
 * @copyright Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
 * @copyright Copyright (C) 2008 Nokia Corporation
 * @license LGPL 2.1
 *
 * 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.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include <TelepathyQt4/PendingContactAttributes>

#include "TelepathyQt4/_gen/pending-contact-attributes.moc.hpp"

#include <TelepathyQt4/Connection>
#include <TelepathyQt4/ReferencedHandles>

#include "TelepathyQt4/debug-internal.h"

namespace Tp
{

/**
 * \class PendingContactAttributes
 * \ingroup clientconn
 * \headerfile TelepathyQt4/pending-contact-attributes.h <TelepathyQt4/PendingContactAttributes>
 *
 * \brief The PendingContactAttributes class represents the parameters of and
 * the reply to an asynchronous request for raw contact attributes, as used in
 * the Connection::contactAttributes() low-level convenience method wrapping the
 * Client::ConnectionInterfaceContactsInterface::GetContactAttributes() D-Bus
 * method.
 */

struct TELEPATHY_QT4_NO_EXPORT PendingContactAttributes::Private
{
    UIntList contactsRequested;
    QStringList interfacesRequested;
    bool shouldReference;
    ReferencedHandles validHandles;
    UIntList invalidHandles;
    ContactAttributesMap attributes;
};

PendingContactAttributes::PendingContactAttributes(const ConnectionPtr &connection,
        const UIntList &handles, const QStringList &interfaces, bool reference)
    : PendingOperation(connection),
      mPriv(new Private)
{
    mPriv->contactsRequested = handles;
    mPriv->interfacesRequested = interfaces;
    mPriv->shouldReference = reference;
}

/**
 * Class destructor.
 */
PendingContactAttributes::~PendingContactAttributes()
{
    delete mPriv;
}

/**
 * Return the Connection object through which the request was made.
 *
 * \return Pointer to the Connection.
 */
ConnectionPtr PendingContactAttributes::connection() const
{
    return ConnectionPtr(qobject_cast<Connection*>((Connection*) object().data()));
}

/**
 * Return the contacts for which attributes were requested.
 *
 * \return Reference to a list with the handles of the contacts.<commit_msg>PendingContactAttributes: Update docs.<commit_after>/**
 * This file is part of TelepathyQt4
 *
 * @copyright Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
 * @copyright Copyright (C) 2008 Nokia Corporation
 * @license LGPL 2.1
 *
 * 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.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include <TelepathyQt4/PendingContactAttributes>

#include "TelepathyQt4/_gen/pending-contact-attributes.moc.hpp"

#include <TelepathyQt4/Connection>
#include <TelepathyQt4/ReferencedHandles>

#include "TelepathyQt4/debug-internal.h"

namespace Tp
{

/**
 * \class PendingContactAttributes
 * \ingroup clientconn
 * \headerfile TelepathyQt4/pending-contact-attributes.h <TelepathyQt4/PendingContactAttributes>
 *
 * \brief The PendingContactAttributes class represents the parameters of and
 * the reply to an asynchronous request for raw contact attributes, as used in
 * the ConnectionLowlevel::contactAttributes() low-level convenience method wrapping the
 * Client::ConnectionInterfaceContactsInterface::GetContactAttributes() D-Bus
 * method.
 *
 * See \ref async_model
 */

struct TELEPATHY_QT4_NO_EXPORT PendingContactAttributes::Private
{
    UIntList contactsRequested;
    QStringList interfacesRequested;
    bool shouldReference;
    ReferencedHandles validHandles;
    UIntList invalidHandles;
    ContactAttributesMap attributes;
};

PendingContactAttributes::PendingContactAttributes(const ConnectionPtr &connection,
        const UIntList &handles, const QStringList &interfaces, bool reference)
    : PendingOperation(connection),
      mPriv(new Private)
{
    mPriv->contactsRequested = handles;
    mPriv->interfacesRequested = interfaces;
    mPriv->shouldReference = reference;
}

/**
 * Class destructor.
 */
PendingContactAttributes::~PendingContactAttributes()
{
    delete mPriv;
}

/**
 * Return the connection through which the request was made.
 *
 * \return A pointer to the Connection object.
 */
ConnectionPtr PendingContactAttributes::connection() const
{
    return ConnectionPtr(qobject_cast<Connection*>((Connection*) object().data()));
}

/**
 * Return the contacts for which attributes were requested.
 *
 * \return Reference to a list with the handles of the contacts.
{'fraction_non_alphanumeric': 0.08144401813742588, 'fraction_numerical': 0.011161492849668643, 'mean_word_length': 4.672601384767557, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2262265', 'n_tokens_mistral': 1541, 'n_tokens_neox': 1494, 'n_words': 545}