[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9
Maximiliano Curia
maxy at moszumanska.debian.org
Mon May 9 09:07:11 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=7a683a0
The following commit has been merged in the master branch:
commit 7a683a033346e6c1898c103a79c3049dae260939
Author: Dario Freddi <drf at kde.org>
Date: Mon May 17 16:01:38 2010 +0000
Add contact capabilities to the database. A change to the ontology was needed
Signed-off-by: Dario Freddi <dario.freddi at collabora.co.uk>
svn path=/trunk/playground/network/telepathy-integration-daemon/; revision=1127774
---
kpeople/nepomuk-feeder/telepathy.trig | 23 ++++++++++
kpeople/nepomuk-feeder/telepathyaccount.cpp | 3 +-
kpeople/nepomuk-feeder/telepathycontact.cpp | 70 ++++++++++++++++++++++++++++-
kpeople/nepomuk-feeder/telepathycontact.h | 4 ++
4 files changed, 98 insertions(+), 2 deletions(-)
diff --git a/kpeople/nepomuk-feeder/telepathy.trig b/kpeople/nepomuk-feeder/telepathy.trig
index b8681fd..fb1cead 100644
--- a/kpeople/nepomuk-feeder/telepathy.trig
+++ b/kpeople/nepomuk-feeder/telepathy.trig
@@ -55,6 +55,29 @@ telepathy: {telepathy:accountIdentifier
rdfs:domain nco:IMAccount ;
rdfs:label "requestedSubscriptionTo" ;
rdfs:range nco:IMAccount .
+
+ telepathy:IMCapability
+ a rdfs:Class ;
+ rdfs:label "IM Capabilities" ;
+ rdfs:comment "Features of a certain IM connection (depends on the IMAccount implementation used by the Contact)" ;
+ rdfs:subClassOf rdfs:Resource .
+
+ telepathy:im-capability-text-chat a nco:IMCapability .
+ telepathy:im-capability-media-calls a nco:IMCapability .
+ telepathy:im-capability-audio-calls a nco:IMCapability .
+ telepathy:im-capability-video-calls a nco:IMCapability .
+ telepathy:im-capability-upgrading-calls a nco:IMCapability .
+ telepathy:im-capability-file-transfers a nco:IMCapability .
+ telepathy:im-capability-stream-tubes a nco:IMCapability .
+ telepathy:im-capability-dbus-tubes a nco:IMCapability .
+
+ telepathy:imCapability
+ a rdf:Property ;
+ rdfs:label "imContact Capability";
+ rdfs:comment "Capabilities of an IM Contact, defining how can we interact with him";
+ rdfs:domain nco:IMAccount ;
+ rdfs:range nco:IMCapability .
+
}
<http://nepomuk.kde.org/ontologies/2009/06/20/telepathy/metadata>
diff --git a/kpeople/nepomuk-feeder/telepathyaccount.cpp b/kpeople/nepomuk-feeder/telepathyaccount.cpp
index 4f143cf..7154d47 100644
--- a/kpeople/nepomuk-feeder/telepathyaccount.cpp
+++ b/kpeople/nepomuk-feeder/telepathyaccount.cpp
@@ -261,7 +261,8 @@ void TelepathyAccount::onConnectionReady(Tp::PendingOperation *op)
QSet<Tp::Contact::Feature> features;
features << Tp::Contact::FeatureAlias
<< Tp::Contact::FeatureSimplePresence
- << Tp::Contact::FeatureAvatarToken;
+ << Tp::Contact::FeatureAvatarToken
+ << Tp::Contact::FeatureCapabilities;
// Handle contact avatars here, by using AvatarsInterface
connect(m_connection->avatarsInterface(),
diff --git a/kpeople/nepomuk-feeder/telepathycontact.cpp b/kpeople/nepomuk-feeder/telepathycontact.cpp
index 909fecb..0fc4d01 100644
--- a/kpeople/nepomuk-feeder/telepathycontact.cpp
+++ b/kpeople/nepomuk-feeder/telepathycontact.cpp
@@ -22,6 +22,9 @@
#include "telepathycontact.h"
#include "telepathyaccount.h"
+#include "telepathyaccountmonitor.h"
+
+#include <TelepathyQt4/ContactCapabilities>
// Ontology Vocabularies
#include "nco.h"
@@ -30,6 +33,7 @@
// Full Resource Classes
#include "contactgroup.h"
#include "dataobject.h"
+#include "imcapability.h"
#include <KDebug>
@@ -45,7 +49,6 @@
#include <Nepomuk/Query/ResourceTerm>
#include <Nepomuk/Query/ResourceTypeTerm>
#include <Nepomuk/Query/Result>
-#include "telepathyaccountmonitor.h"
TelepathyContact::TelepathyContact(Tp::ContactPtr contact,
Tp::ConnectionPtr connection,
@@ -80,6 +83,9 @@ TelepathyContact::TelepathyContact(Tp::ContactPtr contact,
connect(m_contact.data(),
SIGNAL(removedFromGroup(QString)),
SLOT(onRemovedFromGroup(QString)));
+ connect(m_contact.data(),
+ SIGNAL(capabilitiesChanged(Tp::ContactCapabilities*)),
+ SLOT(onCapabilitiesChanged(Tp::ContactCapabilities*)));
// Watch over his subscription, publication and block status
connect(m_contact.data(),
SIGNAL(subscriptionStateChanged(Tp::Contact::PresenceState)),
@@ -99,6 +105,7 @@ TelepathyContact::TelepathyContact(Tp::ContactPtr contact,
onPublishStateChanged(m_contact->publishState());
onSubscriptionStateChanged(m_contact->subscriptionState());
onBlockStatusChanged(m_contact->isBlocked());
+ onCapabilitiesChanged(m_contact->capabilities());
}
TelepathyContact::~TelepathyContact()
@@ -458,5 +465,66 @@ void TelepathyContact::onSubscriptionStateChanged(Tp::Contact::PresenceState sta
}
}
+void TelepathyContact::onCapabilitiesChanged(Tp::ContactCapabilities* capabilities)
+{
+ QList< Nepomuk::Resource > imCapabilities = m_contactIMAccountResource.imCapabilitys();
+
+ // Process all the various capabilities
+ imCapabilities = processCapability(Nepomuk::Vocabulary::Telepathy::imcapabilityaudiocalls(),
+ capabilities->supportsAudioCalls(),
+ imCapabilities);
+ imCapabilities = processCapability(Nepomuk::Vocabulary::Telepathy::imcapabilitytextchat(),
+ capabilities->supportsTextChats(),
+ imCapabilities);
+ imCapabilities = processCapability(Nepomuk::Vocabulary::Telepathy::imcapabilityvideocalls(),
+ capabilities->supportsVideoCalls(),
+ imCapabilities);
+ imCapabilities = processCapability(Nepomuk::Vocabulary::Telepathy::imcapabilityupgradingcalls(),
+ capabilities->supportsUpgradingCalls(),
+ imCapabilities);
+
+ // Set them onto the resource now
+ m_contactIMAccountResource.setImCapabilitys(imCapabilities);
+
+ kDebug() << "Capabilities changed: "
+ << capabilities->supportsTextChats()
+ << capabilities->supportsAudioCalls()
+ << capabilities->supportsVideoCalls()
+ << capabilities->supportsUpgradingCalls();
+}
+
+QList< Nepomuk::Resource > TelepathyContact::processCapability(
+ const QUrl& capability,
+ bool isSupported,
+ const QList< Nepomuk::Resource >& resources)
+{
+ QList< Nepomuk::Resource > imCapabilities = resources;
+ if (isSupported) {
+ bool found = false;
+ foreach (const Nepomuk::Resource &cap, imCapabilities) {
+ if (cap.hasType(capability)) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ Nepomuk::Resource res;
+ res.setTypes(QList< QUrl >() << capability);
+ imCapabilities << res;
+ }
+ } else {
+ QList< Nepomuk::Resource >::iterator it = imCapabilities.begin();
+ while (it != imCapabilities.end()) {
+ if ((*it).hasType(capability)) {
+ it = imCapabilities.erase(it);
+ } else {
+ ++it;
+ }
+ }
+ }
+
+ return imCapabilities;
+}
+
#include "telepathycontact.moc"
diff --git a/kpeople/nepomuk-feeder/telepathycontact.h b/kpeople/nepomuk-feeder/telepathycontact.h
index 2fa5725..c7a49f2 100644
--- a/kpeople/nepomuk-feeder/telepathycontact.h
+++ b/kpeople/nepomuk-feeder/telepathycontact.h
@@ -60,11 +60,15 @@ private Q_SLOTS:
void onBlockStatusChanged(bool blocked);
void onPublishStateChanged(Tp::Contact::PresenceState state);
void onSubscriptionStateChanged(Tp::Contact::PresenceState state);
+ void onCapabilitiesChanged(Tp::ContactCapabilities*);
private:
Q_DISABLE_COPY(TelepathyContact);
void doNepomukSetup();
+ QList< Nepomuk::Resource > processCapability(const QUrl &capability,
+ bool isSupported,
+ const QList< Nepomuk::Resource >& resources);
TelepathyAccount *m_parent;
Tp::ContactPtr m_contact;
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list