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

contact-manager.h

    00001
    00023 #ifndef _TelepathyQt4_contact_manager_h_HEADER_GUARD_
    00024 #define _TelepathyQt4_contact_manager_h_HEADER_GUARD_
    00025
    00026 #ifndef IN_TELEPATHY_QT4_HEADER
    00027 #error IN_TELEPATHY_QT4_HEADER
    00028 #endif
    00029
    00030 #include <TelepathyQt4/Channel>
    00031 #include <TelepathyQt4/Contact>
    00032 #include <TelepathyQt4/Feature>
    00033 #include <TelepathyQt4/Object>
    00034 #include <TelepathyQt4/ReferencedHandles>
    00035 #include <TelepathyQt4/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 TELEPATHY_QT4_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     TELEPATHY_QT4_DEPRECATED PendingOperation *blockContacts(
    00106             const QList<ContactPtr> &contacts, bool value);
    00107     PendingOperation *blockContacts(const QList<ContactPtr> &contacts);
    00108     PendingOperation *blockContactsAndReportAbuse(const QList<ContactPtr> &contacts);
    00109     PendingOperation *unblockContacts(const QList<ContactPtr> &contacts);
    00110
    00111     PendingContacts *contactsForHandles(const UIntList &handles,
    00112             const Features &features = Features());
    00113     PendingContacts *contactsForHandles(const ReferencedHandles &handles,
    00114             const Features &features = Features());
    00115     PendingContacts *contactsForHandles(const HandleIdentifierMap &handles,
    00116             const Features &features = Features());
    00117
    00118     PendingContacts *contactsForIdentifiers(const QStringList &identifiers,
    00119             const Features &features = Features());
    00120
    00121     PendingContacts *upgradeContacts(const QList<ContactPtr> &contacts,
    00122             const Features &features);
    00123
    00124     ContactPtr lookupContactByHandle(uint handle);
    00125
    00126     TELEPATHY_QT4_DEPRECATED void requestContactAvatar(Contact *contact);
    00127     void requestContactAvatars(const QList<ContactPtr> &contacts);
    00128
    00129     PendingOperation *refreshContactInfo(const QList<ContactPtr> &contact);
    00130
    00131 Q_SIGNALS:
    00132     void stateChanged(Tp::ContactListState state);
    00133
    00134     void presencePublicationRequested(const Tp::Contacts &contacts);
    00135     // deprecated - carry redundant data which can be retrieved (meaningfully) from the Contacts
    00136     // themselves (note: multiple contacts, but just a single message/details!)
    00137     void presencePublicationRequested(const Tp::Contacts &contacts, const QString &message);
    00138     void presencePublicationRequested(const Tp::Contacts &contacts,
    00139         const Tp::Channel::GroupMemberChangeDetails &details);
    00140
    00141     void groupAdded(const QString &group);
    00142     void groupRenamed(const QString &oldGroup, const QString &newGroup);
    00143     void groupRemoved(const QString &group);
    00144
    00145     void groupMembersChanged(const QString &group,
    00146             const Tp::Contacts &groupMembersAdded,
    00147             const Tp::Contacts &groupMembersRemoved,
    00148             const Tp::Channel::GroupMemberChangeDetails &details);
    00149
    00150     void allKnownContactsChanged(const Tp::Contacts &contactsAdded,
    00151             const Tp::Contacts &contactsRemoved,
    00152             const Tp::Channel::GroupMemberChangeDetails &details);
    00153
    00154 protected:
    00155     // FIXME: (API/ABI break) Remove connectNotify
    00156     void connectNotify(const char *);
    00157
    00158 private Q_SLOTS:
    00159     TELEPATHY_QT4_NO_EXPORT void onAliasesChanged(const Tp::AliasPairList &);
    00160     TELEPATHY_QT4_NO_EXPORT void doRequestAvatars();
    00161     TELEPATHY_QT4_NO_EXPORT void onAvatarUpdated(uint, const QString &);
    00162     TELEPATHY_QT4_NO_EXPORT void onAvatarRetrieved(uint, const QString &, const QByteArray &, const QString &);
    00163     TELEPATHY_QT4_NO_EXPORT void onPresencesChanged(const Tp::SimpleContactPresences &);
    00164     TELEPATHY_QT4_NO_EXPORT void onCapabilitiesChanged(const Tp::ContactCapabilitiesMap &);
    00165     TELEPATHY_QT4_NO_EXPORT void onLocationUpdated(uint, const QVariantMap &);
    00166     TELEPATHY_QT4_NO_EXPORT void onContactInfoChanged(uint, const Tp::ContactInfoFieldList &);
    00167     TELEPATHY_QT4_NO_EXPORT void doRefreshInfo();
    00168
    00169 private:
    00170     class PendingRefreshContactInfo;
    00171     class Roster;
    00172     friend class Connection;
    00173     friend class PendingContacts;
    00174     friend class PendingRefreshContactInfo;
    00175     friend class Roster;
    00176
    00177     TELEPATHY_QT4_NO_EXPORT ContactManager(Connection *parent);
    00178
    00179     TELEPATHY_QT4_NO_EXPORT ContactPtr ensureContact(const ReferencedHandles &handle,
    00180             const Features &features,
    00181             const QVariantMap &attributes);
    00182     TELEPATHY_QT4_NO_EXPORT ContactPtr ensureContact(uint bareHandle,
    00183             const QString &id, const Features &features);
    00184
    00185     TELEPATHY_QT4_NO_EXPORT static QString featureToInterface(const Feature &feature);
    00186     TELEPATHY_QT4_NO_EXPORT void ensureTracking(const Feature &feature);
    00187
    00188     TELEPATHY_QT4_NO_EXPORT PendingOperation *introspectRoster();
    00189     TELEPATHY_QT4_NO_EXPORT PendingOperation *introspectRosterGroups();
    00190     TELEPATHY_QT4_NO_EXPORT void resetRoster();
    00191
    00192     TELEPATHY_QT4_NO_EXPORT PendingOperation *refreshContactInfo(Contact *contact);
    00193
    00194     struct Private;
    00195     friend struct Private;
    00196     Private *mPriv;
    00197 };
    00198
    00199 } // Tp
    00200
    00201 #endif