| Home · All Classes · All Namespaces · Modules · Functions · Files

contact-manager.h

    00001
    00023 #ifndef _TelepathyQt_contact_manager_h_HEADER_GUARD_
    00024 #define _TelepathyQt_contact_manager_h_HEADER_GUARD_
    00025
    00026 #ifndef IN_TP_QT_HEADER
    00027 #error IN_TP_QT_HEADER
    00028 #endif
    00029
    00030 #include <TelepathyQt/Channel>
    00031 #include <TelepathyQt/Contact>
    00032 #include <TelepathyQt/Feature>
    00033 #include <TelepathyQt/Object>
    00034 #include <TelepathyQt/ReferencedHandles>
    00035 #include <TelepathyQt/Types>
    00036
    00037 #include <QList>
    00038 #include <QSet>
    00039 #include <QString>
    00040 #include <QStringList>
    00041 #include <QVariantMap>
    00042
    00043 namespace Tp
    00044 {
    00045
    00046 class Connection;
    00047 class PendingContacts;
    00048 class PendingOperation;
    00049
    00050 class TP_QT_EXPORT ContactManager : public Object
    00051 {
    00052     Q_OBJECT
    00053     Q_DISABLE_COPY(ContactManager)
    00054
    00055 public:
    00056     virtual ~ContactManager();
    00057
    00058     ConnectionPtr connection() const;
    00059
    00060     Features supportedFeatures() const;
    00061
    00062     ContactListState state() const;
    00063
    00064     Contacts allKnownContacts() const;
    00065     QStringList allKnownGroups() const;
    00066
    00067     PendingOperation *addGroup(const QString &group);
    00068     PendingOperation *removeGroup(const QString &group);
    00069
    00070     Contacts groupContacts(const QString &group) const;
    00071     PendingOperation *addContactsToGroup(const QString &group,
    00072             const QList<ContactPtr> &contacts);
    00073     PendingOperation *removeContactsFromGroup(const QString &group,
    00074             const QList<ContactPtr> &contacts);
    00075
    00076     bool canRequestPresenceSubscription() const;
    00077     bool subscriptionRequestHasMessage() const;
    00078     PendingOperation *requestPresenceSubscription(
    00079             const QList<ContactPtr> &contacts,
    00080             const QString &message = QString());
    00081     bool canRemovePresenceSubscription() const;
    00082     bool subscriptionRemovalHasMessage() const;
    00083     bool canRescindPresenceSubscriptionRequest() const;
    00084     bool subscriptionRescindingHasMessage() const;
    00085     PendingOperation *removePresenceSubscription(
    00086             const QList<ContactPtr> &contacts,
    00087             const QString &message = QString());
    00088     bool canAuthorizePresencePublication() const;
    00089     bool publicationAuthorizationHasMessage() const;
    00090     PendingOperation *authorizePresencePublication(
    00091             const QList<ContactPtr> &contacts,
    00092             const QString &message = QString());
    00093     bool publicationRejectionHasMessage() const;
    00094     bool canRemovePresencePublication() const;
    00095     bool publicationRemovalHasMessage() const;
    00096     PendingOperation *removePresencePublication(
    00097             const QList<ContactPtr> &contacts,
    00098             const QString &message = QString());
    00099     PendingOperation *removeContacts(
    00100             const QList<ContactPtr> &contacts,
    00101             const QString &message = QString());
    00102
    00103     bool canBlockContacts() const;
    00104     bool canReportAbuse() const;
    00105     PendingOperation *blockContacts(const QList<ContactPtr> &contacts);
    00106     PendingOperation *blockContactsAndReportAbuse(const QList<ContactPtr> &contacts);
    00107     PendingOperation *unblockContacts(const QList<ContactPtr> &contacts);
    00108
    00109     PendingContacts *contactsForHandles(const UIntList &handles,
    00110             const Features &features = Features());
    00111     PendingContacts *contactsForHandles(const ReferencedHandles &handles,
    00112             const Features &features = Features());
    00113     PendingContacts *contactsForHandles(const HandleIdentifierMap &handles,
    00114             const Features &features = Features());
    00115
    00116     PendingContacts *contactsForIdentifiers(const QStringList &identifiers,
    00117             const Features &features = Features());
    00118
    00119     PendingContacts *contactsForVCardAddresses(const QString &vcardField,
    00120             const QStringList &vcardAddresses,
    00121             const Features &features = Features());
    00122     PendingContacts *contactsForUris(const QStringList &uris,
    00123             const Features &features = Features());
    00124
    00125     PendingContacts *upgradeContacts(const QList<ContactPtr> &contacts,
    00126             const Features &features);
    00127
    00128     void requestContactAvatars(const QList<ContactPtr> &contacts);
    00129
    00130     PendingOperation *refreshContactInfo(const QList<ContactPtr> &contact);
    00131
    00132 Q_SIGNALS:
    00133     void stateChanged(Tp::ContactListState state);
    00134
    00135     void presencePublicationRequested(const Tp::Contacts &contacts);
    00136
    00137     void groupAdded(const QString &group);
    00138     void groupRenamed(const QString &oldGroup, const QString &newGroup);
    00139     void groupRemoved(const QString &group);
    00140
    00141     void groupMembersChanged(const QString &group,
    00142             const Tp::Contacts &groupMembersAdded,
    00143             const Tp::Contacts &groupMembersRemoved,
    00144             const Tp::Channel::GroupMemberChangeDetails &details);
    00145
    00146     void allKnownContactsChanged(const Tp::Contacts &contactsAdded,
    00147             const Tp::Contacts &contactsRemoved,
    00148             const Tp::Channel::GroupMemberChangeDetails &details);
    00149
    00150 private Q_SLOTS:
    00151     TP_QT_NO_EXPORT void onAliasesChanged(const Tp::AliasPairList &);
    00152     TP_QT_NO_EXPORT void doRequestAvatars();
    00153     TP_QT_NO_EXPORT void onAvatarUpdated(uint, const QString &);
    00154     TP_QT_NO_EXPORT void onAvatarRetrieved(uint, const QString &, const QByteArray &, const QString &);
    00155     TP_QT_NO_EXPORT void onPresencesChanged(const Tp::SimpleContactPresences &);
    00156     TP_QT_NO_EXPORT void onCapabilitiesChanged(const Tp::ContactCapabilitiesMap &);
    00157     TP_QT_NO_EXPORT void onLocationUpdated(uint, const QVariantMap &);
    00158     TP_QT_NO_EXPORT void onContactInfoChanged(uint, const Tp::ContactInfoFieldList &);
    00159     TP_QT_NO_EXPORT void doRefreshInfo();
    00160
    00161 private:
    00162     class PendingRefreshContactInfo;
    00163     class Roster;
    00164     friend class Channel;
    00165     friend class Connection;
    00166     friend class PendingContacts;
    00167     friend class PendingRefreshContactInfo;
    00168     friend class Roster;
    00169
    00170     TP_QT_NO_EXPORT ContactManager(Connection *parent);
    00171
    00172     TP_QT_NO_EXPORT ContactPtr lookupContactByHandle(uint handle);
    00173
    00174     TP_QT_NO_EXPORT ContactPtr ensureContact(const ReferencedHandles &handle,
    00175             const Features &features,
    00176             const QVariantMap &attributes);
    00177     TP_QT_NO_EXPORT ContactPtr ensureContact(uint bareHandle,
    00178             const QString &id, const Features &features);
    00179
    00180     TP_QT_NO_EXPORT static QString featureToInterface(const Feature &feature);
    00181     TP_QT_NO_EXPORT void ensureTracking(const Feature &feature);
    00182
    00183     TP_QT_NO_EXPORT PendingOperation *introspectRoster();
    00184     TP_QT_NO_EXPORT PendingOperation *introspectRosterGroups();
    00185     TP_QT_NO_EXPORT void resetRoster();
    00186
    00187     TP_QT_NO_EXPORT PendingOperation *refreshContactInfo(Contact *contact);
    00188
    00189     struct Private;
    00190     friend struct Private;
    00191     Private *mPriv;
    00192 };
    00193
    00194 } // Tp
    00195
    00196 #endif