[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:08:23 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=a4826cf
The following commit has been merged in the master branch:
commit a4826cf841df25233e9600c1bb73740110a98189
Author: Marcin Ziemiński <zieminn at gmail.com>
Date: Mon Aug 11 20:22:45 2014 +0200
Add fingeprint management
Signed-off-by: Marcin Ziemiński <zieminn at gmail.com>
---
otr-proxy/KTpProxy/CMakeLists.txt | 2 +
otr-proxy/KTpProxy/main.cpp | 2 +
otr-proxy/KTpProxy/otr-manager.cpp | 72 ++++++++++++++---
otr-proxy/KTpProxy/otr-manager.h | 17 +++-
otr-proxy/KTpProxy/otr-session.cpp | 10 +++
otr-proxy/KTpProxy/otr-session.h | 3 +
otr-proxy/KTpProxy/{otr-utils.h => otr-utils.cpp} | 89 ++++++---------------
otr-proxy/KTpProxy/otr-utils.h | 33 +-------
otr-proxy/KTpProxy/proxy-service-adaptee.cpp | 42 ++++++++++
otr-proxy/KTpProxy/proxy-service-adaptee.h | 7 ++
otr-proxy/KTpProxy/proxy-service.cpp | 15 ++++
otr-proxy/KTpProxy/proxy-service.h | 3 +
otr-proxy/KTpProxy/svc-proxy-service.cpp | 43 ++++++++++
otr-proxy/KTpProxy/svc-proxy-service.h | 92 +++++++++++++++++++---
.../{pending-curry-operation.cpp => types.cpp} | 46 ++++++++---
otr-proxy/KTpProxy/types.h | 44 +++++++++++
otr-proxy/spec/ProxyService.xml | 57 ++++++++++++++
otr-proxy/test/otr-test.cpp | 67 ++++++++++++++++
18 files changed, 513 insertions(+), 131 deletions(-)
diff --git a/otr-proxy/KTpProxy/CMakeLists.txt b/otr-proxy/KTpProxy/CMakeLists.txt
index 077e3d7..1caee52 100644
--- a/otr-proxy/KTpProxy/CMakeLists.txt
+++ b/otr-proxy/KTpProxy/CMakeLists.txt
@@ -11,6 +11,8 @@ set(ktp-proxy_SRCS
otr-manager.cpp
otr-message.cpp
otr-config.cpp
+ otr-utils.cpp
+ types.cpp
)
kde4_add_kcfg_files(ktp-proxy_SRCS ktp-proxy-config.kcfgc)
diff --git a/otr-proxy/KTpProxy/main.cpp b/otr-proxy/KTpProxy/main.cpp
index 59e2685..62797bf 100644
--- a/otr-proxy/KTpProxy/main.cpp
+++ b/otr-proxy/KTpProxy/main.cpp
@@ -20,6 +20,7 @@
#include "proxy-service.h"
#include "otr-config.h"
#include "version.h"
+#include "types.h"
#include <KAboutData>
#include <KCmdLineArgs>
@@ -55,6 +56,7 @@ int main(int argc, char *argv[])
KApplication app(false);
Tp::registerTypes();
+ Tp::registerProxyTypes();
OTRL_INIT;
OTR::Config config;
diff --git a/otr-proxy/KTpProxy/otr-manager.cpp b/otr-proxy/KTpProxy/otr-manager.cpp
index ab6d40a..3d65594 100644
--- a/otr-proxy/KTpProxy/otr-manager.cpp
+++ b/otr-proxy/KTpProxy/otr-manager.cpp
@@ -477,6 +477,13 @@ QString Manager::getFingerprintFor(const QString &accountId, const QString &acco
}
}
+void Manager::saveFingerprints(const QString &accountId)
+{
+ OtrlUserState userState = getUserState(accountId)->userState();
+ const QString path = config->saveLocation() + accountId + QLatin1String(".fingerprints");
+ otrl_privkey_write_fingerprints(userState, path.toLocal8Bit());
+}
+
void Manager::saveFingerprints(Session *session)
{
const QString path = config->saveLocation() + session->context().accountId + QLatin1String(".fingerprints");
@@ -492,17 +499,6 @@ void Manager::createInstag(Session *session)
session->context().protocol.toLocal8Bit());
}
-TrustFpResult Manager::trustFingerprint(const SessionContext &ctx, const QString &fingerprint, bool trust)
-{
- Q_UNUSED(ctx);
- Q_UNUSED(fingerprint);
- Q_UNUSED(trust);
- // TODO
- //UserStateBox *usBox = getUserState(ctx);
- //OtrlUserState usersate = usBox->userState();
- return TrustFpResult::OK;
-}
-
TrustFpResult Manager::trustFingerprint(const SessionContext &ctx, Fingerprint *fingerprint, bool trust)
{
if(fingerprint == nullptr) {
@@ -522,6 +518,60 @@ TrustFpResult Manager::trustFingerprint(const SessionContext &ctx, Fingerprint *
return TrustFpResult::OK;
}
+Tp::FingerprintInfoList Manager::getKnownFingerprints(const QString &accountId)
+{
+ Tp::FingerprintInfoList fingerprints;
+
+ for(ConnContext *context = getUserState(accountId)->userState()->context_root;
+ context != nullptr; context = context->next)
+ {
+ for(Fingerprint *fingerprint = context->fingerprint_root.next;
+ fingerprint != nullptr; fingerprint = fingerprint->next)
+ {
+ const QString username = QLatin1String(context->username);
+ const QString hrFp = utils::humanReadable(fingerprint->fingerprint);
+ const bool trusted = otrl_context_is_fingerprint_trusted(fingerprint);
+
+ fingerprints << Tp::FingerprintInfo { username, hrFp, trusted };
+ }
+ }
+
+ return fingerprints;
+}
+
+bool Manager::trustFingerprint(const QString &accountId, const Tp::FingerprintInfo &fingerprintInfo)
+{
+ Fingerprint *fingerprint = utils::findFingerprint(
+ getUserState(accountId)->userState(), fingerprintInfo.fingerprint, fingerprintInfo.contactName);
+
+ if(fingerprint != nullptr) {
+ if(fingerprintInfo.isVerified) {
+ otrl_context_set_trust(fingerprint, "VERIFIED");
+ } else {
+ otrl_context_set_trust(fingerprint, NULL);
+ }
+
+ Q_EMIT fingerprintTrusted(accountId, fingerprintInfo.fingerprint, fingerprintInfo.isVerified);
+ return true;
+ }
+
+ return false;
+}
+
+bool Manager::forgetFingerprint(const QString &accountId, const Tp::FingerprintInfo &fingerprintInfo)
+{
+ Fingerprint *fingerprint = utils::findFingerprint(
+ getUserState(accountId)->userState(), fingerprintInfo.fingerprint, fingerprintInfo.contactName);
+
+ if(fingerprint != nullptr) {
+ otrl_context_forget_fingerprint(fingerprint, 1);
+ saveFingerprints(accountId);
+
+ return true;
+ }
+
+ return false;
+}
KeyGenerationWorker::KeyGenerationWorker(
const QString &accountId,
diff --git a/otr-proxy/KTpProxy/otr-manager.h b/otr-proxy/KTpProxy/otr-manager.h
index a62a16f..8b2d6d3 100644
--- a/otr-proxy/KTpProxy/otr-manager.h
+++ b/otr-proxy/KTpProxy/otr-manager.h
@@ -22,6 +22,7 @@
#include "otr-config.h"
#include "otr-session.h"
+#include "types.h"
#include <QThread>
@@ -42,8 +43,10 @@ namespace OTR
class KeyGenerationWorker;
- class Manager
+ class Manager : public QObject
{
+ Q_OBJECT
+
public:
Manager(Config *otrConfig);
@@ -52,8 +55,8 @@ namespace OTR
OtrlPolicy getPolicy() const;
void setPolicy(OtrlPolicy policy);
+ void saveFingerprints(const QString &accountId);
void saveFingerprints(Session *session);
- TrustFpResult trustFingerprint(const SessionContext &ctx, const QString &fingerprint, bool trust);
TrustFpResult trustFingerprint(const SessionContext &ctx, Fingerprint *fingerprint, bool trust);
void createNewPrivateKey(Session *session);
@@ -61,8 +64,16 @@ namespace OTR
otherwise returns thread which generates a new private key upon calling start method */
KeyGenerationWorker* createNewPrivateKey(const QString &accountId, const QString &accountName);
QString getFingerprintFor(const QString &accountId, const QString &accountName);
+ Tp::FingerprintInfoList getKnownFingerprints(const QString &accountId);
+ bool trustFingerprint(const QString &accountId, const Tp::FingerprintInfo &fingerprint);
+ bool forgetFingerprint(const QString &accountId, const Tp::FingerprintInfo &fingerprint);
+
void createInstag(Session *session);
-private:
+
+ Q_SIGNALS:
+ void fingerprintTrusted(const QString &accountId, const QString &fingerprint, bool trusted);
+
+ private:
Config *config;
// TODO - consider clearing states when not in use
QMap<QString, UserStateBoxPtr> userStates;
diff --git a/otr-proxy/KTpProxy/otr-session.cpp b/otr-proxy/KTpProxy/otr-session.cpp
index e0bbe96..3a61eae 100644
--- a/otr-proxy/KTpProxy/otr-session.cpp
+++ b/otr-proxy/KTpProxy/otr-session.cpp
@@ -74,6 +74,8 @@ namespace OTR
pr(parent)
{
userstate = pr->getUserState(ctx.accountId);
+ connect(parent, SIGNAL(fingerprintTrusted(const QString&, const QString&, bool)),
+ SLOT(onFingerprintTrusted(const QString&, const QString&, bool)));
}
TrustLevel Session::trustLevel() const
@@ -116,6 +118,14 @@ namespace OTR
instance, 0, NULL, NULL, NULL);
}
+ void Session::onFingerprintTrusted(const QString &accountId, const QString &fingerprint, bool trusted)
+ {
+ Q_UNUSED(trusted);
+ if(accountId == ctx.accountId && fingerprint == remoteFingerprint()) {
+ onTrustLevelChanged();
+ }
+ }
+
QString Session::remoteFingerprint() const
{
Fingerprint *fp = getFingerprint();
diff --git a/otr-proxy/KTpProxy/otr-session.h b/otr-proxy/KTpProxy/otr-session.h
index 1e99954..0515b30 100644
--- a/otr-proxy/KTpProxy/otr-session.h
+++ b/otr-proxy/KTpProxy/otr-session.h
@@ -107,6 +107,9 @@ namespace OTR
Fingerprint* getFingerprint() const;
ConnContext* findContext() const;
+ private Q_SLOTS:
+ void onFingerprintTrusted(const QString &accountId, const QString &fingerprint, bool trusted);
+
Q_SIGNALS:
void trustLevelChanged(TrustLevel trustLevel);
void sessionRefreshed();
diff --git a/otr-proxy/KTpProxy/otr-utils.h b/otr-proxy/KTpProxy/otr-utils.cpp
similarity index 55%
copy from otr-proxy/KTpProxy/otr-utils.h
copy to otr-proxy/KTpProxy/otr-utils.cpp
index 0ad4197..3d376cc 100644
--- a/otr-proxy/KTpProxy/otr-utils.h
+++ b/otr-proxy/KTpProxy/otr-utils.cpp
@@ -17,76 +17,36 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
-#ifndef KTP_PROXY_OTR_UTILS_HEADER
-#define KTP_PROXY_OTR_UTILS_HEADER
-
-#include "otr-constants.h"
-
-#include <QString>
-#include <QStringList>
-#include <QDBusObjectPath>
-
-#include <KDebug>
-
-extern "C" {
-#include <libotr/privkey.h>
-}
-
-namespace OTR {
-
- struct SessionContext
- {
- const QString accountId;
- const QString accountName;
- const QString recipientName;
- const QString protocol;
- };
+#include "otr-utils.h"
+namespace OTR
+{
namespace utils
{
- inline QString humanReadable(const unsigned char fingerprint[20])
- {
- char human[OTRL_PRIVKEY_FPRINT_HUMAN_LEN];
- otrl_privkey_hash_to_human(human, fingerprint);
- return QString::fromLocal8Bit(human, OTRL_PRIVKEY_FPRINT_HUMAN_LEN-1);
- }
-
- inline QString accountIdFor(const QDBusObjectPath &objectPath)
- {
- QStringList elems = objectPath.path().split(QLatin1Char('/'));
- return QStringList(elems.mid(elems.size()-3)).join(QLatin1String("."));
- }
- inline QString accountIdFor(const QString &cmName, const QString &protocol, const QString &acc)
+ Fingerprint* findFingerprint(OtrlUserState userState, const QString &fp, const QString &user)
{
- return cmName + QLatin1Char('.') + protocol + QLatin1Char('.') + acc;
- }
-
- inline QString cmNameFromAccountId(const QString &accountId)
- {
- return accountId.split(QLatin1Char('.'))[0];
- }
-
- inline QString protocolFromAccountId(const QString &accountId)
- {
- return accountId.split(QLatin1Char('.'))[1];
- }
-
- inline QString accFromAccountId(const QString &accountId)
- {
- return accountId.split(QLatin1Char('.'))[2];
- }
+ Fingerprint *fingerprint = nullptr;
+
+ for(ConnContext *context = userState->context_root;
+ context != nullptr; context = context->next)
+ {
+ if(user != QLatin1String(context->username)) {
+ continue;
+ }
+ for(fingerprint = context->fingerprint_root.next;
+ fingerprint != nullptr; fingerprint = fingerprint->next)
+ {
+ if(utils::humanReadable(fingerprint->fingerprint) == fp) {
+ return fingerprint;
+ }
+ }
+ }
- inline QDBusObjectPath objectPathFor(const QString &accountId)
- {
- return QDBusObjectPath(
- QLatin1String("/org/freedesktop/Telepathy/Account/") +
- cmNameFromAccountId(accountId) + QLatin1Char('/') +
- protocolFromAccountId(accountId) + QLatin1Char('/') +
- accFromAccountId(accountId));
+ return fingerprint;
}
- inline TrustLevel getTrustLevel(const SessionContext &ctx, OtrlUserState userState, otrl_instag_t instance)
+ TrustLevel getTrustLevel(const SessionContext &ctx, OtrlUserState userState, otrl_instag_t instance)
{
ConnContext *context = otrl_context_find(
userState,
@@ -116,7 +76,6 @@ namespace utils
}
return TrustLevel::NOT_PRIVATE;
}
-}
-}
-#endif
+} /* namespace utils */
+} /* namespace OTR */
diff --git a/otr-proxy/KTpProxy/otr-utils.h b/otr-proxy/KTpProxy/otr-utils.h
index 0ad4197..a9ea8a9 100644
--- a/otr-proxy/KTpProxy/otr-utils.h
+++ b/otr-proxy/KTpProxy/otr-utils.h
@@ -51,6 +51,8 @@ namespace utils
return QString::fromLocal8Bit(human, OTRL_PRIVKEY_FPRINT_HUMAN_LEN-1);
}
+ Fingerprint* findFingerprint(OtrlUserState userState, const QString &fp, const QString &user);
+
inline QString accountIdFor(const QDBusObjectPath &objectPath)
{
QStringList elems = objectPath.path().split(QLatin1Char('/'));
@@ -86,36 +88,7 @@ namespace utils
accFromAccountId(accountId));
}
- inline TrustLevel getTrustLevel(const SessionContext &ctx, OtrlUserState userState, otrl_instag_t instance)
- {
- ConnContext *context = otrl_context_find(
- userState,
- ctx.recipientName.toLocal8Bit(),
- ctx.accountName.toLocal8Bit(),
- ctx.protocol.toLocal8Bit(),
- instance, 0, NULL, NULL, NULL);
-
- if(context == nullptr) {
- kWarning() << "Could not get trust level";
- return TrustLevel::NOT_PRIVATE;
- }
-
- switch(context->msgstate) {
- case OTRL_MSGSTATE_PLAINTEXT:
- return TrustLevel::NOT_PRIVATE;
- case OTRL_MSGSTATE_ENCRYPTED:
- {
- if(otrl_context_is_fingerprint_trusted(context->active_fingerprint)) {
- return TrustLevel::VERIFIED;
- } else {
- return TrustLevel::UNVERIFIED;
- }
- }
- case OTRL_MSGSTATE_FINISHED:
- return TrustLevel::FINISHED;
- }
- return TrustLevel::NOT_PRIVATE;
- }
+ TrustLevel getTrustLevel(const SessionContext &ctx, OtrlUserState userState, otrl_instag_t instance);
}
}
diff --git a/otr-proxy/KTpProxy/proxy-service-adaptee.cpp b/otr-proxy/KTpProxy/proxy-service-adaptee.cpp
index 1fc505a..94a6e0d 100644
--- a/otr-proxy/KTpProxy/proxy-service-adaptee.cpp
+++ b/otr-proxy/KTpProxy/proxy-service-adaptee.cpp
@@ -112,3 +112,45 @@ void ProxyServiceAdaptee::getFingerprintForAccount(QDBusObjectPath accountPath,
context->setFinishedWithError(TP_QT_ERROR_INVALID_ARGUMENT, QLatin1String("No such valid account"));
}
}
+
+void ProxyServiceAdaptee::getKnownFingerprints(const QDBusObjectPath &accountPath,
+ const Tp::Service::ProxyServiceAdaptor::GetKnownFingerprintsContextPtr &context)
+{
+ Tp::AccountPtr ac = ps->accountManager()->accountForObjectPath(accountPath.path());
+ if(ac && ac->isValidAccount()) {
+ context->setFinished(ps->getKnownFingerprints(OTR::utils::accountIdFor(accountPath)));
+ } else {
+ context->setFinishedWithError(TP_QT_ERROR_INVALID_ARGUMENT, QLatin1String("No such valid account"));
+ }
+}
+
+void ProxyServiceAdaptee::trustFingerprint(const QDBusObjectPath &accountPath, const Tp::FingerprintInfo &fingerprintInfo,
+ const Tp::Service::ProxyServiceAdaptor::TrustFingerprintContextPtr &context)
+{
+ Tp::AccountPtr ac = ps->accountManager()->accountForObjectPath(accountPath.path());
+ if(ac && ac->isValidAccount()) {
+ if(ps->trustFingerprint(OTR::utils::accountIdFor(accountPath), fingerprintInfo)) {
+ context->setFinished();
+ } else {
+ context->setFinishedWithError(TP_QT_ERROR_INVALID_ARGUMENT, QLatin1String("Invalid finerprint info"));
+ }
+ } else {
+ context->setFinishedWithError(TP_QT_ERROR_INVALID_ARGUMENT, QLatin1String("No such valid account"));
+ }
+}
+
+void ProxyServiceAdaptee::forgetFingerprint(const QDBusObjectPath &accountPath, const Tp::FingerprintInfo &fingerprintInfo,
+ const Tp::Service::ProxyServiceAdaptor::ForgetFingerprintContextPtr &context)
+{
+ Tp::AccountPtr ac = ps->accountManager()->accountForObjectPath(accountPath.path());
+ if(ac && ac->isValidAccount()) {
+ if(ps->forgetFingerprint(OTR::utils::accountIdFor(accountPath), fingerprintInfo)) {
+ context->setFinished();
+ } else {
+ context->setFinishedWithError(TP_QT_ERROR_INVALID_ARGUMENT,
+ QLatin1String("Invalid finerprint info"));
+ }
+ } else {
+ context->setFinishedWithError(TP_QT_ERROR_INVALID_ARGUMENT, QLatin1String("No such valid account"));
+ }
+}
diff --git a/otr-proxy/KTpProxy/proxy-service-adaptee.h b/otr-proxy/KTpProxy/proxy-service-adaptee.h
index 1627f50..5a5f951 100644
--- a/otr-proxy/KTpProxy/proxy-service-adaptee.h
+++ b/otr-proxy/KTpProxy/proxy-service-adaptee.h
@@ -60,6 +60,13 @@ class ProxyServiceAdaptee : public QObject
const Tp::Service::ProxyServiceAdaptor::GeneratePrivateKeyContextPtr &context);
void getFingerprintForAccount(QDBusObjectPath accountPath,
const Tp::Service::ProxyServiceAdaptor::GetFingerprintForAccountContextPtr &context);
+ void getKnownFingerprints(const QDBusObjectPath &account,
+ const Tp::Service::ProxyServiceAdaptor::GetKnownFingerprintsContextPtr &context);
+ void trustFingerprint(const QDBusObjectPath &account, const Tp::FingerprintInfo &fingerprintInfo,
+ const Tp::Service::ProxyServiceAdaptor::TrustFingerprintContextPtr &context);
+ void forgetFingerprint(const QDBusObjectPath &account, const Tp::FingerprintInfo &fingerprintInfo,
+ const Tp::Service::ProxyServiceAdaptor::ForgetFingerprintContextPtr &context);
+
private Q_SLOTS:
void onKeyGenerationStarted(const QString &accountId);
void onKeyGenerationFinished(const QString &accountId, bool error);
diff --git a/otr-proxy/KTpProxy/proxy-service.cpp b/otr-proxy/KTpProxy/proxy-service.cpp
index cda0bdf..ef3090c 100644
--- a/otr-proxy/KTpProxy/proxy-service.cpp
+++ b/otr-proxy/KTpProxy/proxy-service.cpp
@@ -219,6 +219,21 @@ QString ProxyService::getFingerprintFor(const QString &accountId, const QString
return manager.getFingerprintFor(accountId, accountName);
}
+Tp::FingerprintInfoList ProxyService::getKnownFingerprints(const QString &accountId)
+{
+ return manager.getKnownFingerprints(accountId);
+}
+
+bool ProxyService::trustFingerprint(const QString &accountId, const Tp::FingerprintInfo &fingerprint)
+{
+ return manager.trustFingerprint(accountId, fingerprint);
+}
+
+bool ProxyService::forgetFingerprint(const QString &accountId, const Tp::FingerprintInfo &fingerprint)
+{
+ return manager.forgetFingerprint(accountId, fingerprint);
+}
+
void ProxyService::onKeyGenerationThreadFinished()
{
OTR::KeyGenerationWorker *worker = qobject_cast<OTR::KeyGenerationWorker*>(QObject::sender());
diff --git a/otr-proxy/KTpProxy/proxy-service.h b/otr-proxy/KTpProxy/proxy-service.h
index 324644e..b384d42 100644
--- a/otr-proxy/KTpProxy/proxy-service.h
+++ b/otr-proxy/KTpProxy/proxy-service.h
@@ -59,6 +59,9 @@ class ProxyService : public Tp::DBusService
/** returns false if key cannot be generated - i.e. incorrect id */
bool createNewPrivateKey(const QString &accountId, const QString &accountName);
QString getFingerprintFor(const QString &accountId, const QString &accountName);
+ Tp::FingerprintInfoList getKnownFingerprints(const QString &accountId);
+ bool trustFingerprint(const QString &accountId, const Tp::FingerprintInfo &fingerprint);
+ bool forgetFingerprint(const QString &accountId, const Tp::FingerprintInfo &fingerprint);
OTR::Manager* managerOTR();
Tp::AccountManagerPtr accountManager();
diff --git a/otr-proxy/KTpProxy/svc-proxy-service.cpp b/otr-proxy/KTpProxy/svc-proxy-service.cpp
index 999e951..36ecdc9 100644
--- a/otr-proxy/KTpProxy/svc-proxy-service.cpp
+++ b/otr-proxy/KTpProxy/svc-proxy-service.cpp
@@ -60,5 +60,48 @@ QString ProxyServiceAdaptor::GetFingerprintForAccount(const QDBusObjectPath& acc
return QString();
}
+Tp::FingerprintInfoList ProxyServiceAdaptor::GetKnownFingerprints(const QDBusObjectPath& account, const QDBusMessage& dbusMessage)
+{
+ if (!adaptee()->metaObject()->indexOfMethod("getKnownFingerprints(QDBusObjectPath,Tp::Service::ProxyServiceAdaptor::GetKnownFingerprintsContextPtr)") == -1) {
+ dbusConnection().send(dbusMessage.createErrorReply(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")));
+ return Tp::FingerprintInfoList();
+ }
+
+ GetKnownFingerprintsContextPtr ctx = GetKnownFingerprintsContextPtr(
+ new Tp::MethodInvocationContext< Tp::FingerprintInfoList >(dbusConnection(), dbusMessage));
+ QMetaObject::invokeMethod(adaptee(), "getKnownFingerprints",
+ Q_ARG(QDBusObjectPath, account),
+ Q_ARG(Tp::Service::ProxyServiceAdaptor::GetKnownFingerprintsContextPtr, ctx));
+ return Tp::FingerprintInfoList();
+}
+
+void ProxyServiceAdaptor::TrustFingerprint(const QDBusObjectPath& account, const Tp::FingerprintInfo& fingerprint, const QDBusMessage& dbusMessage)
+{
+ if (!adaptee()->metaObject()->indexOfMethod("trustFingerprint(QDBusObjectPath,Tp::FingerprintInfo,Tp::Service::ProxyServiceAdaptor::TrustFingerprintContextPtr)") == -1) {
+ dbusConnection().send(dbusMessage.createErrorReply(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")));
+ return;
+ }
+
+ TrustFingerprintContextPtr ctx = TrustFingerprintContextPtr(
+ new Tp::MethodInvocationContext< >(dbusConnection(), dbusMessage));
+ QMetaObject::invokeMethod(adaptee(), "trustFingerprint",
+ Q_ARG(QDBusObjectPath, account), Q_ARG(Tp::FingerprintInfo, fingerprint),
+ Q_ARG(Tp::Service::ProxyServiceAdaptor::TrustFingerprintContextPtr, ctx));
+}
+
+void ProxyServiceAdaptor::ForgetFingerprint(const QDBusObjectPath& account, const Tp::FingerprintInfo& fingerprint, const QDBusMessage& dbusMessage)
+{
+ if (!adaptee()->metaObject()->indexOfMethod("forgetFingerprint(QDBusObjectPath,Tp::FingerprintInfo,Tp::Service::ProxyServiceAdaptor::ForgetFingerprintContextPtr)") == -1) {
+ dbusConnection().send(dbusMessage.createErrorReply(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")));
+ return;
+ }
+
+ ForgetFingerprintContextPtr ctx = ForgetFingerprintContextPtr(
+ new Tp::MethodInvocationContext< >(dbusConnection(), dbusMessage));
+ QMetaObject::invokeMethod(adaptee(), "forgetFingerprint",
+ Q_ARG(QDBusObjectPath, account), Q_ARG(Tp::FingerprintInfo, fingerprint),
+ Q_ARG(Tp::Service::ProxyServiceAdaptor::ForgetFingerprintContextPtr, ctx));
+}
+
}
}
diff --git a/otr-proxy/KTpProxy/svc-proxy-service.h b/otr-proxy/KTpProxy/svc-proxy-service.h
index 320045e..b87f6e4 100644
--- a/otr-proxy/KTpProxy/svc-proxy-service.h
+++ b/otr-proxy/KTpProxy/svc-proxy-service.h
@@ -8,6 +8,8 @@
* which it was generated.
*/
+#include "types.h"
+
#include <TelepathyQt/AbstractAdaptor>
#include <TelepathyQt/Global>
#include <TelepathyQt/Types>
@@ -41,6 +43,24 @@ class TP_QT_EXPORT ProxyServiceAdaptor : public Tp::AbstractAdaptor
" <arg direction=\"in\" type=\"o\" name=\"account\"/>
"
" <arg direction=\"out\" type=\"s\" name=\"fingerprint\"/>
"
" </method>
"
+" <method name=\"GetKnownFingerprints\">
"
+" <arg direction=\"in\" type=\"o\" name=\"account\"/>
"
+" <arg direction=\"out\" type=\"a(ssb)\" name=\"fingerprints\">
"
+" <annotation value=\"Tp::FingerprintInfoList\" name=\"com.trolltech.QtDBus.QtTypeName.Out0\"/>
"
+" </arg>
"
+" </method>
"
+" <method name=\"TrustFingerprint\">
"
+" <arg direction=\"in\" type=\"o\" name=\"account\"/>
"
+" <arg direction=\"in\" type=\"(ssb)\" name=\"fingerprint\">
"
+" <annotation value=\"Tp::FingerprintInfo\" name=\"com.trolltech.QtDBus.QtTypeName.In1\"/>
"
+" </arg>
"
+" </method>
"
+" <method name=\"ForgetFingerprint\">
"
+" <arg direction=\"in\" type=\"o\" name=\"account\"/>
"
+" <arg direction=\"in\" type=\"(ssb)\" name=\"fingerprint\">
"
+" <annotation value=\"Tp::FingerprintInfo\" name=\"com.trolltech.QtDBus.QtTypeName.In1\"/>
"
+" </arg>
"
+" </method>
"
" <signal name=\"ProxyConnected\">
"
" <arg type=\"o\" name=\"proxy\"/>
"
" </signal>
"
@@ -64,6 +84,9 @@ public:
typedef Tp::MethodInvocationContextPtr< > GeneratePrivateKeyContextPtr;
typedef Tp::MethodInvocationContextPtr< QString > GetFingerprintForAccountContextPtr;
+ typedef Tp::MethodInvocationContextPtr< Tp::FingerprintInfoList > GetKnownFingerprintsContextPtr;
+ typedef Tp::MethodInvocationContextPtr< > TrustFingerprintContextPtr;
+ typedef Tp::MethodInvocationContextPtr< > ForgetFingerprintContextPtr;
public: // PROPERTIES
/**
@@ -72,7 +95,7 @@ public: // PROPERTIES
* Adaptees should export this property as a Qt property named
* 'policySettings' with type uint.
*
- *
+ *
* \htmlonly
* <p>Set the OTR policy how you like it</p>
* \endhtmlonly
@@ -86,7 +109,7 @@ public: // PROPERTIES
* Adaptees should export this property as a writable Qt property named
* 'policySettings' with type uint.
*
- *
+ *
* \htmlonly
* <p>Set the OTR policy how you like it</p>
* \endhtmlonly
@@ -103,7 +126,7 @@ public Q_SLOTS: // METHODS
* Implementations should call MethodInvocationContext::setFinished (or setFinishedWithError
* accordingly) on the received context object once the method has finished processing.
*
- *
+ *
* \htmlonly
* <p> Generate new private key for given account. </p>
* \endhtmlonly
@@ -119,18 +142,63 @@ public Q_SLOTS: // METHODS
* Implementations should call MethodInvocationContext::setFinished (or setFinishedWithError
* accordingly) on the received context object once the method has finished processing.
*
- *
+ *
* Get private key fingerprint associated with given account
*
* \param account
- *
+ *
* The account the new key is generated for
*
eturn
- *
- * Fingerprint of given account's private key or an empty string
+ *
+ * Fingerprint of given account's private key or an empty string
* if none exists
*/
QString GetFingerprintForAccount(const QDBusObjectPath& account, const QDBusMessage& dbusMessage);
+ /**
+ * Begins a call to the exported D-Bus method
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list