[SCM] ktp-auth-handler packaging branch, master, updated. debian/15.12.1-2-282-g080758e
Maximiliano Curia
maxy at moszumanska.debian.org
Fri May 27 23:59:13 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-auth-handler.git;a=commitdiff;h=e801b5e
The following commit has been merged in the master branch:
commit e801b5e1268572f016a69567bb6f2b09cf5a6d7c
Author: Àlex Fiestas <afiestas at kde.org>
Date: Fri Jun 7 17:46:41 2013 +0200
Make Accounts-SSO support optional
Added a bunch of #ifdef around and two new methods to make
the #ifdef less ugly.
---
CMakeLists.txt | 39 ++++++++++++++++++++++-----------
sasl-auth-op.cpp | 66 ++++++++++++++++++++++++++++++++++++++++----------------
sasl-auth-op.h | 12 +++++++++--
3 files changed, 84 insertions(+), 33 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d9918ac..77ef27c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,8 +15,8 @@ find_package (TelepathyQt4 0.8.9 REQUIRED)
find_package (KTp REQUIRED)
find_package (QJSON REQUIRED)
find_package (QCA2 REQUIRED)
-find_package(AccountsQt REQUIRED)
-find_package(SignOnQt REQUIRED)
+find_package(AccountsQt)
+find_package(SignOnQt)
include (KDE4Defaults)
include (MacroLibrary)
@@ -34,14 +34,12 @@ include_directories (${KDE4_INCLUDES}
)
set(ktp_auth_handler_SRCS
- getcredentialsjob.cpp
main.cpp
sasl-handler.cpp
sasl-auth-op.cpp
tls-cert-verifier-op.cpp
tls-handler.cpp
types.cpp
- x-telepathy-sso-operation.cpp
x-telepathy-password-auth-operation.cpp
x-telepathy-password-prompt.cpp
x-messenger-oauth2-auth-operation.cpp
@@ -50,12 +48,7 @@ set(ktp_auth_handler_SRCS
conference-auth-observer.cpp
)
-configure_file(version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
-
-kde4_add_ui_files(ktp_auth_handler_SRCS x-telepathy-password-prompt.ui)
-kde4_add_executable(ktp-auth-handler ${ktp_auth_handler_SRCS})
-
-target_link_libraries(ktp-auth-handler
+set(ktp_auth_handler_LIBS
${QT_QTDBUS_LIBRARY}
${QT_QTGUI_LIBRARY}
${QT_QTXML_LIBRARY}
@@ -66,12 +59,34 @@ target_link_libraries(ktp-auth-handler
${KDE4_KDECORE_LIBS}
${KDE4_KDEUI_LIBS}
${KDE4_KDEWEBKIT_LIBS}
- ${ACCOUNTSQT_LIBRARIES}
- ${SIGNONQT_LIBRARIES}
${QJSON_LIBRARIES}
${QCA2_LIBRARIES}
)
+#If we find Accounts-SSO frameworks, add support for it
+if(ACCOUNTSQT_FOUND AND SIGNONQT_FOUND)
+ add_definitions(-DHAVE_SSO)
+ set(ktp_auth_handler_SRCS
+ ${ktp_auth_handler_SRCS}
+ x-telepathy-sso-operation.cpp
+ getcredentialsjob.cpp
+ )
+ set(ktp_auth_handler_LIBS
+ ${ktp_auth_handler_LIBS}
+ ${ACCOUNTSQT_LIBRARIES}
+ ${SIGNONQT_LIBRARIES}
+ )
+endif(ACCOUNTSQT_FOUND AND SIGNONQT_FOUND)
+
+configure_file(version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
+
+kde4_add_ui_files(ktp_auth_handler_SRCS x-telepathy-password-prompt.ui)
+kde4_add_executable(ktp-auth-handler ${ktp_auth_handler_SRCS})
+
+target_link_libraries(ktp-auth-handler
+ ${ktp_auth_handler_LIBS}
+)
+
configure_file(org.freedesktop.Telepathy.Client.KTp.SASLHandler.service.in
${CMAKE_CURRENT_BINARY_DIR}/org.freedesktop.Telepathy.Client.KTp.SASLHandler.service)
configure_file(org.freedesktop.Telepathy.Client.KTp.TLSHandler.service.in
diff --git a/sasl-auth-op.cpp b/sasl-auth-op.cpp
index a20a52f..3351307 100644
--- a/sasl-auth-op.cpp
+++ b/sasl-auth-op.cpp
@@ -22,7 +22,10 @@
#include "x-telepathy-password-auth-operation.h"
#include "x-messenger-oauth2-auth-operation.h"
-#include "x-telepathy-sso-operation.h"
+
+#ifdef HAVE_SSO
+ #include "x-telepathy-sso-operation.h"
+#endif
#include <QtCore/QScopedPointer>
@@ -40,9 +43,12 @@ SaslAuthOp::SaslAuthOp(const Tp::AccountPtr &account,
m_walletInterface(0),
m_account(account),
m_channel(channel),
- m_accountStorageId(0),
m_saslIface(channel->interface<Tp::Client::ChannelInterfaceSASLAuthenticationInterface>())
{
+#ifdef HAVE_SSO
+ m_accountStorageId = 0;
+#endif
+
connect(KTp::WalletInterface::openWallet(), SIGNAL(finished(Tp::PendingOperation*)), SLOT(onOpenWalletOperationFinished(Tp::PendingOperation*)));
}
@@ -64,6 +70,7 @@ void SaslAuthOp::gotProperties(Tp::PendingOperation *op)
QStringList mechanisms = qdbus_cast<QStringList>(props.value(QLatin1String("AvailableMechanisms")));
kDebug() << mechanisms;
+#ifdef HAVE_SSO
if (mechanisms.contains(QLatin1String("X-FACEBOOK-PLATFORM")) && m_accountStorageId) {
XTelepathySSOOperation *authop = new XTelepathySSOOperation(m_account, m_accountStorageId, m_saslIface);
connect(authop,
@@ -75,7 +82,10 @@ void SaslAuthOp::gotProperties(Tp::PendingOperation *op)
QString error = qdbus_cast<QString>(props.value(QLatin1String("SASLError")));
QVariantMap errorDetails = qdbus_cast<QVariantMap>(props.value(QLatin1String("SASLErrorDetails")));
authop->onSASLStatusChanged(status, error, errorDetails);
- } else if (mechanisms.contains(QLatin1String("X-TELEPATHY-PASSWORD"))) {
+ }
+ else //if...
+#endif
+ if (mechanisms.contains(QLatin1String("X-TELEPATHY-PASSWORD"))) {
// everything ok, we can return from handleChannels now
Q_EMIT ready(this);
XTelepathyPasswordAuthOperation *authop = new XTelepathyPasswordAuthOperation(m_account, m_saslIface, m_walletInterface, qdbus_cast<bool>(props.value(QLatin1String("CanTryAgain"))));
@@ -113,15 +123,31 @@ void SaslAuthOp::onOpenWalletOperationFinished(Tp::PendingOperation *op)
m_walletInterface = walletOp->walletInterface();
- //Check if the account has any StorageIdentifier, in which case we will
- //prioritize those mechanism related with KDE Accounts integration
- QScopedPointer<Tp::Client::AccountInterfaceStorageInterface> accountStorageInterface(
- new Tp::Client::AccountInterfaceStorageInterface(m_account->busName(), m_account->objectPath()));
+#ifdef HAVE_SSO
+ fetchAccountStorage();
+#else
+ setReady();
+#endif
+}
- Tp::PendingVariantMap *pendingMap = accountStorageInterface->requestAllProperties();
- connect(pendingMap, SIGNAL(finished(Tp::PendingOperation*)), SLOT(onGetAccountStorageFetched(Tp::PendingOperation*)));
+void SaslAuthOp::onAuthOperationFinished(Tp::PendingOperation *op)
+{
+ m_channel->requestClose();
+ if (op->isError()) {
+ setFinishedWithError(op->errorName(), op->errorMessage());
+ } else {
+ setFinished();
+ }
}
+void SaslAuthOp::setReady()
+{
+ connect(m_saslIface->requestAllProperties(),
+ SIGNAL(finished(Tp::PendingOperation*)),
+ SLOT(gotProperties(Tp::PendingOperation*)));
+}
+
+#ifdef HAVE_SSO
void SaslAuthOp::onGetAccountStorageFetched(Tp::PendingOperation* op)
{
kDebug();
@@ -129,19 +155,21 @@ void SaslAuthOp::onGetAccountStorageFetched(Tp::PendingOperation* op)
m_accountStorageId = pendingMap->result()["StorageIdentifier"].value<QDBusVariant>().variant().toInt();
kDebug() << m_accountStorageId;
- connect(m_saslIface->requestAllProperties(),
- SIGNAL(finished(Tp::PendingOperation*)),
- SLOT(gotProperties(Tp::PendingOperation*)));
+
}
-void SaslAuthOp::onAuthOperationFinished(Tp::PendingOperation *op)
+void SaslAuthOp::fetchAccountStorage()
{
- m_channel->requestClose();
- if (op->isError()) {
- setFinishedWithError(op->errorName(), op->errorMessage());
- } else {
- setFinished();
- }
+ //Check if the account has any StorageIdentifier, in which case we will
+ //prioritize those mechanism related with KDE Accounts integration
+ QScopedPointer<Tp::Client::AccountInterfaceStorageInterface> accountStorageInterface(
+ new Tp::Client::AccountInterfaceStorageInterface(m_account->busName(), m_account->objectPath()));
+
+ Tp::PendingVariantMap *pendingMap = accountStorageInterface->requestAllProperties();
+ connect(pendingMap, SIGNAL(finished(Tp::PendingOperation*)), SLOT(onGetAccountStorageFetched(Tp::PendingOperation*)));
+
+ setReady();
}
+#endif
#include "sasl-auth-op.moc"
diff --git a/sasl-auth-op.h b/sasl-auth-op.h
index ecd4da1..962022f 100644
--- a/sasl-auth-op.h
+++ b/sasl-auth-op.h
@@ -44,17 +44,25 @@ Q_SIGNALS:
private Q_SLOTS:
void gotProperties(Tp::PendingOperation *op);
void onOpenWalletOperationFinished(Tp::PendingOperation *op);
+ void onAuthOperationFinished(Tp::PendingOperation *op);
+
+#ifdef HAVE_SSO
//FIXME this is a wordaround until Tp::Client::AccountInterfaceStorageInterface is merged into Tp::Account
//https://bugs.freedesktop.org/show_bug.cgi?id=63191
void onGetAccountStorageFetched(Tp::PendingOperation *op);
- void onAuthOperationFinished(Tp::PendingOperation *op);
+#endif
private:
+ void setReady();
KTp::WalletInterface *m_walletInterface;
Tp::AccountPtr m_account;
Tp::ChannelPtr m_channel;
- int m_accountStorageId;
Tp::Client::ChannelInterfaceSASLAuthenticationInterface *m_saslIface;
+
+#ifdef HAVE_SSO
+ void fetchAccountStorage();
+ int m_accountStorageId;
+#endif
};
#endif // SASL_AUTH_OP_H
--
ktp-auth-handler packaging
More information about the pkg-kde-commits
mailing list