Home · Modules · All Classes · All Namespaces
contact-manager.h
1 
23 #ifndef _TelepathyQt_contact_manager_h_HEADER_GUARD_
24 #define _TelepathyQt_contact_manager_h_HEADER_GUARD_
25 
26 #ifndef IN_TP_QT_HEADER
27 #error IN_TP_QT_HEADER
28 #endif
29 
30 #include <TelepathyQt/Channel>
31 #include <TelepathyQt/Contact>
32 #include <TelepathyQt/Feature>
33 #include <TelepathyQt/Object>
34 #include <TelepathyQt/ReferencedHandles>
35 #include <TelepathyQt/Types>
36 
37 #include <QList>
38 #include <QSet>
39 #include <QString>
40 #include <QStringList>
41 #include <QVariantMap>
42 
43 namespace Tp
44 {
45 
46 class Connection;
47 class PendingContacts;
48 class PendingOperation;
49 
50 class TP_QT_EXPORT ContactManager : public Object
51 {
52  Q_OBJECT
53  Q_DISABLE_COPY(ContactManager)
54 
55 public:
56  virtual ~ContactManager();
57 
58  ConnectionPtr connection() const;
59 
60  Features supportedFeatures() const;
61 
62  ContactListState state() const;
63 
64  Contacts allKnownContacts() const;
65  QStringList allKnownGroups() const;
66 
67  PendingOperation *addGroup(const QString &group);
68  PendingOperation *removeGroup(const QString &group);
69 
70  Contacts groupContacts(const QString &group) const;
71  PendingOperation *addContactsToGroup(const QString &group,
72  const QList<ContactPtr> &contacts);
73  PendingOperation *removeContactsFromGroup(const QString &group,
74  const QList<ContactPtr> &contacts);
75 
76  bool canRequestPresenceSubscription() const;
77  bool subscriptionRequestHasMessage() const;
78  PendingOperation *requestPresenceSubscription(
79  const QList<ContactPtr> &contacts,
80  const QString &message = QString());
81  bool canRemovePresenceSubscription() const;
82  bool subscriptionRemovalHasMessage() const;
83  bool canRescindPresenceSubscriptionRequest() const;
84  bool subscriptionRescindingHasMessage() const;
85  PendingOperation *removePresenceSubscription(
86  const QList<ContactPtr> &contacts,
87  const QString &message = QString());
88  bool canAuthorizePresencePublication() const;
89  bool publicationAuthorizationHasMessage() const;
90  PendingOperation *authorizePresencePublication(
91  const QList<ContactPtr> &contacts,
92  const QString &message = QString());
93  bool publicationRejectionHasMessage() const;
94  bool canRemovePresencePublication() const;
95  bool publicationRemovalHasMessage() const;
96  PendingOperation *removePresencePublication(
97  const QList<ContactPtr> &contacts,
98  const QString &message = QString());
99  PendingOperation *removeContacts(
100  const QList<ContactPtr> &contacts,
101  const QString &message = QString());
102 
103  bool canBlockContacts() const;
104  bool canReportAbuse() const;
105  PendingOperation *blockContacts(const QList<ContactPtr> &contacts);
106  PendingOperation *blockContactsAndReportAbuse(const QList<ContactPtr> &contacts);
107  PendingOperation *unblockContacts(const QList<ContactPtr> &contacts);
108 
109  PendingContacts *contactsForHandles(const UIntList &handles,
110  const Features &features = Features());
111  PendingContacts *contactsForHandles(const ReferencedHandles &handles,
112  const Features &features = Features());
113  PendingContacts *contactsForHandles(const HandleIdentifierMap &handles,
114  const Features &features = Features());
115 
116  PendingContacts *contactsForIdentifiers(const QStringList &identifiers,
117  const Features &features = Features());
118 
119  PendingContacts *contactsForVCardAddresses(const QString &vcardField,
120  const QStringList &vcardAddresses,
121  const Features &features = Features());
122  PendingContacts *contactsForUris(const QStringList &uris,
123  const Features &features = Features());
124 
125  PendingContacts *upgradeContacts(const QList<ContactPtr> &contacts,
126  const Features &features);
127 
128  void requestContactAvatars(const QList<ContactPtr> &contacts);
129 
130  PendingOperation *refreshContactInfo(const QList<ContactPtr> &contact);
131 
132 Q_SIGNALS:
133  void stateChanged(Tp::ContactListState state);
134 
135  void presencePublicationRequested(const Tp::Contacts &contacts);
136 
137  void groupAdded(const QString &group);
138  void groupRenamed(const QString &oldGroup, const QString &newGroup);
139  void groupRemoved(const QString &group);
140 
141  void groupMembersChanged(const QString &group,
142  const Tp::Contacts &groupMembersAdded,
143  const Tp::Contacts &groupMembersRemoved,
145 
146  void allKnownContactsChanged(const Tp::Contacts &contactsAdded,
147  const Tp::Contacts &contactsRemoved,
149 
150 private Q_SLOTS:
151  TP_QT_NO_EXPORT void onAliasesChanged(const Tp::AliasPairList &);
152  TP_QT_NO_EXPORT void doRequestAvatars();
153  TP_QT_NO_EXPORT void onAvatarUpdated(uint, const QString &);
154  TP_QT_NO_EXPORT void onAvatarRetrieved(uint, const QString &, const QByteArray &, const QString &);
155  TP_QT_NO_EXPORT void onPresencesChanged(const Tp::SimpleContactPresences &);
156  TP_QT_NO_EXPORT void onCapabilitiesChanged(const Tp::ContactCapabilitiesMap &);
157  TP_QT_NO_EXPORT void onLocationUpdated(uint, const QVariantMap &);
158  TP_QT_NO_EXPORT void onContactInfoChanged(uint, const Tp::ContactInfoFieldList &);
159  TP_QT_NO_EXPORT void onClientTypesUpdated(uint, const QStringList &);
160  TP_QT_NO_EXPORT void doRefreshInfo();
161 
162 private:
163  class PendingRefreshContactInfo;
164  class Roster;
165  friend class Channel;
166  friend class Connection;
167  friend class PendingContacts;
168  friend class PendingRefreshContactInfo;
169  friend class Roster;
170 
171  TP_QT_NO_EXPORT ContactManager(Connection *parent);
172 
173  TP_QT_NO_EXPORT ContactPtr lookupContactByHandle(uint handle);
174 
175  TP_QT_NO_EXPORT ContactPtr ensureContact(const ReferencedHandles &handle,
176  const Features &features,
177  const QVariantMap &attributes);
178  TP_QT_NO_EXPORT ContactPtr ensureContact(uint bareHandle,
179  const QString &id, const Features &features);
180 
181  TP_QT_NO_EXPORT static QString featureToInterface(const Feature &feature);
182  TP_QT_NO_EXPORT void ensureTracking(const Feature &feature);
183 
184  TP_QT_NO_EXPORT PendingOperation *introspectRoster();
185  TP_QT_NO_EXPORT PendingOperation *introspectRosterGroups();
186  TP_QT_NO_EXPORT void resetRoster();
187 
188  TP_QT_NO_EXPORT PendingOperation *refreshContactInfo(Contact *contact);
189 
190  struct Private;
191  friend struct Private;
192  Private *mPriv;
193 };
194 
195 } // Tp
196 
197 #endif
The ContactManager class is responsible for managing contacts.
Definition: contact-manager.h:50
Definition: build/TelepathyQt/_gen/types.h:109
Definition: build/TelepathyQt/_gen/types.h:3476
QList< ContactInfoField > ContactInfoFieldList
Definition: build/TelepathyQt/_gen/types.h:1213
QList< AliasPair > AliasPairList
Definition: build/TelepathyQt/_gen/types.h:238
The Channel class represents a Telepathy channel.
Definition: channel.h:51
The Feature class represents a feature that can be enabled on demand.
Definition: feature.h:41
ContactListState
Definition: build/TelepathyQt/_gen/constants.h:1732
Helper container for safe management of handle lifetimes. Every handle in a ReferencedHandles contain...
Definition: referenced-handles.h:47
The PendingContacts class is used by ContactManager when creating/updating Contact objects.
Definition: pending-contacts.h:46
The Connection class represents a Telepathy connection.
Definition: connection.h:61
Definition: build/TelepathyQt/_gen/types.h:3880
The Channel::GroupMemberChangeDetails class represents the details of a group membership change.
Definition: channel.h:105
The Features class represents a list of Feature.
Definition: feature.h:61
The Contact class represents a Telepathy contact.
Definition: contact.h:51
Definition: build/TelepathyQt/_gen/types.h:1677
The Object class provides an object with property notification.
Definition: object.h:39
Definition: abstract-adaptor.cpp:31
The PendingOperation class is a base class for pending asynchronous operations.
Definition: pending-operation.h:45