summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Moreira Magalhaes (andrunko) <andre.magalhaes@collabora.co.uk>2010-12-30 15:41:37 -0200
committerAndre Moreira Magalhaes (andrunko) <andre.magalhaes@collabora.co.uk>2010-12-30 15:43:21 -0200
commit548dcabc1d5d5ed62f3e38fdaef2135e3a6a7751 (patch)
tree79a8a1ffdcf70f7f6d51361653269832f226ff81
parent284b22eb721e3f99a2e927b4aec874364f7d952b (diff)
Contact/Manager: Do not use details for publish/subscribe/block signals and use message for publish signals.
-rw-r--r--TelepathyQt4/contact-manager.cpp57
-rw-r--r--TelepathyQt4/contact-manager.h6
-rw-r--r--TelepathyQt4/contact.cpp56
-rw-r--r--TelepathyQt4/contact.h23
4 files changed, 101 insertions, 41 deletions
diff --git a/TelepathyQt4/contact-manager.cpp b/TelepathyQt4/contact-manager.cpp
index 506e9ace..10310fe4 100644
--- a/TelepathyQt4/contact-manager.cpp
+++ b/TelepathyQt4/contact-manager.cpp
@@ -479,7 +479,7 @@ void ContactManager::Private::updateContactsPresenceStateFallback()
contact->setPublishState(SubscriptionStateYes);
} else if (publishContactsLP.contains(contact)) {
contact->setPublishState(SubscriptionStateAsk,
- publishChannel->groupLocalPendingContactChangeInfo(contact));
+ publishChannel->groupLocalPendingContactChangeInfo(contact).message());
} else {
contact->setPublishState(SubscriptionStateNo);
}
@@ -1841,16 +1841,19 @@ void ContactManager::onContactListNewContactsConstructed(Tp::PendingOperation *o
}
contact->setSubscriptionState((SubscriptionState) subscriptions.subscribe);
- Channel::GroupMemberChangeDetails publishRequestDetails;
if (!subscriptions.publishRequest.isEmpty() &&
subscriptions.publish == SubscriptionStateAsk) {
+ Channel::GroupMemberChangeDetails publishRequestDetails;
QVariantMap detailsMap;
detailsMap.insert(QLatin1String("message"), subscriptions.publishRequest);
publishRequestDetails = Channel::GroupMemberChangeDetails(ContactPtr(), detailsMap);
-
+ // FIXME (API/ABI break) remove signal with details
emit presencePublicationRequested(Contacts() << contact, publishRequestDetails);
+
+ emit presencePublicationRequested(Contacts() << contact, subscriptions.publishRequest);
}
- contact->setPublishState((SubscriptionState) subscriptions.publish, publishRequestDetails);
+ contact->setPublishState((SubscriptionState) subscriptions.publish,
+ subscriptions.publishRequest);
}
foreach (uint bareHandle, info.removals) {
@@ -1973,17 +1976,17 @@ void ContactManager::onSubscribeChannelMembersChangedFallback(
foreach (ContactPtr contact, groupMembersAdded) {
debug() << "Contact" << contact->id() << "on subscribe list";
- contact->setSubscriptionState(SubscriptionStateYes, details);
+ contact->setSubscriptionState(SubscriptionStateYes);
}
foreach (ContactPtr contact, groupRemotePendingMembersAdded) {
debug() << "Contact" << contact->id() << "added to subscribe list";
- contact->setSubscriptionState(SubscriptionStateAsk, details);
+ contact->setSubscriptionState(SubscriptionStateAsk);
}
foreach (ContactPtr contact, groupMembersRemoved) {
debug() << "Contact" << contact->id() << "removed from subscribe list";
- contact->setSubscriptionState(SubscriptionStateNo, details);
+ contact->setSubscriptionState(SubscriptionStateNo);
}
// Perform the needed computation for allKnownContactsChanged
@@ -2005,22 +2008,26 @@ void ContactManager::onPublishChannelMembersChangedFallback(
foreach (ContactPtr contact, groupMembersAdded) {
debug() << "Contact" << contact->id() << "on publish list";
- contact->setPublishState(SubscriptionStateYes, details);
+ contact->setPublishState(SubscriptionStateYes);
}
foreach (ContactPtr contact, groupLocalPendingMembersAdded) {
debug() << "Contact" << contact->id() << "added to publish list";
- contact->setPublishState(SubscriptionStateAsk, details);
+ contact->setPublishState(SubscriptionStateAsk, details.message());
}
foreach (ContactPtr contact, groupMembersRemoved) {
debug() << "Contact" << contact->id() << "removed from publish list";
- contact->setPublishState(SubscriptionStateNo, details);
+ contact->setPublishState(SubscriptionStateNo);
}
if (!groupLocalPendingMembersAdded.isEmpty()) {
+ // FIXME (API/ABI break) remove signal with details
emit presencePublicationRequested(groupLocalPendingMembersAdded,
details);
+
+ emit presencePublicationRequested(groupLocalPendingMembersAdded,
+ details.message());
}
// Perform the needed computation for allKnownContactsChanged
@@ -2046,12 +2053,12 @@ void ContactManager::onDenyChannelMembersChanged(
foreach (ContactPtr contact, groupMembersAdded) {
debug() << "Contact" << contact->id() << "added to deny list";
- contact->setBlocked(true, details);
+ contact->setBlocked(true);
}
foreach (ContactPtr contact, groupMembersRemoved) {
debug() << "Contact" << contact->id() << "removed from deny list";
- contact->setBlocked(false, details);
+ contact->setBlocked(false);
}
}
@@ -2321,13 +2328,22 @@ uint ContactManager::ContactListChannel::typeForIdentifier(const QString &identi
}
/**
- * \fn void ContactManager::presencePublicationRequested(const Tp::Contacts &contacts);
- * const Tp::Channel::GroupMemberChangeDetails &details);
+ * \fn void ContactManager::presencePublicationRequested(const Tp::Contacts &contacts,
+ * const QString &message);
*
* This signal is emitted whenever some contacts request for presence publication.
*
* \param contacts A set of contacts which requested presence publication.
- * \param details The request details.
+ * \param message An optional message that was sent by the contacts asking to receive the local
+ * user's presence.
+ */
+
+/**
+ * \fn void ContactManager::presencePublicationRequested(const Tp::Contacts &contacts,
+ * const Tp::Channel::GroupMemberChangeDetails &details);
+ *
+ * \deprecated Use presencePublicationRequested(const Tp::Contacts &contact, const QString &message)
+ * instead.
*/
/**
@@ -2402,4 +2418,15 @@ void PendingContactManagerRemoveContactListGroup::onChannelClosed(PendingOperati
}
}
+void ContactManager::connectNotify(const char *signalName)
+{
+ if (qstrcmp(signalName, SIGNAL(subscriptionStateChanged(Tp::Contact::PresenceState,Tp::Channel::GroupMemberChangeDetails))) == 0) {
+ warning() << "Connecting to deprecated signal subscriptionStateChanged(Tp::Contact::PresenceState,Tp::Channel::GroupMemberChangeDetails)";
+ } else if (qstrcmp(signalName, SIGNAL(publishStateChanged(Tp::Contact::PresenceState,Tp::Channel::GroupMemberChangeDetails))) == 0) {
+ warning() << "Connecting to deprecated signal publishStateChanged(Tp::Contact::PresenceState,Tp::Channel::GroupMemberChangeDetails)";
+ } else if (qstrcmp(signalName, SIGNAL(blockStatusChanged(bool,Tp::Channel::GroupMemberChangeDetails))) == 0) {
+ warning() << "Connecting to deprecated signal blockStatusChanged(bool,Tp::Channel::GroupMemberChangeDetails)";
+ }
+}
+
} // Tp
diff --git a/TelepathyQt4/contact-manager.h b/TelepathyQt4/contact-manager.h
index ef613e4a..a676c386 100644
--- a/TelepathyQt4/contact-manager.h
+++ b/TelepathyQt4/contact-manager.h
@@ -117,6 +117,8 @@ public:
void requestContactAvatar(Contact *contact);
Q_SIGNALS:
+ void presencePublicationRequested(const Tp::Contacts &contacts, const QString &message);
+ // deprecated
void presencePublicationRequested(const Tp::Contacts &contacts,
const Tp::Channel::GroupMemberChangeDetails &details);
@@ -133,6 +135,10 @@ Q_SIGNALS:
const Tp::Contacts &contactsRemoved,
const Tp::Channel::GroupMemberChangeDetails &details);
+protected:
+ // FIXME: (API/ABI break) Remove connectNotify
+ void connectNotify(const char *);
+
private Q_SLOTS:
void onAliasesChanged(const Tp::AliasPairList &);
void doRequestAvatars();
diff --git a/TelepathyQt4/contact.cpp b/TelepathyQt4/contact.cpp
index 094d7c8a..54b2fa42 100644
--- a/TelepathyQt4/contact.cpp
+++ b/TelepathyQt4/contact.cpp
@@ -80,7 +80,7 @@ struct TELEPATHY_QT4_NO_EXPORT Contact::Private
SubscriptionState subscriptionState;
SubscriptionState publishState;
- Channel::GroupMemberChangeDetails publishStateDetails;
+ QString publishStateMessage;
bool blocked;
QSet<QString> groups;
@@ -423,9 +423,9 @@ Contact::PresenceState Contact::publishState() const
return subscriptionStateToPresenceState(mPriv->publishState);
}
-Channel::GroupMemberChangeDetails Contact::publishStateDetails() const
+QString Contact::publishStateMessage() const
{
- return mPriv->publishStateDetails;
+ return mPriv->publishStateMessage;
}
PendingOperation *Contact::requestPresenceSubscription(const QString &message)
@@ -529,13 +529,7 @@ void Contact::augment(const Features &requestedFeatures, const QVariantMap &attr
TP_QT4_IFACE_CONNECTION_INTERFACE_CONTACT_LIST + QLatin1String("/publish")));
QString publishRequest = qdbus_cast<QString>(attributes.value(
TP_QT4_IFACE_CONNECTION_INTERFACE_CONTACT_LIST + QLatin1String("/publish-request")));
- Channel::GroupMemberChangeDetails publishRequestDetails;
- if (!publishRequest.isEmpty() && publishState == SubscriptionStateAsk) {
- QVariantMap detailsMap;
- detailsMap.insert(QLatin1String("message"), publishRequest);
- publishRequestDetails = Channel::GroupMemberChangeDetails(ContactPtr(), detailsMap);
- }
- setPublishState((SubscriptionState) publishState, publishRequestDetails);
+ setPublishState((SubscriptionState) publishState, publishRequest);
}
foreach (const Feature &feature, requestedFeatures) {
@@ -752,34 +746,51 @@ Contact::PresenceState Contact::subscriptionStateToPresenceState(uint subscripti
}
}
-void Contact::setSubscriptionState(SubscriptionState state,
- const Channel::GroupMemberChangeDetails &details)
+void Contact::setSubscriptionState(SubscriptionState state)
{
if (mPriv->subscriptionState == state) {
return;
}
+
mPriv->subscriptionState = state;
- emit subscriptionStateChanged(subscriptionStateToPresenceState(state), details);
+
+ // FIXME (API/ABI break) remove signal with details
+ emit subscriptionStateChanged(subscriptionStateToPresenceState(state),
+ Channel::GroupMemberChangeDetails());
+
+ emit subscriptionStateChanged(subscriptionStateToPresenceState(state));
}
-void Contact::setPublishState(SubscriptionState state,
- const Channel::GroupMemberChangeDetails &details)
+void Contact::setPublishState(SubscriptionState state, const QString &message)
{
if (mPriv->publishState == state) {
return;
}
+
mPriv->publishState = state;
- mPriv->publishStateDetails = details;
- emit publishStateChanged(subscriptionStateToPresenceState(state), details);
+ mPriv->publishStateMessage = message;
+
+ // FIXME (API/ABI break) remove signal with details
+ QVariantMap detailsMap;
+ detailsMap.insert(QLatin1String("message"), message);
+ emit publishStateChanged(subscriptionStateToPresenceState(state),
+ Channel::GroupMemberChangeDetails(ContactPtr(), detailsMap));
+
+ emit publishStateChanged(subscriptionStateToPresenceState(state), message);
}
-void Contact::setBlocked(bool value, const Channel::GroupMemberChangeDetails &details)
+void Contact::setBlocked(bool value)
{
if (mPriv->blocked == value) {
return;
}
+
mPriv->blocked = value;
- emit blockStatusChanged(value, details);
+
+ // FIXME (API/ABI break) remove signal with details
+ emit blockStatusChanged(value, Channel::GroupMemberChangeDetails());
+
+ emit blockStatusChanged(value);
}
void Contact::setAddedToGroup(const QString &group)
@@ -815,4 +826,11 @@ void Contact::setRemovedFromGroup(const QString &group)
* \sa infoFields()
*/
+void Contact::connectNotify(const char *signalName)
+{
+ if (qstrcmp(signalName, SIGNAL(presencePublicationRequested(Tp::Contacts,Tp::Channel::GroupMemberChangeDetails))) == 0) {
+ warning() << "Connecting to deprecated signal presencePublicationRequested(Tp::Contacts,Tp::Channel::GroupMemberChangeDetails)";
+ }
+}
+
} // Tp
diff --git a/TelepathyQt4/contact.h b/TelepathyQt4/contact.h
index 56ff5fb7..b2544bca 100644
--- a/TelepathyQt4/contact.h
+++ b/TelepathyQt4/contact.h
@@ -137,7 +137,7 @@ public:
bool isPublishStateKnown() const;
bool isPublishCancelled() const;
PresenceState publishState() const;
- Channel::GroupMemberChangeDetails publishStateDetails() const;
+ QString publishStateMessage() const;
PendingOperation *requestPresenceSubscription(const QString &message = QString());
PendingOperation *removePresenceSubscription(const QString &message = QString());
@@ -173,10 +173,18 @@ Q_SIGNALS:
void infoFieldsChanged(const Tp::Contact::InfoFields &infoFields);
+ void subscriptionStateChanged(Tp::Contact::PresenceState state);
+ // deprecated
void subscriptionStateChanged(Tp::Contact::PresenceState state,
const Tp::Channel::GroupMemberChangeDetails &details);
+
+ void publishStateChanged(Tp::Contact::PresenceState state, const QString &message);
+ // deprecated
void publishStateChanged(Tp::Contact::PresenceState state,
const Tp::Channel::GroupMemberChangeDetails &details);
+
+ void blockStatusChanged(bool blocked);
+ // deprecated
void blockStatusChanged(bool blocked, const Tp::Channel::GroupMemberChangeDetails &details);
void addedToGroup(const QString &group);
@@ -188,6 +196,10 @@ Q_SIGNALS:
// with that contact getting the same features requested as the current one. Or would we rather
// want to signal that change right away with a handle?
+protected:
+ // FIXME: (API/ABI break) Remove connectNotify
+ void connectNotify(const char *);
+
private:
static const Feature FeatureRosterGroups;
@@ -206,12 +218,9 @@ private:
void receiveInfo(const ContactInfoFieldList &info);
static PresenceState subscriptionStateToPresenceState(uint subscriptionState);
- void setSubscriptionState(SubscriptionState state,
- const Channel::GroupMemberChangeDetails &details = Channel::GroupMemberChangeDetails());
- void setPublishState(SubscriptionState state,
- const Channel::GroupMemberChangeDetails &details = Channel::GroupMemberChangeDetails());
- void setBlocked(bool value, const Channel::GroupMemberChangeDetails &details =
- Channel::GroupMemberChangeDetails());
+ void setSubscriptionState(SubscriptionState state);
+ void setPublishState(SubscriptionState state, const QString &message = QString());
+ void setBlocked(bool value);
void setAddedToGroup(const QString &group);
void setRemovedFromGroup(const QString &group);