[telepathy-qt4/master] Removed Prototype library.
Andre Moreira Magalhaes (andrunko)
andre.magalhaes at collabora.co.uk
Sun Jun 21 21:40:53 PDT 2009
---
TelepathyQt4/Makefile.am | 6 +-
TelepathyQt4/Prototype/Account.cpp | 285 -----
TelepathyQt4/Prototype/Account.h | 173 ---
TelepathyQt4/Prototype/AccountManager.cpp | 390 -------
TelepathyQt4/Prototype/AccountManager.h | 166 ---
TelepathyQt4/Prototype/AvatarManager.cpp | 320 ------
TelepathyQt4/Prototype/AvatarManager.h | 174 ---
TelepathyQt4/Prototype/CapabilitiesManager.cpp | 321 ------
TelepathyQt4/Prototype/CapabilitiesManager.h | 129 ---
TelepathyQt4/Prototype/ChatChannel.cpp | 243 ----
TelepathyQt4/Prototype/ChatChannel.h | 119 --
TelepathyQt4/Prototype/Client/ChannelHandler | 6 -
TelepathyQt4/Prototype/Client/StreamEngine | 6 -
TelepathyQt4/Prototype/Connection.cpp | 439 -------
TelepathyQt4/Prototype/Connection.h | 256 -----
TelepathyQt4/Prototype/ConnectionFacade.cpp | 266 -----
TelepathyQt4/Prototype/ConnectionFacade.h | 143 ---
TelepathyQt4/Prototype/Constants | 6 -
TelepathyQt4/Prototype/Contact.cpp | 191 ----
TelepathyQt4/Prototype/Contact.h | 247 ----
TelepathyQt4/Prototype/ContactManager.cpp | 1145 -------------------
TelepathyQt4/Prototype/ContactManager.h | 351 ------
TelepathyQt4/Prototype/DBusInterface.cpp | 49 -
TelepathyQt4/Prototype/DBusInterface.h | 51 -
TelepathyQt4/Prototype/Makefile.am | 198 ----
TelepathyQt4/Prototype/PresenceManager.cpp | 623 ----------
TelepathyQt4/Prototype/PresenceManager.h | 151 ---
TelepathyQt4/Prototype/Stream_Engine.xml | 44 -
TelepathyQt4/Prototype/StreamedMediaChannel.cpp | 855 --------------
TelepathyQt4/Prototype/StreamedMediaChannel.h | 436 -------
TelepathyQt4/Prototype/TpQt4Prototype.pc.in | 11 -
TelepathyQt4/Prototype/Types | 6 -
TelepathyQt4/Prototype/all.xml | 10 -
TelepathyQt4/Prototype/channel-handler.xml | 9 -
TelepathyQt4/Prototype/cli-channel-handler.cpp | 23 -
TelepathyQt4/Prototype/cli-channel-handler.h | 27 -
TelepathyQt4/Prototype/cli-stream-engine.cpp | 23 -
TelepathyQt4/Prototype/cli-stream-engine.h | 27 -
TelepathyQt4/Prototype/constants.h | 27 -
TelepathyQt4/Prototype/stream-engine.xml | 9 -
TelepathyQt4/Prototype/types.cpp | 22 -
TelepathyQt4/Prototype/types.h | 27 -
configure.ac | 7 -
tests/Makefile.am | 3 +-
tests/prototype/Makefile.am | 61 -
tests/prototype/avatar.png | Bin 7657 -> 0 bytes
tests/prototype/prototype.cpp | 1394 -----------------------
tests/prototype/prototype.h | 145 ---
48 files changed, 4 insertions(+), 9616 deletions(-)
delete mode 100644 TelepathyQt4/Prototype/Account.cpp
delete mode 100644 TelepathyQt4/Prototype/Account.h
delete mode 100644 TelepathyQt4/Prototype/AccountManager.cpp
delete mode 100644 TelepathyQt4/Prototype/AccountManager.h
delete mode 100644 TelepathyQt4/Prototype/AvatarManager.cpp
delete mode 100644 TelepathyQt4/Prototype/AvatarManager.h
delete mode 100644 TelepathyQt4/Prototype/CapabilitiesManager.cpp
delete mode 100644 TelepathyQt4/Prototype/CapabilitiesManager.h
delete mode 100644 TelepathyQt4/Prototype/ChatChannel.cpp
delete mode 100644 TelepathyQt4/Prototype/ChatChannel.h
delete mode 100644 TelepathyQt4/Prototype/Client/ChannelHandler
delete mode 100644 TelepathyQt4/Prototype/Client/StreamEngine
delete mode 100644 TelepathyQt4/Prototype/Connection.cpp
delete mode 100644 TelepathyQt4/Prototype/Connection.h
delete mode 100644 TelepathyQt4/Prototype/ConnectionFacade.cpp
delete mode 100644 TelepathyQt4/Prototype/ConnectionFacade.h
delete mode 100644 TelepathyQt4/Prototype/Constants
delete mode 100644 TelepathyQt4/Prototype/Contact.cpp
delete mode 100644 TelepathyQt4/Prototype/Contact.h
delete mode 100644 TelepathyQt4/Prototype/ContactManager.cpp
delete mode 100644 TelepathyQt4/Prototype/ContactManager.h
delete mode 100644 TelepathyQt4/Prototype/DBusInterface.cpp
delete mode 100644 TelepathyQt4/Prototype/DBusInterface.h
delete mode 100644 TelepathyQt4/Prototype/Makefile.am
delete mode 100644 TelepathyQt4/Prototype/PresenceManager.cpp
delete mode 100644 TelepathyQt4/Prototype/PresenceManager.h
delete mode 100644 TelepathyQt4/Prototype/Stream_Engine.xml
delete mode 100644 TelepathyQt4/Prototype/StreamedMediaChannel.cpp
delete mode 100644 TelepathyQt4/Prototype/StreamedMediaChannel.h
delete mode 100644 TelepathyQt4/Prototype/TpQt4Prototype.pc.in
delete mode 100644 TelepathyQt4/Prototype/Types
delete mode 100644 TelepathyQt4/Prototype/all.xml
delete mode 100644 TelepathyQt4/Prototype/channel-handler.xml
delete mode 100644 TelepathyQt4/Prototype/cli-channel-handler.cpp
delete mode 100644 TelepathyQt4/Prototype/cli-channel-handler.h
delete mode 100644 TelepathyQt4/Prototype/cli-stream-engine.cpp
delete mode 100644 TelepathyQt4/Prototype/cli-stream-engine.h
delete mode 100644 TelepathyQt4/Prototype/constants.h
delete mode 100644 TelepathyQt4/Prototype/stream-engine.xml
delete mode 100644 TelepathyQt4/Prototype/types.cpp
delete mode 100644 TelepathyQt4/Prototype/types.h
delete mode 100644 tests/prototype/Makefile.am
delete mode 100644 tests/prototype/avatar.png
delete mode 100644 tests/prototype/prototype.cpp
delete mode 100644 tests/prototype/prototype.h
diff --git a/TelepathyQt4/Makefile.am b/TelepathyQt4/Makefile.am
index 8ac3565..ea385e1 100644
--- a/TelepathyQt4/Makefile.am
+++ b/TelepathyQt4/Makefile.am
@@ -1,6 +1,6 @@
-# We need to build this directory before the Prototype subdirectory
-DIST_SUBDIRS = Prototype Farsight
-SUBDIRS = . Prototype
+DIST_SUBDIRS = Farsight
+# We need to build this directory before the Farsight subdirectory
+SUBDIRS = .
tpqt4includedir=$(includedir)/telepathy-1.0/TelepathyQt4
genincludedir=$(tpqt4includedir)/_gen
diff --git a/TelepathyQt4/Prototype/Account.cpp b/TelepathyQt4/Prototype/Account.cpp
deleted file mode 100644
index 155543e..0000000
--- a/TelepathyQt4/Prototype/Account.cpp
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 basysKom GmbH
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "TelepathyQt4/Prototype/Account.h"
-
-#include <QDebug>
-#include <QMetaProperty>
-
-#include <TelepathyQt4/Account>
-#include <TelepathyQt4/AccountManager>
-
-#include <TelepathyQt4/Prototype/Connection.h>
-#include <TelepathyQt4/Prototype/PresenceManager.h>
-
-#define ENABLE_SALUT_WORKAROUND_ // Salut shows incorrect object path.
-
-namespace {
- const int g_protocolPosition = 6;
- const int g_connectionManagerPosition = 5;
- const char* g_offline = "offline";
-}
-
-using namespace TpPrototype;
-
-class TpPrototype::AccountPrivate
-{
-public:
- AccountPrivate()
- { init(); }
-
- QString m_handle;
- bool m_isValid;
- Tp::Client::AccountInterface* m_pInterface;
- QVariantMap m_parameters;
- QVariantMap m_properties;
- QString m_connectionManagerName;
- QString m_protocolName;
- QPointer<TpPrototype::Connection> m_pConnection;
-
- void init()
- {
- m_isValid = true;
- m_pInterface = NULL;
- m_pConnection= NULL;
- }
-};
-
-Account::Account( const QString& handle, QObject* parent ):
- QObject( parent ),
- d( new AccountPrivate )
-{
- init( handle );
-}
-
-Account::~Account()
-{
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "D'tor Account:" << this;
-#endif
- delete d;
-}
-
-QVariantMap Account::parameters()
-{
- if ( d->m_parameters.isEmpty() )
- {
- d->m_parameters = d->m_pInterface->Parameters();
- }
-
- return d->m_parameters;
-}
-
-QVariantMap Account::properties()
-{
- Q_ASSERT( d->m_pInterface );
- if ( d->m_properties.isEmpty() )
- {
- for ( int i = 0; i < d->m_pInterface->metaObject()->propertyCount(); ++i )
- {
- const char* property_name = d->m_pInterface->metaObject()->property( i ).name();
- if ( QString( property_name ) == "objectName" )
- { continue; }
- d->m_properties.insert( property_name, d->m_pInterface->property( property_name ) );
- }
- }
-
- return d->m_properties;
-}
-
-void Account::setProperties( const QVariantMap& properties )
-{
- // Update local property cache and save property to DBUS service
- QStringList keys = properties.keys();
- foreach( const QString& key, keys )
- {
- d->m_pInterface->setProperty( qPrintable( key ), properties.value( key ) );
- d->m_properties.insert( key, properties.value( key ) );
- }
-}
-
-bool Account::setParameters( const QVariantMap& parameters )
-{
- if ( parameters.isEmpty() )
- { return false; }
-
- QDBusPendingReply<QStringList> reply = d->m_pInterface->UpdateParameters( parameters, QStringList() );
- reply.waitForFinished();
-
- if ( !reply.isValid() )
- {
- QDBusError error = reply.error();
-
- qWarning() << "setParameters: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- return false;
- }
-
- // Update local cache.
- QStringList keys = parameters.keys();
- foreach( const QString& key, keys )
- {
- d->m_parameters.insert( key, parameters.value( key ) );
- }
- // fall through..
- return true;
-}
-
-TpPrototype::Connection* Account::connection( QObject *parent )
-{
- if ( !d->m_pConnection )
- {
- d->m_pConnection = new Connection( this, parent ? parent : this );
- }
- return d->m_pConnection;
-}
-
-bool Account::remove()
-{
- Q_ASSERT( d->m_pInterface );
-
- emit signalAboutToRemove();
-
- QDBusPendingReply<> remove_reply = d->m_pInterface->Remove();
- remove_reply.waitForFinished();
-
- if ( !remove_reply.isValid() )
- {
- QDBusError error = remove_reply.error();
-
- qWarning() << "Remove: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- return false;
- }
-
- // slotRemoved();
-
- emit signalRemoved();
-
- // Fall through
- return true;
-}
-
-bool Account::isValid()
-{
- return d->m_isValid;
-}
-
-QString Account::connectionManagerName()
-{
- return d->m_connectionManagerName;
-}
-
-QString Account::protocolName()
-{
- return d->m_protocolName;
-}
-
-QString Account::currentPresence()
-{
- if ( !connection()->presenceManager() )
- {
- return g_offline;
- }
-#if 1
- disconnect ( connection()->presenceManager(), SIGNAL( signalOwnPresenceUpdated( const TpPrototype::Account* , const Tp::SimplePresence& ) ),
- this, SIGNAL( signalPresenceChanged() ) );
-
- connect ( connection()->presenceManager(), SIGNAL( signalOwnPresenceUpdated( const TpPrototype::Account* , const Tp::SimplePresence& ) ),
- this, SIGNAL( signalPresenceChanged() ) );
-#endif
-
- return connection()->presenceManager()->currentPresence().status;
-}
-
-QString Account::handle() const
-{
- return d->m_handle;
-}
-
-Tp::Client::AccountInterface* Account::interface()
-{
- return d->m_pInterface;
-}
-
-void Account::slotPropertiesChanged( const QVariantMap& properties )
-{
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Account::slotPropertiesChanged(): " << properties;
-#endif
- QStringList keys = properties.keys();
- foreach( const QString& key, keys )
- {
- d->m_properties.insert( key, properties.value( key ) );
- }
-}
-
-void Account::slotRemoved()
-{
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Account::slotRemoved(): sender:" << sender();
-#endif
- d->m_isValid = false;
-}
-
-void Account::init( const QString handle )
-{
- d->m_handle = handle;
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Handle:" << d->m_handle;
-#endif
- d->m_pInterface = new Tp::Client::AccountInterface( "org.freedesktop.Telepathy.AccountManager",
- d->m_handle,
- this );
-
- QStringList object_path_elements = d->m_pInterface->path().split('/');
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Object path: " << d->m_pInterface->path();
- qDebug() << "Elements : " << object_path_elements;
-#endif
- d->m_connectionManagerName = object_path_elements.at( g_connectionManagerPosition );
- d->m_protocolName = object_path_elements.at( g_protocolPosition );
-
-#ifdef ENABLE_SALUT_WORKAROUND_
- // Salut workaround..
- // Salut has a corrupt object path that results in an invalid protocol name
- if ( d->m_protocolName == "local_2dxmpp" )
- { d->m_protocolName = "local_xmpp"; }
-#endif
-
- // "-" is not allowed on as DBus object path. Thus "-" is mapped to "_".
- // Revert the mapping to get a correct protocol name
- d->m_protocolName.replace( '_', '-' );
-
- connect( d->m_pInterface, SIGNAL( AccountPropertyChanged( const QVariantMap& ) ),
- this, SLOT( slotPropertiesChanged( const QVariantMap& ) ) );
- connect( d->m_pInterface, SIGNAL( AccountPropertyChanged( const QVariantMap& ) ),
- this, SIGNAL( signalPropertiesChanged( const QVariantMap& ) ) );
- connect( d->m_pInterface, SIGNAL( Removed() ),
- this, SLOT( slotRemoved() ) );
-}
-
-#include "_gen/Account.h.moc"
diff --git a/TelepathyQt4/Prototype/Account.h b/TelepathyQt4/Prototype/Account.h
deleted file mode 100644
index 36aa44f..0000000
--- a/TelepathyQt4/Prototype/Account.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 basysKom GmbH
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef TelepathyQt4_Prototype_Account_H_
-#define TelepathyQt4_Prototype_Account_H_
-
-#include <QObject>
-#include <QPointer>
-#include <QVariantMap>
-
-namespace Tp {
-namespace Client {
-class AccountInterface;
-}
-}
-
-namespace TpPrototype {
-
-class Connection;
-class AccountPrivate;
-
-/**
- * @ingroup qt_accountmgm
- * This class manages an account.
- * @todo: Account should be more like QPersistantModelIndex. Thus we don't have to use pointer of it.
- * @todo In order to allow custom extensions, we need a support to register proxies in the AccountManager
- */
-class Account : public QObject
-{
- Q_OBJECT
-public:
- /**
- * The parameters of this account.
- * Returns a list of all parameters of this account that were explicitly set by AccountManager::createAccount().
- * @return The properties as key,value pair.
- */
- QVariantMap parameters();
-
- /**
- * Properties of this account
- */
- QVariantMap properties();
-
- /**
- * Set Properties. Changes the given list of Properties.
- * @param properties The list of changed or new properties.
- */
- void setProperties( const QVariantMap& properties );
-
- /**
- * Set Parameters. Changes the given list of parameters.
- * @param parameters The list of changed or new parameters
- * @return True if successful.
- */
- bool setParameters( const QVariantMap& parameters );
-
- /**
- * Connection.
- * Returns a connection object that belongs to this account.<br>
- * <b>Info:</b> This class keeps ownership of this class.
- * @param parent The parent of this object. If NULL the connection is used as parent.
- * @return Connection object.
- */
- TpPrototype::Connection* connection( QObject* parent = NULL );
-
- /**
- * Remove account. Removes the given account.
- * <b>Note:</b> Although this call is synchronous, the internal book keeping of valid accounts is
- * updated by DBUS signals that might need some time. Thus, calling AccountManager::count() emmediately
- * after removing might return an incorrect value. Wait until AccountManager::signalAccountsUpdated() is emitted.
- * @return true if remove operation was successful.
- */
- bool remove();
-
- /**
- * Validity check.
- * Do not access any functions if this account is invalid.
- */
- bool isValid();
-
- /**
- * Get connection manager for this account.
- * Returns the connection manager that belongs to this account
- * @return The name of the connection manager (like gabble, ..).
- */
- QString connectionManagerName();
-
- /**
- * Get protocol for this account.
- * Returns the protocol that belongs to this account
- * @return The name of the protocol (like jabber, ..)
- */
- QString protocolName();
-
- /**
- * Get the current presence.
- * The presence for the current connection is returned.
- * Needs to be called befor <b>signalPresenceChanged()</b>will be emitted.
- * @return The current aggregated presence.
- */
- QString currentPresence();
-
-signals:
- /** Property were changed. This signal is emitted when properties were changed. */
- void signalPropertiesChanged( const QVariantMap& properties );
-
- /** About to remove. This signal is emmitted before the account is removed. */
- void signalAboutToRemove();
-
- /** Removed. This signal is emmitted after the account is removed. */
- void signalRemoved();
-
- /** Account presence was changed. Signal is emitted after the account changed its presence state.
- * <b>currentPresence()</b> has to be called before.
- */
- void signalPresenceChanged();
-
-
-protected slots:
- void slotPropertiesChanged( const QVariantMap& properties );
- void slotRemoved();
-
-protected:
- /**
- * Constructor. The account manager cannot be instantiated directly. Use AccountManager::account() for it!
- */
- Account( const QString& handle, QObject* parent );
- ~Account();
-
- /**
- * D-BUS interface.
- * This protected access to the D-BUS interface can be used to extend this class with special features.
- */
- Tp::Client::AccountInterface* interface();
-
- /**
- * Returns the handle.
- * The handle is an internal representation to access the real data. Its format should
- * not be interpreted.
- */
- QString handle() const;
-
-private:
- void init( const QString handle );
-
- AccountPrivate * const d;
- friend class AccountManager; // TODO: Remove this friend class
- friend class AccountManagerPrivate;
-};
-
-}
-
-
-#endif
diff --git a/TelepathyQt4/Prototype/AccountManager.cpp b/TelepathyQt4/Prototype/AccountManager.cpp
deleted file mode 100644
index 125aeb1..0000000
--- a/TelepathyQt4/Prototype/AccountManager.cpp
+++ /dev/null
@@ -1,390 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 basysKom GmbH
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "TelepathyQt4/Prototype/AccountManager.h"
-
-#include <QCoreApplication>
-#include <QDBusObjectPath>
-#include <QDBusPendingReply>
-#include <QDebug>
-#include <QMap>
-#include <QPointer>
-
-#include <TelepathyQt4/AccountManager>
-#include <TelepathyQt4/DBus>
-#include <TelepathyQt4/Types>
-
-#include <TelepathyQt4/Prototype/Account.h>
-
-// #define ENABLE_DEBUG_OUTPUT_
-
-using namespace TpPrototype;
-
-AccountManager* TpPrototype::AccountManager::m_pInstance = NULL;
-
-class TpPrototype::AccountManagerPrivate
-{
-public:
- AccountManagerPrivate()
- { init(); }
-
- Tp::Client::AccountManagerInterface* m_pInterface;
- Tp::Client::DBus::PropertiesInterface* m_propertiesInterface;
- QMap<QString, QPointer<Account> > m_validAccountHandles;
-
- void init()
- {
- m_pInterface = NULL;
- }
-
- Tp::ObjectPathList validAccounts()
- {
- Q_ASSERT(m_propertiesInterface);
-
- QDBusPendingReply<QDBusVariant> get = m_propertiesInterface->Get(
- "org.freedesktop.Telepathy.AccountManager", "ValidAccounts");
- get.waitForFinished();
-
- if (!get.isValid())
- {
- qWarning().nospace() << get.error().name() << ": "
- << get.error().message();
- return Tp::ObjectPathList();
- }
-
- Tp::ObjectPathList paths = qdbus_cast<Tp::ObjectPathList>(
- get.value().variant());
-
- if (paths.size() == 0)
- {
- // maybe the AccountManager is buggy, like Mission Control
- // 5.0.beta45, and returns an array of strings rather than
- // an array of object paths?
-
- QStringList wronglyTypedPaths = qdbus_cast<QStringList>(
- get.value().variant());
-
- if (wronglyTypedPaths.size() > 0)
- {
- qWarning() << "AccountManager returned wrong type "
- "(expected 'ao', got 'as'); workaround active";
-
- Q_FOREACH (QString path, wronglyTypedPaths)
- {
- paths << QDBusObjectPath(path);
- }
- }
- }
-
- return paths;
- }
-
- void removeAccount( const QString& handle )
- {
- if ( m_validAccountHandles.contains( handle ) )
- {
- delete m_validAccountHandles.value( handle );
- m_validAccountHandles.remove( handle );
- }
- }
-
- void connectAccountToManager( const TpPrototype::Account* account, TpPrototype::AccountManager* dest )
- {
- QObject::connect( account, SIGNAL( signalRemoved() ),
- dest, SLOT( slotAccountRemoved() ) );
- QObject::connect( account, SIGNAL( signalPropertiesChanged( const QVariantMap& ) ),
- dest, SLOT( slotAccountUpdated() ) );
- QObject::connect( account, SIGNAL( signalPresenceChanged() ),
- dest, SLOT( slotAccountUpdated() ) );
- }
-
-};
-
-AccountManager::AccountManager( QObject* parent ):
- QObject( parent ),
- d( new AccountManagerPrivate )
-{
- init();
-}
-
-AccountManager* AccountManager::instance()
-{
- if ( NULL == m_pInstance )
- {
- m_pInstance = new AccountManager( QCoreApplication::instance() );
- Q_ASSERT( m_pInstance );
- }
-
- return m_pInstance;
-}
-
-
-AccountManager::~AccountManager()
-{
- delete d;
-}
-
-int AccountManager::count()
-{
- return d->m_validAccountHandles.count();
-}
-
-// TODO: Define a accountlist container class that stores the accounts and is doing the book keeping..
-QList<QPointer<Account> > AccountManager::accountList()
-{
- QList<QPointer<Account> > ret_list;
-
- Account* account = NULL;
- QStringList handles = d->m_validAccountHandles.keys();
- foreach( const QString& handle, handles )
- {
- account = d->m_validAccountHandles.value( handle );
- Q_ASSERT( account );
- if ( !account )
- {
- qWarning() << "Found handles that points to no object!";
- d->removeAccount( handle );
- continue;
- }
- ret_list.append( QPointer<Account>( account ) );
- }
-
- return ret_list;
-}
-
-#if 0
-TpPrototype::Account* account( int num )
-{
- if ( d->m_validAccountHandles.at(
-}
-#endif
-
-
-QList<QPointer<Account> > AccountManager::accountListOfEnabledAccounts()
-{
- QList<QPointer<Account> > ret_list;
-
- if ( accountList().count() != 0)
- {
- foreach (const QPointer<Account>& account, accountList() )
- {
- if ( account->properties().value( "Enabled" ) == true )
- {
- ret_list.append( account );
- }
- }
- }
- return ret_list;
-}
-
-bool AccountManager::createAccount( const QString& connectionManager, const QString& protocol, const QString& displayName, const QVariantMap& _parameters )
-{
- QVariantMap parameters = _parameters;
-
- //HACK: Set server for google talk which cannot be set after the account was created.
- // This should be removed after fixing the create account workflow!
- if ( parameters.value( "account" ).toString().contains( "google" ) )
- { parameters.insert( "server", "talk.google.com" ); }
-
- if ( parameters.contains( "port" ) && parameters.value( "port" ).type() != QVariant::UInt )
- {
- qWarning() << "We got the wrong type of the port. We correct it here manually";
- parameters.insert( "port", qvariant_cast<uint>( parameters.value( "port" ) ) );
- }
-
- // empty Parameterlists should not be send to create account. Otherwise strange things may happen..
- if ( parameters.size() > 0 )
- {
- QStringList keys = parameters.keys();
- foreach( const QString& key, keys )
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "createAccount--> Key:" << key << "value:" << parameters.value( key );
-#endif
- if (parameters.value(key).toString().isEmpty() )
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Remove Key:" << key << "value:" << parameters.value( key );
-#endif
- parameters.remove( key );
- }
- }
- }
-
- QDBusPendingReply<QDBusObjectPath> create_reply = d->m_pInterface->CreateAccount( connectionManager,
- protocol,
- displayName,
- parameters,
- QVariantMap());
- create_reply.waitForFinished();
-
- if ( !create_reply.isValid() )
- {
- QDBusError error = create_reply.error();
-
- qWarning() << "Disconnect: error type:" << error.type()
- << "Disconnect: error name:" << error.name()
- << "error message:" << error.message();
-
- return false;
- }
-
- // Fall through
- return true;
-}
-
-void AccountManager::slotAccountValidityChanged( const QDBusObjectPath& account, bool valid )
-{
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "AccountManager::slotAccountValidityChanged: " << valid;
-#endif
- bool update_occurred = false;
- if ( valid )
- {
- // Add account to the list if it is not already stored
- if ( !d->m_validAccountHandles.contains( account.path() )
- || !d->m_validAccountHandles.value( account.path() ) )
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "AccountManager::slotAccountValidityChanged: Add new account to list";
-#endif
- TpPrototype::Account* new_account = new Account( account.path(), this );
- d->connectAccountToManager( new_account, this );
- d->m_validAccountHandles.insert( account.path(), QPointer<Account>( new_account ) );
- update_occurred = true;
- emit signalNewAccountAvailable( new_account );
- }
- }
- else
- {
- if ( d->m_validAccountHandles.contains( account.path() ) )
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "AccountManager::slotAccountValidityChanged: Remove account from list";
-#endif
- emit signalAboutToRemoveAccount( d->m_validAccountHandles.value( account.path() ) );
- d->removeAccount( account.path() );
- emit signalAccountRemoved();
- update_occurred = true;
- }
- }
- if ( update_occurred )
- { emit signalAccountsUpdated(); }
-}
-
-void AccountManager::slotAccountRemoved( const QDBusObjectPath& account )
-{
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "AccountManager::slotAccountRemoved() <external>";
-#endif
- Account* account_object = d->m_validAccountHandles.value( account.path() );
- if ( !account_object )
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "AccountManager::slotAccountRemoved():Account already removed";
-#endif
- return;
- }
-
- // These signals are emitted if an account was removed extarnally.
- // The signals were already emitted by slotAccountRemoved() if the account was removed locally
- emit signalAboutToRemoveAccount( account_object );
- d->removeAccount( account.path() );
- emit signalAccountRemoved();
- emit signalAccountsUpdated();
-}
-
-
-void AccountManager::slotAccountUpdated()
-{
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "AccountManager::slotPropertiesChanged()";
-#endif
- Account* account = qobject_cast<Account*>( sender() );
- Q_ASSERT( account );
-
- emit signalAccountUpdated( account );
- emit signalAccountsUpdated();
-}
-
-// Called when an Account was removed
-void AccountManager::slotAccountRemoved()
-{
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "AccountManager::slotAccountRemoved sender:" << sender();
-#endif
- Account* account = qobject_cast<Account*>( sender() );
- Q_ASSERT( account );
- if ( account )
- {
- QString handle = account->handle();
- emit signalAboutToRemoveAccount( account );
- d->removeAccount( handle );
- emit signalAccountRemoved();
- emit signalAccountsUpdated();
- }
-}
-
-void AccountManager::init()
-{
- Tp::registerTypes();
- d->m_pInterface = new Tp::Client::AccountManagerInterface( "org.freedesktop.Telepathy.AccountManager",
- "/org/freedesktop/Telepathy/AccountManager",
- this );
- Q_ASSERT( d->m_pInterface );
- if ( ! d->m_pInterface )
- { return; }
-
- if ( !d->m_pInterface->isValid() )
- {
- qWarning() << "Unable to connect to AccountManagerInterface: MissionControl seems to be missing!";
- }
- //Q_ASSERT( d->m_pInterface->isValid() );
-
- d->m_propertiesInterface = new Tp::Client::DBus::PropertiesInterface(
- "org.freedesktop.Telepathy.AccountManager",
- "/org/freedesktop/Telepathy/AccountManager",
- this);
- Q_ASSERT( d->m_propertiesInterface );
-
- // It might be better to use layzy initializing here.. (ses)
- Tp::ObjectPathList account_handles = d->validAccounts();
-
- foreach( const QDBusObjectPath& account_handle, account_handles )
- {
-
- Account* account = new Account( account_handle.path(), this );
- d->connectAccountToManager( account, this );
- d->m_validAccountHandles.insert( account_handle.path(), QPointer<Account>( account ) );
- emit signalNewAccountAvailable( account );
- emit signalAccountsUpdated();
- }
-
- connect( d->m_pInterface, SIGNAL( AccountValidityChanged( const QDBusObjectPath&, bool ) ),
- this, SLOT( slotAccountValidityChanged( const QDBusObjectPath&, bool ) ) );
- connect( d->m_pInterface, SIGNAL( AccountRemoved(const QDBusObjectPath& ) ),
- this, SLOT( slotAccountRemoved( const QDBusObjectPath& ) ) );
-
-
-}
-
-#include "_gen/AccountManager.h.moc"
diff --git a/TelepathyQt4/Prototype/AccountManager.h b/TelepathyQt4/Prototype/AccountManager.h
deleted file mode 100644
index 28b5812..0000000
--- a/TelepathyQt4/Prototype/AccountManager.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 basysKom GmbH
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#ifndef TelepathyQt4_Prototype_AccountManager_H_
-#define TelepathyQt4_Prototype_AccountManager_H_
-
-#include <QDBusObjectPath>
-#include <QObject>
-#include <QPointer>
-
-#include <TelepathyQt4/Prototype/Account.h>
-
-#ifdef DEPRECATED_ENABLED__
-#define ATTRIBUTE_DEPRECATED __attribute__((deprecated))
-#else
-#define ATTRIBUTE_DEPRECATED
-#endif
-
-
-namespace TpPrototype {
-//
-class AccountManagerPrivate;
-
-/**
- * @defgroup qt_accountmgm Account Management
- * @ingroup qt_style_api
- * Classes that provide functions to handle accounts.
- */
-
-
-/**
- * This class manages all accounts.
- * The account manager provides access to the list of accounts. Additionally you can create and remove accounts.<br>
- * Use the Connectionfacade to obtain a list of valid parameters for a protocol or the list of available connection managers.<br>
- * @see ConnectionFacade
- * @ingroup qt_accountmgm
- * @todo Integrate all functions related to Accounts from the ConnectionFacade into this class.
- */
-class AccountManager : public QObject
-{
- Q_OBJECT
-public:
- /**
- * Returns pointer to the instance of this class.
- * @return Instance pointer.
- */
- static AccountManager* instance();
-
- /**
- * Number of Accounts. Returns how many accounts are available.
- * @return Number of accounts available.
- * @deprecated Use accountList().count() instead.
- */
- int count() ATTRIBUTE_DEPRECATED;
-
- /**
- * List of accounts. The account pointer is stored in a QPointer. If the account is removed it is deleted
- * by the account manager. Thus, the pointer is set to 0.
- * @todo: Return QList<Account> here, instead of a pointer.
- */
- QList<QPointer<Account> > accountList();
-
- /**
- * List of enabled accounts
- */
- QList<QPointer<Account> > accountListOfEnabledAccounts();
-
- /**
- * Create account. This function creates an account with the given parameters.<br>
- * <b>Note:</b> Although this call is synchronous, the internal book keeping of valid accounts is
- * updated by DBUS signals that might need some time. Thus, calling count() emmediately after create might
- * return an incorrect value. Wait until signalAccountsUpdated() is emitted.
- * @param connectionManager The name of the connection manager, e.g. "salut".
- * @param protocol The protocol, e.g. "local-xmpp".
- * @param parameters List of parameters needed to create the account
- * @param displayName The name of the account to display.
- * @return true when creating was successful.
- */
- bool createAccount( const QString& connectionManager, const QString& protocol, const QString& displayName, const QVariantMap& parameters );
-
- /**
- * Remove account. Removes the given account.
- * @param account The pointer to the account. The pointer is not accessable after this call!
- * @return true if remove operation was successful.
- */
- bool removeAccount( Account* account );
-
-signals:
- /**
- * Some changes occurred on the account data. This signal is emitted if the internal data of the account manager
- * is changed (accounts were created or removed).<br>
- * It is suggested to refetch all locally stored data after this signal.
- */
- void signalAccountsUpdated();
-
- /**
- * A new account is available.
- * This signal is emitted if a new account was created by a contact manager
- */
- void signalNewAccountAvailable( TpPrototype::Account* account );
-
- /**
- * An account will be removed from internal data.
- * This signal is emitted after the account was removed but immediately before the account is removed from the internal lists.<br>
- * Use this signal to obtain all necessary information to handle this remove operation properly. The signal <i>signalAccountRemoved()</i>
- * will be called immediately after cleaning the internal lists.
- * <br>
- * Do not use <i>account</i> after receiving this signal!
- * @see signalAccountRemoved()
- */
- void signalAboutToRemoveAccount( TpPrototype::Account* account );
-
- /**
- * An account was removed.
- * This signal is emitted after <i>signalAboutToRemoveAccount()</i>. The internal lists are updated now.
- * @see signalAboutToRemoveAccount()
- */
- void signalAccountRemoved();
-
- /**
- * An account was updated.
- * This signal is emitted after an account was updated.
- */
- void signalAccountUpdated( TpPrototype::Account* account );
-
-protected:
- /**
- * Constructor. The account manager cannot be instantiated directly. Use instance() for it!
- */
- AccountManager( QObject* parent = NULL );
- ~AccountManager();
-
-protected slots:
- void slotAccountValidityChanged( const QDBusObjectPath& account, bool valid );
- void slotAccountRemoved( const QDBusObjectPath& account );
- void slotAccountRemoved();
- void slotAccountUpdated();
-
-private:
- void init();
-
- AccountManagerPrivate * const d;
- static AccountManager* m_pInstance;
-};
-
-}
-
-#endif
diff --git a/TelepathyQt4/Prototype/AvatarManager.cpp b/TelepathyQt4/Prototype/AvatarManager.cpp
deleted file mode 100644
index 6bc91cf..0000000
--- a/TelepathyQt4/Prototype/AvatarManager.cpp
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 basysKom GmbH
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "TelepathyQt4/Prototype/AvatarManager.h"
-
-#include <QCoreApplication>
-#include <QDBusObjectPath>
-#include <QDBusPendingReply>
-#include <QDebug>
-#include <QMap>
-#include <QPointer>
-
-#include <TelepathyQt4/Connection>
-
-#include <TelepathyQt4/Prototype/Account.h>
-#include <TelepathyQt4/Prototype/AccountManager.h>
-#include <TelepathyQt4/Prototype/ConnectionFacade.h>
-#include <TelepathyQt4/Prototype/Connection.h>
-#include <TelepathyQt4/Prototype/Contact.h>
-#include <TelepathyQt4/Prototype/ContactManager.h>
-
-// #define ENABLE_DEBUG_OUTPUT_
-
-using namespace TpPrototype;
-
-class TpPrototype::AvatarManagerPrivate
-{
-public:
- AvatarManagerPrivate( Connection* connection,
- Tp::Client::ConnectionInterface* interface )
- { init( connection, interface ); }
-
- Tp::Client::ConnectionInterface* m_pConnectionInterface;
- Tp::Client::ConnectionInterfaceAvatarsInterface* m_pAvatarsInterface;
- QPointer<Connection> m_pConnection;
-
- bool m_isValid;
- void init( Connection* connection,
- Tp::Client::ConnectionInterface* interface )
- {
- m_pConnection = connection;
- m_pConnectionInterface = interface;
- m_pAvatarsInterface = NULL;
- m_isValid = true;
- }
-
-};
-
-AvatarManager::AvatarManager( Connection* connection,
- Tp::Client::ConnectionInterface* interface,
- QObject* parent ):
- QObject( parent ),
- d( new AvatarManagerPrivate( connection, interface ) )
-{
- init( connection, interface );
-}
-
-AvatarManager::~AvatarManager()
-{
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "D'tor AvatarManager (" << this << ")";
-#endif
- delete d;
-}
-
-bool AvatarManager::isValid()
-{
- return d->m_isValid;
-}
-
-
-
-TpPrototype::Connection* AvatarManager::connection()
-{
- return d->m_pConnection;
-}
-
-bool AvatarManager::setAvatar( const TpPrototype::AvatarManager::Avatar& newValue )
-{
- QDBusPendingReply<QString> set_avatar_reply = d->m_pAvatarsInterface->SetAvatar( newValue.avatar, newValue.mimeType );
- set_avatar_reply.waitForFinished();
-
- if ( !set_avatar_reply.isValid() )
- {
- QDBusError error = set_avatar_reply.error();
-
- qWarning() << "AvatarManager::setAvatar: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- d->m_isValid = false;
- return false;
- }
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "AvatarManager::setAvatar: token " << set_avatar_reply.value();
-#endif
-
- return true;
-}
-
-void AvatarManager::requestAvatar()
-{
- uint self_handle = TpPrototype::ConnectionFacade::instance()->selfHandleForConnectionInterface( d->m_pConnectionInterface );
- QList<uint> contact_ids;
- contact_ids << self_handle;
-
- QDBusPendingReply<> avatars_reply = d->m_pAvatarsInterface->RequestAvatars( contact_ids );
-
- // slotAvatarRetrieved is called after this point.
-}
-
-TpPrototype::AvatarManager::AvatarRequirements AvatarManager::avatarRequirements()
-{
- Q_ASSERT( d->m_pAvatarsInterface );
-
- TpPrototype::AvatarManager::AvatarRequirements return_data;
- return_data.isValid = false;
-
- QDBusPendingReply<QStringList, ushort, ushort, ushort, ushort, uint> requirements_reply = d->m_pAvatarsInterface->GetAvatarRequirements();
- requirements_reply.waitForFinished();
-
- if ( !requirements_reply.isValid() )
- {
- QDBusError error = requirements_reply.error();
-
- qWarning() << "AvatarManager::GetAvatarRequirements: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- d->m_isValid = false;
- return return_data;
- }
-
- TpPrototype::AvatarManager::AvatarRequirements ret_requirement;
- ret_requirement.mimeTypes = qvariant_cast<QStringList>( requirements_reply.argumentAt( 0 ) );
- ret_requirement.minimumWidth = qvariant_cast<ushort>(requirements_reply.argumentAt( 1 ) );
- ret_requirement.minimumHeight = qvariant_cast<ushort>(requirements_reply.argumentAt( 2 ) );
- ret_requirement.maximumWidth = qvariant_cast<ushort>(requirements_reply.argumentAt( 3 ) );
- ret_requirement.maximumHeight = qvariant_cast<ushort>(requirements_reply.argumentAt( 4 ) );
- ret_requirement.maxSize = qvariant_cast<uint>(requirements_reply.argumentAt( 5 ) );
- return_data.isValid = true;
-
- return ret_requirement;
-}
-
-void AvatarManager::avatarForContactList( const QList<QPointer<Contact> >& contacts )
-{
- Q_ASSERT( d->m_pAvatarsInterface );
- Tp::UIntList contact_ids;
- foreach( Contact* contact, contacts )
- {
- if ( !contact )
- { continue; }
- contact_ids.append( contact->telepathyHandle() );
- }
-
- QDBusPendingReply<> avatars_reply = d->m_pAvatarsInterface->RequestAvatars( contact_ids );
-
- // slotAvatarRetrieved is called after this point.
-}
-
-
-void AvatarManager::slotAvatarUpdated( uint contactHandle, const QString& newAvatarToken )
-{
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "AvatarManager::slotAvatarUpdated(" << contactHandle << "," << newAvatarToken << ")";
-#endif
- if ( !d->m_pConnection )
- {
- qWarning() << "AvatarManager::slotAvatarUpdated(): Received a Avatar changed signal but no connection object exists!";
- return;
- }
-
- Q_ASSERT( d->m_pAvatarsInterface );
- Q_ASSERT( d->m_pAvatarsInterface->isValid() );
- Q_ASSERT( d->m_pConnection );
- Q_ASSERT( d->m_pConnection->contactManager() );
-
- if ( !d->m_pConnection
- || !d->m_pConnection->contactManager() )
- {
- qWarning() << "AvatarManager::slotAvatarUpdated(): Unable to request contact manager or connection is not valid!";
- return;
- }
-
- uint self_handle = ConnectionFacade::instance()->selfHandleForConnectionInterface( d->m_pConnectionInterface );
-
- if ( self_handle == contactHandle )
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "AvatarManager::slotAvatarUpdated(): Ignored that my avatar is updated.";
-#endif
-
- //emit void signalOwnAvatarChanged();
- }
- else
- {
- foreach( TpPrototype::Contact* contact, d->m_pConnection->contactManager()->contactList() )
- {
- if ( ( contact->telepathyHandle() == contactHandle )
- && ( contact->avatar().token != newAvatarToken ) )
- {
- // Request avatar for this contact.
- avatarForContactList( QList<QPointer<Contact> >() << QPointer<Contact>( contact ) );
- }
- }
- }
-}
-
-// Called after avatarForContactList() is called.
-void AvatarManager::slotAvatarRetrieved( uint contactHandle, const QString& token, const QByteArray& avatar, const QString& type )
-{
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "slotAvatarRetrieved: Handle: " << contactHandle << "Token:" << token << "Type: " << type;
-#endif
-
- TpPrototype::AvatarManager::Avatar new_avatar;
- new_avatar.avatar = avatar;
- new_avatar.token = token;
- new_avatar.mimeType = type;
-
- uint self_handle = ConnectionFacade::instance()->selfHandleForConnectionInterface( d->m_pConnectionInterface );
- if ( self_handle == contactHandle )
- {
- emit signalOwnAvatarChanged( new_avatar );
- return;
- }
-
- foreach( TpPrototype::Contact* contact, d->m_pConnection->contactManager()->contactList() )
- {
- // Find contact for handle and check whether the token has changed. If not, the avatar was not changed.
- if ( ( contact->telepathyHandle() == contactHandle )
- && ( contact->avatar().token != token ) )
- {
- contact->setAvatar( new_avatar );
- emit signalAvatarChanged( contact );
- }
- }
-}
-
-void AvatarManager::init( Connection* connection,
- Tp::Client::ConnectionInterface* interface )
-{
- Q_ASSERT( interface );
-
- if ( !interface || !connection )
- {
- d->m_isValid = false;
- return;
- }
-
- Tp::registerTypes();
- qRegisterMetaType<TpPrototype::AvatarManager::Avatar>();
-
- QDBusPendingReply<QStringList> interfaces_reply = d->m_pConnectionInterface->GetInterfaces();
- interfaces_reply.waitForFinished();
-
- if ( !interfaces_reply.isValid() )
- {
- QDBusError error = interfaces_reply.error();
-
- qWarning() << "GetInterfaces: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- d->m_isValid = false;
- return;
- }
-
- QString avatar_interface_name;
- bool found_avatar_support = false;
- foreach( const QString& interface, interfaces_reply.value() )
- {
- if ( interface.endsWith( ".Avatars" ) )
- {
- found_avatar_support = true;
- avatar_interface_name = interface;
- break;
- }
- }
- if ( !found_avatar_support )
- {
- d->m_isValid = false;
- qWarning( "AvatarManager::init(): Connection Manager does not support the Interface \"Avatars\". Other interfaces are not supported!" );
- return;
- }
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Interface Name: " << avatar_interface_name;
-#endif
- d->m_pAvatarsInterface = new Tp::Client::ConnectionInterfaceAvatarsInterface( d->m_pConnectionInterface->service(), d->m_pConnectionInterface->path(), this );
-
- connect( d->m_pAvatarsInterface, SIGNAL( AvatarUpdated(uint, const QString&) ),
- this, SLOT( slotAvatarUpdated(uint, const QString&) ) );
- connect( d->m_pAvatarsInterface, SIGNAL( AvatarRetrieved(uint , const QString& , const QByteArray& , const QString& ) ),
- this, SLOT( slotAvatarRetrieved( uint , const QString& , const QByteArray& , const QString& ) ) );
-
-}
-
-#include "_gen/AvatarManager.h.moc"
diff --git a/TelepathyQt4/Prototype/AvatarManager.h b/TelepathyQt4/Prototype/AvatarManager.h
deleted file mode 100644
index a6f07a7..0000000
--- a/TelepathyQt4/Prototype/AvatarManager.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 basysKom GmbH
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#ifndef TelepathyQt4_Prototype_AvatarManager_H_
-#define TelepathyQt4_Prototype_AvatarManager_H_
-
-#include <QDBusObjectPath>
-#include <QObject>
-#include <QPointer>
-
-#include <TelepathyQt4/Types>
-
-namespace Tp
-{
- namespace Client
- {
- class ConnectionInterface;
- }
-}
-
-namespace TpPrototype {
-
-class AvatarManagerPrivate;
-class Connection;
-class Contact;
-class Account;
-
-/**
- * @ingroup qt_connection
- * This class manages avatar information for one connection.
- * Whenever a contact avatar changes, the signal signalAvatarChanged() is emitted. This signal provides the related contact object
- * obtained from the ContactManager.
- * In order to keep the contacts updated, you just have to instantiate this class (by requesting the object with Connection::avatarManager())
- * and initialize the list of contacts once (by calling avatarForContactList() ). After this point, the avatar of the contact
- * is updated automatically if a change is signalled by the backend.
- * @see Connection
- */
-class AvatarManager : public QObject
-{
- Q_OBJECT
-
-public:
- /**
- * The required Avatar format.
- */
- struct AvatarRequirements
- {
- /** The list of supported Mimetypes */
- QStringList mimeTypes;
- /** The minimum image width */
- uint minimumWidth;
- /** The minmum image height */
- uint minimumHeight;
- /** The maximum image width */
- uint maximumWidth;
- /** The maximum image height */
- uint maximumHeight;
- /** The maximum size */
- uint maxSize;
- /** data validity */
- bool isValid;
- };
-
- /**
- * The Avatar
- */
- struct Avatar
- {
- /** The avatar data */
- QByteArray avatar;
- /** The mimetype of this data */
- QString mimeType;
- /** The id associated with this avatar */
- QString token;
- };
-
- /**
- * Validity.
- * Do not access any methods if the object is invalid!
- */
- bool isValid();
-
- /**
- * Returns the connection that belongs to this capabilities information.
- * @return The connection object
- */
- TpPrototype::Connection* connection();
-
- /**
- * Set local Avatar.
- * This function sets the capabilites of the account that belongs to this connection.
- * @param newValue The new avatar. The content of <i>token</i> is ignored.
- * @return true if setting was successful
- */
- bool setAvatar( const TpPrototype::AvatarManager::Avatar& newValue );
-
- /**
- * Request local Avatar.
- * Requests the avatar of the account that belongs to this connection.
- * <b>Info:</b> The signal signalOwnAvatarChanged() is called asynchonously after this call.
- */
- void requestAvatar();
-
- /**
- * Get the required format of avatars on this connection.
- * @return The requirements of supported avatars.
- * @see AvatarRequirements
- */
- AvatarRequirements avatarRequirements();
-
- /**
- * Get the avatar for a list of contacts.
- * The avatars can be requested from the contact object.
- * <b>Info:</b> The signal signalAvatarChanged() is called asynchonously after this call for every contact in this list.
- * @param List of contacts to request the avatars from.
- * @see signalAvatarChanged()
- */
- void avatarForContactList( const QList<QPointer<Contact> >& contacts );
-
-signals:
- /**
- * The avatar of a contact was changed. This signal is emitted when any of the known contacts changed its avatar.
- */
- void signalAvatarChanged( TpPrototype::Contact* contact );
-
- /**
- * My avatar was changed.
- * This signal is emmitted if the local avatar was changed.
- */
- void signalOwnAvatarChanged( TpPrototype::AvatarManager::Avatar avatar );
-
-protected:
- /**
- * Constructor. The capabilities manager cannot be instantiated directly. Use Connection::AvatarManager() for it!
- */
- AvatarManager( TpPrototype::Connection* connection,
- Tp::Client::ConnectionInterface* interface,
- QObject* parent = NULL );
- ~AvatarManager();
-
-protected slots:
- void slotAvatarUpdated( uint contact, const QString& newAvatarToken );
- void slotAvatarRetrieved( uint contact, const QString& token, const QByteArray& avatar, const QString& type );
-
-private:
- void init( TpPrototype::Connection* connection, Tp::Client::ConnectionInterface* interface );
-
- TpPrototype::AvatarManagerPrivate * const d;
- friend class Connection;
- friend class ConnectionPrivate;
-};
-}
-
-Q_DECLARE_METATYPE( TpPrototype::AvatarManager::Avatar );
-Q_DECLARE_METATYPE( TpPrototype::AvatarManager::AvatarRequirements );
-#endif
diff --git a/TelepathyQt4/Prototype/CapabilitiesManager.cpp b/TelepathyQt4/Prototype/CapabilitiesManager.cpp
deleted file mode 100644
index 294e755..0000000
--- a/TelepathyQt4/Prototype/CapabilitiesManager.cpp
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 basysKom GmbH
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "TelepathyQt4/Prototype/CapabilitiesManager.h"
-
-#include <QCoreApplication>
-#include <QDBusObjectPath>
-#include <QDBusPendingReply>
-#include <QDebug>
-#include <QMap>
-#include <QPointer>
-
-#include <TelepathyQt4/Connection>
-
-#include <TelepathyQt4/Prototype/Account.h>
-#include <TelepathyQt4/Prototype/AccountManager.h>
-#include <TelepathyQt4/Prototype/ConnectionFacade.h>
-#include <TelepathyQt4/Prototype/Connection.h>
-#include <TelepathyQt4/Prototype/Contact.h>
-#include <TelepathyQt4/Prototype/ContactManager.h>
-
-// #define ENABLE_DEBUG_OUTPUT_
-
-using namespace TpPrototype;
-
-class TpPrototype::CapabilitiesManagerPrivate
-{
-public:
- CapabilitiesManagerPrivate()
- { init(); }
-
- Tp::Client::ConnectionInterface* m_pConnectionInterface;
- Tp::Client::ConnectionInterfaceCapabilitiesInterface* m_pCapabilitiesInterface;
-
-
- QPointer<Connection> m_pConnection;
-
- bool m_isValid;
- void init()
- {
- m_pConnectionInterface = NULL;
- m_pCapabilitiesInterface = NULL;
- m_pConnection = NULL;
- m_isValid = true;
- }
-
-};
-
-CapabilitiesManager::CapabilitiesManager( Connection* connection,
- Tp::Client::ConnectionInterface* interface,
- QObject* parent ):
- QObject( parent ),
- d( new CapabilitiesManagerPrivate )
-{
- init( connection, interface );
-}
-
-CapabilitiesManager::~CapabilitiesManager()
-{
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "D'tor CapabilitiesManager (" << this << ")";
-#endif
- delete d;
-}
-
-bool CapabilitiesManager::isValid()
-{
- return d->m_isValid;
-}
-
-
-
-TpPrototype::Connection* CapabilitiesManager::connection()
-{
- return d->m_pConnection;
-}
-
-bool CapabilitiesManager::setCapabilities( const Tp::CapabilityPairList& capabilities, const QStringList& removedChannels )
-{
- QDBusPendingReply<Tp::CapabilityPairList> advertise_capabilities_reply = d->m_pCapabilitiesInterface->AdvertiseCapabilities( capabilities, removedChannels );
- advertise_capabilities_reply.waitForFinished();
-
- if ( !advertise_capabilities_reply.isValid() )
- {
- QDBusError error = advertise_capabilities_reply.error();
-
- qWarning() << "CapabilitiesManager::AdvertiseCapabilities: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- d->m_isValid = false;
- return false;
- }
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "CapabilitiesManager::setCapabilities: " << capabilities.count();
- qDebug() << "CapabilitiesManager::setCapabilities: " << advertise_capabilities_reply.value().count();
-#endif
-
- return true;
-}
-
-Tp::ContactCapabilityList CapabilitiesManager::capabilities()
-{
- uint self_handle = TpPrototype::ConnectionFacade::instance()->selfHandleForConnectionInterface( d->m_pConnectionInterface );
- QList<uint> handle_list;
- handle_list.append( self_handle );
- QDBusPendingReply<Tp::ContactCapabilityList> capabilities_reply = d->m_pCapabilitiesInterface->GetCapabilities( handle_list );
- capabilities_reply.waitForFinished();
-
- if ( !capabilities_reply.isValid() )
- {
- QDBusError error = capabilities_reply.error();
-
- qWarning() << "CapabilitiesManager::capabilities: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- d->m_isValid = false;
- return Tp::ContactCapabilityList();
- }
-
- Tp::ContactCapabilityList capabilities=capabilities_reply.value();
-
- return capabilities;
-}
-
-
-void CapabilitiesManager::capabilitiesForContactList( const QList<QPointer<Contact> >& contacts )
-{
- Q_ASSERT( d->m_pCapabilitiesInterface );
- Tp::UIntList contact_ids;
- foreach( Contact* contact, contacts )
- {
- if ( !contact )
- { continue; }
- contact_ids.append( contact->telepathyHandle() );
- }
-
- QDBusPendingReply<Tp::ContactCapabilityList> capabilities_reply = d->m_pCapabilitiesInterface->GetCapabilities( contact_ids );
- capabilities_reply.waitForFinished();
-
- if ( !capabilities_reply.isValid() )
- {
- QDBusError error = capabilities_reply.error();
-
- qWarning() << "GetInterfaces: error type:" << error.type()
- << "GetInterfaces: error name:" << error.name()
- << "error message:" << error.message();
-
- d->m_isValid = false;
- return;
- }
-
- Tp::ContactCapabilityList capabilities=capabilities_reply.value();
-
- foreach( Contact* contact, contacts )
- {
- Tp::ContactCapabilityList contact_capabilities;
- for ( int i=0; i < capabilities.size(); i++ )
- {
- Tp::ContactCapability capability = capabilities.value( i );
- if ( contact && contact->telepathyHandle() == capability.handle )
- {
- contact_capabilities.append( capability );
- }
- }
- contact->setCapabilities( contact_capabilities );
- }
-}
-
-void CapabilitiesManager::slotCapabilitiesChanged( const Tp::CapabilityChangeList& capabilities )
-{
- if ( !d->m_pConnection )
- {
- qWarning() << "CapabilitiesManager::slotCapabilitiesChanged(): Received a Capabilities changed signal but no connection object exists!";
- return;
- }
-
- Q_ASSERT( d->m_pCapabilitiesInterface );
- Q_ASSERT( d->m_pCapabilitiesInterface->isValid() );
-
- QPointer<TpPrototype::Contact> contact;
- for (int i=0; i<capabilities.size(); i++)
- {
-
- Tp::CapabilityChange changed_capability = capabilities.value( i );
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "CapabilityChange "<< i<< "handle" <<changed_capability.handle;
- qDebug() << "CapabilityChange"<< i << "CannelType" <<changed_capability.channelType;
- qDebug() << "CapabilityChange "<< i << "Generic Flags" <<changed_capability.oldGenericFlags;
- qDebug() << "CapabilityChange "<< i << "Generic Flags" <<changed_capability.newGenericFlags;
- qDebug() << "CapabilityChange "<< i << "Type Specific Flags" <<changed_capability.oldTypeSpecificFlags;
- qDebug() << "CapabilityChange "<< i << "Type Specific Flags" <<changed_capability.newTypeSpecificFlags;
-#endif
-
- if ( !d->m_pConnection->contactManager() )
- {
- qWarning() << "CapabilitiesManager::slotCapabilitiesChanged(): Unable to request contact manager!";
- return;
- }
-
- uint self_handle = ConnectionFacade::instance()->selfHandleForConnectionInterface( d->m_pConnectionInterface );
- foreach( const Tp::CapabilityChange& changed_capability, capabilities )
- {
- if ( changed_capability.handle == self_handle )
- {
- emit signalOwnCapabilityChanged( changed_capability );
- }
- else
- {
- foreach( Contact* contact, d->m_pConnection->contactManager()->contactList() )
- {
- if ( contact && contact->telepathyHandle() == changed_capability.handle )
- {
- // Modify stored list of capabilities
- Tp::ContactCapabilityList contact_capabilities = contact->capabilities();
- for ( int i = 0; i < contact_capabilities.size(); ++i )
- {
- if ( contact_capabilities.at(i).channelType == changed_capability.channelType )
- {
- contact_capabilities.removeAt( i );
- }
- }
-
- Tp::ContactCapability new_capability;
- new_capability.handle = changed_capability.handle;
- new_capability.channelType = changed_capability.channelType;
- new_capability.genericFlags = changed_capability.newGenericFlags;
- new_capability.typeSpecificFlags = changed_capability.newTypeSpecificFlags;
- contact_capabilities.append( new_capability );
-
- contact->setCapabilities( contact_capabilities );
- emit signalCapabilitiesChanged( contact, changed_capability );
- }
- }
- }
- }
- }
-}
-
-
-void CapabilitiesManager::init( Connection* connection,
- Tp::Client::ConnectionInterface* interface )
-{
- Q_ASSERT( interface );
-
- if ( !interface || !connection )
- {
- d->m_isValid = false;
- return;
- }
-
- Tp::registerTypes();
- d->m_pConnectionInterface = interface;
- d->m_pConnection = connection;
- QDBusPendingReply<QStringList> interfaces_reply = d->m_pConnectionInterface->GetInterfaces();
- interfaces_reply.waitForFinished();
-
- if ( !interfaces_reply.isValid() )
- {
- QDBusError error = interfaces_reply.error();
-
- qWarning() << "GetInterfaces: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- d->m_isValid = false;
- return;
- }
- QString capabilities_interface_name;
- bool found_capabilities_support = false;
-
-
- foreach( const QString& interface, interfaces_reply.value() )
- {
- if ( interface.endsWith( ".Capabilities" ) )
- {
- found_capabilities_support = true;
- capabilities_interface_name = interface;
- break;
- }
- }
- if ( !found_capabilities_support )
- {
- d->m_isValid = false;
- qWarning( "CapabilitiesManager::init(): Connection Manager does not support the Interface \"Capabilities\". Other interfaces are not supported!" );
- return;
- }
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- //qDebug() << "Connection interface :" << d->m_pConnectionInterface->connection().interface()->path();
- qDebug() << "Interface Name: " << capabilities_interface_name;
-#endif
- d->m_pCapabilitiesInterface = new Tp::Client::ConnectionInterfaceCapabilitiesInterface(d->m_pConnectionInterface->service(),d->m_pConnectionInterface->path(),this );
-
- connect( d->m_pCapabilitiesInterface, SIGNAL( CapabilitiesChanged( const Tp::CapabilityChangeList& ) ),
- this, SLOT( slotCapabilitiesChanged( const Tp::CapabilityChangeList& ) ) );
-
-}
-
-#include "_gen/CapabilitiesManager.h.moc"
diff --git a/TelepathyQt4/Prototype/CapabilitiesManager.h b/TelepathyQt4/Prototype/CapabilitiesManager.h
deleted file mode 100644
index e6f7f37..0000000
--- a/TelepathyQt4/Prototype/CapabilitiesManager.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 basysKom GmbH
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef TelepathyQt4_Prototype_CapabilitiesManager_H_
-#define TelepathyQt4_Prototype_CapabilitiesManager_H_
-
-#include <QDBusObjectPath>
-#include <QObject>
-#include <QPointer>
-
-#include <TelepathyQt4/Types>
-
-namespace Tp
-{
- namespace Client
- {
- class ConnectionInterface;
- }
-}
-
-namespace TpPrototype {
-
-class CapabilitiesManagerPrivate;
-class Connection;
-class Contact;
-class Account;
-
-/**
- * @ingroup qt_connection
- * This class manages capabilities information for one connection.
- * Setting the right capability decide whether it is possible to handle incoming or outgoing VoIP or Video over IP channels!
- * Whenever a contact capability changes, the signal signalCapabilitiesChanged() is emitted. This signal provides the related contact object
- * obtained from the ContactManager.
- * In order to keep the contacts updated, you just have to instantiate this class (by requesting the object with Connection::capabilitiesManager())
- * and initialize the list of contacts once (by calling capabilitiesForContactList() ). After this point, the capabilty information of the contact
- * is updated automatically if a change is signalled by the backend.
- * @see Connection
- * @see StreamedMediaChannel
- */
-class CapabilitiesManager : public QObject
-{
- Q_OBJECT
-public:
- /**
- * Validity.
- * Do not access any methods if the object is invalid!
- */
- bool isValid();
-
- /**
- * Returns the connection that belongs to this capabilities information.
- * @return The connection object
- */
- TpPrototype::Connection* connection();
-
- /**
- * Set the capabilities.
- * This function sets the capabilites of the account that belongs to this connection.
- * @param capabilities List of capabilities for a specific channel. See Tp D-Bus spec section "Channel_Media_Capabilities"
- * @param removedChanels List of channels that are removed.
- * @return true if setting was successful
- */
- bool setCapabilities( const Tp::CapabilityPairList& capabilities, const QStringList& removedChannels = QStringList() );
-
- /**
- * Request capabilites.
- * Returns the capabilites of the account that belongs to this connection.
- * @return List of capabilities
- */
- Tp::ContactCapabilityList capabilities();
-
- /**
- * Gets the capabilities for a list of contacts and provides them to to specific contacts.
- * The capabilities can be requested from the contact object.
- */
- void capabilitiesForContactList( const QList<QPointer<Contact> >& contacts );
-
-signals:
- /**
- * The capability of a contact has changed. This signal is emitted when any of the known contacts changed its capability.
- */
- void signalCapabilitiesChanged( TpPrototype::Contact* contact, const Tp::CapabilityChange& changedCapability );
-
- /**
- * My capability was changed. This signal is emmitted if the capability of one of my channes was changed.
- */
- void signalOwnCapabilityChanged( const Tp::CapabilityChange& changedCapability );
-
-protected:
- /**
- * Constructor. The capabilities manager cannot be instantiated directly. Use Connection::CapabilitiesManager() for it!
- */
- CapabilitiesManager( TpPrototype::Connection* connection,
- Tp::Client::ConnectionInterface* interface,
- QObject* parent = NULL );
- ~CapabilitiesManager();
-
-protected slots:
- void slotCapabilitiesChanged( const Tp::CapabilityChangeList& capabilities );
-
-private:
- void init( TpPrototype::Connection* connection, Tp::Client::ConnectionInterface* interface );
-
- TpPrototype::CapabilitiesManagerPrivate * const d;
- friend class Connection;
- friend class ConnectionPrivate;
-};
-}
-
-#endif
diff --git a/TelepathyQt4/Prototype/ChatChannel.cpp b/TelepathyQt4/Prototype/ChatChannel.cpp
deleted file mode 100644
index e388d9b..0000000
--- a/TelepathyQt4/Prototype/ChatChannel.cpp
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 basysKom GmbH
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "TelepathyQt4/Prototype/ChatChannel.h"
-
-#include <QDebug>
-#include <QMetaProperty>
-
-#include <TelepathyQt4/Constants>
-#include <TelepathyQt4/Connection>
-#include <TelepathyQt4/Channel>
-
-#include <TelepathyQt4/Prototype/Contact.h>
-
-using namespace TpPrototype;
-
-class TpPrototype::ChatChannelPrivate
-{
-public:
- ChatChannelPrivate()
- { init(); }
-
- ~ChatChannelPrivate()
- {
- // Close channel before deleting objects
- if ( m_pChannelInterface )
- { m_pChannelInterface->Close(); }
- delete m_pTextChannel;
- delete m_pChannelInterface;
- }
-
- QPointer<TpPrototype::Contact> m_pContact;
- Tp::Client::ChannelTypeTextInterface* m_pTextChannel;
- QPointer<Tp::Client::ConnectionInterface> m_pConnectionInterface;
- Tp::Client::ChannelInterface* m_pChannelInterface;
-
- bool m_isValid;
- bool m_areSignalsConnected;
-
-private:
- void init()
- {
- m_pContact = NULL;
- m_pConnectionInterface = NULL;
- m_pTextChannel = NULL;
- m_pChannelInterface = NULL;
- m_isValid = true;
- m_areSignalsConnected = false;
- }
-};
-
-ChatChannel::ChatChannel( Contact* contact, Tp::Client::ConnectionInterface* connectionInterface, QObject* parent ):
- QObject( parent ),
- d(new ChatChannelPrivate())
-{
- Tp::registerTypes();
-
- d->m_pContact = contact;
- d->m_pConnectionInterface = connectionInterface;
-
- requestTextChannel( d->m_pContact->telepathyHandle() );
-}
-
-ChatChannel::~ChatChannel()
-{ delete d; }
-
-bool ChatChannel::isValid() const
-{ return d->m_isValid; }
-
-
-void ChatChannel::sendTextMessage( const QString& text )
-{
-
- if ( d->m_pTextChannel == NULL )
- {
- requestTextChannel( d->m_pContact->telepathyHandle() );
- }
-
- Q_ASSERT( d->m_pTextChannel );
- if ( !d->m_pTextChannel )
- {
- qWarning() << "ChatChannel::sendTextMessage: Action ignored due to missing text channel!";
- }
-
- d->m_pTextChannel->Send( 0, text ); // TODO: Remove this magic number!
-
-}
-
-void ChatChannel::pendingTextMessages()
-{
- if ( d->m_pTextChannel == NULL )
- {
- requestTextChannel( d->m_pContact->telepathyHandle() );
- }
-
- Q_ASSERT( d->m_pTextChannel );
- if ( !d->m_pTextChannel )
- {
- qWarning() << "ChatChannel::pendingTextMessages: Action ignored due to missing text channel!";
- }
-
- QDBusPendingReply<Tp::PendingTextMessageList> reply= d->m_pTextChannel->ListPendingMessages( true );
- const Tp::PendingTextMessageList chatMessages = reply.value();
- Tp::PendingTextMessage messageshandle;
- for ( int i=0; i < chatMessages.size(); i++ )
- {
- messageshandle = chatMessages.at(i);
- slotReceivedText( messageshandle.identifier,
- messageshandle.unixTimestamp,
- messageshandle.sender,
- messageshandle.messageType,
- messageshandle.flags,
- messageshandle.text );
- }
-}
-
-// Called if a new text channel shall be established.
-void ChatChannel::requestTextChannel( uint handle )
-{
- QDBusPendingReply<QDBusObjectPath> reply0 =
- d->m_pConnectionInterface->RequestChannel( "org.freedesktop.Telepathy.Channel.Type.Text",
- Tp::HandleTypeContact, handle, true );
- reply0.waitForFinished();
- if (!reply0.isValid())
- {
- QDBusError error = reply0.error();
- qWarning() << "Get ContactListChannel: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
- d->m_isValid = false;
- return;
- }
-
- QDBusObjectPath channel_path=reply0.value();
- openTextChannel( handle, 1,channel_path.path(), "org.freedesktop.Telepathy.Channel.Type.Text" ); // TODO: Remove magic number
-}
-
-// Called if a new text channel was notified by the connection channel
-void ChatChannel::openTextChannel(uint handle, uint handleType, const QString& channel_path, const QString& channelType)
-{
- QString channel_service_name = d->m_pConnectionInterface->service();
- qDebug() << "ContactManager Channel Services Name" << channel_service_name;
- qDebug() << "ContactManager Channel Path" << channel_path;
- // This channel may never be closed!
- d->m_pTextChannel = new Tp::Client::ChannelTypeTextInterface( channel_service_name,
- channel_path,
- this );
- d->m_pChannelInterface = new Tp::Client::ChannelInterface( channel_service_name,
- channel_path,
- this );
- Q_ASSERT( d->m_pChannelInterface->isValid() );
- Q_ASSERT( d->m_pTextChannel->isValid() );
- if (!d->m_pTextChannel->isValid() || !d->m_pChannelInterface->isValid())
- {
- qDebug() << "Failed to connect channel interface classes to D-Bus object.";
- delete d->m_pTextChannel;
- delete d->m_pChannelInterface;
- d->m_pTextChannel = NULL;
- d->m_pChannelInterface = NULL;
- d->m_isValid = false;
- return;
- }
- else
- {
- if ( d->m_areSignalsConnected )
- { return; }
-
- d->m_areSignalsConnected = true;
-
- qDebug() << "Success WE got a valid Text channel";
- //ChatChannel * pChatChannel=new ChatChannel();
- //pChatChannel->setChannel(d->m_groupTextChannel);
- //pChatChannel->setContact(channel_contact);
- QString messagesender;
- messagesender = d->m_pContact->name();
-
- qDebug() << "*************************************";
-
- connect(d->m_pTextChannel, SIGNAL(Received(uint , uint , uint , uint , uint , const QString& )),
- this, SLOT(slotReceivedText(uint , uint , uint , uint , uint , const QString& )));
- connect(d->m_pTextChannel, SIGNAL(Sent(uint , uint , const QString& )),
- this, SLOT(slotSentText(uint , uint , const QString& )));
- connect(d->m_pTextChannel, SIGNAL(LostMessage()),
- this, SLOT(slotLostMessage()));
- connect(d->m_pTextChannel, SIGNAL(SendError(uint , uint , uint , const QString& )),
- this, SLOT(slotSendError(uint , uint , uint , const QString& )));
-
- /* QDBusPendingReply<Tp::PendingTextMessageList> reply= d->m_groupTextChannel->ListPendingMessages(false);
- const Tp::PendingTextMessageList chatMessages=reply.value();
- Tp::PendingTextMessage messageshandle;
- for (int i=0; i<chatMessages.size(); i++)
- {
- messageshandle= chatMessages.at(i);
- pChatChannel->slotReceivedText( messageshandle.identifier, messageshandle.unixTimestamp, messageshandle.sender, messageshandle.messageType, messageshandle.flags, messageshandle.text);
-
- } */
- }
-}
-
-
-void ChatChannel::slotReceivedText( uint id, uint timestamp, uint sender, uint type, uint flags, const QString& text )
-{
- qDebug() << "ChatChannel: Reveived text:" << text;
- QList<uint> message_ids;
- message_ids.append( id );
- d->m_pTextChannel->AcknowledgePendingMessages( message_ids );
- emit signalTextMessageReceived( this , timestamp, type, flags, text );
-}
-
-void ChatChannel::slotSentText(uint timestamp, uint type, const QString& text )
-{
- qDebug() << "ChatChannel: Sent text:" << text;
- emit signalTextMessageSent( this, timestamp, type, text );
-}
-
-void ChatChannel::slotLostMessage()
-{
-}
-
-void ChatChannel::slotSendError(uint error, uint timestamp, uint type, const QString& text )
-{
-}
-
-#include "_gen/ChatChannel.h.moc"
diff --git a/TelepathyQt4/Prototype/ChatChannel.h b/TelepathyQt4/Prototype/ChatChannel.h
deleted file mode 100644
index cd55ce6..0000000
--- a/TelepathyQt4/Prototype/ChatChannel.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 basysKom GmbH
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef TelepathyQt4_Prototype_ChatChannel_H_
-#define TelepathyQt4_Prototype_ChatChannel_H_
-
-#include <QObject>
-#include <QPointer>
-#include <QVariantMap>
-
-#ifdef DEPRECATED_ENABLED__
-#define ATTRIBUTE_DEPRECATED __attribute__((deprecated))
-#else
-#define ATTRIBUTE_DEPRECATED
-#endif
-
-namespace Tp {
-namespace Client{
- class ConnectionInterface;
-}
-}
-
-namespace TpPrototype {
-
-class ChatChannelPrivate;
-class Contact;
-class Account;
-
-/**
- * @ingroup qt_connection
- * Chat Channel.
- * This class provides the interface to send or receive text messages.
- */
-class ChatChannel : public QObject
-{
- Q_OBJECT
-public:
- /**
- * Validity check.
- * Do not access any functions if this account is invalid.
- */
- bool isValid() const;
-
- /**
- * Send a text message.
- * This function sends a text message to the contact that belongs to this channel.
- */
- void sendTextMessage( const QString& text );
-
- /**
- * Fetch pending text messages.
- * Force to refetch all messages that were sent while the account was offline.
- * A signal signalTextMessageReceived() will be emitted for every message.
- * @see signalTextMessageReceived()
- */
- void pendingTextMessages();
-
- /**
- * Destructor.
- * Deleting this object forces to drop all channels.
- */
- ~ChatChannel();
-
-signals:
- /**
- * A new text message was received.
- * This signal is emmitted right after receiving a new test message.
- */
- void signalTextMessageReceived( TpPrototype::ChatChannel* chatchannel, uint timestamp, uint type, uint flags, const QString& text );
-
- /**
- * A text message was sent.
- * This signal is emmitted right after test message was delivered.
- */
- void signalTextMessageSent( TpPrototype::ChatChannel* chatchannel, uint timestamp, uint type, const QString& text );
-
-protected:
- /**
- * Constructor.
- * Use Contact::chatChannel() to obtain an object of ChatChannel.
- */
- ChatChannel( Contact* contact, Tp::Client::ConnectionInterface* connectionInterface , QObject* parent = NULL );
-
- void requestTextChannel(uint handle);
- void openTextChannel(uint handle, uint handleType, const QString& channelPath, const QString& channelType );
-
-protected slots:
- void slotSentText(uint timestamp, uint type, const QString& text );
- void slotLostMessage();
- void slotSendError(uint error, uint timestamp, uint type, const QString& text );
- void slotReceivedText(uint ID, uint timestamp, uint sender, uint type, uint flags, const QString& text);
-private:
- ChatChannelPrivate * const d;
- friend class ContactManager;
- friend class Contact;
-};
-
-} // namespace
-
-#endif // Header guard
diff --git a/TelepathyQt4/Prototype/Client/ChannelHandler b/TelepathyQt4/Prototype/Client/ChannelHandler
deleted file mode 100644
index 142eada..0000000
--- a/TelepathyQt4/Prototype/Client/ChannelHandler
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _TelepathyQt4_Prototype_Client_ChannelHandler_HEADER_GUARD_
-#define _TelepathyQt4_Prototype_Client_ChannelHandler_HEADER_GUARD_
-
-#include <TelepathyQt4/Prototype/_gen/cli-channel-handler.h>
-
-#endif
diff --git a/TelepathyQt4/Prototype/Client/StreamEngine b/TelepathyQt4/Prototype/Client/StreamEngine
deleted file mode 100644
index 1e4da23..0000000
--- a/TelepathyQt4/Prototype/Client/StreamEngine
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _TelepathyQt4_Prototype_Client_StreamEngine_HEADER_GUARD_
-#define _TelepathyQt4_Prototype_Client_StreamEngine_HEADER_GUARD_
-
-#include <TelepathyQt4/Prototype/_gen/cli-stream-engine.h>
-
-#endif
diff --git a/TelepathyQt4/Prototype/Connection.cpp b/TelepathyQt4/Prototype/Connection.cpp
deleted file mode 100644
index 0eb9fa9..0000000
--- a/TelepathyQt4/Prototype/Connection.cpp
+++ /dev/null
@@ -1,439 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 basysKom GmbH
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "TelepathyQt4/Prototype/Connection.h"
-
-#include <QDebug>
-#include <QMetaProperty>
-
-#include <TelepathyQt4/Connection>
-#include <TelepathyQt4/ConnectionManager>
-
-#include <TelepathyQt4/Prototype/Account.h>
-#include <TelepathyQt4/Prototype/AvatarManager.h>
-#include <TelepathyQt4/Prototype/CapabilitiesManager.h>
-#include <TelepathyQt4/Prototype/ContactManager.h>
-#include <TelepathyQt4/Prototype/PresenceManager.h>
-
-// #define ENABLE_DEBUG_OUTPUT_
-
-namespace TpPrototype {
-
-class ConnectionPrivate
-{
-public:
- ConnectionPrivate()
- { init(); }
-
- QString m_serviceName;
- QString m_objectPath;
- bool m_isValid;
- Tp::ConnectionStatus m_status;
- Tp::ConnectionStatusReason m_reason;
- Tp::Client::ConnectionInterface* m_pInterface;
- QPointer<ContactManager> m_pContactManager;
- QPointer<PresenceManager> m_pPresenceManager;
- QPointer<CapabilitiesManager> m_pCapabilitiesManager;
- QPointer<AvatarManager> m_pAvatarManager;
- QPointer<Account> m_pAccount;
- QString m_connectionManager;
- QString m_protocol;
- void init()
- {
- m_isValid = false; // Will be set on true after initial initialization.
- m_status = Tp::ConnectionStatusDisconnected;
- m_reason = Tp::ConnectionStatusReasonNoneSpecified;
- m_pInterface = NULL;
- m_pContactManager = NULL;
- m_pPresenceManager = NULL;
- m_pCapabilitiesManager = NULL;
- m_pAvatarManager = NULL;
- m_pAccount = NULL;
- }
-
- void cleanup()
- {
- m_isValid = true;
- m_status = Tp::ConnectionStatusDisconnected;
- m_reason = Tp::ConnectionStatusReasonNoneSpecified;
- delete m_pInterface;
- m_pInterface = NULL;
- delete m_pContactManager;
- m_pContactManager = NULL;
- delete m_pPresenceManager;
- m_pPresenceManager = NULL;
- delete m_pCapabilitiesManager;
- m_pCapabilitiesManager = NULL;
- delete m_pAvatarManager;
- m_pAvatarManager = NULL;
- }
-
- void initConnectionDBUSService()
- {
- cleanup();
-
- Q_ASSERT( m_pAccount );
- Q_ASSERT( !m_pInterface ); // needs to be removed. Otherwise all following will fail
- Q_ASSERT( !m_connectionManager.isEmpty() );
- Q_ASSERT( !m_protocol.isEmpty() );
-
- Tp::Client::ConnectionManagerInterface cm_interface( "org.freedesktop.Telepathy.ConnectionManager." + m_connectionManager,
- "/org/freedesktop/Telepathy/ConnectionManager/" + m_connectionManager,
- NULL );
-
-
- QVariantMap parameter_map = m_pAccount->parameters();
-
- // 2. Request a connection to the server
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Protocol: " << m_protocol;
- qDebug() << "Params : " << parameter_map;
-#endif
-
- QDBusPendingReply<QString, QDBusObjectPath> reply = cm_interface.RequestConnection( m_protocol, parameter_map );
- reply.waitForFinished();
-
- if ( !reply.isValid() )
- {
- QDBusError error = reply.error();
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "initConnectionDBUSService: error type:" << error.type()
- << " error name:" << error.name();
-#endif
- m_isValid = false;
- return /*NULL*/;
- }
-
- QString connection_service_name = reply.argumentAt<0>();
- QDBusObjectPath connection_object_path = reply.argumentAt<1>();
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Service Name: " << connection_service_name;
- qDebug() << "Object Path : " << connection_object_path.path();
-#endif
- m_serviceName = connection_service_name;
- m_objectPath = connection_object_path.path();
-
- m_pInterface = new Tp::Client::ConnectionInterface( m_serviceName,
- m_objectPath,
- NULL );
-
- }
-};
-};
-
-TpPrototype::Connection::Connection( TpPrototype::Account* account, QObject* parent ):
- QObject( parent ),
- d( new ConnectionPrivate )
-{
-
- if ( !account )
- { return; }
-
- init( account );
-}
-
-using namespace TpPrototype;
-Connection::~Connection()
-{
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "D'tor Connection:" << this;
-#endif
- if ( Tp::ConnectionStatusDisconnected != d->m_status )
- { requestDisconnect(); }
- delete d;
-}
-
-
-bool Connection::isValid()
-{
- return d->m_isValid;
-}
-
-Tp::ConnectionStatus Connection::status()
-{
- return d->m_status;
-}
-
-Tp::ConnectionStatusReason Connection::reason()
-{
- return d->m_reason;
-}
-
-bool Connection::requestConnect()
-{
- if ( ( Tp::ConnectionStatusConnecting == d->m_status )
- || ( Tp::ConnectionStatusConnected == d->m_status ) )
- { return false; }
-
- startupInit();
-
- if ( !d->m_pInterface )
- { return false; }
-
- d->m_status = Tp::ConnectionStatusConnecting;
- QDBusPendingReply<> connection_connect_reply = d->m_pInterface->Connect();
- connection_connect_reply.waitForFinished();
-
- if ( !connection_connect_reply.isValid() )
- {
- QDBusError error = connection_connect_reply.error();
-
- qWarning() << "Connect: error type:" << error.type()
- << "Connect: error name:" << error.name()
- << "error message:" << error.message();
-
- d->m_status = Tp::ConnectionStatusDisconnected;
- d->m_isValid = false;
-
- return false;
- }
-
- d->m_isValid = true;
- return true;
-}
-
-bool Connection::requestDisconnect()
-{
- if ( ! d->m_pInterface || ! isValid() || ( Tp::ConnectionStatusDisconnected == d->m_status ) )
- { return false; }
-
- QDBusPendingReply<> connection_disconnect_reply = d->m_pInterface->Disconnect();
- connection_disconnect_reply.waitForFinished();
-
- if ( !connection_disconnect_reply.isValid() )
- {
- QDBusError error = connection_disconnect_reply.error();
-
- qWarning() << "Connect: error type:" << error.type()
- << "Connect: error name:" << error.name()
- << "error message:" << error.message();
- }
-
- // Always expect that we are disconnected after this point!
- d->m_status = Tp::ConnectionStatusDisconnected;
-
- // Get rid of the contact and presence manager
- delete d->m_pContactManager;
- d->m_pContactManager = NULL;
- delete d->m_pPresenceManager;
- d->m_pPresenceManager = NULL;
-
- return d->m_status;
-}
-
-ContactManager* Connection::contactManager()
-{
- if ( Tp::ConnectionStatusConnected != d->m_status )
- { return NULL; }
- if ( !d->m_pContactManager )
- { d->m_pContactManager = new ContactManager( d->m_pInterface, this ); }
- return d->m_pContactManager;
-}
-
-PresenceManager* Connection::presenceManager()
-{
- return createManager<PresenceManager>( d->m_pPresenceManager, "Presence" );
-}
-
-CapabilitiesManager* Connection::capabilitiesManager()
-{
- return createManager<CapabilitiesManager>(d->m_pCapabilitiesManager, "Capabilities" );
-}
-
-AvatarManager* Connection::avatarManager()
-{
- return createManager<AvatarManager>( d->m_pAvatarManager, "Avatars" );
-}
-
-
-Account* Connection::account() const
-{
- if ( !d->m_pAccount
- || !d->m_pAccount->isValid() )
- { return NULL; }
-
- return d->m_pAccount;
-}
-
-QString Connection::handle() const
-{
- return d->m_objectPath;
-}
-
-Tp::Client::ConnectionInterface* Connection::interface()
-{
- return d->m_pInterface;
-}
-
-void Connection::slotStatusChanged( uint status, uint reason )
-{
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Connection::slotStatusChanged() Status:" << status;
-#endif
- Tp::ConnectionStatus old_status = d->m_status;
- d->m_status = static_cast<Tp::ConnectionStatus>( status );
- d->m_reason = static_cast<Tp::ConnectionStatusReason>( reason );
-
- if ( d->m_status != old_status )
- {
- emit signalStatusChanged( this, d->m_status, old_status );
- }
-
- if ( account() && account()->parameters().value( "register") == true )
- {
- QVariantMap parameter_map;
- parameter_map.insert( "register", false );
- account()->setParameters( parameter_map );
- }
-}
-
-void Connection::slotNewChannel(const QDBusObjectPath& objectPath, const QString& channelType, uint handleType, uint handle, bool suppressHandler)
-{
- Q_UNUSED( suppressHandler );
-
- QString tmp_objectpath=objectPath.path();
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Connection:: slotNewChannel";
- qDebug() << "Connection:: slotNewChannel ObjectPath"<< tmp_objectpath;
- qDebug() << "Connection:: slotNewChannel ChannelType"<< channelType;
- qDebug() << "Connection:: slotNewChannel handleType"<< handleType <<"handle"<<handle;
-#endif
-
- // Ignore signals if no contact manager is available..
- if ( !contactManager() )
- {
- // Q_ASSERT( contactManager() ); //FIXME: We have to understand why this can happen and how to avoid it!
- qWarning() << "Connection::slotNewChannel: Receiving signals but don't get a contact manager!";
- return;
- }
-
- if ( handleType == Tp::HandleTypeContact )
- {
- contactManager()->openTextChannel(handle,handleType,objectPath.path(),channelType);
- }
-
- if (channelType==QString("org.freedesktop.Telepathy.Channel.Type.ContactList"))
- {
- if (tmp_objectpath.contains("/subscribe"))
- {
- contactManager()->openSubscribedContactsChannel(handle,objectPath,channelType);
- }
- }
-
- if (channelType==QString("org.freedesktop.Telepathy.Channel.Type.ContactList"))
- {
- if (tmp_objectpath.contains("/known"))
- {
- contactManager()->openKnownContactsChannel(handle,objectPath,channelType);
- }
- }
- if (channelType==QString("org.freedesktop.Telepathy.Channel.Type.ContactList"))
- {
- if (tmp_objectpath.contains("/publish"))
- {
- contactManager()->openPublishContactsChannel(handle,objectPath,channelType);
- }
- }
-
- if (channelType==QString("org.freedesktop.Telepathy.Channel.Type.ContactList"))
- {
- if (tmp_objectpath.contains("/deny"))
- {
- contactManager()->openDenyContactsChannel(handle,objectPath,channelType);
- }
- }
-
- if (channelType==QString("org.freedesktop.Telepathy.Channel.Type.StreamedMedia"))
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Connection::slotNewChannel(): Stream media channel opened!!";
-#endif
- contactManager()->openStreamedMediaChannel( handle, handleType, objectPath.path(), channelType );
- }
-}
-
-QList<uint> Connection::RequestHandles( Tp::HandleType handletype, QStringList& handlestrings)
-{
- Tp::registerTypes();
- return d->m_pInterface->RequestHandles( handletype,handlestrings);
-}
-
-
-bool Connection::managerSupported( const QString& managerName )
-{
- QDBusPendingReply<QStringList> interfaces_reply = interface()->GetInterfaces();
- interfaces_reply.waitForFinished();
-
- if ( !interfaces_reply.isValid() )
- {
- QDBusError error = interfaces_reply.error();
-
- qWarning() << "Connection::GetInterfaces: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- return false;
- }
-
- foreach( const QString& interface, interfaces_reply.value() )
- {
- if ( interface.endsWith( managerName ) )
- {
- return true;
- }
- }
- return false;
-}
-
-void Connection::init( TpPrototype::Account* account )
-{
- Tp::registerTypes();
-
- if ( !account )
- { return; }
-
- d->m_pAccount = account;
- d->m_connectionManager = account->connectionManagerName();
- d->m_protocol = account->protocolName();
-
- d->m_isValid = true;
-}
-
-// Called immediately before connection attempts
-void Connection::startupInit()
-{
- d->initConnectionDBUSService();
-
- if ( !d->m_isValid )
- { return; }
-
- Q_ASSERT( d->m_pInterface );
-
-
- connect( d->m_pInterface, SIGNAL( NewChannel( const QDBusObjectPath&, const QString&, uint, uint, bool ) ),
- this, SLOT( slotNewChannel( const QDBusObjectPath&, const QString&, uint, uint, bool ) ) );
- connect( d->m_pInterface, SIGNAL( StatusChanged( uint, uint ) ),
- this, SLOT( slotStatusChanged( uint, uint ) ) );
-}
-
-#include "_gen/Connection.h.moc"
diff --git a/TelepathyQt4/Prototype/Connection.h b/TelepathyQt4/Prototype/Connection.h
deleted file mode 100644
index 14c44f5..0000000
--- a/TelepathyQt4/Prototype/Connection.h
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 basysKom GmbH
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#ifndef TelepathyQt4_Prototype_Connection_H_
-#define TelepathyQt4_Prototype_Connection_H_
-
-#include <QDBusObjectPath>
-#include <QDBusPendingReply>
-#include <QObject>
-#include <QPointer>
-#include <QVariantMap>
-
-#include <TelepathyQt4/Constants>
-
-#ifdef DEPRECATED_ENABLED__
-#define ATTRIBUTE_DEPRECATED __attribute__((deprecated))
-#else
-#define ATTRIBUTE_DEPRECATED
-#endif
-
-namespace Tp
-{
- namespace Client
- {
- class ConnectionInterface;
- }
-}
-
-/**
- * @defgroup qt_connection Connection Management
- * @ingroup qt_style_api
- * Classes that provide functions to handle connections and additional optional interfaces related to a connection.
- */
-
-
-
-namespace TpPrototype {
-
-class ConnectionPrivate;
-class ContactManager;
-class PresenceManager;
-class CapabilitiesManager;
-class AvatarManager;
-class Account;
-/**
- * @ingroup qt_connection
- * This class manages a connection.
- * The connection object provides access to optional interfaces that are related to the connection using contactManager(),
- * capabilitiesManager(), presenceManager(), avatarManager().
- * @todo In order to allow custom extensions, we need a support for register proxies in the Account object
- */
-class Connection : public QObject
-{
- Q_OBJECT
- Q_PROPERTY( bool valid READ isValid )
-public:
-
- ~Connection();
-
- /**
- * Validity check.
- * Do not access any functions if this account is invalid.
- */
- bool isValid();
-
- /**
- * Connection Status.
- * @return The current connection status.
- * @see Tp::ConnectionStatus defined in constants.h
- */
- Tp::ConnectionStatus status();
-
- /**
- * Reason for last state change.
- * @return The reason.
- * @see Tp::ConnectionStatusReason defined in constants.h
- */
- Tp::ConnectionStatusReason reason();
-
- /**
- * Connect to server.
- * This call is asynchrous. Wait until signalStatusChanged() was emitted and the connection state is Tp::ConnectionStatusConnected
- * before calling contactManager() or presenceManager() will succeed.
- * @see signalStatusChanged()
- */
- bool requestConnect();
-
- /**
- * Disconnect. Disconnects from the server.
- */
- bool requestDisconnect();
-
- /**
- * Returns the contact list manager.
- * The contact list manager contains the list of contacts and provides functions like add and remove.<br>
- * <b>Note:</b> You have to request a connection with requestConnect() before a contact manager can be returned. If the connection disconnects the ContactManager will be invalid!
- * @return Pointer to the contact manager or NULL if something went wrong.
- * @see requestConnect()
- */
- ContactManager* contactManager();
-
- /**
- * Returns the presence manager.
- * The presence manager handles your presence state for this connection.<br>
- * <br>
- * <b>Note:</b>
- * <ul><li>You have to request a connection with requestConnect() before a presence manager can be returned.</li>
- * <li>You have to call this function in order to get your contacts updated automatically.</li>
- * </ul>
- * @return Pointer to the presence manager or NULL if no presence handling is supported or no connection was requested.
- * @see requestConnect()
- */
- PresenceManager* presenceManager();
-
- /**
- * Returns the capabilities manager.
- * The capabilities manager handles your capabilities state for this connection.<br>
- * <br>
- * <b>Note:</b>
- * <ul><li>You have to request a connection with requestConnect() before a capability manager can be returned.</li>
- * <li>You have to call this function in order to get your contacts updated automatically.</li>
- * </ul>
- * @return Pointer to the capabilities manager or NULL if no capabilities handling is supported or no connection was requested.
- * @see requestConnect()
- */
- CapabilitiesManager* capabilitiesManager();
-
- /**
- * Returns the avatar manager.
- * The avatar manager provides you information about the avatars of the connection.<br>
- * <br>
- * <b>Note:</b>
- * <ul><li>You have to request a connection with requestConnect() before an avatar manager can be returned.</li>
- * <li>You have to call this function in order to get your contacts updated automatically.</li>
- * </ul>
- * @return Pointer to the avatar manager or NULL if no avatar support is available or no connection was requested.
- * @see requestConnect()
- */
- AvatarManager* avatarManager();
-
- /**
- * Returns the account for this connection.
- * Every connection belongs to an account that is returned with this call.
- * @return The account for this connection or NULL if no valid account exists.
- */
- Account* account() const;
-
-signals:
- /**
- * Connection status changed.
- * This signal is emitted if the status of the connection was changed
- * @param connection The connection which changes its status.
- * @param newStatus The new status that is valid now.
- * @param oldStatus The old status that was valid before.
- * @see Tp::ConnectionStatus
- */
- void signalStatusChanged( TpPrototype::Connection* connection,
- Tp::ConnectionStatus newStatus,
- Tp::ConnectionStatus oldStatus );
-
-protected slots:
- void slotStatusChanged( uint status, uint reason );
- void slotNewChannel( const QDBusObjectPath& objectPath, const QString& channelType, uint handleType, uint handle, bool suppressHandler );
-
-protected:
- /**
- * Constructor.
- * The connection cannot be instantiated directly. Use Account::connection() to receive a valid connection object.
- * @param account Account to create connection with.
- */
- Connection( TpPrototype::Account* account, QObject* parent );
-
- /**
- * Returns the handle.
- * The handle is an internal representation to access the real data. Its format should
- * not be interpreted.
- */
- QString handle() const;
-
- /**
- * D-BUS interface.
- * This protected access to the D-BUS interface can be used to extend this class with special features.
- */
- Tp::Client::ConnectionInterface* interface();
-
- /**
- * Provides a generic handle.
- * @param handleType The type of handle required.
- * @param handlestrings An array of names of entities to request handles for
- * @return An array of integer handle numbers in the same order as the given strings
- */
- QList<uint> RequestHandles( Tp::HandleType handletype, QStringList& handlestrings);
-
- /**
- * Check if manager is supported.
- */
- bool managerSupported( const QString& managerName );
-
- template <class Manager>
- inline Manager* createManager( QPointer<Manager>& pManager, const QString& managerName )
- {
- if ( pManager && pManager->isValid() )
- { return pManager; }
-
- // Force to reinitialize an invalid manager
- if ( pManager && !pManager->isValid() )
- {
- delete pManager;
- pManager = NULL;
- }
-
- if ( status() != Tp::ConnectionStatusConnected )
- { return NULL; }
-
- pManager = new Manager( this, interface(), this );
- Q_ASSERT( pManager );
-
- if ( pManager->isValid() )
- { return pManager; }
-
- // Fall through: Cleanup if manager is not valid.
- delete pManager;
- pManager = NULL;
- return NULL;
- }
-
-
-private:
- void init( TpPrototype::Account* account );
- void startupInit();
- ConnectionPrivate * const d;
-
- friend class Account;
-};
-
-} // namespace
-
-#endif
diff --git a/TelepathyQt4/Prototype/ConnectionFacade.cpp b/TelepathyQt4/Prototype/ConnectionFacade.cpp
deleted file mode 100644
index 3040d36..0000000
--- a/TelepathyQt4/Prototype/ConnectionFacade.cpp
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 basysKom GmbH
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "TelepathyQt4/Prototype/ConnectionFacade.h"
-
-#include <QCoreApplication>
-#include <QDebug>
-#include <QPointer>
-
-#include <TelepathyQt4/Connection>
-#include <TelepathyQt4/ConnectionManager>
-
-#include <TelepathyQt4/Prototype/Account.h>
-#include <TelepathyQt4/Prototype/AccountManager.h>
-#include <TelepathyQt4/Prototype/Connection.h>
-#include <TelepathyQt4/Prototype/DBusInterface.h>
-
-using namespace TpPrototype;
-
-ConnectionFacade* ConnectionFacade::m_instance = NULL;
-
-enum {
- mgr_Param_Flag_Required = 1,
- mgr_Param_Flag_Register = 2,
- mgr_Param_Flag_Has_Default = 4,
- mgr_Param_Flag_Secret = 8
-};
-
-
-class TpPrototype::ConnectionFacadePrivate
-{
-public:
-};
-
-ConnectionFacade* ConnectionFacade::instance()
-{
- if ( NULL == m_instance )
- {
- m_instance = new ConnectionFacade( QCoreApplication::instance() );
- }
-
- return m_instance;
-}
-
-ConnectionFacade::ConnectionFacade( QObject* parent ):
- QObject( parent ),
- d( new ConnectionFacadePrivate )
-{
-}
-
-ConnectionFacade::~ConnectionFacade()
-{
- delete d;
-}
-
-QStringList ConnectionFacade::listOfConnectionManagers()
-{
- Tp::registerTypes();
-
- QStringList ret_list;
-
- DBusInterface* interface = new DBusInterface( NULL );
-
- QDBusReply<QStringList> reply = interface->listActivatableNames();
-
- delete interface;
-
- if ( !reply.isValid() )
- {
- QDBusError error = reply.error();
-
- qWarning() << "Disconnect: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- return ret_list; // returns empty list
- }
-
-
- foreach( const QString& name, reply.value() )
- {
- // qDebug() << "+++Name: " << name;
- if ( !name.startsWith( "org.freedesktop.Telepathy.ConnectionManager" )
- || name.isEmpty() )
- { continue; }
-
- QString cm_name;
- int pos_of_last_dot = name.lastIndexOf( "." );
- Q_ASSERT( pos_of_last_dot >= 0 );
- cm_name = name.right( name.length() - ( pos_of_last_dot + 1 ) );
- ret_list << cm_name;
- }
-
- // qDebug() << "+++Names found: " << ret_list;
- return ret_list;
-}
-
-QStringList ConnectionFacade::listOfProtocolsForConnectionManager( const QString& connectionManager )
-{
- Tp::registerTypes();
-
- QStringList empty_list;
-
- QStringList list_of_connection_managers = listOfConnectionManagers();
- if ( !list_of_connection_managers.contains( connectionManager ) )
- { return empty_list; } // return empty list
-
- Tp::Client::ConnectionManagerInterface connection_manager_interface( "org.freedesktop.Telepathy.ConnectionManager." + connectionManager,
- "/org/freedesktop/Telepathy/ConnectionManager/" + connectionManager );
-
- QDBusPendingReply<QStringList> list_protocols_reply = connection_manager_interface.ListProtocols();
- list_protocols_reply.waitForFinished();
-
- if ( !list_protocols_reply.isValid() )
- {
- QDBusError error = list_protocols_reply.error();
-
- qWarning() << "ListProtocols: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- return empty_list; // returns empty list
- }
-
- return list_protocols_reply.value();
-}
-
-// TODO: Return the parameter list with all flags as we receive it from telepathy. This solution hides the flags and is unable
-// to handle all required types..
-Tp::ParamSpecList ConnectionFacade::paramSpecListForConnectionManagerAndProtocol( const QString& connectionManager, const QString& protocol )
-{
- Tp::registerTypes();
-
- Tp::Client::ConnectionManagerInterface connection_manager_interface( "org.freedesktop.Telepathy.ConnectionManager." + connectionManager,
- "/org/freedesktop/Telepathy/ConnectionManager/" + connectionManager );
-
- QDBusPendingReply<Tp::ParamSpecList> get_parameters_reply = connection_manager_interface.GetParameters( protocol );
- get_parameters_reply.waitForFinished();
-
- if ( !get_parameters_reply.isValid() )
- {
- QDBusError error = get_parameters_reply.error();
-
- qWarning() << "ListProtocols: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- return Tp::ParamSpecList() ; // returns empty list
- }
-
- Tp::ParamSpecList param_spec_list = get_parameters_reply.value();
-
- return param_spec_list;
-}
-
-QVariantMap ConnectionFacade::parameterListForConnectionManagerAndProtocol( const QString& connectionManager, const QString& protocol )
-{
- QVariantMap ret_map;
-
- foreach( const Tp::ParamSpec& item, paramSpecListForConnectionManagerAndProtocol(connectionManager, protocol) )
- {
- ret_map.insert( item.name, item.defaultValue.variant() );
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "item: " << item.name << "flag:" << item.flags;
-#endif
- if ( ( item.flags & ( mgr_Param_Flag_Required | mgr_Param_Flag_Register ) )
- && item.defaultValue.variant().toString().isEmpty() )
- {
-
- if ( item.defaultValue.variant().type() == QVariant::String )
- {
- ret_map.insert( item.name, QVariant("required") );
- }
- }
- }
-
- return ret_map;
-}
-
-QVariantMap ConnectionFacade::parameterListForProtocol( const QString& protocol, int account_number )
-{
- Tp::registerTypes();
-
- QVariantMap ret_map;
-
- if (account_number==1)
- {
- ret_map.insert( "account", "basyskom at localhost" );
- }
- else if (account_number==2)
- {
- ret_map.insert( "account", "test at localhost" );
- }
- ret_map.insert( "password", "basyskom" );
- ret_map.insert( "server", "localhost" );
- ret_map.insert( "resource", "Tp" );
- ret_map.insert( "port", static_cast<uint>(5222) );
- return ret_map;
-}
-
-// account_number is used for test purposes only we have to delte this later
-TpPrototype::Connection* ConnectionFacade::connectionWithAccount( Account* account, int account_number )
-{
- Tp::registerTypes();
-
- if ( !account )
- { return NULL; }
-
- account->setParameters( parameterListForProtocol( "jabber", account_number ) );
-
- // Get the default connection manager. "Default" is currently only the first one in the list of possible connection managers
- QStringList connection_managers = listOfConnectionManagers();
- Q_ASSERT( connection_managers.count() );
- if ( !connection_managers.count() )
- { return NULL; }
-
- return account->connection();
-}
-
-int ConnectionFacade::selfHandleForConnectionInterface( Tp::Client::ConnectionInterface* connectionInterface )
-{
- if ( !connectionInterface )
- {
- return -1;
- }
-
- QDBusPendingReply<uint> local_handle_reply = connectionInterface->GetSelfHandle();
- local_handle_reply.waitForFinished();
-
- if ( !local_handle_reply.isValid() )
- {
- QDBusError error = local_handle_reply.error();
-
- qWarning() << "GetSelfHandle: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- return -1;
- }
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "****Self handle:" << local_handle_reply.value();
-#endif
-
- return local_handle_reply.value();
-}
-
-#include "_gen/ConnectionFacade.h.moc"
diff --git a/TelepathyQt4/Prototype/ConnectionFacade.h b/TelepathyQt4/Prototype/ConnectionFacade.h
deleted file mode 100644
index 80543b4..0000000
--- a/TelepathyQt4/Prototype/ConnectionFacade.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 basysKom GmbH
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#ifndef ConnectionFacade_H_
-#define ConnectionFacade_H_
-
-#include <QObject>
-#include <QStringList>
-#include <QVariantMap>
-
-#include <TelepathyQt4/Types>
-
-#ifdef DEPRECATED_ENABLED__
-#define ATTRIBUTE_DEPRECATED __attribute__((deprecated))
-#else
-#define ATTRIBUTE_DEPRECATED
-#endif
-
-namespace Tp
-{
- namespace Client
- {
- class ConnectionInterface;
- }
-}
-
-namespace TpPrototype
-{
-
-/**
- * @defgroup qt_style_api Prototype Qt-Style Client API
- *
- * This API provides a high level client side API that enables developers
- * to access to Tp on a high level of abstraction. However, the
- * implementation is problematic in places.
- *
- * Work is in progress to merge the functionality of this prototype API into
- * the main part of telepathy-qt4 while converting it to asynchronous
- * operation. Using it for new code is not recommended.
- */
-
-/**
- * @defgroup qt_convenience Convenience Classes
- * @ingroup qt_style_api
- * Classes that provide functions that are needed for various tasks.
- */
-
-class ConnectionFacadePrivate;
-class Connection;
-class Account;
-
-/**
- * @ingroup qt_convenience
- * Class to access to Tp and Mission control services. This class is used to encapsulate the low level D-BUS Interface
- * to Tp and MissionControl. It provides a series of helper functions.<br>
- * This class follows the <i>facade</i> pattern.
- * @todo Move as much functions as possible into adequate classes.
- */
-class ConnectionFacade: public QObject
-{
- Q_OBJECT
-public:
- static ConnectionFacade* instance();
- /**
- * Returns a list of all connection managers registered.
- * @return List of connection manager names.
- */
- QStringList listOfConnectionManagers();
-
- /**
- * Returns a list of supported protocols of a connection manager.
- * @return List of supported protocols.
- */
- QStringList listOfProtocolsForConnectionManager( const QString& connectionManager );
-
- /**
- * Returns a Tp::ParamSpecList from the given protocol an connection manager.
- * @param connectionManager The connection manager for the protocol.
- * @param protocol Name of the protocol that is supported by the connection manager.
- * @return A map with all supported parameters with default values.
- */
- Tp::ParamSpecList paramSpecListForConnectionManagerAndProtocol( const QString& connectionManager, const QString& protocol );
-
- /**
- * Returns a list of parameters for the given protocol and connection manager.
- * @param connectionManager The connection manager for the protocol.
- * @param protocol Name of the protocol that is supported by the connection manager.
- * @return A map with all supported parameters with default values.
- */
- QVariantMap parameterListForConnectionManagerAndProtocol( const QString& connectionManager, const QString& protocol );
-
- /**
- * Returns a list of parameters for the given protocol.
- * @deprecated Use parameterListForConnectionManagerAndProtocol() instead!
- * @param protocol Name of the protocol.
- * @return A map with all supported parameters with default values.
- */
- QVariantMap parameterListForProtocol( const QString& protocol, int account_number=1 ) ATTRIBUTE_DEPRECATED;
-
- /**
- * Connects to account. Connects an account to a service using the default connection manager.
- * @deprecated Use <i>Account::connection()</i> instead!
- * @param account The account to use.
- * @return A connection. A null pointer is returned if the connection was <i>not</i> successful.
- */
- TpPrototype::Connection* connectionWithAccount( Account* account, int account_number=1 ) ATTRIBUTE_DEPRECATED;
-
- /**
- * Returns the self handle. The self handle is needed by various interfaces to request information about myself
- * @todo: This is more or less a local function and should not be part of a public API. But I don't have a better place right now!
- * @return The local handle is usually 1 but may change on demand. -1 is returned on error.
- */
- int selfHandleForConnectionInterface( Tp::Client::ConnectionInterface* connectionInterface );
-
-private:
- ConnectionFacade( QObject* parent );
- ~ConnectionFacade();
-
- ConnectionFacadePrivate * const d;
- static ConnectionFacade* m_instance;
-};
-
-}
-#endif // ConnectionFacade_H_
-
diff --git a/TelepathyQt4/Prototype/Constants b/TelepathyQt4/Prototype/Constants
deleted file mode 100644
index 3cc33f9..0000000
--- a/TelepathyQt4/Prototype/Constants
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _TelepathyQt4_Prototype_Constants_HEADER_GUARD_
-#define _TelepathyQt4_Prototype_Constants_HEADER_GUARD_
-
-#include <TelepathyQt4/Prototype/constants.h>
-
-#endif
diff --git a/TelepathyQt4/Prototype/Contact.cpp b/TelepathyQt4/Prototype/Contact.cpp
deleted file mode 100644
index 9dec667..0000000
--- a/TelepathyQt4/Prototype/Contact.cpp
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 basysKom GmbH
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "TelepathyQt4/Prototype/Contact.h"
-
-#include <QDebug>
-#include <QMetaProperty>
-
-#include <TelepathyQt4/Channel>
-#include <TelepathyQt4/Constants>
-
-#include <TelepathyQt4/Prototype/ChatChannel.h>
-#include <TelepathyQt4/Prototype/ContactManager.h>
-#include <TelepathyQt4/Prototype/StreamedMediaChannel.h>
-
-using namespace TpPrototype;
-
-class TpPrototype::ContactPrivate
-{
-public:
- ContactPrivate( const uint & handle, const QString & name, Contact::ContactTypes type,
- Tp::Client::ConnectionInterface* connectionInterface, TpPrototype::ContactManager* contactManager )
- { init(handle, name, type, connectionInterface, contactManager); }
- ~ContactPrivate()
- {}
- uint m_handle;
- bool m_isValid;
- bool m_isPresenceInitialized;
- Contact::ContactTypes m_type;
- QString m_name;
- uint m_presenceType;
- QString m_presenceStatus;
- QString m_presenceMessage;
- Tp::ContactCapabilityList m_capabilityList;
- TpPrototype::AvatarManager::Avatar m_avatar;
- Tp::Client::ConnectionInterface* m_pConnectionInterface;
- QPointer<TpPrototype::ChatChannel> m_pChatChannel;
- QPointer<TpPrototype::StreamedMediaChannel> m_pStreamedMediaChannel;
- QPointer<TpPrototype::ContactManager> m_pContactManager;
-
-private:
- void init( uint handle, const QString & name, Contact::ContactTypes type,
- Tp::Client::ConnectionInterface* connectionInterface, TpPrototype::ContactManager* contactManager )
- {
- Q_ASSERT( connectionInterface );
- Q_ASSERT( contactManager );
-
- m_handle = handle;
- m_name = name;
- m_type = type;
- m_presenceType = 0;
- m_presenceStatus = "unknown";
- m_presenceMessage = "";
- m_pChatChannel = NULL;
- m_pStreamedMediaChannel = NULL;
- m_pConnectionInterface = connectionInterface;
- m_pContactManager = contactManager;
- m_isPresenceInitialized = false;
-
- if ( 0 == m_handle )
- m_isValid = false;
- else
- m_isValid = true;
- }
-};
-
-uint Contact::telepathyHandle() const
-{ return d->m_handle; }
-
-uint Contact::telepathyHandleType() const
-{ return Tp::HandleTypeContact; }
-
-QString Contact::name() const
-{ return d->m_name; }
-
-Contact::ContactTypes Contact::type() const
-{ return d->m_type; }
-
-void Contact::setType( ContactTypes type )
-{
- d->m_type = type;
-}
-
-bool Contact::isValid() const
-{ return d->m_isValid; }
-
-void Contact::setPresenceType( uint _presenceType)
-{ d->m_presenceType=_presenceType; }
-
-uint Contact::presenceType()
-{
- d->m_isPresenceInitialized = true;
- return d->m_presenceType;
-}
-
-void Contact::setPresenceStatus( QString _presenceStatus)
-{
- d->m_isPresenceInitialized = true;
- d->m_presenceStatus=_presenceStatus;
-}
-
-QString Contact::presenceStatus()
-{ return d->m_presenceStatus; }
-
-bool Contact::isPresenceStateAvailable()
-{ return d->m_isPresenceInitialized; }
-
-void Contact::setPresenceMessage( QString _presenceMessage)
-{ d->m_presenceMessage=_presenceMessage; }
-
-QString Contact::presenceMessage()
-{ return d->m_presenceMessage; }
-
-void Contact::setCapabilities( const Tp::ContactCapabilityList& capabilityList )
-{ d->m_capabilityList = capabilityList; }
-
-Tp::ContactCapabilityList Contact::capabilities() const
-{ return d->m_capabilityList; }
-
-void Contact::setAvatar( const TpPrototype::AvatarManager::Avatar& avatar )
-{
- d->m_avatar = avatar;
-}
-
-Tp::Client::ConnectionInterface* Contact::interface()
-{
- return d->m_pConnectionInterface;
-}
-
-TpPrototype::AvatarManager::Avatar Contact::avatar() const
-{
- return d->m_avatar;
-}
-
-ChatChannel* Contact::chatChannel()
-{
- if ( !d->m_pChatChannel )
- {
- d->m_pChatChannel = new ChatChannel( this, d->m_pConnectionInterface, this );
- Q_ASSERT( d->m_pChatChannel->isValid() );
- }
- return d->m_pChatChannel;
-}
-
-TpPrototype::StreamedMediaChannel* Contact::streamedMediaChannel()
-{
- if ( !d->m_pStreamedMediaChannel )
- {
- d->m_pStreamedMediaChannel = new StreamedMediaChannel( this, d->m_pConnectionInterface, this );
- Q_ASSERT( d->m_pStreamedMediaChannel->isValid() );
- }
- return d->m_pStreamedMediaChannel;
-
-}
-
-TpPrototype::ContactManager* Contact::contactManager()
-{
- return d->m_pContactManager;
-}
-
-
-Contact::Contact( const uint & handle, const QString & url, ContactTypes type,
- Tp::Client::ConnectionInterface* connectionInterface, TpPrototype::ContactManager* contactManager ) :
- QObject( contactManager ),
- d( new ContactPrivate( handle, url, type, connectionInterface, contactManager ) )
-{
-}
-
-Contact::~Contact()
-{ delete d; }
-
-#include "_gen/Contact.h.moc"
diff --git a/TelepathyQt4/Prototype/Contact.h b/TelepathyQt4/Prototype/Contact.h
deleted file mode 100644
index 2b7eb5e..0000000
--- a/TelepathyQt4/Prototype/Contact.h
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 basysKom GmbH
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef TelepathyQt4_Prototype_Contact_H_
-#define TelepathyQt4_Prototype_Contact_H_
-
-#include <QObject>
-#include <QPointer>
-#include <QVariantMap>
-
-#include <TelepathyQt4/Channel>
-
-#include <TelepathyQt4/Prototype/AvatarManager.h>
-
-#ifdef DEPRECATED_ENABLED__
-#define ATTRIBUTE_DEPRECATED __attribute__((deprecated))
-#else
-#define ATTRIBUTE_DEPRECATED
-#endif
-
-namespace Tp
-{
- namespace Client
- {
- class ConnectionInterface;
- }
-}
-
-namespace TpPrototype {
-
-class ContactPrivate;
-class ContactManager;
-class ChatChannel;
-class StreamedMediaChannel;
-
-/**
- * This class handles information related to a contact.
- * Contact objects are always owned by ContactManager. Therefore, there is no way to create or remove a contact without using the ContactManager object.<br>
- * Other Managers (like PresenceManager, AvatarManager) are accessing the contacts inside of the contact manager to update its information.
- * Whether a contact was updated is signalled by the Managers but the new information is stored in the contact object and can be retrieved from it.
- * @ingroup qt_connection
- * @ingroup qt_contact
- * @todo Do not provide a function for every presence parameter. Use SimplePresence instead.
- * @todo Use implicit sharing instead of expolicit sharig!
- * @see CapabilitiesManager, AvatarManager, PresenceManager
- */
-class Contact : public QObject
-{
- Q_OBJECT
-public:
- enum ContactTypes
- {
- CT_Subscribed = 0,
- CT_LocalPending,
- CT_RemotePending,
- CT_Removed,
- CT_Known,
- CT_Blocked
- };
-
- /**
- * Validity.
- * Do not access any method if this function returns false.
- */
- bool isValid() const;
-
- /**
- * Returns the contact type.
- * @return The contact type.
- */
- ContactTypes type() const;
-
- /**
- * Set type.
- * @param type The new type
- * @see ContactTypes
- */
- void setType( ContactTypes type );
-
- /**
- * Returns the telepathy internal handle.
- * @return The telepathy internal handle.
- */
- uint telepathyHandle() const;
-
- /**
- * Returns the telepathy internal handle type.
- * @return The telepathy internal handle type.
- */
- uint telepathyHandleType() const;
-
- /**
- * Returns the name of the contact.
- * @return The name of the contact as it is used by protocol (E.g. user at jabber.org).
- * @todo Make this private. We need an encapsulation for </i>PresenceManager::presencesForContacts()</i> first. (ses)
- * THUN: Stefan, this is not possible as this information is required to work with all telepathy classes
- * unknown to this lib.
- */
- QString name() const;
-
- /**
- * Returns the presence information of this contact.
- * This presence information is automatically updated after the presence information was requested for the first time (PresenceManager::presencesForContacts()).<br>
- * <b>Note:</b> Use <i>isPresenceStateAvailable()</i> to check whether the returned presence is valid!
- * @todo Implement this!
- * @see PresenceManager
- */
- Tp::SimplePresence presence() { return Tp::SimplePresence(); /* TODO: Implement me ! */ };
-
- /**
- * @todo: Add Doc and get/setr in presence manager
- * @deprecated Use <i>presence()</i> instead.
- *
- */
- uint presenceType() ATTRIBUTE_DEPRECATED;
-
- /**
- * @todo: Add Doc and get/setr in presence manager
- * @deprecated Use <i>presence()</i> instead.
- *
- */
- QString presenceStatus() ATTRIBUTE_DEPRECATED;
-
- /**
- * Returns whether there is any presence information available.
- * This functionreturns <i>false</i> if there is no valid presence information available.
- * @return <i>true</i> if valid resence information is available. Otherwise <i>false</i> is returned.
- */
- bool isPresenceStateAvailable();
-
- /**
- * @todo: Add Doc and get/setr in presence manager
- * @deprecated Use <i>presence()</i> instead.
- *
- */
- QString presenceMessage() ATTRIBUTE_DEPRECATED;
-
- /**
- * @todo: Add Doc and get/setr in presence manager
- *
- */
- Tp::ContactCapabilityList capabilities() const;
-
-
- /**
- * Get Avatar for this contact.
- * This function does not return valid information after the avatar was not requested by avatarForContactList()
- * @see AvatarManager
- */
- TpPrototype::AvatarManager::Avatar avatar() const;
-
- /**
- * Get chat channel for this contact.
- * This function provides the chat channel object for this contact. It contains all information to do a text chat
- * @return The channel object.
- */
- TpPrototype::ChatChannel* chatChannel();
-
- /**
- * Get channel for media streaming.
- * This function returns the media streaming object for this contact. It contains all information and functions for VoIP and Video Over IP communication.
- */
- TpPrototype::StreamedMediaChannel* streamedMediaChannel();
-
- /**
- * Get the contact manager where this object is stored.
- * @return The contact manager that owns this object.
- */
- TpPrototype::ContactManager* contactManager();
-
-protected:
- /**
- * Contstuctor.
- * This object is never created directly. Use ContactManager to create or request a contact.
- * @see ContactManager
- */
- Contact( const uint & handle, const QString & name, ContactTypes type, Tp::Client::ConnectionInterface* connectionInterface, TpPrototype::ContactManager* contactManager );
-
- ~Contact();
-
- /**
- * @todo: Add Doc and get/setr in presence manager
- */
- void setPresenceType( uint _presenceType);
-
- /**
- * @todo: Add Doc and get/setr in presence manager
- */
- void setPresenceStatus( QString _presenceStatus);
-
- /**
- * @todo: Add Doc and get/setr in presence manager
- */
- void setPresenceMessage( QString _presenceMessage);
-
- /**
- * @todo: Add Doc and get/setr in presence manager
- */
- void setCapabilities( const Tp::ContactCapabilityList& capabilityList );
-
- /**
- * Set the avatar.
- * This avatar is set by the AvatarManager.
- *
- */
- void setAvatar( const TpPrototype::AvatarManager::Avatar& avatar );
-
- /**
- * D-BUS interface.
- * This protected access to the D-BUS interface can be used to extend this class with special features.
- */
- Tp::Client::ConnectionInterface* interface();
-
-
-private:
- ContactPrivate * const d;
-
- friend class ContactManager;
- friend class AvatarManager;
- friend class PresenceManager;
- friend class CapabilitiesManager;
-};
-
-} // namespace
-
-// Q_DECLARE_METATYPE( TpPrototype::Contact )
-
-#endif // Header guard
diff --git a/TelepathyQt4/Prototype/ContactManager.cpp b/TelepathyQt4/Prototype/ContactManager.cpp
deleted file mode 100644
index 4145843..0000000
--- a/TelepathyQt4/Prototype/ContactManager.cpp
+++ /dev/null
@@ -1,1145 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 basysKom GmbH
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "TelepathyQt4/Prototype/ContactManager.h"
-
-#include <time.h>
-
-#include <QCoreApplication>
-#include <QDBusPendingReply>
-#include <QDBusObjectPath>
-#include <QDebug>
-#include <QHash>
-#include <QPointer>
-#include <QString>
-
-#include <TelepathyQt4/Channel>
-
-#include <TelepathyQt4/Prototype/ChatChannel.h>
-#include <TelepathyQt4/Prototype/ConnectionFacade.h>
-#include <TelepathyQt4/Prototype/Contact.h>
-#include <TelepathyQt4/Prototype/StreamedMediaChannel.h>
-
-// #define ENABLE_DEBUG_OUTPUT_
-
-using namespace TpPrototype;
-
-class TpPrototype::ContactManagerPrivate
-{
-public:
- ContactManagerPrivate()
- { init(); }
-
- ~ContactManagerPrivate()
- { }
-
- Tp::Client::ConnectionInterface* m_pInterface;
- Tp::Client::ChannelInterfaceGroupInterface* m_groupSubscribedChannel;
- Tp::Client::ChannelInterfaceGroupInterface* m_groupKnownChannel;
- Tp::Client::ChannelInterfaceGroupInterface* m_groupPublishedChannel;
- Tp::Client::ChannelInterfaceGroupInterface* m_groupDeniedChannel;
- Tp::Client::ChannelTypeTextInterface* m_groupTextChannel;
-
- QHash<uint, QPointer<Contact> > m_members;
- QHash<uint, QPointer<Contact> > m_subscribed;
- QHash<uint, QPointer<Contact> > m_localPending;
- QHash<uint, QPointer<Contact> > m_remotePending;
- QHash<uint, QPointer<Contact> > m_known;
- QHash<uint, QPointer<Contact> > m_denied;
-
- bool m_isValid;
-
- void init()
- {
- m_pInterface = NULL;
- m_groupSubscribedChannel = NULL;
- m_groupKnownChannel = NULL;
- m_groupPublishedChannel = NULL;
- m_groupTextChannel = NULL; //leave this temporaryly here push it later to contact
- m_isValid = false;
- }
-
- // Returns a list of all <i>handles</i> already <i>contained</i> in <i>list</i>
- QList<uint> handlesToLookUp( const QHash<uint, QPointer<Contact> >& list, const Tp::UIntList& handles, bool contained )
- {
- QList<uint> to_look_up;
- foreach(uint handle, handles)
- {
- if ( contained == list.contains(handle) )
- { to_look_up.append(handle); }
- }
- return to_look_up;
- }
-
- QList<uint> subscribedHandlesToLookUp(const Tp::UIntList& handles)
- {
- return handlesToLookUp( m_subscribed, handles, false );
- }
-
- QList<uint> newKnownHandlesToLookUp(const Tp::UIntList& handles)
- {
- return handlesToLookUp( m_members, handles, false );
- }
-
- QList<uint> removedHandlesToLookUp(const Tp::UIntList& handles)
- {
- return handlesToLookUp( m_members, handles, true );
- }
-
- QList<uint> localPendingHandlesToLookUp(const Tp::UIntList& handles)
- {
- return handlesToLookUp( m_localPending, handles, false );
- }
-
- QList<uint> remotePendingHandlesToLookUp(const Tp::UIntList& handles)
- {
- return handlesToLookUp( m_remotePending, handles, false );
- }
-
- QList<uint> newDeniedHandles( const Tp::UIntList& handles )
- {
- return handlesToLookUp( m_denied, handles, false );
- }
-
- QList<uint> removedDeniedHandles( const Tp::UIntList& handles )
- {
- return handlesToLookUp( m_denied, handles, true );
- }
-
- QList<QPointer<TpPrototype::Contact> > mapHashToList( QHash<uint, QPointer<Contact> > hash )
- {
- QList<QPointer<TpPrototype::Contact> > ret_list;
-
- foreach( const QPointer<TpPrototype::Contact>& contact, hash )
- {
- // Filter possilble null pointers
- if ( NULL == contact )
- { continue; }
-
- ret_list.append( contact );
- }
-
- return ret_list;
- }
-
-};
-
-ContactManager::ContactManager( Tp::Client::ConnectionInterface* connection,
- QObject* parent ):
- QObject( parent ),
- d( new ContactManagerPrivate )
-{
- init( connection );
-}
-
-ContactManager::~ContactManager()
-{
- // Delete this here as we are a friend of contact.
- foreach (QPointer<Contact> current_contact, d->m_members)
- { delete current_contact; }
- foreach (QPointer<Contact> current_contact, d->m_subscribed)
- { delete current_contact; }
- foreach (QPointer<Contact> current_contact, d->m_localPending)
- { delete current_contact; }
- foreach (QPointer<Contact> current_contact, d->m_remotePending)
- { delete current_contact; }
-
- delete d;
-}
-
-int ContactManager::count()
-{ return d->m_members.size(); }
-
-bool ContactManager::isValid()
-{ return d->m_isValid; }
-
-QList<QPointer<Contact> > ContactManager::contactList()
-{ return d->m_members.values(); }
-
-QList<QPointer<Contact> > ContactManager::toAuthorizeList()
-{ return d->m_localPending.values();}
-
-QList<QPointer<Contact> > ContactManager::remoteAuthorizationPendingList()
-{ return d->m_remotePending.values();}
-
-QList<QPointer<Contact> > ContactManager::blockedContacts()
-{ return d->m_denied.values(); }
-
-void ContactManager::init( Tp::Client::ConnectionInterface* connection )
-{
- Q_ASSERT(0 != connection);
- Tp::registerTypes();
- d->m_pInterface = connection;
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "ContactManager up and running... waiting for signals.";
-#endif//
- d->m_isValid = true;
-}
-
-bool ContactManager::requestContact( const QString& id )
-{
- QStringList contact_ids;
- contact_ids.append(id);
-
- QList<uint> contact_handles=d->m_pInterface->RequestHandles( Tp::HandleTypeContact,contact_ids);
- if (!contact_handles.empty())
- {
- if ( d->m_groupSubscribedChannel)
- d->m_groupSubscribedChannel->AddMembers(contact_handles,"Contact Request");
- return true;
- }
- return false;
-}
-
-bool ContactManager::authorizeContact( const Contact* contact )
-{
- if ( !contact )
- { return false; }
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "ContactManager Try to authorize a contact";
-#endif
- QList<uint> toauthorizelist;
- toauthorizelist.append(contact->telepathyHandle());
- if ( d->m_groupPublishedChannel)
- d->m_groupPublishedChannel->AddMembers(toauthorizelist,"Add");
- return true;
-}
-
-
-bool ContactManager::removeContact( const Contact* contact_toremove )
-{
- if ( !contact_toremove )
- { return false; }
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "ContactManager Try to remove a contact ..";
-#endif
- QList<uint> toremovelist;
- toremovelist.append(contact_toremove->telepathyHandle());
-
- if ( d->m_groupSubscribedChannel)
- d->m_groupSubscribedChannel->RemoveMembers(toremovelist,"Remove");
- if ( d->m_groupPublishedChannel)
- d->m_groupPublishedChannel->RemoveMembers(toremovelist,"Remove");
- if ( d->m_groupKnownChannel)
- d->m_groupKnownChannel->RemoveMembers(toremovelist,"Remove");
-
- return true;
-}
-
-bool ContactManager::blockContact( const Contact* contactToBlock )
-{
- if ( !contactToBlock || !d->m_groupDeniedChannel )
- { return false; }
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "ContactManager: Try to block a contact";
-#endif
- QList<uint> handle_list;
- handle_list.append( contactToBlock->telepathyHandle() );
-
- d->m_groupDeniedChannel->AddMembers( handle_list, "Block" );
-
- return true;
- // The list of blocked users (d->m_denied()) will be updated by a signal after this point
-}
-
-bool ContactManager::unblockContact( const Contact* contactToUnblock )
-{
- if ( !contactToUnblock || !d->m_groupDeniedChannel )
- { return false; }
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "ContactManager: Try to unblock a contact";
-#endif
- QList<uint> handle_list;
- handle_list.append( contactToUnblock->telepathyHandle() );
-
- d->m_groupDeniedChannel->RemoveMembers( handle_list, "Unblock" );
-
- return true;
- // The list of blocked users (d->m_denied()) will be updated by a signal after this point
-}
-
-QPointer<TpPrototype::Contact> ContactManager::contactForHandle( uint handle )
-{
- return d->m_members.value( handle );
-}
-
-uint ContactManager::localHandle()
-{
- return ConnectionFacade::instance()->selfHandleForConnectionInterface( d->m_pInterface );
-}
-
-
-/*
- inline QDBusPendingReply<> AcknowledgePendingMessages(const Tp::UIntList& IDs)
-{
- QList<QVariant> argumentList;
- argumentList << QVariant::fromValue(IDs);
- return asyncCallWithArgumentList(QLatin1String("AcknowledgePendingMessages"), argumentList);
-}
-
- inline QDBusPendingReply<Tp::UIntList> GetMessageTypes()
-{
- return asyncCall(QLatin1String("GetMessageTypes"));
-}
-
-*/
-
-
-void ContactManager::openSubscribedContactsChannel(uint handle, const QDBusObjectPath& channelPath, const QString& channelType)
-{
- QString channel_service_name(d->m_pInterface->service());
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "ContactManager Channel Services Name" << channel_service_name;
- qDebug() << "ContactManager Channel Path" << channelPath.path();
-#endif
- // This channel may never be closed!
- d->m_groupSubscribedChannel = new Tp::Client::ChannelInterfaceGroupInterface(channel_service_name,channelPath.path(),
- this);
- if (!d->m_groupSubscribedChannel->isValid())
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Failed to connect Group channel interface class to D-Bus object.";
-#endif
- delete d->m_groupSubscribedChannel;
- d->m_groupSubscribedChannel = 0;
- return;
- }
- QDBusPendingReply<Tp::UIntList, Tp::UIntList, Tp::UIntList> reply2=d->m_groupSubscribedChannel->GetAllMembers();
- reply2.waitForFinished();
-
- const Tp::UIntList mlist1= QList< quint32 > (reply2.argumentAt<0>());
- const Tp::UIntList mlist2;
- const Tp::UIntList mlist3= QList< quint32 > (reply2.argumentAt<1>());
- const Tp::UIntList mlist4= QList< quint32 > (reply2.argumentAt<2>());
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Number of current members" << mlist1.size();
- qDebug() << "Number of local pending members" << mlist2.size();
- qDebug() << "Number of remote pending members" << mlist3.size();
-#endif
- if (( mlist1.size()>0) || ( mlist3.size()>0) || ( mlist4.size()>0))
- slotSubscribedMembersChanged("",
- mlist1,
- mlist2,
- mlist3,
- mlist4,
- 0, 0);
-
- // All lists are empty when the channel is created, so it suffices to connect
- // the MembersChanged signal.
- connect(d->m_groupSubscribedChannel, SIGNAL(MembersChanged(const QString&,
- const Tp::UIntList&, // added to members list
- const Tp::UIntList&, // removed from members list
- const Tp::UIntList&, // local pending list
- const Tp::UIntList&, // remote pending list
- uint, uint)),
- this, SLOT(slotSubscribedMembersChanged(const QString&,
- const Tp::UIntList&,
- const Tp::UIntList&,
- const Tp::UIntList&,
- const Tp::UIntList&,
- uint, uint)));
-
-}
-
-void ContactManager::openKnownContactsChannel(uint handle, const QDBusObjectPath& channelPath, const QString& channelType)
-{
- QString channel_service_name(d->m_pInterface->service());
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "ContactManager Channel Services Name" << channel_service_name;
- qDebug() << "ContactManager Channel Path" << channelPath.path();
-#endif
- // This channel may never be closed!
- d->m_groupKnownChannel = new Tp::Client::ChannelInterfaceGroupInterface(channel_service_name,channelPath.path(),
- this);
- if (!d->m_groupKnownChannel->isValid())
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Failed to connect Group channel interface class to D-Bus object.";
-#endif
- delete d->m_groupKnownChannel;
- d->m_groupKnownChannel = 0;
- return;
- }
- QDBusPendingReply<Tp::UIntList, Tp::UIntList, Tp::UIntList> reply2=d->m_groupKnownChannel->GetAllMembers();
- reply2.waitForFinished();
-
- const Tp::UIntList mlist1= QList< quint32 > (reply2.argumentAt<0>());
- const Tp::UIntList mlist2;
- const Tp::UIntList mlist3= QList< quint32 > (reply2.argumentAt<1>());
- const Tp::UIntList mlist4= QList< quint32 > (reply2.argumentAt<2>());
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Number of current members" << mlist1.size();
- qDebug() << "Number of local pending members" << mlist2.size();
- qDebug() << "Number of remote pending members" << mlist3.size();
-#endif
- if (( mlist1.size()>0) || ( mlist3.size()>0) || ( mlist4.size()>0))
- slotKnownMembersChanged("",
- mlist1,
- mlist2,
- mlist3,
- mlist4,
- 0, 0);
-
- // All lists are empty when the channel is created, so it suffices to connect
- // the MembersChanged signal.
- connect(d->m_groupKnownChannel, SIGNAL(MembersChanged(const QString&,
- const Tp::UIntList&, // added to members list
- const Tp::UIntList&, // removed from members list
- const Tp::UIntList&, // local pending list
- const Tp::UIntList&, // remote pending list
- uint, uint)),
- this, SLOT(slotKnownMembersChanged(const QString&,
- const Tp::UIntList&,
- const Tp::UIntList&,
- const Tp::UIntList&,
- const Tp::UIntList&,
- uint, uint)));
-
-}
-
-void ContactManager::openDenyContactsChannel(uint handle, const QDBusObjectPath& channelPath, const QString& channelType)
-{
- QString channel_service_name(d->m_pInterface->service());
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "ContactManager Channel Services Name" << channel_service_name;
- qDebug() << "ContactManager Channel Path" << channelPath.path();
-#endif
- // This channel may never be closed!
- d->m_groupDeniedChannel = new Tp::Client::ChannelInterfaceGroupInterface(channel_service_name,channelPath.path(),
- this);
- if (!d->m_groupDeniedChannel->isValid())
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Failed to connect Group channel interface class to D-Bus object.";
-#endif
- delete d->m_groupDeniedChannel;
- d->m_groupDeniedChannel = NULL;
- return;
- }
-
- QDBusPendingReply<Tp::UIntList, Tp::UIntList, Tp::UIntList> reply2=d->m_groupKnownChannel->GetAllMembers();
- reply2.waitForFinished();
-
- const Tp::UIntList current = QList< quint32 > (reply2.argumentAt<0>());
- const Tp::UIntList local_pending = QList< quint32 > (reply2.argumentAt<1>());
- const Tp::UIntList remote_pending = QList< quint32 > (reply2.argumentAt<2>());
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Denied-Members: Number of current members" << current.size();
- qDebug() << "Denied-Members: Number of local pending members" << local_pending.size();
- qDebug() << "Denied-Members: Number of remote pending members" << remote_pending.size();
-#endif
- if (( current.size()>0) || ( local_pending.size()>0) || ( remote_pending.size()>0))
- slotDeniedMembersChanged("",
- current,
- Tp::UIntList(),
- local_pending,
- remote_pending,
- 0, 0);
-
- // All lists are empty when the channel is created, so it suffices to connect
- // the MembersChanged signal.
- connect(d->m_groupDeniedChannel, SIGNAL(MembersChanged(const QString&,
- const Tp::UIntList&, // added to members list
- const Tp::UIntList&, // removed from members list
- const Tp::UIntList&, // local pending list
- const Tp::UIntList&, // remote pending list
- uint, // actor
- uint)), // reason
- this, SLOT(slotDeniedMembersChanged(const QString&,
- const Tp::UIntList&,
- const Tp::UIntList&,
- const Tp::UIntList&,
- const Tp::UIntList&,
- uint, uint)));
-
-}
-
-void ContactManager::openTextChannel( uint handle, uint handleType, const QString& channelPath, const QString& channelTyp )
-{
- Contact* contact = d->m_members.value( handle );
-
- if ( !contact )
- {
- qWarning() << "ContactManager::openTextChannel: Tried to open a text channel but there was no receiving contact found!";
- return;
- }
- if ( !contact->chatChannel() )
- {
- qWarning() << "ContactManager::openTextChannel: Requesting a valid text channel object failed!";
- return;
- }
-
- if ( contact && contact->chatChannel() )
- {
- contact->chatChannel()->openTextChannel( handle, handleType, channelPath, channelTyp );
- emit signalTextChannelOpenedForContact( contact );
- }
-}
-
-void ContactManager::openStreamedMediaChannel( uint handle, uint handleType, const QString& channelPath, const QString& channelType )
-{
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "ContactManager::openStreamedMediaChannel handle: " << handle
- << "handleType:" << handleType
- << "channelPath: " << channelPath
- << "channelType: " << channelType;
-#endif
-
- // Outbound calls have no handle and don't need to be handled here.
- if ( handle == 0 )
- { return; }
-
-
- Contact* contact = d->m_members.value( handle );
-
- if ( !contact )
- {
- qWarning() << "ContactManager::openStreamedMediaChannel: Tried to open a media stream channel but there was no receiving contact found!";
- return;
- }
- if ( !contact->streamedMediaChannel() )
- {
- qWarning() << "ContactManager::openStreamedMediaChannel: Requesting a valid streamed media channel object failed!";
- return;
- }
-
- if ( contact && contact->streamedMediaChannel() )
- {
- disconnect( contact->streamedMediaChannel(), SIGNAL( signalIncomingChannel( TpPrototype::Contact* ) ), this, 0 );
- connect( contact->streamedMediaChannel(), SIGNAL( signalIncomingChannel( TpPrototype::Contact* ) ),
- this, SIGNAL( signalStreamedMediaChannelOpenedForContact( TpPrototype::Contact* ) ) );
- contact->streamedMediaChannel()->openStreamedMediaChannel( handle, handleType, channelPath, channelType );
- }
-}
-
-void ContactManager::openPublishContactsChannel(uint handle, const QDBusObjectPath& channelPath, const QString& channelType)
-{
- QString channel_service_name(d->m_pInterface->service());
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "ContactManager Channel Services Name" << channel_service_name;
- qDebug() << "ContactManager Channel Path" << channelPath.path();
-#endif
- // This channel may never be closed!
- d->m_groupPublishedChannel = new Tp::Client::ChannelInterfaceGroupInterface(channel_service_name,channelPath.path(),
- this);
- if (!d->m_groupPublishedChannel->isValid())
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Failed to connect Group channel interface class to D-Bus object.";
-#endif
- delete d->m_groupPublishedChannel;
- d->m_groupPublishedChannel = 0;
- return;
- }
- QDBusPendingReply<Tp::UIntList, Tp::UIntList, Tp::UIntList> reply2=d->m_groupPublishedChannel->GetAllMembers();
- reply2.waitForFinished();
-
- const Tp::UIntList mlist1= QList< quint32 > (reply2.argumentAt<0>());
- const Tp::UIntList mlist2;
- const Tp::UIntList mlist3= QList< quint32 > (reply2.argumentAt<1>());
- const Tp::UIntList mlist4= QList< quint32 > (reply2.argumentAt<2>());
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Number of current members" << mlist1.size();
- qDebug() << "Number of local pending members" << mlist2.size();
- qDebug() << "Number of remote pending members" << mlist3.size();
-#endif
- if (( mlist1.size()>0) || ( mlist3.size()>0) || ( mlist4.size()>0))
- slotPublishedMembersChanged("",
- mlist1,
- mlist2,
- mlist3,
- mlist4,
- 0, 0);
- // qDebug() << "Number of current members" << mlist1.size();
- // qDebug() << "Number of local pending members" << mlist2.size();
- // qDebug() << "Number of remote pending members" << mlist3.size();
-
- // All lists are empty when the channel is created, so it suffices to connect
- // the MembersChanged signal.
- connect(d->m_groupPublishedChannel, SIGNAL(MembersChanged(const QString&,
- const Tp::UIntList&, // added to members list
- const Tp::UIntList&, // removed from members list
- const Tp::UIntList&, // local pending list
- const Tp::UIntList&, // remote pending list
- uint, uint)),
- this, SLOT(slotPublishedMembersChanged(const QString&,
- const Tp::UIntList&,
- const Tp::UIntList&,
- const Tp::UIntList&,
- const Tp::UIntList&,
- uint, uint)));
-
-}
-
-
-
-void ContactManager::slotKnownMembersChanged(const QString& message,
- const Tp::UIntList& members_added,
- const Tp::UIntList& members_removed,
- const Tp::UIntList& local_pending,
- const Tp::UIntList& remote_pending,
- uint actor, uint reason)
-{
- slotMembersChanged("Known",
- members_added,
- members_removed,
- local_pending,
- remote_pending,
- actor, reason);
-}
-void ContactManager::slotPublishedMembersChanged(const QString& message,
- const Tp::UIntList& members_added,
- const Tp::UIntList& members_removed,
- const Tp::UIntList& local_pending,
- const Tp::UIntList& remote_pending,
- uint actor, uint reason)
-{
- slotMembersChanged("Published",
- members_added,
- members_removed,
- local_pending,
- remote_pending,
- actor, reason);
-}
-
-void ContactManager::slotSubscribedMembersChanged(const QString& message,
- const Tp::UIntList& members_added,
- const Tp::UIntList& members_removed,
- const Tp::UIntList& local_pending,
- const Tp::UIntList& remote_pending,
- uint actor, uint reason)
-{
- slotMembersChanged("Subscribed",
- members_added,
- members_removed,
- local_pending,
- remote_pending,
- actor, reason);
-}
-
-void ContactManager::slotDeniedMembersChanged(const QString& message,
- const Tp::UIntList& members_added,
- const Tp::UIntList& members_removed,
- const Tp::UIntList& local_pending,
- const Tp::UIntList& remote_pending,
- uint actor,
- uint reason)
-{
- QList<uint> added_members = d->newDeniedHandles( members_added ); // members added to the list of denied.
- QList<uint> removed_members = d->removedDeniedHandles( members_removed ); // members removed from the list of denied.
- QList<uint> new_members = d->newKnownHandlesToLookUp( members_added ); // new members that are not yet in the list of members
-
- // Remove all removed members from the denied list
- foreach( uint member_handle, removed_members )
- {
- Contact* contact = d->m_denied.value( member_handle );
- if ( !contact )
- { continue; }
- contact->setType( Contact::CT_Known );
- d->m_denied.remove( member_handle );
- }
-
- // Members that are not already known (in list of members): create new contact.
- QDBusPendingReply<QStringList> handle_names_reply = d->m_pInterface->InspectHandles( Tp::HandleTypeContact, new_members );
- handle_names_reply.waitForFinished();
- if ( !handle_names_reply.isValid() )
- {
- QDBusError error = handle_names_reply.error();
-
- qWarning() << "InspectHandles (new denied handles=: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
- return;
- }
- Q_ASSERT( handle_names_reply.value().size() == new_members.size() );
-
- // Create Contacts for the looked up handles:
- for (int i = 0; i < new_members.size(); ++i)
- {
- QPointer<Contact> contact = new Contact( new_members.at(i), handle_names_reply.value().at(i), Contact::CT_Blocked, d->m_pInterface, this );
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Create contact for known Handle" << handle_names_reply.value().at(i);
-#endif
- Q_ASSERT(contact->isValid());
- d->m_members.insert( new_members.at( i ), contact );
- }
- // end: create new contact
-
- // Now update list of blocked members and emit signals.
- foreach( uint member_handle, added_members )
- {
- Contact* contact = d->m_members.value( member_handle );
- if ( !contact )
- { continue; }
- contact->setType( Contact::CT_Blocked );
- d->m_denied.insert( member_handle, contact );
-
- emit signalContactBlocked( this, contact );
- }
- // Emit signals for the removed members
- foreach( uint member_handle, removed_members )
- {
-
- emit signalContactUnblocked( this, d->m_members.value( member_handle ) );
- }
-}
-
-
-// TODO: This function is a real beast. It should be split into separate functions. Rethink whether it is a good idea
-// to map all slots to this functions!?
-void ContactManager::slotMembersChanged(const QString& message,
- const Tp::UIntList& members_added,
- const Tp::UIntList& members_removed,
- const Tp::UIntList& local_pending,
- const Tp::UIntList& remote_pending,
- uint actor, uint reason)
-{
- static bool is_already_in = false; // FIXME: Remove this until RTCHM-329
- Q_UNUSED(actor);
- Q_UNUSED(reason);
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Members Changed" << message << "Actor" << actor << "Reason" <<reason;
- qDebug() << "Members Added" << members_added.size();
- qDebug() << "Members Removed" << members_removed.size();
- qDebug() << "Members Local Pending" << local_pending.size();
- qDebug() << "Members Remote Pending" << remote_pending.size();
-#endif
- // Figure out handles that we need to look up.
- // Batch them up to minimize roundtrips.
-
-
-
-
- if (members_added.size()!=0)
- {
- if (message==QString("Known"))
- {
- QList<uint> known_to_look_up(d->newKnownHandlesToLookUp(members_added));
- // look up 'missing' handles:
- QDBusPendingReply<QStringList> handle_names =
- d->m_pInterface->InspectHandles(Tp::HandleTypeContact, known_to_look_up);
- handle_names.waitForFinished();
- if (!handle_names.isValid())
- {
- QDBusError error = handle_names.error();
-
- qWarning() << "InspectHandles: error type:" << error.type()
- << "error name:" << error.name();
- return;
- }
- Q_ASSERT(handle_names.value().size() == known_to_look_up.size());
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Known Handle" << handle_names.value().size() <<"Look Up Size" << known_to_look_up.size();
-#endif
- // Create Contacts for the looked up handles:
- QHash<uint, QPointer<Contact> > tmp_list;
- for (int i = 0; i < known_to_look_up.size(); ++i)
- {
-
-
- QPointer<Contact> contact = new Contact(known_to_look_up.at(i), handle_names.value().at(i), Contact::CT_Known, d->m_pInterface, this );
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Known Handle" << handle_names.value().at(i);
-#endif
- Q_ASSERT(contact->isValid());
- tmp_list.insert(known_to_look_up.at(i), contact);
-
- }
- known_to_look_up.clear();
- if (tmp_list.size()>0)
- {
- foreach (uint handle, members_added)
- {
- //Q_ASSERT(!d->m_subscribed.contains(handle)); // We do not yet know that handle.
- // FIXME: Check where the handle comes from to figure out whether it was
- // Getting authorized, etc.
- QPointer<Contact> current_contact = tmp_list.value(handle);
- // Detect mixups when writing into the hash.
- if (current_contact)
- {
- Q_ASSERT(current_contact->telepathyHandle() == handle);
- tmp_list.remove(handle);
- if (!d->m_subscribed.contains(handle))
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Added Handle to Known List";
-#endif
- }
- else
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Known Contact already in contactlist";
-#endif
- d->m_members.remove(handle);
- d->m_subscribed.remove(handle);
- }
- d->m_members.insert(handle, current_contact);
- d->m_known.insert(handle, current_contact);
- emit signalContactKnown( this, current_contact );
- }
- }
- }
- }
- else //message!="Known"
- {
-
- QList<uint> subscribed_to_look_up(d->subscribedHandlesToLookUp(members_added));
-
- // look up 'missing' handles:
- QDBusPendingReply<QStringList> handle_names =
- d->m_pInterface->InspectHandles(Tp::HandleTypeContact, subscribed_to_look_up);
- handle_names.waitForFinished();
- if (!handle_names.isValid())
- {
- QDBusError error = handle_names.error();
-
- qWarning() << "InspectHandles: error type:" << error.type()
- << "error name:" << error.name();
- return;
- }
- Q_ASSERT(handle_names.value().size() == subscribed_to_look_up.size());
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Subscribed Handle" << handle_names.value().size() <<"Look Up Size" << subscribed_to_look_up.size()<< "Mmebers Added Size "<< members_added.size();
-#endif
- // Create Contacts for the looked up handles:
- QHash<uint, QPointer<Contact> > tmp_list;
- for (int i = 0; i < subscribed_to_look_up.size(); ++i)
- {
-
- QPointer<Contact> contact = new Contact(subscribed_to_look_up.at(i), handle_names.value().at(i), Contact::CT_Subscribed, d->m_pInterface, this );
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Subscribed Handle" << handle_names.value().at(i);
-#endif
- Q_ASSERT(contact->isValid());
- tmp_list.insert(subscribed_to_look_up.at(i), contact);
- }
- if (tmp_list.size()>0)
- {
- QPointer<Contact> current_contact;
- foreach (uint handle, members_added)
- {
- //Q_ASSERT(!d->m_subscribed.contains(handle)); // We do not yet know that handle.
- // FIXME: Check where the handle comes from to figure out whether it was
- // Getting authorized, etc.
- current_contact = tmp_list.value(handle);
-
- if (current_contact)
- {
- // Detect mixups when writing into the hash.
- Q_ASSERT(current_contact->telepathyHandle() == handle);
-
- tmp_list.remove(handle);
- if (!d->m_members.contains(handle))
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Added Handle to Subscribed List"<< handle;
-#endif
- Q_ASSERT( current_contact->type() == Contact::CT_Subscribed );
- d->m_members.insert(handle, current_contact);
- //d->m_subscribed.insert(handle, current_contact);
- }
- else
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Subscribed Contact already in contactlist"<< handle;
-#endif
-#if 1 // Don't understand this code.
-
- if (d->m_members[handle]->type() == Contact::CT_LocalPending)
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Changed Subscribed Contact to local pending:"<< d->m_members[handle]->name();
- qDebug() << "Current type: " << d->m_members[handle]->type();
-#endif
- d->m_members[handle]->setType(Contact::CT_LocalPending);
-
- // TODO: Signal?
- }
- else
- {
-#endif
- d->m_members[handle]->setType(Contact::CT_Subscribed);
- if (d->m_remotePending.contains(handle))
- d->m_remotePending.remove(handle);
- if (d->m_localPending.contains(handle))
- d->m_localPending.remove(handle);
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Signal for Subscribed Contact:"<< d->m_members[handle]->name();
-#endif
- emit signalContactSubscribed( this, d->m_members[handle] );
-#if 1
- }
-#endif
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "delete Contact object later:" << current_contact->name();;
-#endif
- current_contact->deleteLater();
- }
-
- }
- }
- }
- }
- }
- if (local_pending.size()!=0)
- {
- QList<uint> localPending_to_look_up(d->localPendingHandlesToLookUp(local_pending));
- // look up 'missing' handles:
- QDBusPendingReply<QStringList> handle_names =
- d->m_pInterface->InspectHandles(Tp::HandleTypeContact, localPending_to_look_up);
- handle_names.waitForFinished();
- if (!handle_names.isValid())
- {
- QDBusError error = handle_names.error();
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "InspectHandles: error type:" << error.type()
- << "error name:" << error.name();
-#endif
- return;
- }
- Q_ASSERT(handle_names.value().size() == localPending_to_look_up.size());
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Local Pending Size" << handle_names.value().size() <<"Look Up Size" << localPending_to_look_up.size();
-#endif
-
- // Create Contacts for the looked up handles:
- QHash<uint, QPointer<Contact> > tmp_list;
- for (int i = 0; i < localPending_to_look_up.size(); ++i)
- {
- QPointer<Contact> contact = new Contact(localPending_to_look_up.at(i), handle_names.value().at(i), Contact::CT_LocalPending, d->m_pInterface, this );
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Local Pending Handle" << handle_names.value().at(i);
-#endif
- Q_ASSERT(contact->isValid());
- tmp_list.insert(localPending_to_look_up.at(i), contact);
- }
- if (tmp_list.size()>0)
- {
- foreach (uint handle, local_pending)
- {
- QPointer<Contact> current_contact = tmp_list.value(handle);
- if (current_contact)
- {
- Q_ASSERT(current_contact->telepathyHandle() == handle);
-
- tmp_list.remove(handle);
- if (!d->m_members.contains(handle))
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Added Handle to Local Pending List";
-#endif
- d->m_members.insert(handle, current_contact);
- d->m_localPending.insert(handle, current_contact);
- }
- else
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Local Pending Contact already in contactlist";
-#endif
- d->m_members[handle]->setType(Contact::CT_LocalPending);
- if (d->m_remotePending.contains(handle))
- d->m_remotePending.remove(handle);
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "delete current contact" << current_contact->name();
-#endif
- delete current_contact;
- }
-
- emit signalContactLocalPending( this, d->m_members[handle] );
- }
-
- }
- }
- }
-
- if (remote_pending.size()!=0)
- {
- QList<uint> remotePending_to_look_up(d->remotePendingHandlesToLookUp(remote_pending));
-
- // look up 'missing' handles:
- QDBusPendingReply<QStringList> handle_names =
- d->m_pInterface->InspectHandles(Tp::HandleTypeContact, remotePending_to_look_up);
- handle_names.waitForFinished();
-
- if (!handle_names.isValid())
- {
- QDBusError error = handle_names.error();
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "InspectHandles: error type:" << error.type()
- << "error name:" << error.name();
-#endif
- return;
- }
- Q_ASSERT(handle_names.value().size() == remotePending_to_look_up.size());
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Remote Pending Handle Size" << handle_names.value().size() <<"Look Up Size" << remotePending_to_look_up.size();
-#endif
- // Create Contacts for the looked up handles:
- QHash<uint, QPointer<Contact> > tmp_list;
- for (int i = 0; i < remotePending_to_look_up.size(); ++i)
- {
- QPointer<Contact> contact = new Contact(remotePending_to_look_up.at(i), handle_names.value().at(i), Contact::CT_RemotePending, d->m_pInterface, this );
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Remote Pending Handle " << handle_names.value().at(i);
-#endif
- Q_ASSERT(contact->isValid());
- tmp_list.insert(remotePending_to_look_up.at(i), contact);
- }
- if (tmp_list.size()>0)
- {
- foreach (uint handle, remote_pending)
- {
-
- QPointer<Contact> current_contact = tmp_list.value(handle);
- if (current_contact)
- {
- // Detect mixups when writing into the hash.
- Q_ASSERT(current_contact->telepathyHandle() == handle);
- tmp_list.remove(handle);
- if (!d->m_members.contains(handle))
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Added Handle to Remote Pending List";
-#endif
- d->m_remotePending.insert(handle, current_contact);
- d->m_members.insert(handle, current_contact);
- }
- else
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Remote Pending Contact already in contactlist";
-#endif
- d->m_members[handle]->setType(Contact::CT_RemotePending);
-
- if (d->m_localPending.contains(handle))
- d->m_localPending.remove(handle);
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Delete current contact:" << current_contact->name();
-#endif
- delete current_contact;
- }
-
- emit signalContactRemotePending( this, d->m_members[handle] );
- }
-
- }
- }
- }
-
- if (members_removed.size()!=0)
- {
- // FIXME: Remove this until RTCHM-329
- if (is_already_in)
- {
- qDebug() << "Reentrance detected..";
- return;
- }
- is_already_in = true;
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "SlotMembers Changed Removed Called";
-#endif
- QList<uint> removed_to_look_up(d->removedHandlesToLookUp(members_removed));
- // look up 'missing' handles:
- QDBusPendingReply<QStringList> handle_names =
- d->m_pInterface->InspectHandles(Tp::HandleTypeContact, removed_to_look_up);
- handle_names.waitForFinished();
- if (!handle_names.isValid())
- {
- QDBusError error = handle_names.error();
- qWarning() << "InspectHandles: error type:" << error.type()
- << "error name:" << error.name();
- return;
- }
- Q_ASSERT(handle_names.value().size() == removed_to_look_up.size());
- // Create Contacts for the looked up handles:
- QHash<uint, QPointer<Contact> > tmp_list;
- for (int i = 0; i < removed_to_look_up.size(); ++i)
- {
- // QPointer<Contact> contact = new Contact(removed_to_look_up.at(i), handle_names.value().at(i), Contact::CT_Known, d->m_pInterface, this );
- Contact* contact = d->m_members.value( removed_to_look_up.at(i) );
- Q_ASSERT(contact);
- Q_ASSERT(contact->isValid());
- tmp_list.insert(removed_to_look_up.at(i), contact);
- }
-
- if (tmp_list.size()>0)
- {
- foreach (uint handle, members_removed)
- {
-
- QPointer<Contact> current_contact = tmp_list.value(handle);
- if (current_contact)
- {
- // Detect mixups when writing into the hash.
- Q_ASSERT(current_contact->telepathyHandle() == handle);
-
- tmp_list.remove(handle);
- if (d->m_members.contains(handle))
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Remove Contact";
-#endif
- emit signalAboutToRemoveContact( this, current_contact );
-
- d->m_members.remove(handle);
- d->m_subscribed.remove(handle);
- d->m_remotePending.remove(handle);
- d->m_localPending.remove(handle);
- d->m_known.remove(handle);
-
- emit signalContactRemoved( this );
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "delete Contact object: " << current_contact->name();
-#endif
- delete current_contact;
- }
- else
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Removed Contact not in contactlist: " << current_contact->name();
-#endif
- delete current_contact;
- }
- }
- }
- }
- is_already_in = false; // FIXME: Remove this until RTCHM-329
- }
- emit signalMembersChanged( this,
- message,
- d->mapHashToList( d->m_members ),
- d->mapHashToList( d->m_localPending ),
- d->mapHashToList( d->m_remotePending ),
- contactForHandle( actor ),
- static_cast<Tp::ChannelGroupChangeReason>( reason ) );
-}
-
-#include "_gen/ContactManager.h.moc"
diff --git a/TelepathyQt4/Prototype/ContactManager.h b/TelepathyQt4/Prototype/ContactManager.h
deleted file mode 100644
index 64fc0ac..0000000
--- a/TelepathyQt4/Prototype/ContactManager.h
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 basysKom GmbH
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef TelepathyQt4_Prototype_ContactManager_H_
-#define TelepathyQt4_Prototype_ContactManager_H_
-
-#include <TelepathyQt4/Types>
-#include <TelepathyQt4/Constants>
-
-#include <QObject>
-#include <QDBusObjectPath>
-#include <QPointer>
-
-#ifdef DEPRECATED_ENABLED__
-#define ATTRIBUTE_DEPRECATED __attribute__((deprecated))
-#else
-#define ATTRIBUTE_DEPRECATED
-#endif
-
-/**
- * @defgroup qt_contact Contact Management
- * @ingroup qt_style_api
- * Classes that provide functions to handle contacts.
- */
-
-
-
-namespace Tp
-{
- namespace Client
- {
- class ConnectionInterface;
- class ChannelInterfaceGroupInterface;
-
- }
-}
-
-namespace TpPrototype {
-
-class ContactManagerPrivate;
-class Contact;
-class Connection;
-class ChatChannel;
-class StreamedMediaChannel;
-
-/**
- * @ingroup qt_connection
- * @ingroup qt_contact
- * This class manages all contacts.
- * This class provides the list of contacts associated with an account. It is possible to register new contacts by requestContact(), or remove contacts
- * by removeContact(). Signals providing information whether any contact changes or wether a communication channel is opened.
- * @todo We need a ContactGroup that contains the Contacts instead use QList< QPointer<> >. If a contact is removed we get a NULL element in the list instead to remove one element from the list (seil)
- */
-class ContactManager : public QObject
-{
- Q_OBJECT
-public:
- /**
- * Validity of this class.
- * Do not access any methods if this object is invalid.
- */
- bool isValid();
-
- /**
- * Number of Contacts. Returns how many contacts are available.
- * @return Number of contacts available.
- */
- int count();
-
- /**
- * List of contacts. The contact pointer is stored in a QPointer. If the contact is removed it is deleted
- * by the contact manager. Thus, the pointer is set to 0.
- * @todo: Return ContactGroup here, instead a list of a pointer.
- */
- QList<QPointer<TpPrototype ::Contact> > contactList();
-
- /**
- * List of contacts that have requested authorization from us.
- *
- * The contact pointer is stored in a QPointer. If the contact is removed it is deleted
- * by the contact manager. Thus, the pointer is set to 0.
- * @todo: Return ContactGroup here, instead a list of a pointer.
- */
- QList<QPointer<TpPrototype ::Contact> > toAuthorizeList();
-
- /**
- * List of contacts <i>we</i> asked to authorize us to see their presence state.
- *
- * The contact pointer is stored in a QPointer. If the contact is removed it is deleted
- * by the contact manager. Thus, the pointer is set to 0.
- * @todo: Return ContactGroup here, instead of a list of pointer.
- */
- QList<QPointer<TpPrototype ::Contact> > remoteAuthorizationPendingList();
-
- /**
- * List of contacts that are blocked.
- * @todo: Return ContactGroup here, instead of a list of pointer.
- */
- QList<QPointer<TpPrototype::Contact> > blockedContacts();
-
- /**
- * Request a contact.
- * A remote contact should be added to the list of known contacts.
- * @param id The id identifies the contact (protocol specific)
- * @return true if the handle was found else false.
- */
- bool requestContact( const QString& id );
-
- /**
- * Authorize contact.
- * A remote contact should be authorized.
- * @param contact The contact to autorize.
- * @return true if ...
- */
- bool authorizeContact( const Contact* contact );
-
- /**
- * Remove a contact.
- * The contact should be removed.
- * @param contactToRemove The contact that should be removed. Do not use this pointer after this call!
- */
- bool removeContact( const TpPrototype ::Contact* contactToRemove );
-
- /**
- * Block a contact.
- * The contact is moved to the list of blocked contacts. This may not be supported by the protocol/contact manager. In this case false is returned.
- * A blocked contact will not receive any presence information from the local account. Messages from this contact are ignored.
- * The signal signalContactBlocked() is emitted if this call was successful.<br>
- * <b>Hint:</b>Blocking support is currently available with the connection manager Gabble and GoogleTalk.
- * @return true if blocking is supported.
- */
- bool blockContact( const Contact* contactToBlock );
-
- /**
- * Block a contact.
- * The contact is moved to the list of blocked contacts. This may not be supported by the protocol/contact manager. In this case false is returned.
- * A blocked contact will not receive any presence information from the local account. Messages from this contact are ignored.<br>
- * The signal signalContactUnblocked() is emitted if this call was successful.<br>
- * <b>Hint:</b>Blocking support is currently available with the connection manager Gabble and GoogleTalk.
- * @return true if blocking is supported
- */
- bool unblockContact( const Contact* contactToUnblock );
-
- /**
- * Returns a contact pointer for handle id.
- * This function provides a fast lookup of a contact if a valid handle is provided.
- * @return The contact that corresponds to the handle or NULL if the handle is unknown.
- */
- QPointer<TpPrototype ::Contact> contactForHandle( uint handle );
-
- /**
- * The local handle.
- * The local user has a handle that is returned by this function. The local handle cannot be used to get
- * a valid contact with contactForHandle()!
- */
- uint localHandle();
-
-signals:
- /**
- * A text channel was opened.
- * This signal is emitted when a text channel was opened for a contact. This usually means that you received a text message.<br>
- * The chat channel object can be retrieved from the contact.
- * @param contact The contact that received the text message and contains the text channel object.
- */
- void signalTextChannelOpenedForContact( TpPrototype ::Contact* contact );
-
- /**
- * A streamed media channel was opened.
- * This signal is emitted when a streamed media channel was opened for a contact and all interfaces were established successfully.
- * This usually means that you received a call.<br>
- * The StreamedMedia channel object can be retrieved from the contact. Use acceptIncomingStream() or rejectIncomingStream() to accept or reject.
- * @param contact The contact that received the text message and contains the StreamedMediaChannel object.
- * @see StreamMediaChannel
- */
- void signalStreamedMediaChannelOpenedForContact( TpPrototype ::Contact* contact );
-
- /**
- * A Contact was added.
- * A new remote Contact was added but needs to be accepted remotely.
- * @see signalContactRemotePending()
- */
- void signalContactAdded( TpPrototype ::ContactManager* contactManager, TpPrototype ::Contact* contact );
-
- /**
- * A Contact is pending locally.
- * A Contact that is local pending have requested membership of the channel, but the local user of the framework must
- * accept their request before they may join.
- */
- void signalContactLocalPending( TpPrototype ::ContactManager* contactManager, TpPrototype ::Contact* contact );
-
- /**
- * A Contact is pending remotely.
- * A Contact that is remote pending list have been invited to the channel, but the remote user has not
- * accepted the invitation.
- */
- void signalContactRemotePending( TpPrototype ::ContactManager* contactManager, TpPrototype ::Contact* contact );
-
- /**
- * A Contact was subscribed.
- * This signal is emitted if a new contact was subscribed.
- */
- void signalContactSubscribed( TpPrototype ::ContactManager* contactManager, TpPrototype ::Contact* contact );
-
- /**
- * A Contact will be removed.
- * This signal is emitted after the contact was removed but immediately before the account is removed from the internal lists.<br>
- * Use this signal to obtain all necessary information to handle this remove operation properly. The signal <i>signalContactRemoved()</i>
- * will be called immediately after cleaning the internal lists.
- * <br>
- * @param contact The removed contact. This object is deleted after this call!
- * @see signalContactRemoved()
- */
- void signalAboutToRemoveContact( TpPrototype ::ContactManager* contactManager, TpPrototype ::Contact* contact );
-
- /**
- * A contact is removed.
- * This signal is emmited immediately after <i>signalAboutToRemoveContact()</i> if all internal lists are updated.
- * @see signalAboutToRemoveContact()
- */
- void signalContactRemoved( TpPrototype ::ContactManager* contactManager );
-
- /**
- * @todo: Add doc! (seil)
- */
- void signalContactKnown( TpPrototype ::ContactManager* contactManager, TpPrototype ::Contact* contact );
-
- /**
- * @todo: Add doc!
- * Contact was blocked.
- * This signal is emitted after a contact was blocked.
- */
- void signalContactBlocked( TpPrototype::ContactManager* contactManager, TpPrototype::Contact* contact );
-
- /**
- * Contact was unblocked.
- * This signal is emitted after a contact was unblocked.
- */
- void signalContactUnblocked( TpPrototype::ContactManager* contactManager, TpPrototype::Contact* contact );
-
- /**
- * Members changed.
- * This signal is emitted whenever one of the internal lists of contacts (member, local pending, remote pending) changes.
- * @param contactManager The contact manager that handles the contacts.
- * @param message A string message from the server, or blank if not
- * @param members List of contacts currently listed as members.
- * @param localPending Contacts that are waiting for a local approval.
- * @param remotePending Contacs that are waiting for a remote approval.
- * @param actor The contact that causes the change. May be NULL if unkown.
- * @param reason The reason of the change.
- */
- void signalMembersChanged( TpPrototype ::ContactManager* contactManager,
- const QString& message,
- QList<QPointer<TpPrototype ::Contact> > members,
- QList<QPointer<TpPrototype ::Contact> > localPending,
- QList<QPointer<TpPrototype ::Contact> > remotePending,
- TpPrototype ::Contact* actor,
- Tp::ChannelGroupChangeReason reason );
-
-protected:
- /**
- * Constructor. The contact manager cannot be instantiated directly. Use Connection::contactManager() for it!
- */
- ContactManager( Tp::Client::ConnectionInterface* connection,
- QObject* parent = NULL );
- ~ContactManager();
-
-
- void openSubscribedContactsChannel(uint handle, const QDBusObjectPath& objectPath, const QString& channelType);
-
- /**
- * ..
- */
- void openPublishContactsChannel(uint handle, const QDBusObjectPath& objectPath, const QString& channelType);
-
- /**
- * ..
- */
- void openKnownContactsChannel(uint handle, const QDBusObjectPath& objectPath, const QString& channelType);
-
- /**
- * ..
- */
- void openDenyContactsChannel(uint handle, const QDBusObjectPath& objectPath, const QString& channelType);
-
- void openTextChannel( uint handle, uint handleType, const QString& channelPath, const QString& channelType );
-
- void openStreamedMediaChannel( uint handle, uint handleType, const QString& channelPath, const QString& channelType );
-
-protected slots:
-
- void slotMembersChanged(const QString& message,
- const Tp::UIntList& members_added,
- const Tp::UIntList& members_removed,
- const Tp::UIntList& local_pending,
- const Tp::UIntList& remote_pending,
- uint actor, uint reason);
- void slotKnownMembersChanged(const QString& message,
- const Tp::UIntList& members_added,
- const Tp::UIntList& members_removed,
- const Tp::UIntList& local_pending,
- const Tp::UIntList& remote_pending,
- uint actor, uint reason);
- void slotPublishedMembersChanged(const QString& message,
- const Tp::UIntList& members_added,
- const Tp::UIntList& members_removed,
- const Tp::UIntList& local_pending,
- const Tp::UIntList& remote_pending,
- uint actor, uint reason);
- void slotSubscribedMembersChanged(const QString& message,
- const Tp::UIntList& members_added,
- const Tp::UIntList& members_removed,
- const Tp::UIntList& local_pending,
- const Tp::UIntList& remote_pending,
- uint actor, uint reason);
- void slotDeniedMembersChanged(const QString& message,
- const Tp::UIntList& members_added,
- const Tp::UIntList& members_removed,
- const Tp::UIntList& local_pending,
- const Tp::UIntList& remote_pending,
- uint actor, uint reason);
-private:
- void init( Tp::Client::ConnectionInterface* connection );
-
- ContactManagerPrivate * const d;
- friend class Connection;
- friend class ConnectionPrivate;
- friend class Contact;
-};
-
-}
-
-#endif
diff --git a/TelepathyQt4/Prototype/DBusInterface.cpp b/TelepathyQt4/Prototype/DBusInterface.cpp
deleted file mode 100644
index 7f8f2a0..0000000
--- a/TelepathyQt4/Prototype/DBusInterface.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 basysKom GmbH
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "TelepathyQt4/Prototype/DBusInterface.h"
-
-namespace
-{
- const char* g_serviceName = "org.freedesktop.DBus";
- const char* g_objectPath = "/";
- const char* g_interfaceName = "org.freedesktop.DBus";
-}
-
-using namespace TpPrototype;
-
-DBusInterface::DBusInterface( QObject* parent ):
-QDBusAbstractInterface( g_serviceName,
- g_objectPath,
- g_interfaceName,
- QDBusConnection::sessionBus(),
- parent )
-{
-}
-
-QDBusReply<QStringList> DBusInterface::listActivatableNames()
-{
- Q_ASSERT( isValid() );
- return call( QLatin1String("ListActivatableNames") );
-}
-
-#include "_gen/DBusInterface.h.moc"
diff --git a/TelepathyQt4/Prototype/DBusInterface.h b/TelepathyQt4/Prototype/DBusInterface.h
deleted file mode 100644
index e786ff1..0000000
--- a/TelepathyQt4/Prototype/DBusInterface.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 basysKom GmbH
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#ifndef TelepathyQt4_Prototype_DBusInterface_h_
-#define TelepathyQt4_Prototype_DBusInterface_h_
-
-#include <QDBusAbstractInterface>
-#include <QDBusReply>
-#include <QStringList>
-
-namespace TpPrototype
-{
-
-/**
- * Class to access function provided by dbus daemon.
- */
-class DBusInterface : public QDBusAbstractInterface
-{
- Q_OBJECT
-public:
- DBusInterface( QObject* parent = NULL );
-
- /**
- * Return a list of all registered service names. These names can be activated by calling the service.
- * @return List of service names.
- */
- QDBusReply<QStringList> listActivatableNames();
-
-};
-
-}
-#endif
-
diff --git a/TelepathyQt4/Prototype/Makefile.am b/TelepathyQt4/Prototype/Makefile.am
deleted file mode 100644
index d087e23..0000000
--- a/TelepathyQt4/Prototype/Makefile.am
+++ /dev/null
@@ -1,198 +0,0 @@
-protoincludedir=$(includedir)/tpqt4-prototype/TelepathyQt4/Prototype
-protoclientincludedir=$(protoincludedir)/Client
-genincludedir=$(protoincludedir)/_gen
-
-pkgconfigdir = ${libdir}/pkgconfig
-pkgconfig_DATA = TpQt4Prototype.pc
-
-EXTRA_DIST = \
- all.xml \
- channel-handler.xml \
- stream-engine.xml \
- Stream_Engine.xml
-
-lib_LTLIBRARIES = libtpqt4-prototype.la
-
-# The quoting here is unnecessary but harmless, and has the useful side-effect
-# that vim quickfix mode (:make) doesn't interpret the libtool --mode=link
-# command as an error message in a bizarrely named file
-libtpqt4_prototype_la_LDFLAGS = \
- -version-info "$(LT_CURRENT)":"$(LT_REVISION)":"$(LT_AGE)" -static
-libtpqt4_prototype_la_LIBADD = $(ALL_LIBS)
-libtpqt4_prototype_la_DEPENDENCIES = Makefile.am
-
-libtpqt4_prototype_la_SOURCES = \
- Account.cpp \
- AccountManager.cpp \
- AvatarManager.cpp \
- CapabilitiesManager.cpp \
- ChatChannel.cpp \
- Connection.cpp \
- ConnectionFacade.cpp \
- Contact.cpp \
- ContactManager.cpp \
- DBusInterface.cpp \
- PresenceManager.cpp \
- StreamedMediaChannel.cpp \
- cli-channel-handler.cpp \
- cli-stream-engine.cpp \
- types.cpp
-
-nodist_libtpqt4_prototype_la_SOURCES = \
- _gen/Account.h.moc \
- _gen/AccountManager.h.moc \
- _gen/AvatarManager.h.moc \
- _gen/CapabilitiesManager.h.moc \
- _gen/ChatChannel.h.moc \
- _gen/Connection.h.moc \
- _gen/ConnectionFacade.h.moc \
- _gen/Contact.h.moc \
- _gen/ContactManager.h.moc \
- _gen/DBusInterface.h.moc \
- _gen/PresenceManager.h.moc \
- _gen/StreamedMediaChannel.h.moc \
- _gen/cli-channel-handler-body.hpp \
- _gen/cli-channel-handler.moc.hpp \
- _gen/cli-stream-engine-body.hpp \
- _gen/cli-stream-engine.moc.hpp \
- _gen/types-body.hpp
-
-protoinclude_HEADERS = \
- Account.h \
- AccountManager.h \
- AvatarManager.h \
- CapabilitiesManager.h \
- ChatChannel.h \
- Connection.h \
- ConnectionFacade.h \
- Constants \
- Contact.h \
- ContactManager.h \
- DBusInterface.h \
- PresenceManager.h \
- StreamedMediaChannel.h \
- Types \
- constants.h \
- cli-channel-handler.h \
- cli-stream-engine.h \
- types.h
-
-protoclientinclude_HEADERS = \
- Client/ChannelHandler \
- Client/StreamEngine
-
-nodist_geninclude_HEADERS = \
- _gen/cli-channel-handler.h \
- _gen/cli-stream-engine.h \
- _gen/constants.h \
- _gen/types.h
-
-BUILT_SOURCES = \
- $(nodist_libtpqt4_prototype_la_SOURCES) \
- $(nodist_geninclude_HEADERS) \
- _gen/stable-spec.xml \
- _gen/spec-stamp \
- _gen/stable-stamp
-
-CLEANFILES = \
- $(BUILT_SOURCES)
-
-distclean-local:
- rm -rf _gen
-
-include $(top_srcdir)/tools/check-coding-style.mk
-check-local: check-coding-style
-
-AM_CXXFLAGS = \
- $(ERROR_CXXFLAGS)
-
-AM_CPPFLAGS = \
- -I$(top_srcdir) -I$(top_builddir) \
- $(QTCORE_CFLAGS) \
- $(QTDBUS_CFLAGS)
-
-ALL_LIBS = \
- $(QTCORE_LIBS) \
- $(QTDBUS_LIBS) \
- $(top_builddir)/TelepathyQt4/libtelepathy-qt4.la
-
-# Generated stuff
-
-# Bootstrapping
-
-_gen/spec-stamp: $(wildcard $(top_srcdir)/spec/*.xml)
- $(mkdir_p) _gen
- touch $@
-
-_gen/stable-stamp: $(wildcard *.xml) _gen/spec-stamp
- touch $@
-
-_gen/stable-spec.xml: all.xml _gen/stable-stamp \
- $(top_srcdir)/tools/xincludator.py \
- Makefile.am
- $(PYTHON) $(top_srcdir)/tools/xincludator.py \
- $< > $@
-
-# Things generated from the whole spec at once
-
-_gen/constants.h: _gen/stable-spec.xml \
- $(top_srcdir)/tools/qt4-constants-gen.py \
- Makefile.am
- $(PYTHON) $(top_srcdir)/tools/qt4-constants-gen.py \
- --namespace='TpPrototype' \
- --str-constant-prefix='TP_PROTOTYPE_' \
- --specxml=$< \
- > $@.tmp && mv $@.tmp $@
-
-_gen/types.h _gen/types-body.hpp: _gen/stable-spec.xml \
- $(top_srcdir)/tools/qt4-types-gen.py \
- Makefile.am
- $(PYTHON) $(top_srcdir)/tools/qt4-types-gen.py \
- --namespace='TpPrototype' \
- --declfile='_gen/types.h' \
- --implfile='_gen/types-body.hpp' \
- --realinclude='TelepathyQt4/Prototype/types.h' \
- --prettyinclude='TelepathyQt4/Prototype/Types' \
- --specxml=$<
-
-# Things generated per interface group
-
-_gen/spec-%.xml: %.xml $(top_srcdir)/tools/xincludator.py _gen/spec-stamp
- $(PYTHON) $(top_srcdir)/tools/xincludator.py \
- $< > $@
-
-_gen/cli-%.h _gen/cli-%-body.hpp: _gen/spec-%.xml \
- _gen/stable-spec.xml \
- $(top_srcdir)/tools/qt4-client-gen.py \
- Makefile.am
- set -e; \
- namespace='TpPrototype::Client'; \
- group= ; \
- prettyinclude= ; \
- mainiface= ; \
- case $* in \
- channel-handler) \
- group='clientchannelhandler'; \
- prettyinclude='ChannelHandler';; \
- stream-engine) \
- group='clientstreamengine'; \
- prettyinclude='StreamEngine';; \
- esac; \
- $(PYTHON) $(top_srcdir)/tools/qt4-client-gen.py \
- --group=$$group \
- --namespace=$$namespace \
- --typesnamespace='Tp' \
- --headerfile=_gen/cli-$*.h \
- --implfile=_gen/cli-$*-body.hpp \
- --realinclude='TelepathyQt4/Prototype/cli-$*.h' \
- --prettyinclude='TelepathyQt4/Prototype/Client/'$$prettyinclude \
- --specxml=_gen/stable-spec.xml \
- --ifacexml=$< \
- --extraincludes='<TelepathyQt4/Types>,<TelepathyQt4/Prototype/Types>' \
- $$mainiface
-
-_gen/%.moc: % _gen/constants.h _gen/types.h
- $(MOC) $(AM_CPPFLAGS) -i $< -o $@
-
-_gen/%.moc.hpp: _gen/%.h _gen/constants.h _gen/types.h
- $(MOC) $(AM_CPPFLAGS) -i $< -o $@
diff --git a/TelepathyQt4/Prototype/PresenceManager.cpp b/TelepathyQt4/Prototype/PresenceManager.cpp
deleted file mode 100644
index 220377b..0000000
--- a/TelepathyQt4/Prototype/PresenceManager.cpp
+++ /dev/null
@@ -1,623 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 basysKom GmbH
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "TelepathyQt4/Prototype/PresenceManager.h"
-
-#include <QCoreApplication>
-#include <QDBusObjectPath>
-#include <QDBusPendingReply>
-#include <QDebug>
-#include <QMap>
-#include <QPointer>
-
-#include <TelepathyQt4/Connection>
-
-#include <TelepathyQt4/Prototype/Account.h>
-#include <TelepathyQt4/Prototype/AccountManager.h>
-#include <TelepathyQt4/Prototype/ConnectionFacade.h>
-#include <TelepathyQt4/Prototype/Connection.h>
-#include <TelepathyQt4/Prototype/Contact.h>
-#include <TelepathyQt4/Prototype/ContactManager.h>
-
-// #define ENABLE_DEBUG_OUTPUT_
-
-namespace
-{
- const char* g_offlineStatusString = "offline";
- const char* g_statusParamMessageString = "message";
-}
-
-using namespace TpPrototype;
-
-class TpPrototype::PresenceManagerPrivate
-{
-public:
- PresenceManagerPrivate( Connection* connection,
- Tp::Client::ConnectionInterface* interface )
- { init( connection, interface ); }
-
- Tp::Client::ConnectionInterface* m_pConnectionInterface;
- Tp::Client::ConnectionInterfaceSimplePresenceInterface* m_pSimplePresenceInterface;
- Tp::Client::ConnectionInterfacePresenceInterface* m_pPresenceInterface;
- QPointer<Connection> m_pConnection;
- bool m_isValid;
- QMap<QString,int> m_mapStatusStringToType;
-
- void init( Connection* connection,
- Tp::Client::ConnectionInterface* interface )
- {
- m_pConnectionInterface = interface;
- m_pConnection = connection;
- m_pSimplePresenceInterface = NULL;
- m_pPresenceInterface = NULL;
- m_isValid = true;
-
- m_mapStatusStringToType.insert( "offline" , 1 /*Connection_Presence_Type_Offline*/ ); //TODO: Why is there no enum for these types?
- m_mapStatusStringToType.insert( "available", 2 /*Connection_Presence_Type_Available*/ );
- m_mapStatusStringToType.insert( "away" , 3 /*Connection_Presence_Type_Away*/ );
- m_mapStatusStringToType.insert( "brb" , 3 /*Connection_Presence_Type_Away*/ );
- m_mapStatusStringToType.insert( "xa" , 4 /*Connection_Presence_Type_Extended_Away*/ );
- m_mapStatusStringToType.insert( "hidden" , 5 /*Connection_Presence_Type_Busy*/ );
- m_mapStatusStringToType.insert( "busy" , 6 /*Connection_Presence_Type_Busy*/ );
- m_mapStatusStringToType.insert( "dnd" , 6 /*Connection_Presence_Type_Busy*/ );
- m_mapStatusStringToType.insert( "unknown" , 7 /*Connection_Presence_Type_Unknown*/ );
- m_mapStatusStringToType.insert( "error" , 8 /*Connection_Presence_Type_Error*/ );
-
- }
-
- uint localHandle()
- {
- uint self_handle = ConnectionFacade::instance()->selfHandleForConnectionInterface( m_pConnectionInterface );
- if ( self_handle == 0 )
- { m_isValid = false; }
-
- return self_handle;
- }
-
-// Protected functions
-
- uint mapStatusStringToType( const QString& status ) const
- {
- return m_mapStatusStringToType.value( status );
- }
-
- Tp::SimplePresence convertToSimplePresence( const Tp::LastActivityAndStatuses& status ) const
- {
- Tp::SimplePresence simple_presence;
-
- QStringList status_list = status.statuses.keys();
-
- Q_ASSERT( status_list.count() == 1 );
- if ( status_list.count() < 1 )
- { return simple_presence; }
-
- simple_presence.type = mapStatusStringToType( status_list.at( 0 ) );
- simple_presence.status = status_list.at( 0 );
- simple_presence.statusMessage = status.statuses.value( status_list.at( 0 ) ).value( g_statusParamMessageString ).toString();
-
- return simple_presence;
- }
-
- Tp::SimpleContactPresences convertToSimplePresences( const Tp::ContactPresences& presences ) const
- {
- Tp::SimpleContactPresences contact_presences;
-
- QList<uint> keys = presences.keys();
- foreach( uint key, keys )
- {
- contact_presences.insert( key, convertToSimplePresence( presences.value( key ) ) );
- }
-
- return contact_presences;
- }
-
- Tp::MultipleStatusMap convertToMultipleStatusMap( const QString& status, const QString& statusMessage ) const
- {
- Tp::MultipleStatusMap status_map;
-
- QVariantMap protocol_specif_parameters;
- if ( !statusMessage.isEmpty() )
- { protocol_specif_parameters.insert( g_statusParamMessageString, statusMessage ); }
-
- status_map.insert( status, protocol_specif_parameters );
-
- return status_map;
- }
-};
-
-PresenceManager::PresenceManager( Connection* connection,
- Tp::Client::ConnectionInterface* interface,
- QObject* parent ):
- QObject( parent ),
- d( new PresenceManagerPrivate( connection, interface ) )
-{
- init();
-}
-
-PresenceManager::~PresenceManager()
-{
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "D'tor PresenceManager (" << this << ")";
-#endif
- delete d;
-}
-
-bool PresenceManager::isValid()
-{
- return d->m_isValid;
-}
-
-Tp::SimpleStatusSpecMap PresenceManager::statuses()
-{
- Q_ASSERT( d->m_pSimplePresenceInterface || d->m_pPresenceInterface );
-
- if ( d->m_pSimplePresenceInterface )
- { return d->m_pSimplePresenceInterface->Statuses(); }
-
- if ( d->m_pPresenceInterface )
- {
- // We return a minimum set of states that should be provided by every contact manager and protocol
- Tp::SimpleStatusSpecMap ret_status;
- Tp::SimpleStatusSpec available = { 2, 2, true };
- ret_status.insert( "available", available );
- Tp::SimpleStatusSpec away = { 3, 3, true };
- ret_status.insert( "away", away );
- Tp::SimpleStatusSpec offline = { 1, 1, true };
- ret_status.insert( "offline", offline );
-
- return ret_status;
- }
-
- return Tp::SimpleStatusSpecMap();
-}
-
-bool PresenceManager::setPresence( const QString& status, const QString& statusMessage )
-{
- Q_ASSERT( d->m_pSimplePresenceInterface || d->m_pPresenceInterface );
-
- if ( !d->m_pSimplePresenceInterface && !d->m_pPresenceInterface )
- { return false; }
-
- // The state "offline" is presented as possible state with statuses(). Due to unknown reasons it is not
- // a valid name for setPresence(). Thus, we handle it on this layer..
- if ( status == g_offlineStatusString )
- {
- Q_ASSERT( d->m_pConnection );
-
- // TODO: Think whether sending this signal here manually (and before disconnecting) is really a good idea!
- const Tp::SimplePresence new_presence = { d->mapStatusStringToType( "offline" ), status, statusMessage };
- emit signalOwnPresenceUpdated( d->m_pConnection->account(), new_presence );
-
- d->m_pConnection->requestDisconnect();
- return true;
- }
-
- if ( d->m_pSimplePresenceInterface )
- {
- QDBusPendingReply<> set_presence_reply = d->m_pSimplePresenceInterface->SetPresence( status, statusMessage );
- set_presence_reply.waitForFinished();
-
- if ( !set_presence_reply.isValid() )
- {
- QDBusError error = set_presence_reply.error();
-
- qWarning() << "SetPresence: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- d->m_isValid = false;
- return false;
- }
- return true;
- }
-
- if ( d->m_pPresenceInterface )
- {
- QDBusPendingReply<> set_status_reply = d->m_pPresenceInterface->SetStatus( d->convertToMultipleStatusMap( status, statusMessage ) );
- set_status_reply.waitForFinished();
- if ( !set_status_reply.isValid() )
- {
- QDBusError error = set_status_reply.error();
-
- qWarning() << "SetStatus: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- d->m_isValid = false;
- return false;
- }
-
-#if 0 // TODO: Exame further: At some point I received the signal. Don't know why..
- // The simple presence interface is emitting a signal if I changed the local presence here but the presence interface does not!
- // We simulate this behavior here..
- const Tp::SimplePresence new_presence = { d->mapStatusStringToType( status ), status, statusMessage };
- emit signalOwnPresenceUpdated( d->m_pConnection->account(), new_presence );
-#endif
- return true;
- }
-
- // Fall through..
- return false;
-}
-
-// TODO: This function is doing the same as presencesForContacts() but just for one contact! Merge both functions to remove code duplication!
-Tp::SimplePresence PresenceManager::currentPresence()
-{
- Q_ASSERT( d->m_pSimplePresenceInterface || d->m_pPresenceInterface );
-
- if ( !d->m_pConnection || ( !d->m_pSimplePresenceInterface && !d->m_pPresenceInterface ) )
- {
- return Tp::SimplePresence();
- }
-
- Tp::UIntList uid_list;
- uid_list << d->localHandle();
-
- if ( d->m_pSimplePresenceInterface )
- {
- QDBusPendingReply<Tp::SimpleContactPresences> get_presence_reply = d->m_pSimplePresenceInterface->GetPresences( uid_list );
- get_presence_reply.waitForFinished();
-
- if ( !get_presence_reply.isValid() )
- {
- QDBusError error = get_presence_reply.error();
-
- qWarning() << "GetPresences: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- d->m_isValid = false;
- return Tp::SimplePresence();
- }
-
- Tp::SimpleContactPresences presence_list = get_presence_reply.value();
- QList<Tp::SimplePresence> value_list = presence_list.values();
-
- if ( value_list.count() == 0 )
- { return Tp::SimplePresence(); }
-
- return value_list.at( 0 );
- }
-
- if ( d->m_pPresenceInterface )
- {
- QDBusPendingReply<Tp::ContactPresences> get_presence_reply = d->m_pPresenceInterface->GetPresence( uid_list );
- get_presence_reply.waitForFinished();
-
- if ( !get_presence_reply.isValid() )
- {
- QDBusError error = get_presence_reply.error();
-
- qWarning() << "GetPresence: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- d->m_isValid = false;
- return Tp::SimplePresence();
- }
-
- Tp::ContactPresences presence_list = get_presence_reply.value();
- QList<Tp::LastActivityAndStatuses> value_list = presence_list.values();
-
- if ( value_list.count() == 0 )
- { return Tp::SimplePresence(); }
-
- return d->convertToSimplePresence( value_list.at( 0 ) );
- }
-
- // Fall through..
- return Tp::SimplePresence();
-}
-
-// TODO: See comment for currentPresence! Merge both to remove code duplication
-Tp::SimpleContactPresences PresenceManager::presencesForContacts( const QList<QPointer<Contact> >& contacts )
-{
- Q_ASSERT( d->m_pSimplePresenceInterface || d->m_pPresenceInterface );
-
- if ( !d->m_pConnection || ( !d->m_pSimplePresenceInterface && !d->m_pPresenceInterface ) )
- { return Tp::SimpleContactPresences(); }
-
- Tp::UIntList contact_ids;
- foreach( Contact* contact, contacts )
- {
- if ( !contact )
- { continue; }
- contact_ids.append( contact->telepathyHandle() );
- }
-
- if ( d->m_pSimplePresenceInterface )
- {
- QDBusPendingReply<Tp::SimpleContactPresences> get_presence_reply = d->m_pSimplePresenceInterface->GetPresences( contact_ids );
- get_presence_reply.waitForFinished();
-
- if ( !get_presence_reply.isValid() )
- {
- QDBusError error = get_presence_reply.error();
-
- qWarning() << "GetPresences: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- return Tp::SimpleContactPresences();
- }
-
- Tp::SimpleContactPresences presences=get_presence_reply.value();
- QList<uint> keys = presences.keys();
- QPointer<TpPrototype::Contact> contact;
- foreach( uint key, keys )
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "presencesForContacts Key"<<key;
-#endif
- for (int i=0; i<contacts.size(); i++)
- {
-
- contact=contacts.at( i);
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Contact "<< key << "Type:" << contact->type() << "Status" <<presences.value( key ).status << "Message:" << presences.value( key ).statusMessage;
-#endif
- if (contact->telepathyHandle()==key)
- {
- contact->setPresenceType(presences.value( key ).type);
- contact->setPresenceStatus(presences.value( key ).status);
- contact->setPresenceMessage(presences.value( key ).statusMessage);
- }
- }
- }
-
- return get_presence_reply.value();
- }
-
- if ( d->m_pPresenceInterface )
- {
- QDBusPendingReply<Tp::ContactPresences> get_presence_reply = d->m_pPresenceInterface->GetPresence( contact_ids );
- get_presence_reply.waitForFinished();
-
- if ( !get_presence_reply.isValid() )
- {
- QDBusError error = get_presence_reply.error();
-
- qWarning() << "GetPresence: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- d->m_isValid = false;
- return Tp::SimpleContactPresences();
- }
-
- Tp::ContactPresences presences = get_presence_reply.value();
- QList<uint> keys = presences.keys();
- QPointer<TpPrototype::Contact> contact;
- foreach( uint key, keys )
- {
- //qDebug() << "presencesForContacts Key"<<key;
- for ( int i=0; i<contacts.size(); i++ )
- {
- contact=contacts.at( i);
- //qDebug() << "Contact "<< key << "Status" <<presences.value( key ).status;
- if (contact->telepathyHandle()==key)
- {
- Tp::SimplePresence simple_presence = d->convertToSimplePresence( presences.value( key ) );
- contact->setPresenceType( simple_presence.type );
- contact->setPresenceStatus( simple_presence.status );
- contact->setPresenceMessage( simple_presence.statusMessage );
- }
- }
- }
-
- return d->convertToSimplePresences( presences );
- }
-
- // Fall through..
- return Tp::SimpleContactPresences();
-}
-
-// Protected slots
-
-// Called by the _simple_ presence interface if presence were updated
-void PresenceManager::slotPresencesChanged( const Tp::SimpleContactPresences& presences )
-{
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << __PRETTY_FUNCTION__;
-#endif
- if ( !d->m_pConnection )
- {
- qWarning() << "PresenceManager::slotPresencesChanged(): Received a presence changed signal but no connection object exists!";
- return;
- }
-
- QList<uint> keys = presences.keys();
- foreach( uint key, keys )
- {
- Tp::SimplePresence changed_presence = presences.value( key );
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Contact ID: " << key
- << "Type: " << changed_presence.type
- << "Status:" << changed_presence.status
- << "StatusMessage:"<< changed_presence.statusMessage;
-#endif
-
- if ( d->localHandle() == key )
- {
- if ( !d->m_pConnection->account() )
- {
- qWarning() << "PresenceManager::slotPresencesChanged(): Connection without account!";
- return;
- }
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "PresenceManager::slotPresencesChanged() -> signalOwnPresenceUpdated";
-#endif
- emit signalOwnPresenceUpdated( d->m_pConnection->account(), changed_presence );
- }
- else
- {
- if ( !d->m_pConnection->contactManager() )
- {
- qWarning() << "PresenceManager::slotPresencesChanged(): Unable to request contact manager!";
- return;
- }
-
- Contact* found_contact = NULL;
- foreach( Contact* contact, d->m_pConnection->contactManager()->contactList() )
- {
- if ( contact && contact->telepathyHandle() == key )
- { found_contact = contact; }
- }
- if ( found_contact )
- {
- found_contact->setPresenceType(changed_presence.type);
- found_contact->setPresenceStatus(changed_presence.status);
- found_contact->setPresenceMessage(changed_presence.statusMessage);
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "PresenceManager::slotPresencesChanged() -> signalRemotePresencesUpdated (contact: " << found_contact->name() << "type:" << found_contact->type() << ")";
-#endif
- emit signalRemotePresencesUpdated( found_contact, changed_presence );
- }
- else
- {
- qWarning() << "PresenceManager::slotPresencesChanged: Received a signal that a non existing contact changed its presence!";
- }
- }
- }
-}
-
-// Called by the presence interface (that one without "simple" prefix) if any presences were updated
-void PresenceManager::slotPresencesUpdate( const Tp::ContactPresences& presences )
-{
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "PresenceManager::slotPresencesUpdate()";
- QList<uint> keys = presences.keys();
- foreach( uint key, keys )
- {
- qDebug() << "Contact ID : " << key
- << "LastActivity: " << presences.value( key ).lastActivity;
- Tp::MultipleStatusMap statuses = presences.value( key ).statuses; // QMap<QString, QVariantMap>
- QList<QString> status_keys = statuses.keys();
- foreach( QString status_key, status_keys )
- {
- qDebug() << "Status:" << status_key << "Map:" << statuses.value( status_key );
- }
- }
-#endif
- slotPresencesChanged( d->convertToSimplePresences( presences ) );
-}
-
-TpPrototype::Connection * PresenceManager::connection()
-{
- return d->m_pConnection;
-}
-
-void PresenceManager::init()
-{
- Q_ASSERT( d->m_pConnectionInterface );
-
- if ( !d->m_pConnectionInterface || !d->m_pConnection )
- {
- d->m_isValid = false;
- return;
- }
-
- Tp::registerTypes();
- QDBusPendingReply<QStringList> interfaces_reply = d->m_pConnectionInterface->GetInterfaces();
- interfaces_reply.waitForFinished();
-
- if ( !interfaces_reply.isValid() )
- {
- QDBusError error = interfaces_reply.error();
-
- qWarning() << "GetInterfaces: error type:" << error.type()
- << "GetInterfaces: error name:" << error.name();
-
- d->m_isValid = false;
- return;
- }
-
- QString simplepresence_interface_name;
- bool found_simple_presence_support = false;
- QString presence_interface_name;
- bool found_presence_support = false;
-
- foreach( const QString& interface, interfaces_reply.value() )
- {
- if ( interface.endsWith( ".SimplePresence" ) )
- {
- found_simple_presence_support = true;
- simplepresence_interface_name = interface;
- }
- if ( interface.endsWith( ".Presence" ) )
- {
- found_presence_support = true;
- presence_interface_name = interface;
- }
- }
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Simple Presence Interface Name: " << simplepresence_interface_name;
- qDebug() << "Presence Interface Name : " << presence_interface_name;
-#endif
-
- // FIXME: The following line shound be commented out!!
- // found_simple_presence_support = false; // Override to test the (not simple) presence interface implementation
-
- if ( found_simple_presence_support )
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug( "PresenceManager::init(): Connection Manager provides the Interface \"SimplePresence\". I will use this one!" );
-#endif
- d->m_pSimplePresenceInterface = new Tp::Client::ConnectionInterfaceSimplePresenceInterface( d->m_pConnectionInterface->service(),
- d->m_pConnectionInterface->path(),
- this );
- Q_ASSERT( d->m_pSimplePresenceInterface );
- Q_ASSERT( d->m_pSimplePresenceInterface->isValid() );
-
- connect( d->m_pSimplePresenceInterface, SIGNAL( PresencesChanged( const Tp::SimpleContactPresences& ) ),
- this, SLOT( slotPresencesChanged( const Tp::SimpleContactPresences& ) ) );
-
- return;
- }
-
- if ( found_presence_support )
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug( "PresenceManager::init(): Connection Manager provides the Interface \"Presence\". I will use this one!" );
-#endif
- d->m_pPresenceInterface = new Tp::Client::ConnectionInterfacePresenceInterface( d->m_pConnectionInterface->service(),
- d->m_pConnectionInterface->path(),
- this );
- Q_ASSERT( d->m_pPresenceInterface );
- Q_ASSERT( d->m_pPresenceInterface->isValid() );
-
- connect( d->m_pPresenceInterface, SIGNAL( PresenceUpdate(const Tp::ContactPresences& ) ),
- this, SLOT( slotPresencesUpdate( const Tp::ContactPresences& ) ) );
-
- return;
-
- }
-
- // Fall through: No valid presence interface was found..
- d->m_isValid = false;
- qWarning( "PresenceManager::init(): Connection Manager neither supports the Interface \"Presence\" nor the Interface \"SimplePresence\". Other interfaces are not supported!" );
- return;
-}
-
-#include "_gen/PresenceManager.h.moc"
diff --git a/TelepathyQt4/Prototype/PresenceManager.h b/TelepathyQt4/Prototype/PresenceManager.h
deleted file mode 100644
index aa9c7d4..0000000
--- a/TelepathyQt4/Prototype/PresenceManager.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 basysKom GmbH
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#ifndef TelepathyQt4_Prototype_PresenceManager_H_
-#define TelepathyQt4_Prototype_PresenceManager_H_
-
-#include <QDBusObjectPath>
-#include <QObject>
-#include <QPointer>
-
-#include <TelepathyQt4/Types>
-
-namespace Tp
-{
- namespace Client
- {
- class ConnectionInterface;
- }
-}
-
-namespace TpPrototype {
-
-class PresenceManagerPrivate;
-class Connection;
-class Contact;
-class Account;
-
-/**
- * @ingroup qt_connection
- * This class manages presence information for one connection.
- * Whenever a contact presence changes, the signal signalRemotePresencesUpdated() is emitted. This signal provides the related contact object
- * obtained from the ContactManager.
- * In order to keep the contacts updated, you just have to instantiate this class (by requesting the object with Connection::presenceManager())
- * and initialize the list of contacts once (by calling presencesForContacts() ). After this point, the presence information of the contact
- * is updated automatically if a change is signalled by the backend.<br>
- * <br>
- * <b>Info:</b> The deprecated interface "org.freedesktop.Telepathy.Channel.Interface.Presence" is used as fallback, if the interface
- * "org.freedesktop.Telepathy.Channel.Interface.SimplePresence" is not supported by the connection manager. Thus, a wide range of
- * connection managers should work with this class.
-
- * @see Connection
- */
-class PresenceManager : public QObject
-{
- Q_OBJECT
-public:
- /**
- * Validity.
- * Do not access any methods if the object is invalid!
- */
- bool isValid();
-
- /**
- * Supported statuses.
- * Returns the list of supported status states. The list may change if the status of the connection changes from <i>disconnected</i> to <i>connected</i>.
- * @return The list of supported statuses.
- * @see connection::status();
- */
- Tp::SimpleStatusSpecMap statuses();
-
- /**
- * Set Presence.
- * Request that the presence status and status message are published for the connection. Changes will be indicated by
- * signal signalOwnPresenceUpdated().
- * @param status The state to set the presence to as returned by statuses().
- * @see signalOwnPresenceUpdated().;
- */
- bool setPresence( const QString& status, const QString& statusMessage );
-
- /**
- * Gets local presence.
- * The local presence is returned for the connection.
- * @return Returns my current local presence or an empty item on error.
- */
- Tp::SimplePresence currentPresence();
-
- /**
- * Request presences.
- * Requests a list of presences for the given list of contacts.
- * @param contacts List of contacts.
- * @return List of presence information for contacts as <i>QMap<int,SimplePresence> </i>. The <i>int</i> represents the
- * identifier of the contact as returned by Contact::identifier(), An empty list is returned on error.
- * @todo Future: Use QList<Contact> instead QList<QPointer<Contact> > or introduce a class <i>ContactGroup</i> that handles all internally.
- * @todo Future: Tp::SimpleContactPresences relies of an handle (the <i>int</i>). This should be encapsulated.
- */
- Tp::SimpleContactPresences presencesForContacts( const QList<QPointer<TpPrototype::Contact> >& contacts );
-
- /**
- * Returns the connection that belongs to this presence information.
- * @return The connection object
- */
- TpPrototype::Connection* connection();
-
-signals:
- /**
- * Presences of remote contacts are changed.
- * This signal is emitted when the presence state of a remote contact is changed.
- * @param contact The contact that changes.
- * @param presence The presence information.
- */
- void signalRemotePresencesUpdated( TpPrototype::Contact* contact, const Tp::SimplePresence& presence );
-
- /**
- * Local presence changed.
- * This signal is emitted when the local presence state was changed.
- * @param account The account that changes.
- * @param presence The presence information.
- */
- void signalOwnPresenceUpdated( const TpPrototype::Account* account, const Tp::SimplePresence& presence );
-
-protected:
- /**
- * Constructor. The presence manager cannot be instantiated directly. Use Connection::presenceManager() for it!
- */
- PresenceManager( TpPrototype::Connection* connection,
- Tp::Client::ConnectionInterface* interface,
- QObject* parent = NULL );
- ~PresenceManager();
-
-protected slots:
- void slotPresencesChanged( const Tp::SimpleContactPresences& presences );
- void slotPresencesUpdate( const Tp::ContactPresences& presences );
-private:
- void init();
-
- TpPrototype::PresenceManagerPrivate * const d;
- friend class Connection;
- friend class ConnectionPrivate;
-};
-}
-
-
-#endif
diff --git a/TelepathyQt4/Prototype/Stream_Engine.xml b/TelepathyQt4/Prototype/Stream_Engine.xml
deleted file mode 100644
index 0303a51..0000000
--- a/TelepathyQt4/Prototype/Stream_Engine.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
-<node name="/Stream_Engine">
- <interface name="org.freedesktop.Telepathy.StreamEngine">
- <method name="SetOutputVolume">
- <arg direction="in" type="o" name="channel_path" />
- <arg direction="in" type="u" name="stream_id" />
- <arg direction="in" type="u" name="volume" />
- </method>
- <method name="MuteInput">
- <arg direction="in" type="o" name="channel_path" />
- <arg direction="in" type="u" name="stream_id" />
- <arg direction="in" type="b" name="mute_state" />
- </method>
- <method name="MuteOutput">
- <arg direction="in" type="o" name="channel_path" />
- <arg direction="in" type="u" name="stream_id" />
- <arg direction="in" type="b" name="mute_state" />
- </method>
- <method name="SetOutputWindow">
- <arg direction="in" type="o" name="channel_path" />
- <arg direction="in" type="u" name="stream_id" />
- <arg direction="in" type="u" name="window" />
- </method>
- <method name="AddPreviewWindow">
- <arg direction="in" type="u" name="window" />
- </method>
- <method name="RemovePreviewWindow">
- <arg direction="in" type="u" name="window" />
- </method>
- <signal name="Receiving">
- <arg type="o" name="channel_path" />
- <arg type="u" name="stream_id" />
- <arg type="b" name="state" />
- </signal>
- <signal name="StreamStateChanged">
- <arg type="o" name="channel_path" />
- <arg type="u" name="stream_id" />
- <arg type="u" name="state" />
- <arg type="u" name="direction" />
- </signal>
- <method name="Shutdown">
- </method>
- </interface>
-</node>
diff --git a/TelepathyQt4/Prototype/StreamedMediaChannel.cpp b/TelepathyQt4/Prototype/StreamedMediaChannel.cpp
deleted file mode 100644
index 2e6cf0d..0000000
--- a/TelepathyQt4/Prototype/StreamedMediaChannel.cpp
+++ /dev/null
@@ -1,855 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 basysKom GmbH
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "TelepathyQt4/Prototype/StreamedMediaChannel.h"
-
-#include <QDebug>
-#include <QMetaProperty>
-
-#include <TelepathyQt4/Connection>
-#include <TelepathyQt4/Channel>
-
-// ChannelHandlerInterface and StreamEngineInterface from stream-engine
-// 0.5.x, which is currently used as the only media streaming backend.
-// These interfaces are not really part of the Tp spec
-#include <TelepathyQt4/Prototype/Client/ChannelHandler>
-#include <TelepathyQt4/Prototype/Client/StreamEngine>
-
-#include <TelepathyQt4/Prototype/ConnectionFacade.h>
-#include <TelepathyQt4/Prototype/Constants>
-#include <TelepathyQt4/Prototype/Contact.h>
-#include <TelepathyQt4/Prototype/ContactManager.h>
-
-#define ENABLE_DEBUG_OUTPUT_
-
-using namespace TpPrototype;
-
-class TpPrototype::StreamedMediaChannelPrivate
-{
-public:
- StreamedMediaChannelPrivate()
- { init(); }
-
- QPointer<TpPrototype::Contact> m_pContact;
- QPointer<Tp::Client::ConnectionInterface> m_pConnectionInterface;
- Tp::Client::ChannelTypeStreamedMediaInterface* m_pStreamedMediaInterface;
- Tp::Client::ChannelInterfaceGroupInterface* m_pGroupInterface;
- Tp::Client::ChannelInterfaceMediaSignallingInterface* m_pMediaSignallingInterface;
- Tp::Client::ChannelInterfaceCallStateInterface* m_pCallStateInterface;
-
- // Interfaces of the telepathy stream engine:
- TpPrototype::Client::ChannelHandlerInterface* m_pStreamEngineHandlerInterface;
- TpPrototype::Client::StreamEngineInterface* m_pStreamEngineInterface;
-
- bool m_isValid;
-
- uint localHandle()
- {
- int self_handle = ConnectionFacade::instance()->selfHandleForConnectionInterface( m_pConnectionInterface );
- Q_ASSERT( self_handle >= 0 );
- return (uint) self_handle;
- }
-
- QList<uint> handleListForContacts( QList<QPointer<TpPrototype::Contact> > contacts )
- {
- QList<uint> handle_list;
-
- foreach( TpPrototype::Contact* contact, contacts )
- {
- if ( !contact )
- { continue; }
-
- handle_list.append( contact->telepathyHandle() );
- }
-
- return handle_list ;
- }
-
- bool isStreamEngineAvailable()
- {
- if ( !m_pStreamEngineInterface )
- {
- qWarning() << "No " << TpPrototype::Client::StreamEngineInterface::staticInterfaceName() << "found!";
- return false;
- }
- return true;
- }
-
- void checkDBusCall( QDBusPendingReply<>& reply, const QString& methodName )
- {
- reply.waitForFinished();
- if ( !reply.isValid() )
- {
- QDBusError error = reply.error();
- qWarning() << methodName << ": error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- }
- return;
- }
-
- void cleanup()
- {
- delete m_pStreamedMediaInterface;
- m_pStreamedMediaInterface = NULL;
- delete m_pCallStateInterface;
- m_pCallStateInterface = NULL;
- delete m_pMediaSignallingInterface;
- m_pMediaSignallingInterface = NULL;
- delete m_pStreamEngineHandlerInterface;
- m_pStreamEngineHandlerInterface = NULL;
- delete m_pStreamEngineInterface;
- m_pStreamEngineInterface = NULL;
- delete m_pGroupInterface;
- m_pGroupInterface = NULL;
- m_isValid = true;
- }
-
-
-private:
- void init()
- {
- m_pContact = NULL;
- m_pConnectionInterface = NULL;
- m_pStreamedMediaInterface = NULL;
- m_pCallStateInterface = NULL;
- m_pMediaSignallingInterface = NULL;
- m_pStreamEngineHandlerInterface = NULL;
- m_pStreamEngineInterface = NULL;
- m_pGroupInterface = NULL;
- m_isValid = true;
- }
-
-
-};
-
-
-StreamedMediaChannel::StreamedMediaChannel( Contact* contact, Tp::Client::ConnectionInterface* connectionInterface, QObject* parent ):
- QObject( parent ),
- d(new StreamedMediaChannelPrivate())
-{
- Tp::registerTypes();
-
- d->m_pContact = contact;
- d->m_pConnectionInterface = connectionInterface;
-
-}
-
-StreamedMediaChannel::~StreamedMediaChannel()
- { delete d; }
-
-bool StreamedMediaChannel::isValid() const
-{ return d->m_isValid; }
-
-// This functions adds the local handle from the group of local pending members into the group of members.
-bool StreamedMediaChannel::acceptIncomingStream()
-{
- QList<uint> accept_handles;
- accept_handles << d->localHandle();
-
- return addMembers( accept_handles );
-}
-
-bool StreamedMediaChannel::rejectIncomingStream()
-{
- QList<uint> reject_handles;
- reject_handles << d->localHandle();
-
- return removeMembers( reject_handles );
-}
-
-bool StreamedMediaChannel::requestChannel( QList<Tp::MediaStreamType> types )
-{
- Q_ASSERT( d->m_pConnectionInterface );
- Q_ASSERT( d->m_pContact );
- if ( !d->m_pConnectionInterface
- || !d->m_pContact )
- {
- return false;
- }
-
- QDBusPendingReply<QDBusObjectPath> request_channel_reply = d->m_pConnectionInterface->RequestChannel( Tp::Client::ChannelTypeStreamedMediaInterface::staticInterfaceName(),
- Tp::HandleTypeContact,
- d->m_pContact->telepathyHandle(),
- true );
- request_channel_reply.waitForFinished();
-
- if ( !request_channel_reply.isValid() )
- {
- QDBusError error = request_channel_reply.error();
-
- qWarning() << "RequestChannel: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- return false;
- }
-
-
- if ( d->m_pStreamedMediaInterface )
- {
- delete d->m_pStreamedMediaInterface;
- d->m_pStreamedMediaInterface = NULL;
- }
-
- QDBusObjectPath channel_path=request_channel_reply.value();
- d->m_pStreamedMediaInterface = new Tp::Client::ChannelTypeStreamedMediaInterface( d->m_pConnectionInterface->service(), channel_path.path(), this );
- connectSignals();
-
- if ( !d->m_pStreamedMediaInterface )
- {
- return false;
- }
-
-
- QList<uint> stream_types;
- foreach( uint type, types )
- {
- stream_types << type;
- }
-
-
- QDBusPendingReply<Tp::MediaStreamInfoList> request_streams_reply = d->m_pStreamedMediaInterface->RequestStreams( d->m_pContact->telepathyHandle(),
- stream_types );
- request_streams_reply.waitForFinished();
-
- if ( !request_streams_reply.isValid() )
- {
- QDBusError error = request_streams_reply.error();
-
- qWarning() << "RequestStreams: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- return false;
- }
-
- // Fall through..
- return true;
-}
-
-bool StreamedMediaChannel::requestStreams( TpPrototype::Contact* contact, QList<Tp::MediaStreamType> types )
-{
- Q_ASSERT( d->m_pStreamedMediaInterface );
-
- if ( !d->m_pStreamedMediaInterface )
- {
- return false;
- }
-
- QList<uint> stream_types;
- foreach( uint type, types )
- {
- stream_types << type;
- }
-
-
- QDBusPendingReply<Tp::MediaStreamInfoList> request_streams_reply = d->m_pStreamedMediaInterface->RequestStreams( d->m_pContact->telepathyHandle(),
- stream_types );
- request_streams_reply.waitForFinished();
-
- if ( !request_streams_reply.isValid() )
- {
- QDBusError error = request_streams_reply.error();
-
- qWarning() << "RequestStreams: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- return false;
- }
-
- // Fall through..
- return true;
-}
-
-bool StreamedMediaChannel::addContactsToGroup( QList<QPointer<TpPrototype::Contact> > contacts )
-{
- QList<uint> handle_list = d->handleListForContacts( contacts );
-
- return addMembers( handle_list );
-}
-
-bool StreamedMediaChannel::removeContactsFromGroup( QList<QPointer<TpPrototype::Contact> > contacts )
-{
- QList<uint> handle_list = d->handleListForContacts( contacts );
-
- return removeMembers( handle_list );
-}
-
-QList<QPointer<TpPrototype::Contact> > StreamedMediaChannel::localPendingContacts()
-{
- QList<QPointer<TpPrototype::Contact> > local_pending_members;
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Local Pending members : ";
-#endif
- foreach( Tp::LocalPendingInfo local_pending_info, d->m_pGroupInterface->LocalPendingMembers() )
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "To be added: " << local_pending_info.toBeAdded;
- qDebug() << "Actor : " << local_pending_info.actor;
- qDebug() << "Reason : " << local_pending_info.reason;
- qDebug() << "Message : " << local_pending_info.message;
-#endif
- local_pending_members.append( d->m_pContact->contactManager()->contactForHandle( local_pending_info.toBeAdded ) );
- }
- return local_pending_members;
-}
-
-QList<QPointer<TpPrototype::Contact> > StreamedMediaChannel::members()
-{
- Tp::UIntList member_handles = d->m_pGroupInterface->Members();
-
- QList<QPointer<TpPrototype::Contact> > member_list;
-
- foreach( uint member_handle, member_handles )
- {
- member_list.append( d->m_pContact->contactManager()->contactForHandle( member_handle ) );
- }
-
- return member_list;
-}
-
-bool StreamedMediaChannel::removeStreams( const QList<uint>& streamIds )
-{
- QDBusPendingReply<> remove_streams_reply = d->m_pStreamedMediaInterface->RemoveStreams( streamIds );
- remove_streams_reply.waitForFinished();
- if ( !remove_streams_reply.isValid() )
- {
- QDBusError error = remove_streams_reply.error();
- qWarning() << "RemoveStreams: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- return false;
- }
-
- return true;
-}
-
-Tp::MediaStreamInfoList StreamedMediaChannel::requestStreams( QList<Tp::MediaStreamType> _types )
-{
- Tp::UIntList types;
-
- foreach( uint type, _types )
- {
- types.append( type );
- }
-
- QDBusPendingReply<Tp::MediaStreamInfoList> request_streams_reply = d->m_pStreamedMediaInterface->RequestStreams( d->m_pContact->telepathyHandle(), types);
-
- request_streams_reply.waitForFinished();
- if ( !request_streams_reply.isValid() )
- {
- QDBusError error = request_streams_reply.error();
- qWarning() << "RequestStreams: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- return QDBusPendingReply<Tp::MediaStreamInfoList>();
- }
-
- return request_streams_reply.value();
-}
-
-Tp::MediaStreamInfoList StreamedMediaChannel::listStreams()
-{
- if ( !d->m_pStreamedMediaInterface )
- { return Tp::MediaStreamInfoList();}
-
- QDBusPendingReply<Tp::MediaStreamInfoList> reply = d->m_pStreamedMediaInterface->ListStreams();
- reply.waitForFinished();
- if ( !reply.isValid() )
- {
- QDBusError error = reply.error();
- qWarning() << "ListStreams: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- return Tp::MediaStreamInfoList();
- }
-
- return reply.value();
-}
-
-
-
-// public Slots
-void StreamedMediaChannel::slotSetOutputVolume( uint streamId, uint volume )
-{
- if ( !d->isStreamEngineAvailable() )
- { return;}
-
- QDBusPendingReply<> reply = d->m_pStreamEngineInterface->SetOutputVolume( QDBusObjectPath( d->m_pStreamedMediaInterface->path() ), streamId, volume );
-
- d->checkDBusCall( reply, "SetOutputVolume" );
-}
-
-void StreamedMediaChannel::slotMuteInput( uint streamId, bool muteState )
-{
- if ( !d->isStreamEngineAvailable() )
- { return;}
-
- QDBusPendingReply<> reply = d->m_pStreamEngineInterface->MuteInput( QDBusObjectPath( d->m_pStreamedMediaInterface->path() ), streamId, muteState );
-
- d->checkDBusCall( reply, "MuteInput" );
-}
-
-void StreamedMediaChannel::slotMuteOutput( uint streamId, bool muteState )
-{
- if ( !d->isStreamEngineAvailable() )
- { return;}
-
- QDBusPendingReply<> reply = d->m_pStreamEngineInterface->MuteOutput( QDBusObjectPath( d->m_pStreamedMediaInterface->path() ), streamId, muteState );
-
- d->checkDBusCall( reply, "MuteOutput" );
-}
-
-void StreamedMediaChannel::slotSetOutputWindow( uint streamId, uint windowId )
-{
- if ( !d->isStreamEngineAvailable() )
- { return;}
-
- QDBusPendingReply<> reply = d->m_pStreamEngineInterface->SetOutputWindow( QDBusObjectPath( d->m_pStreamedMediaInterface->path() ), streamId, windowId );
-
- d->checkDBusCall( reply, "SetOutputWindow" );
-}
-
-void StreamedMediaChannel::slotAddPreviewWindow( uint windowId )
-{
- if ( !d->isStreamEngineAvailable() )
- { return;}
-
- QDBusPendingReply<> reply = d->m_pStreamEngineInterface->AddPreviewWindow( windowId );
-
- d->checkDBusCall( reply, "AddPreviewWindow" );
-}
-
-void StreamedMediaChannel::slotRemovePreviewWindow( uint windowId )
-{
- if ( !d->isStreamEngineAvailable() )
- { return;}
-
- QDBusPendingReply<> reply = d->m_pStreamEngineInterface->RemovePreviewWindow( windowId );
-
- d->checkDBusCall( reply, "RemovePreviewWindow" );
-}
-
-
-void StreamedMediaChannel::slotShutDown()
-{
- if ( !d->isStreamEngineAvailable() )
- { return;}
-
- QDBusPendingReply<> reply = d->m_pStreamEngineInterface->Shutdown();
-
- d->checkDBusCall( reply, "Shutdown" );
-
- // Cleanup locally
- d->cleanup();
-}
-
-// Protected functions
-
-// Called if a new media channel shall be established.
-void StreamedMediaChannel::requestStreamedMediaChannel( uint handle )
-{
- // Ignore this call if the media channel is already available
- if ( d->m_pStreamedMediaInterface )
- {
- delete d->m_pStreamedMediaInterface;
- d->m_pStreamedMediaInterface = NULL;
- }
-
- QDBusPendingReply<QDBusObjectPath> reply0 = d->m_pConnectionInterface->RequestChannel( "org.freedesktop.Telepathy.Channel.Type.StreamedMedia",
- Tp::HandleTypeContact,
- handle,
- true );
- reply0.waitForFinished();
- if (!reply0.isValid())
- {
- QDBusError error = reply0.error();
- qWarning() << "RequestChannel (Type: StreamedMedia): error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
- d->m_isValid = false;
- return;
- }
- QDBusObjectPath channel_path=reply0.value();
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "StreamedMediaChannel new ChannelTypeStreamedMediaInterface(): Path:" << channel_path.path();
-#endif
- d->m_pStreamedMediaInterface = new Tp::Client::ChannelTypeStreamedMediaInterface( d->m_pConnectionInterface->service(), channel_path.path(), this );
- connectSignals();
-}
-
-
-// Called if a new streamed media channel was notified by the connection
-void StreamedMediaChannel::openStreamedMediaChannel( uint handle, uint handleType, const QString& channelPath, const QString& channelType )
-{
- Q_ASSERT( d->m_pConnectionInterface );
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "StreamedMediaChannel::openStreamedMediaChannel(): handle:" << handle
- << "handleType:" << handleType
- << "channel path: " << channelPath
- << "Channel Type:" << channelType;
-#endif
-
- QString channel_service_name = d->m_pConnectionInterface->service();
-
- if ( !d->m_pStreamedMediaInterface )
- {
- delete d->m_pStreamedMediaInterface;
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Create new ChannelTypeStreamedMediaInterface";
-#endif
- d->m_pStreamedMediaInterface = new Tp::Client::ChannelTypeStreamedMediaInterface( channel_service_name, channelPath, this );
- connectSignals();
- }
- if (!d->m_pStreamedMediaInterface->isValid())
- {
- qWarning() << "Failed to connect streamed media interface class to D-Bus object.";
- delete d->m_pStreamedMediaInterface;
- d->m_pStreamedMediaInterface = NULL;
- d->m_isValid = false;
- return;
- }
- else
- {
- // Obtain the group and callstate interfaces.
- QString streamed_media_service_name = d->m_pStreamedMediaInterface->service();
-
- // I don't know why, but I have to reinitialize the group channel every time..
- if ( d->m_pGroupInterface )
- {
- delete d->m_pGroupInterface;
- d->m_pGroupInterface = NULL;
- }
-
- if ( !d->m_pGroupInterface )
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Initialize ChannelInterfaceGroupInterface..";
-#endif
- d->m_pGroupInterface = new Tp::Client::ChannelInterfaceGroupInterface( streamed_media_service_name,
- channelPath );
-
- connect( d->m_pGroupInterface, SIGNAL( MembersChanged(const QString& ,
- const Tp::UIntList& ,
- const Tp::UIntList& ,
- const Tp::UIntList& ,
- const Tp::UIntList& ,
- uint ,
- uint )
- ),
- this, SLOT( slotMembersChanged(const QString& ,
- const Tp::UIntList& ,
- const Tp::UIntList& ,
- const Tp::UIntList& ,
- const Tp::UIntList& ,
- uint ,
- uint )
- )
- );
-
-
- }
-
- if ( !d->m_pCallStateInterface )
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Initialize ChannelInterfaceCallStateInterface..";
-#endif
- d->m_pCallStateInterface = new Tp::Client::ChannelInterfaceCallStateInterface( streamed_media_service_name,
- channelPath );
- }
-
- if ( !d->m_pMediaSignallingInterface )
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Initialize ChannelInterfaceMediaSignallingInterface..";
-#endif
- d->m_pMediaSignallingInterface = new Tp::Client::ChannelInterfaceMediaSignallingInterface( streamed_media_service_name, channelPath );
- }
-
- if ( !d->m_pStreamEngineInterface )
- {
-
- // FIXME: Think whether we really need this Maemo variant of StreamEngineInterface. The default telepathy version should
- // be enough and avoids platform dependency.
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Initialize StreamEngineInterface..";
-#endif
- d->m_pStreamEngineInterface = new TpPrototype::Client::StreamEngineInterface( "org.freedesktop.Telepathy.StreamEngine",
- "/org/freedesktop/Telepathy/StreamEngine",
- this );
-
- }
-
- if ( !d->m_pStreamEngineHandlerInterface )
- {
- // The following interface is exported by the stream engine as well.
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Initialize ChannelHandlerInterface..";
-#endif
- d->m_pStreamEngineHandlerInterface = new TpPrototype::Client::ChannelHandlerInterface( "org.freedesktop.Telepathy.StreamEngine",
- "/org/freedesktop/Telepathy/StreamEngine",
- this );
- }
-
- Q_ASSERT( d->m_pCallStateInterface->isValid() );
- Q_ASSERT( d->m_pMediaSignallingInterface->isValid() );
-
- // Cleanup if we were unable to establish interfaces..
- if ( d->m_pGroupInterface && !d->m_pGroupInterface->isValid() )
- {
- qWarning() << "Could not establish interface:" << Tp::Client::ChannelInterfaceGroupInterface::staticInterfaceName();
- delete d->m_pGroupInterface;
- d->m_pGroupInterface = NULL;
- }
-
- if ( d->m_pCallStateInterface && !d->m_pCallStateInterface->isValid() )
- {
- qWarning() << "Could not establish interface:" << Tp::Client::ChannelInterfaceCallStateInterface::staticInterfaceName();
- delete d->m_pCallStateInterface;
- d->m_pCallStateInterface = NULL;
- }
-
- if ( d->m_pMediaSignallingInterface && !d->m_pMediaSignallingInterface->isValid() )
- {
- qWarning() << "Could not establish interface:" << Tp::Client::ChannelInterfaceMediaSignallingInterface::staticInterfaceName();
- delete d->m_pMediaSignallingInterface;
- d->m_pMediaSignallingInterface = NULL;
- }
-
- // Now use the streaming engine to handle this media channel
- if ( !d->m_pStreamEngineHandlerInterface || !d->m_pStreamEngineInterface )
- {
- qWarning() << "Could not establish interface:" << TpPrototype::Client::ChannelHandlerInterface::staticInterfaceName();
- qWarning() << "or interface:" << TpPrototype::Client::StreamEngineInterface::staticInterfaceName();
-
- delete d->m_pStreamEngineHandlerInterface;
- d->m_pStreamEngineHandlerInterface = NULL;
-
- delete d->m_pStreamEngineInterface;
- d->m_pStreamEngineInterface = NULL;
-
- // This is fatal, cause we need this interface
- d->m_isValid = false;
- qWarning() << "The interface:" << TpPrototype::Client::StreamEngineInterface::staticInterfaceName() << "is required! We will be unable to handle this call!";
- }
- else
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Now delegate channel to stream-engine by calling HandleChannel()";
-#endif
- QDBusPendingReply<> handle_channel_reply = d->m_pStreamEngineHandlerInterface->HandleChannel( d->m_pConnectionInterface->service(),
- QDBusObjectPath( d->m_pConnectionInterface->path() ),
- channelType,
- QDBusObjectPath( channelPath ),
- handleType,
- handle );
-
- handle_channel_reply.waitForFinished();
-
- if ( !handle_channel_reply.isValid() )
- {
- QDBusError error = handle_channel_reply.error();
-
- qWarning() << "HandleChannel: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- d->m_isValid = false;
- return ;
- }
- }
-
- }
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Telling the world about new channel (signalIncomingChannel())";
-#endif
- emit signalIncomingChannel( d->m_pContact );
-
-}
-
-void StreamedMediaChannel::connectSignals()
-{
- connect( d->m_pStreamedMediaInterface, SIGNAL( StreamAdded(uint , uint , uint ) ),
- this, SLOT( slotStreamAdded(uint , uint , uint ) ) );
- connect( d->m_pStreamedMediaInterface, SIGNAL( StreamDirectionChanged(uint , uint , uint ) ),
- this, SLOT( slotStreamDirectionChanged(uint , uint , uint ) ) );
- connect( d->m_pStreamedMediaInterface, SIGNAL( StreamError(uint , uint , const QString& ) ),
- this, SLOT( slotStreamError(uint , uint , const QString& ) ) );
- connect( d->m_pStreamedMediaInterface, SIGNAL( StreamRemoved(uint) ),
- this, SLOT( slotStreamRemoved(uint) ) );
- connect( d->m_pStreamedMediaInterface, SIGNAL( StreamStateChanged(uint , uint ) ),
- this, SLOT( slotStreamStateChanged(uint , uint ) ) );
-}
-
-bool StreamedMediaChannel::addMembers( QList<uint> handles )
-{
- if ( !d->m_pGroupInterface )
- {
- qWarning() << "StreamedMediaChannel::addMembers: No group channel found. Ignore call ..";
- return false;
- }
-
- QDBusPendingReply<> add_members_reply = d->m_pGroupInterface->AddMembers( handles, "Welcome!" );
- add_members_reply.waitForFinished();
-
- if ( !add_members_reply.isValid() )
- {
- QDBusError error = add_members_reply.error();
-
- qWarning() << "AddMembers: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- return false;
- }
- return true;
-}
-
-bool StreamedMediaChannel::removeMembers( QList<uint> handles )
-{
- if ( !d->m_pGroupInterface )
- {
- qWarning() << "StreamedMediaChannel::removeMembers: No group channel found. Ignore call ..";
- return false;
- }
-
- QDBusPendingReply<> remove_members_reply = d->m_pGroupInterface->RemoveMembers( handles, "Bye-bye!!" );
- remove_members_reply.waitForFinished();
-
- if ( !remove_members_reply.isValid() )
- {
- QDBusError error = remove_members_reply.error();
-
- qWarning() << "RemoveMembers: error type:" << error.type()
- << "error name:" << error.name()
- << "error message:" << error.message();
-
- return false;
- }
- return true;
-}
-
-
-void StreamedMediaChannel::slotStreamAdded(uint streamID, uint contactHandle, uint streamType)
-{
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << __PRETTY_FUNCTION__ << "streamID:" << streamID << "contactHandle: " << contactHandle << "streamType:" << streamType;
-#endif
- emit signalStreamAdded( this, streamID, static_cast<Tp::MediaStreamType>(streamType) );
-}
-
-void StreamedMediaChannel::slotStreamDirectionChanged(uint streamID, uint streamDirection, uint pendingFlags)
-{
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << __PRETTY_FUNCTION__ << "streamID:" << streamID << "streamDirection: " << streamDirection << "pendingFlags:" << pendingFlags;
-#endif
- emit signalStreamDirectionChanged( this, streamID, streamDirection, pendingFlags );
-}
-
-void StreamedMediaChannel::slotStreamError(uint streamID, uint errorCode, const QString& message)
-{
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << __PRETTY_FUNCTION__ << "streamID:" << streamID << "errorCode: " << errorCode << "message:" << message;
-#endif
- qWarning() << "Stream error: streamId: " << streamID << "ErrorCode: " << errorCode << "Message:" << message;
- emit signalStreamError( this, streamID, errorCode, message );
-}
-
-void StreamedMediaChannel::slotStreamRemoved(uint streamID)
-{
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << __PRETTY_FUNCTION__ << "streamID:" << streamID;
-#endif
- emit signalStreamRemoved( this, streamID );
-}
-
-void StreamedMediaChannel::slotStreamStateChanged(uint streamID, uint streamState)
-{
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << __PRETTY_FUNCTION__ << "streamID:" << streamID << "streamState: " << streamState;
-#endif
- emit signalStreamStateChanged( this, streamID, static_cast<Tp::MediaStreamState>(streamState) );
-}
-
-void StreamedMediaChannel::slotMembersChanged( const QString& message,
- const Tp::UIntList& added,
- const Tp::UIntList& removed,
- const Tp::UIntList& localPending,
- const Tp::UIntList& remotePending,
- uint actor,
- uint reason )
-{
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << __PRETTY_FUNCTION__
- << "message:" << message
- << "added:" << added
- << "removed:" << removed
- << "localPending:" << localPending
- << "remotePending:" << remotePending
- << "actor:" << actor
- << "reason:" << reason;
-#endif
- uint local_handle = d->localHandle();
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "local handle: " << local_handle;
-#endif
- if ( !added.isEmpty() )
- {
- foreach ( uint handle, added )
- {
- if ( handle == local_handle )
- {
- // I was added to the group. That means that an invitation was accepted.
- emit signalLocalInvitationAccepted( this );
- continue;
- }
- emit signalContactAdded( this, d->m_pContact->contactManager()->contactForHandle( handle ) );
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "signalContactAdded: " << handle;
-#endif
- }
- }
-
- if ( !removed.isEmpty() )
- {
- foreach ( uint handle, removed )
- {
- if ( handle == local_handle )
- { continue; }
- emit signalContactRemoved( this, d->m_pContact->contactManager()->contactForHandle( handle ) );
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "signalContactRemoved: " << handle;
-#endif
- }
- }
-}
-
-#include "TelepathyQt4/Prototype/_gen/StreamedMediaChannel.h.moc"
diff --git a/TelepathyQt4/Prototype/StreamedMediaChannel.h b/TelepathyQt4/Prototype/StreamedMediaChannel.h
deleted file mode 100644
index 3b69faa..0000000
--- a/TelepathyQt4/Prototype/StreamedMediaChannel.h
+++ /dev/null
@@ -1,436 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 basysKom GmbH
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#ifndef TelepathyQt4_Prototype_StreamedMediaChannel_H_
-#define TelepathyQt4_Prototype_StreamedMediaChannel_H_
-
-#include <TelepathyQt4/Connection>
-#include <TelepathyQt4/Channel>
-
-#include <QObject>
-#include <QVariantMap>
-#include <QPointer>
-
-#ifdef DEPRECATED_ENABLED__
-#define ATTRIBUTE_DEPRECATED __attribute__((deprecated))
-#else
-#define ATTRIBUTE_DEPRECATED
-#endif
-
-
-namespace TpPrototype {
-
-class StreamedMediaChannelPrivate;
-class Contact;
-class Account;
-
-/**
- * @ingroup qt_connection
- * StreamedMedia Channel for VoIP and Video Over IP.
- * The StreamedMedia channel object provides a simple API to manage the signalling of streamed media. The real
- * encoding/decoding of the data is done by the telepathy stream engine. New/incoming channels are handed over to
- * this stream engine internally.<br>
- * The channel contains multiple streams each representing its own media (video, audio, ..) and provides
- * its own group channel which can be used for conferences.<br>
- * <br>
- * <b>Important:</b><br>
- * This implementation currently just supports the telepathy stream engine as backend (see http://telepathy.freedesktop.org/wiki/Streamed_Media).<br>
- * <br>
- * <b>Example opening a VoIP communication to a contact:</b><br>
- * A valid streamed media channel object is provided by the remote contact object:
- * @code
- * TpPrototype::StreamedMediaChannel* media_channel = contact->streamedMediaChannel();
- * if ( !media_channel )
- * { return; }
- * @endcode
- * Request a channel (in this case an audio channel):
- * @code
- * media_channel->requestChannel( QList<Tp::MediaStreamType>() << Tp::MediaStreamTypeAudio );
- * @endcode
- * Whether the call was accepted or rejected is signalled by the following signals:
- * @code
- * connect( media_channel, SIGNAL( signalContactAdded( TpPrototype::Contact* ) ),
- * this, SLOT( slotStreamContactAdded( TpPrototype::Contact* ) ) );
- * connect( media_channel, SIGNAL( signalContactRemoved( TpPrototype::Contact* ) ),
- * this, SLOT( slotStreamContactRemoved( TpPrototype::Contact* ) ) );
- * @endcode
- * <b>Example receiving a VoIP communication from a contact:</b><br>
- * First you have to be informed about incoming calls. The ContactManager provides the signal:
- * @code
- * connect( m_pContactManager, SIGNAL( signalStreamedMediaChannelOpenedForContact( TpPrototype::Contact* ) ),
- * this, SLOT( slotStreamedMediaChannelOpenedForContact( TpPrototype::Contact* ) ) );
- * @endcode
- * Then you have to accept or reject the incoming call:
- * @code
- * TpPrototype::StreamedMediaChannel* streamed_channel = contact->streamedMediaChannel();
- * streamed_channel->acceptIncomingStream();
- * @endcode
- * or
- * @code
- * streamed_channel->rejectIncomingStream();
- * @endcode
- * <b>Hint:</b><br>
- * Before using this class set the capabilities with CapabilitiesManager::setCapabilities() according your requirements!
- * @see CapabiltiesManager
- * @see ChatChannel
- */
-class StreamedMediaChannel : public QObject
-{
- Q_OBJECT
-public:
- /**
- * Validity check.
- * Do not access any functions if this account is invalid.
- */
- bool isValid() const;
-
- /**
- * Destructor.
- * Deleting this object forces to drop all channels.
- */
- ~StreamedMediaChannel();
-
- /**
- * Accept the incoming media stream (call).
- * This function must be called to accept the incoming media stream.
- * @return Returns true if command was successful.
- */
- bool acceptIncomingStream();
-
- /**
- * Reject the incoming media stream (call).
- * This function should be called if an incoming call should be rejected.
- * @return Returns true if command was successful.
- */
- bool rejectIncomingStream();
-
- /**
- * Request outgoing media channel (call).
- * Ask remote contact to start a media channel.
- * @todo Describe what happens after this call ..
- * @param types The stream types that should be opened for this channel
- * @return Returns true if request call was successful.
- */
- bool requestChannel( QList<Tp::MediaStreamType> types );
-
- bool requestStreams( TpPrototype::Contact* contact, QList<Tp::MediaStreamType> types );
-
- /**
- * Add contacts to the group.
- * Multiple contacts may sharing the same stream. Use this function to invite a contact to this group. The contact will
- * be added to the group after he accepted the invitation.
- * @return Returns true if command was successful.
- */
- bool addContactsToGroup( QList<QPointer<TpPrototype::Contact> > contacts );
-
- /**
- * Remove contacts from the group.
- * Multiple contacts may sharing the same stream. Use this function to remove a contact from this group.
- * @return Returns true if command was successful.
- */
- bool removeContactsFromGroup( QList<QPointer<TpPrototype::Contact> > contacts );
-
- /**
- * Returns a list of contacts that are waiting locally for accaptance.
- * A Contact that is local pending has requested membership of the channel, but the local user of the framework must
- * accept their request before they may join.
- * @return Returns the list of contacts that are waiting for acceptance.
- */
- QList<QPointer<TpPrototype::Contact> > localPendingContacts();
-
- /**
- * Returns the list of members in the group.
- * The StreamedMediaChannel contains a group of members that currently part of the group.
- * @return Returns the list of contacts that are currently group members.
- */
- QList<QPointer<TpPrototype::Contact> > members();
-
- /**
- * Remove streams.
- * Use this function if a certain stream in a channel should be removed. This might be necessary if
- * a video stream should be canceled without terminating the audio channel.
- */
- bool removeStreams( const QList<uint>& streamIds );
-
- /**
- * Request streams for the current channel.
- *
- * Request that streams be established to exchange the given types of
- * media with the given member. In general this will try and establish a
- * bidirectional stream, but on some protocols it may not be possible to
- * indicate to the peer that you would like to receive media, so a
- * send-only stream will be created initially. In the cases where the
- * stream requires remote agreement (eg you wish to receive media from
- * them), the StreamDirectionChanged signal will be emitted with the
- * MEDIA_STREAM_PENDING_REMOTE_SEND flag set, and the signal emitted again
- * with the flag cleared when the remote end has replied.
- *
- * @param types An array of stream types (values of MediaStreamType)
- * @return An array of structs (in the same order as the given stream types)
- * containing:
- * <ul>
- * <li>the stream identifier</li>
- * <li>the contact handle who the stream is with (or 0 if the stream
- * represents more than a single member)</li>
- * <li>the type of the stream</li>
- * <li>the current stream state</li>
- * <li>the current direction of the stream</li>
- * <li>the current pending send flags</li>
- * </ul>
- * The returned list is empty if an error occured.
- *
- */
- Tp::MediaStreamInfoList requestStreams( QList<Tp::MediaStreamType> types );
-
- /**
- * Begins a call to the D-Bus method "ListStreams" on the remote object.
- *
- * Returns an array of structs representing the streams currently active
- * within this channel. Each stream is identified by an unsigned integer
- * which is unique for each stream within the channel.
- *
- * @return
- * An array of structs containing:
- * <ul>
- * <li>the stream identifier</li>
- * <li>the contact handle who the stream is with (or 0 if the stream
- * represents more than a single member)</li>
- * <li>the type of the stream</li>
- * <li>the current stream state</li>
- * <li>the current direction of the stream</li>
- * <li>the current pending send flags</li>
- * </ul>
- * The returned list is empty if an error occured.
- */
- Tp::MediaStreamInfoList listStreams();
-
-signals:
- /**
- * Incoming channel detected.
- * This signal is emitted when a valid incoming channel was detected and all needed interfaces were established successfully.
- * Usually it does not make sense to connect to this signal, because this object might be created or removed without any prior notification. Thus,
- * there is no chance to connect before this signal is emitted.<br>
- * Use ContactManager::signalStreamedMediaChannelOpenedForContact() instead to get informed about new channels!
- * @param contact The contact that contains this StreamedMediaChannel object.
- * @see ContactManager
- */
- void signalIncomingChannel( TpPrototype::Contact* contact );
-
- /**
- * A stream was added.
- * If a new stream was added to this media channel.
- * @param channel The channel where the stream was added to.
- * @param streamId The id of the stream.
- * @param streamType The type of the stream.
- */
- void signalStreamAdded( TpPrototype::StreamedMediaChannel* channel, uint streamId, Tp::MediaStreamType streamType );
-
- /**
- * Stream was removed.
- * This signal is emmitted when a media stream was removed. This may happen on network errors, if the remote contact
- * rejected/removed a stream or if the established connection was closed.
- * @param streamId The id of the stream.
- */
- void signalStreamRemoved( TpPrototype::StreamedMediaChannel* channel, uint streamId );
-
- /**
- * A remote contact was added to the group.
- * This signal has different meaning with regard to the context:
- * <ul><li>Outgoing call: The remote contact accapted the call. <i>addedContact</i> contains the remote contact in this case.</li>
- * </ul>
- * @param addedContact The contact that was removed from the group.
- * @todo: Are there any additional situations?
- */
- void signalContactAdded( TpPrototype::StreamedMediaChannel* channel, TpPrototype::Contact* addedContact );
-
- /**
- * A contact was removed from the channel.
- * This signal has different meaning with regard to the context:
- * <ul><li>Ongoing chat: The remote contact disconnected or closed the chat.</li>
- * <li>Initiating chat: The remote contact rejected the incoming call.</li>
- * <li>Group Chat: A contact was removed from the group.</li>
- * </ul>
- * @param removedContact The contact that was removed from the group.
- */
- void signalContactRemoved( TpPrototype::StreamedMediaChannel* channel, TpPrototype::Contact* removedContact );
-
- /**
- * A stream changed its state
- * @param streamId The ID of the stream as returned by listStreams()
- * @param streamState The state as provided by Tp::MediaStreamInfo
- */
- void signalStreamStateChanged( TpPrototype::StreamedMediaChannel* channel, uint streamID, Tp::MediaStreamState streamState );
-
- /**
- * Emitted when the direction or pending flags of a stream are changed.
- * If the MEDIA_STREAM_PENDING_LOCAL_SEND flag is set, the remote user has
- * requested that we begin sending on this stream. RequestStreamDirection
- * should be called to indicate whether or not this change is acceptable.
- *
- * @param streamID The stream identifier (as defined in ListStreams)
- * @param streamDirection The new stream direction (as defined in listStreams)
- * @param pendingFlags The new pending send flags (as defined in listStreams)
- */
- void signalStreamDirectionChanged( TpPrototype::StreamedMediaChannel* channel, uint streamID, uint streamDirection, uint pendingFlags );
-
- /**
- * Stream error.
- * Emitted when a stream encounters an error.
- * @param streamID The stream identifier (as defined in ListStreams)
- * @param errorCode A stream error number, one of the values of MediaStreamError
- * @param message A string describing the error (for debugging purposes only)
- */
- void signalStreamError( TpPrototype::StreamedMediaChannel* channel, uint streamID, uint errorCode, const QString& message );
-
- /**
- * Local invitation accepted.
- * This signal is accepted if the local contact was added into the group channel
- */
- void signalLocalInvitationAccepted( TpPrototype::StreamedMediaChannel* channel );
-
-
-public slots:
- /**
- * Set output volume.
- * @param streamId The id of the stream as emitted by signalStreamAdded()
- * @param volume The volume (range?)
- */
- void slotSetOutputVolume( uint streamId, uint volume );
-
- /**
- * Mute input.
- * @param streamId The id of the stream as emitted by signalStreamAdded()
- * @param muteState Muted on true.
- * @todo Check whether it is muted if muteState == true and correct API doc if needed.
- */
- void slotMuteInput( uint streamId, bool muteState );
-
- /**
- * Mute output.
- * @param streamId The id of the stream as emitted by signalStreamAdded()
- * @param muteState The volume (range?)
- * @todo Check whether it is muted if muteState == true and correct API doc if needed.
- */
- void slotMuteOutput( uint streamId, bool muteState );
-
- /**
- * Set output Window.
- * @param streamId The id of the stream as emitted by signalStreamAdded()
- * @param windowId The window id of the window that should be used to embed the output.
- * @todo Tell how to obtain a windowId
- */
- void slotSetOutputWindow( uint streamId, uint windowId );
-
- /**
- * Add a preview window.
- * @param windowId The window id of the window that should be used to show the preview image.
- * @see slotRemovePreviewWindow()
- * @todo Tell how to obtain a windowId
- */
- void slotAddPreviewWindow( uint windowId );
-
- /**
- * Remove a preview window.
- * @param windowId The window id of the window that was used to show the preview image.
- * @see slotAddPreviewWindow()
- * @todo Tell how to obtain a windowId
- */
- void slotRemovePreviewWindow( uint windowId );
-
- /**
- * Shutdown.
- * Shuts the stream engine down and deletes all internal interfaces.
- * @todo What does this function really does and how to handle this here?
- */
- void slotShutDown();
-
-protected:
- /**
- * Constructor.
- * Use Contact::streamedMediaChannel() to obtain an object of StreamedMediaChannel.
- */
- StreamedMediaChannel( Contact* contact, Tp::Client::ConnectionInterface* connectionInterface , QObject* parent = NULL );
-
- /**
- * Request a new streamed media channel.
- * This functions needs to be called if a new streamed media channel D-BUS object should be established.
- */
- void requestStreamedMediaChannel( uint handle );
-
- /**
- * Called internally to notify that a new media channel object was stablished on D-BUS.
- */
- void openStreamedMediaChannel( uint handle, uint handleType, const QString& channelPath, const QString& channelType );
-
- /** Connect slots to channel signals */
- void connectSignals();
-
- /** Add members to interal group channel */
- bool addMembers( QList<uint> handles );
-
- /** Remove members from interal group channel */
- bool removeMembers( QList<uint> handles );
-
-protected slots:
- /**
- * Represents the signal "slotStreamAdded" on the remote object.
- */
- void slotStreamAdded(uint streamID, uint contactHandle, uint streamType);
-
- /**
- * Represents the signal "StreamDirectionChanged" on the remote object.
- */
- void slotStreamDirectionChanged(uint streamID, uint streamDirection, uint pendingFlags);
-
- /**
- * Represents the signal "StreamError" on the remote object.
- */
- void slotStreamError(uint streamID, uint errorCode, const QString& message);
-
- /**
- * Represents the signal "StreamRemoved" on the remote object.
- */
- void slotStreamRemoved(uint streamID);
-
- /**
- * Represents the signal "StreamStateChanged" on the remote object.
- */
- void slotStreamStateChanged(uint streamID, uint streamState);
-
- /**
- * Represents the signal "MembersChanged" on the remote object.
- */
- void slotMembersChanged(const QString& message,
- const Tp::UIntList& added,
- const Tp::UIntList& removed,
- const Tp::UIntList& localPending,
- const Tp::UIntList& remotePending,
- uint actor,
- uint reason);
-private:
- StreamedMediaChannelPrivate * const d;
- friend class ContactManager;
- friend class Contact;
-};
-
-} // namespace
-
-#endif // Header guard
diff --git a/TelepathyQt4/Prototype/TpQt4Prototype.pc.in b/TelepathyQt4/Prototype/TpQt4Prototype.pc.in
deleted file mode 100644
index e62070d..0000000
--- a/TelepathyQt4/Prototype/TpQt4Prototype.pc.in
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: TpQt4Prototype
-Description: Transitional Qt4 utility library for the Telepathy framework
-Version: @VERSION@
-Requires.private: QtCore >= 4.5, QtDBus >= 4.5, TelepathyQt4 >= @VERSION@
-Libs: -L${libdir} -ltpqt4-prototype
-Cflags: -I${includedir}/tpqt4-prototype
diff --git a/TelepathyQt4/Prototype/Types b/TelepathyQt4/Prototype/Types
deleted file mode 100644
index 59ee649..0000000
--- a/TelepathyQt4/Prototype/Types
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _TelepathyQt4_Prototype_Types_HEADER_GUARD_
-#define _TelepathyQt4_Prototype_Types_HEADER_GUARD_
-
-#include <TelepathyQt4/Prototype/types.h>
-
-#endif
diff --git a/TelepathyQt4/Prototype/all.xml b/TelepathyQt4/Prototype/all.xml
deleted file mode 100644
index a146300..0000000
--- a/TelepathyQt4/Prototype/all.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<tp:spec
- xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
- xmlns:xi="http://www.w3.org/2001/XInclude">
-
- <tp:title>Prototype/transitional spec extensions</tp:title>
-
-<xi:include href="channel-handler.xml"/>
-<xi:include href="stream-engine.xml"/>
-
-</tp:spec>
diff --git a/TelepathyQt4/Prototype/channel-handler.xml b/TelepathyQt4/Prototype/channel-handler.xml
deleted file mode 100644
index 71c9c7e..0000000
--- a/TelepathyQt4/Prototype/channel-handler.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<tp:spec
- xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
- xmlns:xi="http://www.w3.org/2001/XInclude">
-
-<tp:title>Old ChannelHandler interface</tp:title>
-
-<xi:include href="../../spec/Channel_Handler.xml"/>
-
-</tp:spec>
diff --git a/TelepathyQt4/Prototype/cli-channel-handler.cpp b/TelepathyQt4/Prototype/cli-channel-handler.cpp
deleted file mode 100644
index a2d753c..0000000
--- a/TelepathyQt4/Prototype/cli-channel-handler.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <TelepathyQt4/Prototype/_gen/cli-channel-handler-body.hpp>
-#include <TelepathyQt4/Prototype/_gen/cli-channel-handler.moc.hpp>
diff --git a/TelepathyQt4/Prototype/cli-channel-handler.h b/TelepathyQt4/Prototype/cli-channel-handler.h
deleted file mode 100644
index 0f8575a..0000000
--- a/TelepathyQt4/Prototype/cli-channel-handler.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef _TelepathyQt4_Prototype_cli_channel_handler_h_HEADER_GUARD_
-#define _TelepathyQt4_Prototype_cli_channel_handler_h_HEADER_GUARD_
-
-#include <TelepathyQt4/Prototype/_gen/cli-channel-handler.h>
-
-#endif
diff --git a/TelepathyQt4/Prototype/cli-stream-engine.cpp b/TelepathyQt4/Prototype/cli-stream-engine.cpp
deleted file mode 100644
index a027dcc..0000000
--- a/TelepathyQt4/Prototype/cli-stream-engine.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <TelepathyQt4/Prototype/_gen/cli-stream-engine-body.hpp>
-#include <TelepathyQt4/Prototype/_gen/cli-stream-engine.moc.hpp>
diff --git a/TelepathyQt4/Prototype/cli-stream-engine.h b/TelepathyQt4/Prototype/cli-stream-engine.h
deleted file mode 100644
index 3c1db90..0000000
--- a/TelepathyQt4/Prototype/cli-stream-engine.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef _TelepathyQt4_Prototype_cli_stream_engine_h_HEADER_GUARD_
-#define _TelepathyQt4_Prototype_cli_stream_engine_h_HEADER_GUARD_
-
-#include <TelepathyQt4/Prototype/_gen/cli-stream-engine.h>
-
-#endif
diff --git a/TelepathyQt4/Prototype/constants.h b/TelepathyQt4/Prototype/constants.h
deleted file mode 100644
index 79fd647..0000000
--- a/TelepathyQt4/Prototype/constants.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef _TelepathyQt4_Prototype_constants_h_HEADER_GUARD_
-#define _TelepathyQt4_Prototype_constants_h_HEADER_GUARD_
-
-#include <TelepathyQt4/Prototype/_gen/constants.h>
-
-#endif
diff --git a/TelepathyQt4/Prototype/stream-engine.xml b/TelepathyQt4/Prototype/stream-engine.xml
deleted file mode 100644
index ec33bce..0000000
--- a/TelepathyQt4/Prototype/stream-engine.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<tp:spec
- xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
- xmlns:xi="http://www.w3.org/2001/XInclude">
-
-<tp:title>Private stream engine interface</tp:title>
-
-<xi:include href="Stream_Engine.xml"/>
-
-</tp:spec>
diff --git a/TelepathyQt4/Prototype/types.cpp b/TelepathyQt4/Prototype/types.cpp
deleted file mode 100644
index 12aeb7c..0000000
--- a/TelepathyQt4/Prototype/types.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "_gen/types-body.hpp"
diff --git a/TelepathyQt4/Prototype/types.h b/TelepathyQt4/Prototype/types.h
deleted file mode 100644
index d94e621..0000000
--- a/TelepathyQt4/Prototype/types.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * This file is part of TelepathyQt4
- *
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef _TelepathyQt4_Prototype_types_h_HEADER_GUARD_
-#define _TelepathyQt4_Prototype_types_h_HEADER_GUARD_
-
-#include <TelepathyQt4/Prototype/_gen/types.h>
-
-#endif
diff --git a/configure.ac b/configure.ac
index 311b97d..a66284e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -176,10 +176,6 @@ dnl TP_QT4_LIBS would interfere with dependency tracking, so don't do that
TP_QT4_CFLAGS='-I${top_builddir} -I${top_srcdir}'
AC_SUBST(TP_QT4_CFLAGS)
-dnl Likewise for the prototype library
-PROTO_CFLAGS='-I${top_builddir} -I${top_srcdir}'
-AC_SUBST(PROTO_CFLAGS)
-
dnl Check for telepathy-glib, and for Qt <-> GLib main loop integration:
dnl if we have both, we can run more tests
PKG_CHECK_MODULES(TP_GLIB, [telepathy-glib >= 0.7.28], [have_tp_glib=yes],
@@ -251,8 +247,6 @@ AC_OUTPUT([
Makefile
TelepathyQt4/Makefile
TelepathyQt4/Farsight/Makefile
- TelepathyQt4/Prototype/Makefile
- TelepathyQt4/Prototype/TpQt4Prototype.pc
TelepathyQt4/TelepathyQt4.pc
TelepathyQt4/TelepathyQt4-uninstalled.pc
TelepathyQt4/TelepathyQt4Farsight.pc
@@ -275,6 +269,5 @@ AC_OUTPUT([
tests/lib/echo/Makefile
tests/lib/echo2/Makefile
tests/pinocchio/Makefile
- tests/prototype/Makefile
tools/Makefile
])
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 07fbf2d..c78728a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -2,8 +2,7 @@
SUBDIRS = \
lib \
dbus \
- pinocchio \
- prototype
+ pinocchio
# Standalone tests that don't touch D-Bus
TESTS = \
diff --git a/tests/prototype/Makefile.am b/tests/prototype/Makefile.am
deleted file mode 100644
index 457b894..0000000
--- a/tests/prototype/Makefile.am
+++ /dev/null
@@ -1,61 +0,0 @@
-if HAVE_QTGUI
-
-# Tests for the prototype code, run under their own dbus-daemon.
-
-manual_tests = \
- test-prototype
-
-# test-prototype is not run automatically because it isn't self-contained -
-# it needs Gabble, a local Jabber server with an account already set up, and
-# Mission Control 5
-TESTS =
-noinst_PROGRAMS = \
- $(TESTS) \
- $(manual_tests)
-
-BUILT_SOURCES = \
- _gen/prototype.h.moc
-
-test_prototype_SOURCES = prototype.cpp prototype.h
-
-EXTRA_DIST = avatar.png
-
-AM_CPPFLAGS = \
- -I$(top_srcdir) -I$(top_builddir) \
- $(QTCORE_CFLAGS) \
- $(QTDBUS_CFLAGS) \
- $(QTGUI_CFLAGS) \
- $(QTTEST_CFLAGS)
-
-LDADD = \
- $(QTCORE_LIBS) \
- $(QTDBUS_LIBS) \
- $(QTGUI_LIBS) \
- $(QTTEST_LIBS) \
- $(top_builddir)/TelepathyQt4/libtelepathy-qt4.la \
- $(top_builddir)/TelepathyQt4/Prototype/libtpqt4-prototype.la
-
-AM_CXXFLAGS = \
- $(ERROR_CXXFLAGS)
-
-TESTS_ENV = \
- abs_top_builddir=@abs_top_builddir@ \
- abs_top_srcdir=@abs_top_srcdir@ \
- XDG_DATA_HOME=@abs_top_builddir@/tests \
- XDG_DATA_DIRS=@abs_top_srcdir@/tests
-
-TESTS_ENVIRONMENT = \
- $(TESTS_ENV) \
- sh $(top_srcdir)/tools/with-session-bus.sh --session --
-
-CLEANFILES = \
- $(BUILT_SOURCES)
-
-_gen/%.moc: %
- $(mkdir_p) _gen
- $(MOC) $(AM_CPPFLAGS) -i $< -o $@
-
-distclean-local:
- rm -rf _gen
-
-endif
diff --git a/tests/prototype/avatar.png b/tests/prototype/avatar.png
deleted file mode 100644
index 7e280b74bd206d64da13c77b0d7bda4400fc73c7..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 7657
zcmV<F9Twt=P)<h;3K|Lk000e1NJLTq002M$002M;1^@s6s%dfF00006VoOIv0RI60
z0RN!9r;`8x010qNS#tmY3labT3lag+-G2N403C@*L_t(|oUMCVj2+jR-gi!Ickg at q
zHhbaHB%8Y^iHmkw^2qW!-p0;2V_TVEfPrTaWD?{hK=LrjV}iT{$YX*a0mcZBWa1<q
z+XGv+lkuvBqA2bZcQ(8G?tATZ&iV6DRo%tQrX-J3z`^aVTes@}zkfOZRt$g!fCJF1
znSEyMz-MOb%g-F0t(8va^k|+4-0@^@(Cggl-+Sw3|JLg*5l#XC5`X{@C4Z+&0iewK
zZ4M5AC7(PuvtrF3du^#!KYYAw>Bn<i)g?hWK{)94?_BBM|JChr<ISNGZkW)PUE9*f
z0GI$YZj{XZpZr%RcI{dI%CQ~oSDswzt?ZZ~i-FJ at vhZ5F+P%6_K7Zr#yWeYG{Py|K
z?M?uM0D=UBaOy$7EeKiWwbJ~l;^LG4;Pk#)^$#B_HC{Nj;4Re4WQvHWG10;co!Z*_
z1O3d}y*GZcap^BEDi!((ZDF#a3>Yc}LIYqj%`*0V{LhabKYHL_eEIN&FMa)mVDC%M
zKb=2z^tg89z&_*geL3sN9e1m9`rVbW_4EOk7Ja9CZ6JlG5+bw5G}C_ at 09dj#09tX!
ziTv)<|K#Pz=V$-vH}+rn%-23wn}6Zelh(1Pj_OB`FX>ONDC;P{Fqe1jLw50*1GZo-
zXK;N2Qap37EL|#nkj6ACzvpBB{LqodPW`h#dHRhneC2oc<aZwaG&2i3pm7ZvCzzUn
zYPp0XwKZ)HXXks`vn!LZIvzF8w}=!n4^UGN`fZr!2>`}{kNwN%PcG#D{9BK|_re$c
z;5oDY*o(|8*T6M`#uaj=j)f{?kI^}^)>~b?Q~Ba<FK|2V_}+v_(i8v>(5IIcPL%6Q
zhhBYQ>Aja;I^gkAX`V5!1xODhJz~OR5Dp-1SR6RL(ADnld}n$6z{yXyukTu&jP9)_
zgk~8|Rg7oQ{!PHx)PP*|Kxw{G|KiKDm!5d$<g8|t>mYjr2q%C)0=yB(8v)}kDtV5V
z%s2Qu#(^V)<(EG(>0BH;<JC0)dgk7QjEU-{rBjQ`3)ag|*WR41m5(zvxecfQh-^T5
zfUp7S0Kx^xL5(-?bgiksx$CK;cXvMbxHH*sl#0 at urYp6x-&6w_rqqA#;8*tU$wj~O
zZ0%m5Qal0bTnD@%;0^(22(kwZ?ijF#fa9RfhIl#pQQ^|;AD?X3AG_v^S0 at P_S^p%G
zb4t(UXO?!CS_cl7HgrC+K<rv9b+Q5BFmMkbACLi{0&w!Nuguudx%-v3XAd7S&Ejp}
zAEu5bbvCKPNj2a%l|Bc+8RLdkTsp8~w0A8>_Ze?kpfCWO5y%-cIAg$Z0M7$F9|%LR
zFv3yoKHtkm^_$hb2RDG52 at P4=!UPDeYY;O9ZCEU`4ujJrrpZ_XC<H_VViHVCct|$P
zd_hMg?`xV~n&Vub126&L0`Rf5Gib?!vrg!vFrNW|8I0>Qv#Mw2yQ`pEJ`nhz$%Mgk
z0Y3o32#^XOm9m5a1B#psL$~Gt)DmHM*xD8RR3mgH1(#AXrH6p(vP}{=11x|s4rm-;
z4A2N*fDA1JQ~^|I0w at D00>}ff02qjEF6)6)rameNn@&(g9*-0wHR%JlMu3QbNG9ZK
zfNlV~4v++*2w*@&8bUqC70En+5&#E4ZaeyP-|o3B_xNZ%T%x61mqFL!Yx285=58>n
z25<|AHUQ at uC>)?K=Wu7RQ^7w+N=b9-=0+lY4G-G%M?E$HAW}S>+#B9gPk5bhrd*~j
zpb~7#v%q7gfFq}X>H;uq0%v{%x_lMuavp7}N)b$u2xgl3H27n>- at 7rq*L?NXm4hEY
z@<epSvhq4mei2ywQ=o7h&}%VS{tck<ZxOD)j;q7dxVKS={K=XxWuPZFw-5(a=>yW0
z4T?7R-$yW=-TpLyG`D%Cb??Ya_pcaF&+U{y;T93YTpjrAH-YD011h@#ZUDg$OausS
z+`w6Sff`N}_)aTKXfmgm-+Uf-1~*5Ydsol>^xn&@8_r3JA`TQ+fSDHoYcHTz04)z_
z8l;@yM(+TAc=J=TztM6={hOW;0g{{QQ%jpVKmB+1`|1DF#V7r1la21$nV%V-9^YpB
zL5P6my}+q20M&f}Hvt)fwXY$(aUSQ?A^Z$4igE9jZIA9cc+eEH=Ewj*lfth{w-W~J
zP-$R&e1DERW{Ivcll8#mU9j*HMCZR_bmKqZ-HQtU<;u6z`D+EQee<WC#>Sb3l)(tG
z19Y(EXwv+EG7sbrN*DYCm`_b9r&N at ap(C8i>H4sIVxcCwMltL%L-(NtBe1pekmvpi
zt?z#uKfhVRUuu7-Znt}r_MIO$y4@>HrJ at l48^9=`G3%^_24FS}#!R^#-=U+`+ujS6
z#%PD-v at h}T`WZBC{Ti1p4e|Qb=jexbeowuBi~GIXKO1b^|7FK at yMyG0DF8mUw!kz3
zV^dN!wpm#<H4&Rr4zc|f0<Wj3z?S{ok at DU0$7Y&g#jx+LVtDZkTR(da=P!2g{n2yu
zWBEzBHt^imogX!ujdz+sFzzLcj{yu5AW}hv00aYY5I~i4V}5?=)XBx=m!GLEJ$AfQ
zt1RR#VKPYWg(kd7B;7$X>^I-DTg`X-w%zP2Df(cn$GF~Sn$cxk?{nQ6b3JEs-Ez5R
z3Z_|tX$CRI6=R%%aRva4F$Qo379SZ6;iQB?Bn^^bUWu?sDy(SSn6Fg!9-ONkIar?A
zy}Ot%R0>=f#E5xPC)af&cXZe7wchKm-~Uy^^ZFek)dbK1&<4;1&;>9^Kyd+t48UFh
z6#!Mn_ at ZUaEZ1r)D>Jo~6~ijeamEWuNfU)?F2As3mFs2BbtbuP2(Fnz)6Ix!M#MEM
zV!9cTW+;N86xWD|gBS;aaey&J(1<Zc#A0R{;{@<c02tRm;FJKN01i@`0yI*j$uL0c
zt-rqGy#J$4vA8g2S(OrF+>pX2&+P=m;T_wyo5Lt_M+u|d%xYzrAE#QNV=FLliPXsV
z2aQ(ieAMk;8*{GL8RM0F{ovxMFZ`oppZeXGYKNE0nrXy-g at b_@gCqu_G!hC31cN64
zHv;n_LMRv_34{`e1Q05QP!d#<LlFQXKoOvbK`KB>KoTG%AXNNYApo6+j7o3%-R`yZ
zPV4+SW17VnGl&#P8HGwk9+9#$Hs4QFfBXm^rS#;VAW;bufTolnrGx_Dg7KNTg+sF^
zpF2@}<-`uXY6vJIC@?6-00{(AhbMIwN=|Obz!f1<3|>f(ArORs8v<TPa6`sINkkNb
zpb|GpgiSEgzZGqPLqtq)KzVMiRy(v~GP>Jw-S!0W)+!S|yoAw7!gN0)@zh79bqh5O
z08g9{k4XZHZ_H$&Iv4Gz7d4YJ2nB$#7y!vYV31%?vE-PLgh&!X0YnlM2w-~coMG5q
zW4P5Jv_=%)Gjk9TLrMq(GzM at T7>s-fN9AVs{N8TU`nmA#{bY?uriBkb5#l7#fJsLB
z*-$-O!6H3DBS at Z|CNF8}NHE5vX69YSIYq=l(Blo10HqitaY*7&V2Shy3H<<wF&0PB
z>C!ncUk3a96C7R${P42G*?S7~Awe?N2o#LTp7^i|3kKIL4Pa3s*>t6nPt9PQ`R;-3
zFRK9}Bk^ou1Mw$=ZsvU=4xwU3H`yZwNr*vE41!{t6$(&9aS%XB5Rjx4Tm!B)6nc)r
zrykSr&1W@)0=U-v5D*w3hD|7`lMa$jFbV;cCSEDyW5g<-0+8Chmtj6inFr#1S!F;-
z4?=1RjOk3XLLvsKI7tHINqnQgpa>8$c69M#5HfaXj3xe`C*fG4&H_Ml41D)Ji9dNs
z!<SER^c-N|ZjS&1AP~Xp+$W9aiK(&l{f<whB5bLCD)CeUrlr1Z%~HpM5nIZ9CWv7s
z*Q`i_kx;SJdFDc?0HI==4 at K-F7G{8Doxu(mF0T^;5RzRV8sB=59|3ROC4B8P$DUaR
zJD_dTMaBT>hj4~{GL0Nj)DodTOl>&@!NHd8+X?d?wrT*W<R2*5>exO>Nu#%bG43->
zmy*Cj8K>Qw0MOQU6$*wRivNCc7su`@Lvuv9*(5l$6$66<I@?MP+hYRfK)nd`#=yV<
zMlQh%06&bc$>o5(GZT2D35wbbg_C9!hW0c7sV1b1Pj7kKmh4jifUV+1w%#wmSj2UM
zh&UnvkRosv7u1Pj4TvNV$k at Y60+foky-5f#4KR$P0MBA^Dk1~|7&<`I2fPqi?E!Dy
z0fOjZEzp^QnDn4RBGZ!O`JGToKXqg&t*M%)MUQM{DwRC4%%=dPCs_uB^arucFb#qL
zUoe1TRR-eyISW9PFn?y1z?j0s2P6 at 6Jx=4f1_Xkz-Xq-Y0(}QqEHeZG7zY3}g1$}V
zV5UNd8XZ!ClV*A{@VkLhBDLpinQNNyRO(r^e-PZv-`P^O+WKS!a3&<+C04{);sn#k
zE%E$7tQDOJK at vg8q`JugrhvwXaBTx<j$#b}#kCAWiyffOV<-6#0A>Vd(1pe=VzMU!
zuNNc^Fl}^Xna*~CHX9(@F+UB!^s)H^#u*a|%#GqeeQUp@&BzT%q1rMJ&H*lgu>)M*
zAY5+|f+&s^^h6_`-_J2{fz_UZ#%SBxQ8nkG*&UF{Imw_K2EjPB?MJn~K9unf0wAji
z1jKbgMPNc?YDsL<q#x=!XbdoP1}7j~-H2CbM359a!1Mug1%_9SaQyPRLUXV^F}eYm
zkqh7UP|yo1n6v^R+-y5;x(_(*?6N$4Bmf>b7~_a{at208Fq1GIU$Av;>OfvTtf7<x
zetb#c-8%|S7;gg_0LJ1#zhDA?=V=X$fbX1 at kc#4R<kV4{0o+j^q3cn#V9Alw^rei_
zkT%tVtj+&M4cZR{AO?YP&KPtKm^?if+kP0u-hbi~dNwfjfUlec=1OtIC>4Qo0`XY#
zoW+v={Bee-_cHwZzY*w+)aHGskJ&unthR|MO=$>(?{_^SnRRy4PVXZz{!svk3m05t
zq-$&_Id1m|GK%l(g at 79poB(hFVC2OhSUSTGFG+m%xQ5k{f-(R~GDiaN)E<tnJ`oq6
zzx}qr<(7hBK7s%aR7wgPjRrJs5=Fx(4900SC%Yc%`hHXpK9UBIuJLZb*!`Boa1^`y
zG*wOGeM)Y|1n~Yk!-?G-=T;Sn5z^q97+{zTKfOt~xF%tH1RVqeacsd7rZpCST6w?}
zHb%_`<%}66!k!;RP8!~Bx8F~DetZ}R9|k~NIpv(^3@|H4(4!9qwVY=-y`SNKzZaqF
z5ej)0Q%VdHz*`#x4GKBNFjE1_I-zU;1&hE)f<b@@AAxHla!0uS_5~Vu`)X-NU4-Md
zD`l8Qc<Gvs at gG%s|62h708HcH6^kK9gew1F05py8>+1sdCqT|(i1Z{_QVc{4#DKiT
z at c5iWUGpI(V>rVxyjCBBRuiLc5B6|K<KYOd?UUyzl`kHaCW|7+ZQDdLEo@|yoXrXk
z{y+GDhid0K*LXG0Fq<QY93I-MDarN0;)ri76lQh6QVJERqaPSpoiMl&gTaBlCBWLa
zfWQ9U>lk&r6#71-1PFNoFMw-B(v6+UFiffyEIDI}h`h^V$6o6bsce>)&F`m^x^#E`
zz?R%J0Bm{@5oaJ)GJwS#K@?Q%&=`wjOr;={gck(xT_27;!LT>Pcre0vI6-CiKAb*r
z0=BZy9mHr62xB`!w`&kn`zT+^k<K+TG?2kU#StovY)N7gK{$b!H0^HhV$-o3ZN!;g
zHowod;%SPHtUy075}amyvxz}6#IUhC9`;7j%HerkhJ^9N$Dn6Zr_n^W-Nm5YMZeRA
zJ)FR{J$SyNDB>WN$BumgUY^^<kIyfm=MgkU$ZLe<L;JAzNDslrhSI`yDZ{>$&On60
zFbu<CAVNEcqKPYnXG`IYqsZ$M$v)zAH(TG!+C9&#Y?7Bf9spvR at w7W*g0Uh9MKD$^
z&K*5j-}~%q)w%soxIPsJ{V_t{V<I9DOh&u_O)Eju3(z$ahNhFL0XmnYYayzKcIhAg
z>dRV>&7ffuD!Rmz^9)YAi~swbABDGm`5*1c;D#@S9}r28NO?r$0hHGG9Bef=(lr3s
z2w*lqV}P>l?+?lc9?AwEkhoEt&&?kC;#_WK-vKZ+FZ at BtAKc41jq4W;hYG%Nc%M}J
z3 at dN)Vp-z`2h({3UHRY$2(lwpG?pru$jI+WCz?pFH)FkRIF*-v_mk${r5e15L1z-D
zj?JR<+9&n at B|FCTU;S6x?p$?1D(y0*pOehznCrPPH+wjjtL<Mf3Uf<bFM1?{uHV18
zG1+*tFGD94B*%lP at bnHrsRpFIa(&0~Z`A6Czx13rSN&XW?*3_BYSlFuOpNM*drwYy
z$73uqOG3gTX>%ELm<Wdyg?$yc9Vvt>qHq*Np)I5gg_OQfN|J6Aj2(MEwy^8OXXcMS
z`<!v&se^2xo<l(s*pVk(y+2al`R=dWx4-wF)`s_f*(4c`Gfb!TJ=-iTiMiunUoI^_
z_ZTl0=5@=+bFL{8d>BpKi*Dn>FS=L$+eNo?X at p0I$`5D+17LDJZ!VnpqaBOSeEuKS
z_V&KI{KV?+XO7Mp`)8J!U;;OXxA6X*fx7)}Eo{HR+MSC(ZA`jXg3upuDMKhFK_ny*
zMe(G<1I<wapcRS><%L}@Eo<d{^XA;n{QhGHv=gWHv12Q9Z0~#?w&e8vpWh08{(~Q^
zt-kwLH|*A>btQr!fC(7)$~&Ja%s=(VPtC8aJpcIqQtiayC9PI2!44E|Z4Bt#%}&_u
z%5}eW|Mj(B|GWP&**Mz-)by<2LkW`xz?y&jwc7m2ue~;Z>c*cv^J-`5%O{@JpQ%5`
zmaJWvw-&KnS;me<i$^=J83QH?(Ri7L_b&}RyWuD$LL!;kYbvctMtTkaR|wx$(szov
z8HLc$*6%dgxwF at C=Ikw8xVBEM<^ZKiUaKsvl&N&ILag8fPNyS7XPlosWGp=Wt>^YU
zcJyPv|A_<jZ+zk)Kec}ri?eymRtl)qY7DuWzHW<Zz;i35(jIc#SDTUFPv?}f&hG&~
zpyg%{mX}U_>!r$(@jpKB>bd3TSDs`$%tbilVxaoysvZVvzyb)MNa&O<X`#26=i}XS
zym7v-lt{Ovl<5(+x-pp=J=sw>nFM}!WO8`rLRIGVlJad*>#Kcr<>Fm+?ff;_yK_}~
z{WUHXEY5SD2!`z)kAMBZ!eh_B^63{>>YsgTH?vF~0}p6SfVC0Om at o_i6BAixw|h>Z
zUNCnsUk>fg<u0j6ZNvChQM9`EmATSV`EzRjUmmFJDX|thXa`+{2oX_;fI=2hh=?M%
z<RPe!5FUTqtgn4(=j86mR%hePSSgXM#(IeZ%kI$}fT5Hy?a6x2b34s^=X||XS)MD;
ztjyJm%QMWV=LPbX^c2^~5e5IAD?>L|D(_k-?>Tj9ac6aI|L%F#b~wg8pyL3|3DC8H
zjzg^H0)5{iuW$hEpu1~!|MQ<5t-aA2HqKs8oMOs!w(&!{S(;lg>!V|X#p~7v?LpJ;
zBcceQ3J|K0MTj7jgd%}Jh44ZbVO6n(J+J2LOV89sz4teKukT^2A(^VZp8+6swibZA
zl;PO6H-?VWYW2I9%lX1wxlmjz<O at qhtFU0{=B!~BmXNb%5Hh(dSJ|<L<tkd&v#@T*
zOt)=fT^H#4z$gHQ5#R}8fo=ijf-zrl_m->s4h|b<+X>^@>hNZBMCV-1Qm!)>l^uS?
zz5+0Uhy+9^n3M_%D(><y1*H^75%fGDX1csk-d)P)W)0sPL>V8D?Zu at JLL!Ci;6sr}
zPQq|92*Zgr9<7?1W at x%m&<vx*O|znzR+X1_J-b)xX1*H~aiPI5^nt!hY#0E;5U>T{
zB@=Rz126%VtAa;XDPO4X22f3yPOC@{&IuBc9>FmbkI)+pA>+Oli_=&Fae#9MP7F$_
zxGJO-VCZ=;vtXKLNoR}+B1${V*`8c#21v{xo&Lxt*A)^#EFx(LA-NDf^SwR*D8 at 9t
zP~BU|=_cJAXc*|gBqC-Dz>`2g0Mh|IA6Kd*l5Vogz_?~;nlTGtCZWT{RtA}l=14tq
zMxpNQcTA^9p4E>>7A%I@{0=PS7Eshm2;iY98tA$mkS}2dWpH~QoE$LD(y%jCtpE=<
zCXg`$6I+Rlm(dCnTLBCQz=)(Sf`P5cC~|xk<B?*K#vmEM3}9&ncya+)sl_#fa~<HF
z4q&uxm_ianVB*0!!R!=UJSOM$ZjPhI3-?R?BS*(OR&`~79jP6|H!FV+PZ-BB!)D-;
zi}&OOe0%b3+-hGz!QKxvXBCTDkrZLJ_MUB0q%G^z4AO|xz*a#cJ6 at NLv1KR8%*bx^
zxbKeh#c_2&ArpoLrUQrSz at ME2UfBc87vgHu5AG1|{vv`Iw!vLT3V%!q<GHD4Y=W%Y
z&2#qX#*6Rl-1ph1O3Rn#{hed{e)SLV4fF4!fII+z7@^E6_yvB2rrkm5>MNu-DRk|Y
z7lxC7h_c>w8i>^Sq-GE%M5Hr(`V?_S=3LGn-ff_L=i2W5mH8m-7RIF|%vCu4^aSwt
zk24hXxCgOj1J~LS(720587k3U^}NYih=*qc9~k1)lnCkwT`KCQ7pvv{dqv^C#tR|l
zj5<O@=u;1u#ASSU^gr>|t#?qp^f at YAI4xMa;WpOZX!d&VH>3;)*m8bp9G`VMSuM%d
z?WY0D*7{?UR)UIF)u`51b{2DN#v!g*1p_A+G%S{Yjt9KgBK+qw4u10XJ(LGMDs{U4
zWc`g^bK~qr5R8Y|3ahhy!w7)T0g|K6rB3(K_kOm!^!1gw-XHD1dGwd&zuEV%QJyJ6
zF@;fYj9|5j!mY1T?&fi+wfe!J`~JAwz1oi=*UK=GElo`~DzfQm)?^+vCujnYN(tUw
zf9w59ZRMRA_G0k}r^VL&mi`yx8T`%VDx{F;bO-R-8<>qi6(@*-)+M{syfAd#t~Ukz
zLm8n4V3w57oYB2NcRfEhUa`#eSMvIulUi_j3C{Ti=<mHk=H*wUb!S$v&YIV6ygRsi
z_y4R92Dh6;DxJK_&f;u4jxx2>6meN?$P&!LU=&48%PA<Rk}MVHpc^IM;eM+D*=nLV
zoT$1-GT&?ZLF2v2>h0H??e at i{5N<a^R~n;a+vY+;yiFKN3GUiWA)U5o_`cG{7U!L^
z(mQp*y9m*52f^T$-P$<QUt4>lH5lA(D<#q)q;#bwknRB6b!xH&i7Xg2bzORJA_d<c
zD9>*Dy6}YIyHa;tWx9bdCzDVcbpzSE=?)ubM;mKzcG~TW%_wpP*qRYa>3ax(?2wcf
z1fyPK<DDDh(P~hw?(66Bv-7%cm57uTg^sfArZ*a`j)Pz{R!R(~n9fQ)Tce+j#k0(3
z%U0P}Y$)@+hIn#qI2_)-9|R++v at Z>c#rfT)S*`<Ah=j*Iw<ji(b<cIX6CwOGC&~Jy
zheqU(%$_eGp7$>Um__`8K at C7X(T)=0z$Go8r7s^ihzAeT)k{9JIYAbTM^$R4Yj^1^
z#pX_s&{s+5swQ;KCg)1YHECllOrC9HYfiAA(3cfh03gb0fS&v)ovudmox2SH=`=>x
z_HBG{q4H6c+3fe(83lm{$LCWAnH}azqt7e=*?GaNX--dxZ4OF`<Rs7BBy~zYwq7{M
z0+2>~+s))mtJz1c(Pyqp%_hy~vn#zW)kGU{Fr{VAr}SlK2B(L)<7^OHp=x?$L)rqi
zBDFMl$bRomt%v6DrWpIEAY^NI(-UmjxuBGJ6I<Yj%=f8KQu@;B(54Sar^K?Yj%-}-
zV=IzMO(UJl$%eb>=QQ)biS(zB^tWjgnbMe at 3-U7bWxt;e$G2;vJv1js+dRO>);mC1
z0Mh+>`c<???fZWl=2Kdx&u8h&<_}o_vh+Qwfx1}~-AoLy{cA4S3=NqdKPvj0-qU}Z
zW4c+hUDTKrP8Rf(u1C?g3BYz8p)45FufI)4a?_#aZ>#zr210ga>B}BjA*reLfM)(b
Xmn<&<kL+=%00000NkvXXu0mjfPH1k~
diff --git a/tests/prototype/prototype.cpp b/tests/prototype/prototype.cpp
deleted file mode 100644
index 6fa4e4b..0000000
--- a/tests/prototype/prototype.cpp
+++ /dev/null
@@ -1,1394 +0,0 @@
-#include "prototype.h"
-
-#include <QtDBus/QDBusConnection>
-#include <QtDBus/QDBusConnectionInterface>
-#include <QtDBus/QDBusError>
-#include <QtDBus/QDBusPendingReply>
-#include <QtDBus/QDBusReply>
-
-#include <QtGui/QPixmap>
-
-#include <QtTest/QSignalSpy>
-
-#include <TelepathyQt4/Account>
-#include <TelepathyQt4/AccountManager>
-#include <TelepathyQt4/ConnectionManager>
-#include <TelepathyQt4/Connection>
-#include <TelepathyQt4/Types>
-
-#include <TelepathyQt4/Prototype/Account.h>
-#include <TelepathyQt4/Prototype/AccountManager.h>
-#include <TelepathyQt4/Prototype/AvatarManager.h>
-#include <TelepathyQt4/Prototype/CapabilitiesManager.h>
-#include <TelepathyQt4/Prototype/ChatChannel.h>
-#include <TelepathyQt4/Prototype/Connection.h>
-#include <TelepathyQt4/Prototype/ConnectionFacade.h>
-#include <TelepathyQt4/Prototype/Contact.h>
-#include <TelepathyQt4/Prototype/ContactManager.h>
-#include <TelepathyQt4/Prototype/PresenceManager.h>
-#include <TelepathyQt4/Prototype/StreamedMediaChannel.h>
-
-// #define ENABLE_DEBUG_OUTPUT_
-// #define DO_INTERACTIVE_TESTS_ // Needs user interaction
-
-// TODO: Add cleanup that removes all accounts. Start own DBUS for testing to have a real clean starting point
-
-namespace
-{
- const char* g_displayName = "DisplayName";
- const char* g_newResourceName = "New Resource Name";
-
- /** Waits for count signals. Returns true if signals were received. False on timeout */
- bool waitForSignal( const QSignalSpy* spy, int count = 1 )
- {
- const int max_loop = 10;
- int loop_count = 0;
- while ( ( loop_count < max_loop )
- && ( count != spy->count() ) )
- {
- ++loop_count;
- QTest::qWait( 1000 );
- }
- return ( loop_count < max_loop );
- }
-
- /** */
- bool compareType( int pos, QList<QVariant>& paramList, const QVariant compareType )
- {
- if ( !( paramList.at(pos).isValid() & compareType.isValid() ) )
- { return false; }
-
- if ( !paramList.at(pos).type() == compareType.type() )
- { return false; }
-
- else if (! (paramList.at(pos) == compareType) )
- { return false; }
- else
- { return true; }
- }
-
- /** Workaround for varying strictness of object path <-> string conversion
- * in different Qt 4.5 snapshots */
- QStringList objectPathListToStringList(Tp::ObjectPathList list)
- {
- QStringList ret;
- // qDebug() << __PRETTY_FUNCTION__ << "ListCount: " << list.count();
- foreach (QDBusObjectPath p, list)
- {
- ret << p.path();
- }
- return ret;
- }
-
- QStringList validAccounts()
- {
- Tp::registerTypes();
- Tp::Client::DBus::PropertiesInterface* m_propertiesInterface = new Tp::Client::DBus::PropertiesInterface(
- "org.freedesktop.Telepathy.AccountManager",
- "/org.freedesktop.Telepathy/AccountManager",
- NULL );
- QDBusPendingReply<QDBusVariant> get = m_propertiesInterface->Get( "org.freedesktop.Telepathy.AccountManager", "ValidAccounts");
- get.waitForFinished();
-
- if (!get.isValid())
- {
- qWarning().nospace() << get.error().name() << ": "
- << get.error().message();
- return QStringList();
- }
-
- Tp::ObjectPathList object_path_list_valid = qdbus_cast<Tp::ObjectPathList>( get.value().variant());
-
- if (object_path_list_valid.size() == 0)
- {
- // maybe the AccountManager is buggy, like Mission Control
- // 5.0.beta45, and returns an array of strings rather than
- // an array of object paths?
-
- QStringList wronglyTypedPaths = qdbus_cast<QStringList>( get.value().variant() );
-
- if (wronglyTypedPaths.size() > 0)
- {
- qWarning() << "AccountManager returned wrong type "
- "(expected 'ao', got 'as'); workaround active";
-
- Q_FOREACH (QString path, wronglyTypedPaths)
- {
- object_path_list_valid << QDBusObjectPath(path);
- }
- }
- }
- return objectPathListToStringList( object_path_list_valid );
- }
-}
-
-void UnitTests::initTestCase()
-{
-}
-
-
-void UnitTests::testMissionControlBindings()
-{
- QSKIP( "The interface NMC4Interface is not included and therefore cannot be tested!", SkipAll );
-#if 0 // The interface is currently not created. We don't use it anywhere..
- Tp::Client::NMC4Interface mission_control( "org.freedesktop.Telepathy.MissionControl", "/org.freedesktop.Telepathy/MissionControl", this );
-
- QDBusPendingReply<uint> reply = mission_control.GetPresenceActual();
- reply.waitForFinished();
-
- QVERIFY2( reply.isFinished(),
- "Reply from GetPresenceActual() is not finished but should be.." );
-
- QDBusError error = reply.error();
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "GetPresenceActual: error type:" << error.type()
- << "GetPresenceActual: error name:" << error.name();
-#endif
-
- QVERIFY2( reply.isValid(),
- "Received invalid reply to GetPresenceActual()." );
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "GetPresenceActual: Return: " << reply.value();
-#endif
-
- QDBusPendingReply<QString, QDBusObjectPath> reply2 = mission_control.GetConnection( "blah" );
- reply2.waitForFinished();
-
- QVERIFY2( reply2.isFinished(),
- "Reply from GetConnection() is not finished but should be.." );
-
- error = reply2.error();
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "GetConnection: error type:" << error.type()
- << "GetConnection: error name:" << error.name();
-
- qDebug() << "GetPresenceActual: Value : " << reply2.value();
-#endif
-
- QVERIFY( reply2.value() == QString( "No such account blah" ) );
-
-#endif
-}
-
-void UnitTests::testConnectToJabberServer()
-{
- Tp::registerTypes();
- // 1. Connect to connection manager
- Tp::Client::ConnectionManagerInterface cm_interface( "org.freedesktop.Telepathy.ConnectionManager.gabble",
- "/org.freedesktop.Telepathy/ConnectionManager/gabble",
- this );
-
-
- QVariantMap parameter_map;
- parameter_map.insert( "account", "basyskom at localhost" );
- parameter_map.insert( "password", "basyskom" );
- parameter_map.insert( "server", "localhost" );
- parameter_map.insert( "resource", "Tp" );
- parameter_map.insert( "port", static_cast<uint>(5222) );
-
- // 2. Request a connection to the Jabber server
- QDBusPendingReply<QString, QDBusObjectPath> reply = cm_interface.RequestConnection( "jabber",
- parameter_map );
-
- reply.waitForFinished();
-
- if ( !reply.isValid() )
- {
- QDBusError error = reply.error();
-
- qDebug() << "RequestConnection: error type:" << error.type()
- << "RequestConnection: error name:" << error.name();
- }
-
- QVERIFY2( reply.isValid(),
- "Received invalid reply to CreateAccount()." );
-
- QString connection_service_name = reply.argumentAt<0>();
- QDBusObjectPath connection_object_path = reply.argumentAt<1>();
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Connection service name: " << connection_service_name;
- qDebug() << "Connection object path : " << connection_object_path.path();
-#endif
-
- Tp::Client::ConnectionInterface connection_interface( connection_service_name,
- connection_object_path.path(),
- this );
-
- // :SX
- QDBusPendingReply<> connection_connect_reply = connection_interface.Connect();
- connection_connect_reply.waitForFinished();
-
- if ( !connection_connect_reply.isValid() )
- {
- QDBusError error = connection_connect_reply.error();
-
- qDebug() << "Connect: error type:" << error.type()
- << "Connect: error name:" << error.name();
- }
-
- QVERIFY2( connection_connect_reply.isValid(),
- "Received invalid reply to Connect()." );
-
- QTest::qWait( 1000 );
-
- QDBusPendingReply<Tp::ChannelInfoList> channel_info_list_reply = connection_interface.ListChannels();
- channel_info_list_reply.waitForFinished();
-
- if ( !channel_info_list_reply.isValid() )
- {
- QDBusError error = channel_info_list_reply.error();
-
- qDebug() << "ListChannels: error type:" << error.type()
- << "ListChannels: error name:" << error.name();
- }
-
- QVERIFY2( channel_info_list_reply.isValid(),
- "Received invalid reply to ListChannels()." );
-
-#if 0
- qDebug() << "Available channels:";
- Tp::ChannelInfoList channel_list = channel_info_list_reply.value();
- foreach( Tp::ChannelInfo channel, channel_list )
- {
- qDebug() << "Channel: " << channel.channel.path();
- qDebug() << "Type : " << channel.channelType;
- qDebug() << "H. Type: " << channel.handleType;
- qDebug() << "Handle : " << channel.handle;
- }
-#endif
-
- // x. Disconnect from jabber server
- QDBusPendingReply<> connection_reply = connection_interface.Disconnect();
-
- connection_reply.waitForFinished();
-
- if ( !connection_reply.isValid() )
- {
- QDBusError error = connection_reply.error();
-
- qDebug() << "Disconnect: error type:" << error.type()
- << "Disconnect: error name:" << error.name();
- }
-
- QVERIFY2( connection_reply.isValid(),
- "Received invalid reply to CreateAccount()." );
-
-}
-
-// Precondition: gabble is installed
-// This simple test just checks whether gabble is available.
-void UnitTests::testRequestingOfConnectionManagers()
-{
- QStringList cm_names = TpPrototype::ConnectionFacade::instance()->listOfConnectionManagers();
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Available CMs:" << cm_names;
-#endif
- QVERIFY2( cm_names.count() != 0, "No connection managers registered on the bus!" );
- QVERIFY2( cm_names.contains( "gabble" ), "No gabble found!" );
-}
-
-void UnitTests::testAccountManager_createAccount()
-{
- QVariantMap parameter_map;
- parameter_map.insert( "account", "basyskom at localhost" );
- parameter_map.insert( "password", "basyskom" );
- parameter_map.insert( "server", "localhost" );
- parameter_map.insert( "resource", "Tp" );
- parameter_map.insert( "port", static_cast<uint>(5222) );
-
- Tp::registerTypes();
- Tp::Client::AccountManagerInterface accountmanager_interface( "org.freedesktop.Telepathy.AccountManager",
- "/org.freedesktop.Telepathy/AccountManager",
- this );
-
- QSignalSpy spy_validity_changed( &accountmanager_interface, SIGNAL( AccountValidityChanged( const QDBusObjectPath&, bool ) ) );
- QCOMPARE( spy_validity_changed.isValid(), true );
-
- QDBusPendingReply<QDBusObjectPath> create_reply = accountmanager_interface.CreateAccount( "gabble", "jabber", g_displayName, parameter_map, QVariantMap() );
- create_reply.waitForFinished();
-
- if ( !create_reply.isValid() )
- {
- QDBusError error = create_reply.error();
-
- qDebug() << "Disconnect: error type:" << error.type()
- << "Disconnect: error name:" << error.name();
- }
-
- QVERIFY2( create_reply.isValid(),
- "Received invalid reply to CreateAccount()." );
-
-
- QTest::qWait( 2000 );
- QEXPECT_FAIL( "", "There is currently no signal emitted on AccountInterface::CreateAccount(). This needs to be analyzed further", Continue );
- QVERIFY2( spy_validity_changed.count() == 1, "CreateAccount does not emits the signal AccountValidityChanged!" );
-}
-
-
-
-// Precodition: testAcountManager_createAccount() was called to create accounts!
-#define ENABLE_DEBUG_OUTPUT_
-void UnitTests::testAccountManager_listAccount()
-{
- QStringList object_path_list_valid = validAccounts();
-
- QVERIFY2( object_path_list_valid.count() > 0, "No accounts found. Possible reason: testAcountManager_createAccount() was not called before!" );
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Num of Accounts: " << object_path_list_valid.count();
- foreach( QString path, object_path_list_valid )
- {
- qDebug() << "Valid Accounts : " << path;
- }
-#endif
-
-#if 0 // Reenable this after a real cleanup of accounts is implemented. Otherwise this may fail without be an error!
- QStringList object_path_list_invalid = accountmanager_interface.InvalidAccounts();
- QVERIFY( object_path_list_invalid.count() == 0 );
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Num of Invalid Accounts: " << object_path_list_invalid.count();
- foreach( QString path, object_path_list_invalid )
- {
- qDebug() << "Invalid Accounts : " << path;
- }
-#endif // ENABLE_DEBUG_OUTPUT_
-#endif // 0
-}
-
-void UnitTests::testAccountManager_showProperties()
-{
- Tp::registerTypes();
- QStringList object_path_list_valid = validAccounts();
- QVERIFY2( object_path_list_valid.count() > 0, "No accounts found. Possible reason: testAcountManager_createAccount() was not called before!" );
- bool found_correct_display_name = false;
- foreach( QString path, object_path_list_valid )
- {
- Tp::Client::AccountInterface account_interface( "org.freedesktop.Telepathy.AccountManager",
- path,
- this );
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "DisplayName :" << account_interface.DisplayName();
- qDebug() << "Icon :" << account_interface.Icon();
- qDebug() << "Account Valid :" << account_interface.Valid();
- qDebug() << "Account Enabled :" << account_interface.Enabled();
- qDebug() << "Nickname :" << account_interface.Nickname();
- qDebug() << "Parameters :" << account_interface.Parameters();
- Tp::SimplePresence automatic_presence = account_interface.AutomaticPresence();
- qDebug() << "* Auto Presence type :" << automatic_presence.type;
- qDebug() << "* Auto Presence status :" << automatic_presence.status;
- qDebug() << "Connection :" << account_interface.Connection().path();
- qDebug() << "ConnectionStatus:" << account_interface.ConnectionStatus();
- qDebug() << "Connect. Reason :" << account_interface.ConnectionStatusReason();
- Tp::SimplePresence current_presence = account_interface.CurrentPresence();
- qDebug() << "* Current Presence type :" << current_presence.type;
- qDebug() << "* Current Presence status :" << current_presence.status;
- qDebug() << "Auto Connect :" << account_interface.ConnectAutomatically();
- Tp::SimplePresence requested_presence = account_interface.RequestedPresence();
- qDebug() << "* Requested Presence type :" << requested_presence.type;
- qDebug() << "* Requested Presence status :" << requested_presence.status;
- qDebug() << "Normalized Name :" << account_interface.NormalizedName();
-#endif
- if ( account_interface.DisplayName() == g_displayName )
- found_correct_display_name = true;
- }
- // Check whether the expected account was found
- QVERIFY( found_correct_display_name );
-
-}
-
-// Precondition: testAcountManager_createAccount() was called to create accounts!
-void UnitTests::testAccountManager_removeAccount()
-{
- {
- Tp::Client::AccountManagerInterface accountmanager_interface( "org.freedesktop.Telepathy.AccountManager",
- "/org.freedesktop.Telepathy/AccountManager",
- this );
- Tp::registerTypes();
- QStringList object_path_list_valid = objectPathListToStringList(accountmanager_interface.ValidAccounts());
- QVERIFY2( object_path_list_valid.count() > 0, "No accounts found. Possible reason: testAcountManager_createAccount() was not called before!" );
-
- foreach( QString path, object_path_list_valid )
- {
- Tp::Client::AccountInterface account_interface( "org.freedesktop.Telepathy.AccountManager",
- path,
- this );
-
-#if 1 // Disable to remove all accounts
- // Ignore all accounts that were not created by us
- if ( account_interface.DisplayName() != g_displayName )
- { continue; }
-#endif
-
- QSignalSpy spy_removed( &account_interface, SIGNAL( Removed() ) );
- QCOMPARE( spy_removed.isValid(), true );
-
- QDBusPendingReply<> remove_reply = account_interface.Remove();
- remove_reply.waitForFinished();
-
- if ( !remove_reply.isValid() )
- {
- QDBusError error = remove_reply.error();
-
- qDebug() << "Remove: error type:" << error.type()
- << "Remove: error name:" << error.name();
- }
-
- QVERIFY2( remove_reply.isValid(),
- "Received invalid reply to AccountInterface::Remove()." );
-
- QTest::qWait( 2000 );
-
- QEXPECT_FAIL( "", "There is currently no signal emitted on AccountInterface::Remove(). This needs to be analyzed further!", Continue );
- QVERIFY2( spy_removed.count() == 1, "RemoveAccount does not emits the signal Removed()!" );
- }
- }
- {
- // Check whether there are really no accounts left..
- Tp::Client::AccountManagerInterface accountmanager_interface( "org.freedesktop.Telepathy.AccountManager",
- "/org.freedesktop.Telepathy/AccountManager",
- this );
- Tp::registerTypes();
- QStringList object_path_list_valid = objectPathListToStringList(accountmanager_interface.ValidAccounts());
- int accounts_left = 0;
- foreach( QString path, object_path_list_valid )
- {
- Tp::Client::AccountInterface account_interface( "org.freedesktop.Telepathy.AccountManager",
- path,
- this );
- if ( account_interface.DisplayName() != g_displayName )
- { continue; }
- ++accounts_left;
- }
- QCOMPARE( accounts_left, 0 );
- }
-}
-
-void UnitTests::testPrototypeAccountManager()
-{
- QTest::qWait( 3000 );
-
- TpPrototype::AccountManager* account_manager = TpPrototype::AccountManager::instance();
- QVERIFY( NULL != account_manager );
-
- QVariantMap parameter_map;
- parameter_map.insert( "account", "basyskom at localhost" );
- parameter_map.insert( "password", "basyskom" );
- parameter_map.insert( "server", "localhost" );
- parameter_map.insert( "resource", "Tp" );
- parameter_map.insert( "port", static_cast<uint>(5222) );
-#if 1// Disable this temporarily if the accounts were not deleted properly
- if ( 0 != account_manager->count() )
- {
- QList<QPointer<TpPrototype::Account> > account_list = account_manager->accountList();
- foreach( TpPrototype::Account* account, account_list )
- {
- true == account->remove();
- }
- }
- QVERIFY( 0 == account_manager->count() );
-
- QSignalSpy spy_create_account( account_manager, SIGNAL( signalNewAccountAvailable( TpPrototype::Account* ) ) );
- QCOMPARE( spy_create_account.isValid(), true );
-
- QVERIFY( true == account_manager->createAccount( "gabble", "jabber", "Ich 1", parameter_map ) );
- QVERIFY( true == account_manager->createAccount( "gabble", "jabber", "Ich 2", parameter_map ) );
- QVERIFY( true == account_manager->createAccount( "gabble", "jabber", "Ich 3", parameter_map ) );
-
- QVERIFY2( waitForSignal( &spy_create_account, 3 ), "Received no signals after createAccount() ");
-#endif
-
- QVERIFY( 3 == account_manager->count() );
-
- QList<QPointer<TpPrototype::Account> > account_list = account_manager->accountList();
- QVERIFY( 3 == account_list.count() );
-
- //qDebug() << "Parameters: " << account_list.at(0)->parameters();
- //qDebug() << "Properties: " << account_list.at(0)->properties();
-
- QSignalSpy spy_update_account( account_manager, SIGNAL( signalAccountUpdated( TpPrototype::Account* ) ) );
- QCOMPARE( spy_update_account.isValid(), true );
-
- QVariant enabled_flag = account_list.at(0)->properties().value( "Enabled" );
- QCOMPARE( enabled_flag.toBool(), false );
- QVariantMap new_properties;
- new_properties.insert( "Enabled", true );
- account_list.at(0)->setProperties( new_properties );
- enabled_flag = account_list.at(0)->properties().value( "Enabled" );
- QCOMPARE( enabled_flag.toBool(), true );
-
- QVariantMap new_parameter;
- QVariantMap old_parameters = account_list.at(0)->parameters();
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Old Parameters: " << old_parameters;
-#endif
- new_parameter.insert( "resource", g_newResourceName );
- QVERIFY( account_list.at(0)->setParameters( new_parameter ) );
- QVariantMap updated_parameters = account_list.at(0)->parameters();
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Updated Parameters: " << updated_parameters;
-#endif
- QVERIFY( old_parameters != updated_parameters );
- QVERIFY( updated_parameters.value( "resource" ) == g_newResourceName );
-
- QVERIFY2( waitForSignal( &spy_update_account, 2 ), "Received no signals after removeAccount() ");
-
- QSignalSpy spy_remove_account( account_manager, SIGNAL( signalAboutToRemoveAccount( TpPrototype::Account* ) ) );
- QCOMPARE( spy_remove_account.isValid(), true );
-
- int count = 0;
- foreach( TpPrototype::Account* account, account_list )
- {
- ++count;
- QVERIFY( true == account->remove() );
- }
-
- QVERIFY2( waitForSignal( &spy_remove_account, count ), "Received no signals after removeAccount() ");
-
- QVERIFY( 0 == account_manager->count() );
-}
-
-void UnitTests::testPrototype_ContactHandling()
-{
-
- TpPrototype::AccountManager* account_manager = TpPrototype::AccountManager::instance();
- QVERIFY( NULL != account_manager );
- // Create an account if there is none..
- if ( account_manager->accountList().count() < 2 )
- {
- QVariantMap parameter_map = TpPrototype::ConnectionFacade::instance()->parameterListForProtocol( "jabber" );
- QVERIFY( true == account_manager->createAccount( "gabble", "jabber", "ContactHandlingTest", parameter_map) );
- QTest::qWait( 1000 );
-
- QVERIFY( true == account_manager->createAccount( "gabble", "jabber", "ContactHandlingTest2", parameter_map) );
- QTest::qWait( 1000 );
-
- QVERIFY( account_manager->accountList().count() != 0 );
- }
-
- TpPrototype::Account* account1 = account_manager->accountList().at( 0 );
- QVERIFY( NULL != account1 );
-
- TpPrototype::Connection* connection = TpPrototype::ConnectionFacade::instance()->connectionWithAccount( account1, 1 );
-
- QVERIFY( connection );
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "testPrototypeContactHandling Create First Connection";
-#endif // ENABLE_DEBUG_OUTPUT_
-
- QSignalSpy spy_status_changed( connection, SIGNAL( signalStatusChanged( TpPrototype::Connection*, Tp::ConnectionStatus, Tp::ConnectionStatus ) ) );
- QCOMPARE( spy_status_changed.isValid(), true );
- QVERIFY( connection->requestConnect() == true );
-
- QVERIFY2( waitForSignal( &spy_status_changed, 2 ), "Received no signal after connectRequest ");
-
- TpPrototype::ContactManager* contact_manager = connection->contactManager();
- QVERIFY( NULL != contact_manager );
- QVERIFY( contact_manager->isValid() );
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "testPrototypeContactHandling Initialize First Contact Manager";
-#endif// ENABLE_DEBUG_OUTPUT_
-
- // Make sure we got some contacts:
- QTest::qWait( 1000 );
- QList<QPointer<TpPrototype::Contact> > contacts = contact_manager->contactList();
- QVERIFY2(!contacts.isEmpty(), "No contacts found.");
-
- TpPrototype::Account* account2 = account_manager->accountList().at( 1 );
- QVERIFY( NULL != account2 );
- TpPrototype::Connection* connection2 = TpPrototype::ConnectionFacade::instance()->connectionWithAccount( account2, 2 );
- QVERIFY( connection2 );
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "testPrototypeContactHandling Creation Second Connection";
-#endif// ENABLE_DEBUG_OUTPUT_
- //spy_status_changed( connection2, SIGNAL( signalStatusChanged( TpPrototype::Connection*, Tp::ConnectionStatus, Tp::ConnectionStatus ) );
- QCOMPARE( spy_status_changed.isValid(), true );
- QVERIFY( connection2->requestConnect() == true );
-
- // QVERIFY2( waitForSignal( &spy_status_changed, 2 ), "Received no signal after connectRequest ");
- QTest::qWait( 1000 );
-
- TpPrototype::ContactManager* contact_manager2 = connection2->contactManager();
- QVERIFY( NULL != contact_manager2 );
- QVERIFY( contact_manager2->isValid() );
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "testPrototypeContactHandling Initialize Second Contact Manager";
-#endif//def ENABLE_DEBUG_OUTPUT_
- // Make sure we got some contacts:
- QTest::qWait( 1000 );
- QList<QPointer<TpPrototype::Contact> > contacts2 = contact_manager2->contactList();
- // QVERIFY2(!contacts2.isEmpty(), " Account 2 No contacts found.");
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- foreach (QPointer<TpPrototype::Contact> ptr, contacts)
- { qDebug() << "Contact:" << ptr->name(); }
-#endif
-
- contact_manager2->requestContact("basyskom at localhost");
- QTest::qWait( 2000 );
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "testPrototypeContactHandling Contact Request by Account 2";
-#endif// ENABLE_DEBUG_OUTPUT_
-
- contact_manager->requestContact("test at localhost");
- QTest::qWait( 2000 );
-
- contact_manager2->requestContact("basyskom at localhost");
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "testPrototypeContactHandling Contact Request by Account 1";
-#endif// ENABLE_DEBUG_OUTPUT_
-// QVERIFY2( waitForSignal( &spy_contacts_added ), "Received no signal Remote Pending Contact");
-
- connection->requestDisconnect();
- delete connection;
-
- QTest::qWait( 1000 );
-}
-
-#define ENABLE_DEBUG_OUTPUT_
-void UnitTests::testPrototype_OwnPresenceChanged()
-{
- TpPrototype::AccountManager* account_manager = TpPrototype::AccountManager::instance();
- QVERIFY( NULL != account_manager );
-
- // Create an account if there is none..
- if ( account_manager->accountList().isEmpty() )
- {
- QVariantMap parameter_map = TpPrototype::ConnectionFacade::instance()->parameterListForProtocol( "jabber" );
- QVERIFY( true == account_manager->createAccount( "gabble", "jabber", "ContactHandlingTest", parameter_map) );
- QTest::qWait( 1000 );
-
- QVERIFY( account_manager->accountList().count() != 0 );
- }
-
- TpPrototype::Account* account = account_manager->accountList().at( 0 );
- QVERIFY( NULL != account );
-// verbinden mit erstem konto
- TpPrototype::Connection* connection = TpPrototype::ConnectionFacade::instance()->connectionWithAccount( account, 1 );
- QVERIFY( connection );
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "testPrototypeContactHandling Create First Connection";
-#endif
-
- QSignalSpy spyConnectionStatusChanged( connection, SIGNAL(signalStatusChanged (TpPrototype::Connection* , Tp::ConnectionStatus, Tp::ConnectionStatus ) ) );
- QVERIFY( connection->requestConnect() == true );
- QVERIFY2( waitForSignal( &spyConnectionStatusChanged, 2 ), "Received no signal after connectRequest ");
-
- TpPrototype::PresenceManager* presence_manager = connection->presenceManager();
- QVERIFY2( NULL != presence_manager, "No presence information is supported!" );
-
- // The presence manager is invalid if no valid presence interface is available
- QVERIFY2( true == presence_manager->isValid(), "No compatible presence interface found!" );
-
- Tp::SimpleStatusSpecMap status_map = presence_manager->statuses();
- QVERIFY2( status_map.count() != 0, "No presence information returned!" );
-
- QStringList keys = status_map.keys();
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Possible Presence settings: ";
- foreach( QString key, keys )
- {
- qDebug() << "Name: " << key << "type: " << status_map.value( key ).type << "MaySetOnSelf: " << status_map.value( key ).type << "canHaveMessage:" << status_map.value( key ).canHaveMessage;
-
- }
-#endif
-
- QVERIFY( keys.contains( "available" ) );
- QVERIFY( keys.contains( "away" ) );
- QVERIFY( keys.contains( "offline" ) );
-
- QSignalSpy spy_state_changed( presence_manager, SIGNAL( signalOwnPresenceUpdated( const TpPrototype::Account*, const Tp::SimplePresence& ) ) );
- QCOMPARE( spy_state_changed.isValid(), true );
-
-
- QStringList testDataPresenceChangeStatus;
- QStringList testDataPresenceChangeStatusMessage;
- testDataPresenceChangeStatus.append( "available" );
- testDataPresenceChangeStatus.append( "away" );
- testDataPresenceChangeStatus.append( "offline" );
-
- testDataPresenceChangeStatusMessage.append( "I am available" );
- testDataPresenceChangeStatusMessage.append( "I am away" );
- testDataPresenceChangeStatusMessage.append( "I am offline" );
-
-
- for ( int count = 0; count< testDataPresenceChangeStatus.count(); count++ )
- {
-
- presence_manager->setPresence( testDataPresenceChangeStatus.at( count ), testDataPresenceChangeStatusMessage.at(count) );
-
- QString verifyMessage = QString("Received no signal after changing presence to %1").arg(testDataPresenceChangeStatus.at(count) ) ;
- if( testDataPresenceChangeStatus.at(count) == QString("offline") )
- {
- QVERIFY2( waitForSignal( &spy_state_changed ), verifyMessage.toLatin1() );
- }
- else
- {
- // Test whether emmitted signal contains the expected data
- QVERIFY2( waitForSignal( &spy_state_changed ), verifyMessage.toLatin1() );
-
- QCOMPARE( false, spy_state_changed.isEmpty() );
- QList<QVariant> firstSignalEmited = spy_state_changed.takeFirst();
-
- QCOMPARE( firstSignalEmited.count(), 2 );
-
- Tp::SimplePresence emitedPresence = firstSignalEmited.at(1).value<Tp::SimplePresence>() ;
- QCOMPARE( emitedPresence.status , testDataPresenceChangeStatus.at(count) );
- QCOMPARE( emitedPresence.statusMessage , testDataPresenceChangeStatusMessage.at(count) );
-
- // Test whether "currentPresence()" returns the expected state as well.
- QCOMPARE( emitedPresence.status, presence_manager->currentPresence().status );
- QCOMPARE( emitedPresence.statusMessage, presence_manager->currentPresence().statusMessage );
- }
- }
-
- delete connection;
-}
-#undef ENABLE_DEBUG_OUTPUT_
-
-void UnitTests::testTextChatFunction()
-{
- // get the account Manager
- TpPrototype::AccountManager* account_manager = TpPrototype::AccountManager::instance();
- QVERIFY( NULL != account_manager );
-
- // Stop if there are less than 2 accounts
- QVERIFY( validAccounts().count() > 1 );
-
- TpPrototype::Account* acc_2 = account_manager->accountList().at( account_manager->accountList().count()-1 );
- TpPrototype::Account* acc_1 = account_manager->accountList().at( account_manager->accountList().count()-2 );
-
- QVERIFY( acc_2 );
- QVERIFY( acc_1 );
-
- qDebug() << "acc_1 = " << acc_1->parameters().value("account");
- qDebug() << "acc_2 = " << acc_2->parameters().value("account");
-
- // connect both accounts
- TpPrototype::Connection* conn_2 = acc_2->connection();
- QVERIFY( conn_2 );
- TpPrototype::Connection* conn_1 = acc_1->connection();
- QVERIFY( conn_1 );
-
- QSignalSpy spy_conn_1_status_changed( conn_1, SIGNAL( signalStatusChanged( TpPrototype::Connection*, Tp::ConnectionStatus, Tp::ConnectionStatus ) ) );
- QCOMPARE( spy_conn_1_status_changed.isValid(), true );
-
- QTest::qWait( 1000 );
- QVERIFY( conn_1->requestConnect() == true );
-
- QSignalSpy spy_conn_2_status_changed( conn_2, SIGNAL( signalStatusChanged( TpPrototype::Connection*, Tp::ConnectionStatus, Tp::ConnectionStatus ) ) );
- QCOMPARE( spy_conn_2_status_changed.isValid(), true );
-
- QTest::qWait( 1000 );
- QVERIFY( conn_2->requestConnect() == true );
-
- QVERIFY2( waitForSignal( &spy_conn_1_status_changed, 2 ), "Received no signal after connectRequest for conn_1 ");
- QVERIFY2( waitForSignal( &spy_conn_2_status_changed, 2 ), "Received no signal after connectRequest for conn_2 ");
-
- TpPrototype::ContactManager* contact_manager_1 = conn_1->contactManager();
- TpPrototype::ContactManager* contact_manager_2 = conn_2->contactManager();
-
- QVERIFY( NULL != contact_manager_1 );
- QVERIFY( contact_manager_1->isValid() );
- QVERIFY( NULL != contact_manager_2 );
- QVERIFY( contact_manager_2->isValid() );
-
- QVERIFY( contact_manager_1->requestContact( acc_2->parameters().value("account").toString() ) == true );
- QVERIFY( contact_manager_2->requestContact( acc_1->parameters().value("account").toString() ) == true );
-
- QList < QPointer<TpPrototype::Contact> > contact_list_1 = contact_manager_1->contactList();
- QVERIFY( contact_list_1.count() > 0 );
-
- TpPrototype::Contact* chat_contact = contact_list_1.at(0);
-
- foreach( TpPrototype::Contact* cont_insp , contact_list_1 )
- {
- if (cont_insp->name() == acc_2->parameters().value("account").toString() )
- {
- chat_contact = cont_insp;
- }
- }
-
- QList < QPointer<TpPrototype::Contact> > contact_list_2 = contact_manager_2->contactList();
- QVERIFY( contact_list_2.count() > 0 );
-
- TpPrototype::Contact* contact_chatty = contact_list_2.at(0);
-
- foreach( TpPrototype::Contact* cont_insp , contact_list_2 )
- {
- if (cont_insp->name() == acc_1->parameters().value("account").toString() )
- {
- contact_chatty = cont_insp;
- }
- }
-
-
- // Send message to account2 from account1
- QString message("get in touch with Tp QT4");
-
- QSignalSpy spy_message(contact_manager_2 , SIGNAL( signalTextChannelOpenedForContact( TpPrototype::Contact* contact ) ));
-
- chat_contact->chatChannel()->sendTextMessage( message );
-
-
- QSignalSpy spy_incoming_message( contact_chatty->chatChannel(), SIGNAL( signalTextMessageReceived( TpPrototype::ChatChannel* chatchannel, uint timestamp, uint type, uint flags, const QString& text ) ) );
-
- contact_chatty->chatChannel()->pendingTextMessages();
-
- QTest::qWait( 2000 );
-
- // Something's wrong here probably with QSignalSpy
- // the signals are emited but not catched by teh spies
- QVERIFY2( waitForSignal( &spy_incoming_message, 2 ), "Received no Signal from chatChannel() after checking for pendingMessages() ");
-
- QVERIFY2( waitForSignal( &spy_message, 2 ), "Received no Signal from contact_maanger_2 after sending a message from acc_1");
-
- QCOMPARE(spy_message.count(), 1);
-
- QList<QVariant> arguments = spy_message.takeFirst();
-
- qDebug() << arguments.at(0);
-
-
-
-// qRegisterMetaType<TpPrototype::Contact*>("TpPrototype::Contact*");
-// TpPrototype::Contact* receiving_contact = qvariant_cast<TpPrototype::Contact*>(arguments.at(0));
-
- // contact -> chatchannel ->
-
- // signal des chatchannel abfangen
-
- // chatchannel->pending()
-
-
-
-
- // prüfen ob empfangene nachricht - gesendetet enthält
-
- // umgekehrt auch testen
- QTest::qWait( 2000 );
-
-}
-
-void UnitTests::testReconnect()
-{
- TpPrototype::AccountManager* account_manager = TpPrototype::AccountManager::instance();
- QVERIFY( NULL != account_manager );
-
- // Create an account if there is none..
- if ( account_manager->accountList().isEmpty() )
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "*** Create Account";
-#endif
- QVariantMap parameter_map = TpPrototype::ConnectionFacade::instance()->parameterListForProtocol( "jabber" );
- QVERIFY( true == account_manager->createAccount( "gabble", "jabber", "ContactHandlingTest", parameter_map ) );
- QTest::qWait( 1000 );
-
- QVERIFY( account_manager->accountList().count() != 0 );
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "*** Account Created";
-#endif
-
- }
-
- TpPrototype::Account* account = account_manager->accountList().at( 0 );
- QVERIFY( NULL != account );
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "*** Request connection object for account";
-#endif
- TpPrototype::Connection* connection = TpPrototype::ConnectionFacade::instance()->connectionWithAccount( account, 1 );
- QVERIFY( connection );
-
- qDebug() << "testPrototypeContactHandling Create First Connection";
- QSignalSpy spy_status_changed( connection, SIGNAL( signalStatusChanged( TpPrototype::Connection*, Tp::ConnectionStatus, Tp::ConnectionStatus ) ) );
- QCOMPARE( spy_status_changed.isValid(), true );
-
- QTest::qWait( 1000 );
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "*** Request connect for the first time";
-#endif
- QVERIFY( connection->requestConnect() == true );
-
- QTest::qWait( 1000 );
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "*** Request _dis_connect";
-#endif
- QVERIFY( connection->requestDisconnect() );
-
- QTest::qWait( 1000 );
- // Now go back online..
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "*** Request connect for the _second_ time";
-#endif
- QVERIFY( connection->requestConnect() == true );
- QTest::qWait( 1000 );
-
- QVERIFY( connection->presenceManager()->setPresence( "available", "Back online" ) == true );
-
- delete connection;
-
- QTest::qWait( 1000 );
-
-}
-
-void UnitTests::testCapabilityManager()
-{
- TpPrototype::AccountManager* account_manager = TpPrototype::AccountManager::instance();
- QVERIFY( NULL != account_manager );
-
- // Create an account if there is none..
- if ( account_manager->accountList().isEmpty() )
- {
- QVariantMap parameter_map = TpPrototype::ConnectionFacade::instance()->parameterListForProtocol( "jabber" );
- QVERIFY( true == account_manager->createAccount( "gabble", "jabber", "ContactHandlingTest", parameter_map) );
- QTest::qWait( 1000 );
-
- QVERIFY( account_manager->accountList().count() != 0 );
- }
-
- TpPrototype::Account* account = account_manager->accountList().at( 0 );
- QVERIFY( NULL != account );
-// verbinden mit erstem konto
- TpPrototype::Connection* connection = account->connection();
- QVERIFY( connection );
- // The connection shouldn't provide a capability manager if no connection is available!
- QVERIFY( connection->capabilitiesManager() == NULL );
-
- QVERIFY( connection->requestConnect() == true );
- QSignalSpy spyConnectionStatusChanged( connection, SIGNAL(signalStatusChanged (TpPrototype::Connection* , Tp::ConnectionStatus, Tp::ConnectionStatus ) ) );
- QVERIFY2( waitForSignal( &spyConnectionStatusChanged, 2 ), "Received no signal after connectRequest ");
-
- TpPrototype::CapabilitiesManager* cap_manager = connection->capabilitiesManager();
- QVERIFY( cap_manager );
-
- // Need to get the list of my contacts to request their capability:
- QVERIFY( connection->contactManager() );
- QList<QPointer<TpPrototype::Contact> > contact_list = connection->contactManager()->contactList();
-
- // TODO: Create contacts if the following fails.
- QVERIFY2( contact_list.count() != 0, "Account has no contacts assigned! Cannot request any capabilities!" );
-
- cap_manager->capabilitiesForContactList( contact_list );
-
- foreach( TpPrototype::Contact* contact, contact_list )
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Contact: " << contact->name();
-#endif
- foreach( Tp::ContactCapability cap, contact->capabilities() )
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "capabilitiesChannelType:" << cap.channelType << "capabilitiesGenericFlags:" << cap.genericFlags << "capabilitiesTypeSpecificFlags:" << cap.typeSpecificFlags;
-#endif
- // Check minimum requirement: A text channel capability is available
- QVERIFY( cap.channelType == QString( "org.freedesktop.Telepathy.Channel.Type.Text" ) );
- }
- }
-
- foreach( Tp::ContactCapability cap, cap_manager->capabilities() )
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "My capabilities: capabilitiesChannelType:" << cap.channelType << "capabilitiesGenericFlags:" << cap.genericFlags << "capabilitiesTypeSpecificFlags:" << cap.typeSpecificFlags;
-#endif
- // Check minimum requirement: A text channel capability is available
- QVERIFY( cap.channelType == QString( "org.freedesktop.Telepathy.Channel.Type.Text" ) );
- }
-
-
- // Now checking setting of capabilities and whether we receive a signal after that..
- QSignalSpy spy_own_capability_changed( cap_manager, SIGNAL( signalOwnCapabilityChanged( const Tp::CapabilityChange& ) ) );
- QCOMPARE( spy_own_capability_changed.isValid(), true );
-
- Tp::CapabilityPair new_capability = { "org.freedesktop.Telepathy.Channel.Type.StreamedMedia", 15 }; // See Tp D-Bus spec section "Channel_Media_Capabilities"
- Tp::CapabilityPairList capability_list;
- capability_list << new_capability;
- QVERIFY( cap_manager->setCapabilities( capability_list ) );
-
- QVERIFY2( waitForSignal( &spy_own_capability_changed ), "Received no signal after changing my capability! ");
-
- bool found_media_stream_channel = false;
- foreach( Tp::ContactCapability cap, cap_manager->capabilities() )
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "My changed capabilities: capabilitiesChannelType:" << cap.channelType << "capabilitiesGenericFlags:" << cap.genericFlags << "capabilitiesTypeSpecificFlags:" << cap.typeSpecificFlags;
-#endif
- // Check whether the Stream Media channel is registered succesfully
- if ( cap.channelType == QString( "org.freedesktop.Telepathy.Channel.Type.StreamedMedia" ) )
- { found_media_stream_channel = true; }
- }
- // QEXPECT_FAIL( "", "The registered channel was not found. We need to investigate why!", Continue );
- QVERIFY( found_media_stream_channel );
-
- connection->requestDisconnect();
-
- delete connection;
-
- QTest::qWait( 1000 );
-}
-#undef ENABLE_DEBUG_OUTPUT
-
-void UnitTests::testAvatarManager()
-{
- QSKIP( "This test is currently crashing due to unknown reasons", SkipAll );
-
- TpPrototype::AccountManager* account_manager = TpPrototype::AccountManager::instance();
- QVERIFY( NULL != account_manager );
-
- // Create an account if there is none..
- if ( account_manager->accountList().isEmpty() )
- {
- QVariantMap parameter_map = TpPrototype::ConnectionFacade::instance()->parameterListForProtocol( "jabber" );
- QVERIFY( true == account_manager->createAccount( "gabble", "jabber", "ContactHandlingTest", parameter_map) );
- QTest::qWait( 1000 );
-
- QVERIFY( account_manager->accountList().count() != 0 );
- }
-
- TpPrototype::Account* account = account_manager->accountList().at( 0 );
- QVERIFY( NULL != account );
-// verbinden mit erstem konto
- TpPrototype::Connection* connection = account->connection();
- QVERIFY( connection );
-
- QSignalSpy spyConnectionStatusChanged( connection, SIGNAL(signalStatusChanged (TpPrototype::Connection* , Tp::ConnectionStatus, Tp::ConnectionStatus ) ) );
- QVERIFY( connection->requestConnect() == true );
- QVERIFY2( waitForSignal( &spyConnectionStatusChanged, 2 ), "Received no signal after connectRequest ");
-
- TpPrototype::AvatarManager* avatar_manager = connection->avatarManager();
- QVERIFY( avatar_manager );
-
- // Get Avatar requirements
- TpPrototype::AvatarManager::AvatarRequirements avatar_requirements = avatar_manager->avatarRequirements();
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Avatar requirements: ";
- qDebug() << "mimeTypes :" << avatar_requirements.mimeTypes;
- qDebug() << "minimumWidth :" << avatar_requirements.minimumWidth;
- qDebug() << "minimumHeight :" << avatar_requirements.minimumHeight;
- qDebug() << "maximumWidth :" << avatar_requirements.maximumWidth;
- qDebug() << "maximumHeight :" << avatar_requirements.maximumHeight;
- qDebug() << "maxSize :" << avatar_requirements.maxSize;
-#endif
- // Check whether previous call failed.
- QEXPECT_FAIL( "", "This issue was reported on bugs.freedesktop.org: #18202", Continue );
- QVERIFY( avatar_requirements.isValid );
-
- // Set own avatar.
- QString abs_top_srcdir = QString::fromLocal8Bit(::getenv("abs_top_srcdir"));
- QVERIFY2(!abs_top_srcdir.isEmpty(),
- "Put $abs_top_srcdir in your environment");
- abs_top_srcdir += "/tests/prototype/avatar.png";
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Look for avatar at: " << abs_top_srcdir;
-#endif
- QPixmap avatar( abs_top_srcdir );
- QVERIFY( !avatar.isNull() );
-
- QByteArray bytes;
- QBuffer buffer( &bytes );
- buffer.open( QIODevice::WriteOnly );
- avatar.save( &buffer, "PNG" );
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Avatar size is: " << bytes.size();
-#endif
-
- TpPrototype::AvatarManager::Avatar local_avatar;
- local_avatar.avatar = bytes;
- local_avatar.mimeType = "image/png";
-
- QEXPECT_FAIL( "", "This fails on gabble but works well on Salut. Issue was reported on bugs.freedesktop.org: #18303", Continue );
- QVERIFY( avatar_manager->setAvatar( local_avatar ) );
-
- // Request own avatar
- QSignalSpy spy_request_local_avatar( avatar_manager, SIGNAL( signalOwnAvatarChanged( TpPrototype::AvatarManager::Avatar ) ) );
- QVERIFY( spy_request_local_avatar.isValid() );
- avatar_manager->requestAvatar();
- QVERIFY2( waitForSignal( &spy_request_local_avatar ), "Received no signal after requesting the local avatar!" );
-
- // Request Avatar of a contact
- // This might fail if the first contact does not provide an avatar. In this case we will receive no signal.. :(
- QList<QPointer<TpPrototype::Contact> > contact_list;
- foreach( TpPrototype::Contact* contact, connection->contactManager()->contactList() )
- {
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "Request avatar for contact: " << contact->name();
-#endif
- contact_list << contact;
- break; // Test one contact should be ok for now..
- }
- QSignalSpy spy_request_contact_avatar( avatar_manager, SIGNAL( signalAvatarChanged( TpPrototype::Contact* ) ) );
- QVERIFY( spy_request_contact_avatar.isValid() );
- avatar_manager->avatarForContactList( contact_list );
- // QEXPECT_FAIL( "", "This test may fail if the first contact has no avatar.", Continue );
- QVERIFY2( waitForSignal( &spy_request_contact_avatar ), "Received no signal after requesting an avatar of a contact! " );
-
- connection->requestDisconnect();
- delete connection;
-}
-
-void UnitTests::testStreamedMedia_receiveCall()
-{
- // Connect to first account.
- TpPrototype::AccountManager* account_manager = TpPrototype::AccountManager::instance();
- QVERIFY( NULL != account_manager );
-
- // Create an account if there is none.. TODO: Add avalid account here that supports VoIP calls.
- if ( account_manager->accountList().isEmpty() )
- {
- QVariantMap parameter_map = TpPrototype::ConnectionFacade::instance()->parameterListForProtocol( "jabber" );
- QVERIFY( true == account_manager->createAccount( "gabble", "jabber", "ContactHandlingTest", parameter_map) );
- QTest::qWait( 1000 );
-
- QVERIFY( account_manager->accountList().count() != 0 );
- }
-
- TpPrototype::Account* account = account_manager->accountList().at( 0 );
- QVERIFY( NULL != account );
-// verbinden mit erstem konto
- TpPrototype::Connection* connection = account->connection();
- QVERIFY( connection );
-
- QSignalSpy spyConnectionStatusChanged( connection, SIGNAL(signalStatusChanged (TpPrototype::Connection* , Tp::ConnectionStatus, Tp::ConnectionStatus ) ) );
- QVERIFY( connection->requestConnect() == true );
- QVERIFY2( waitForSignal( &spyConnectionStatusChanged, 2 ), "Received no signal after connectRequest ");
-
- // The StreamedMedia channel is stored in the calling contact and new channels are signalled by the ContactManager.
- TpPrototype::ContactManager* contact_manager = connection->contactManager();
- QVERIFY( NULL != contact_manager );
-
- // Start Support of VoIP
- TpPrototype::CapabilitiesManager* capabilities_manager = connection->capabilitiesManager();
- QVERIFY( NULL != capabilities_manager );
-
- Tp::CapabilityPair new_capability = { "org.freedesktop.Telepathy.Channel.Type.StreamedMedia",
- Tp::ChannelMediaCapabilityAudio
- | Tp::ChannelMediaCapabilityVideo
- | Tp::ChannelMediaCapabilityNATTraversalGTalkP2P }; // See Tp D-Bus spec section "Channel_Media_Capabilities"
- Tp::CapabilityPairList capability_list;
- capability_list << new_capability;
- capabilities_manager->setCapabilities( capability_list );
-
- // Now wait for a calling user..
- qDebug() << "Wait for call.. (timout after 10 seconds)";
- connect( contact_manager, SIGNAL( signalStreamedMediaChannelOpenedForContact( TpPrototype::Contact* ) ),
- this, SLOT( slotReceiveContactPointer( TpPrototype::Contact* ) ) );
- QSignalSpy spy_wait_for_call( contact_manager, SIGNAL( signalStreamedMediaChannelOpenedForContact( TpPrototype::Contact* ) ) );
- QCOMPARE( spy_wait_for_call.isValid(), true );
- QVERIFY2( waitForSignal( &spy_wait_for_call ), "Timout waiting for call..");
-
- // Get StreamedMediaChannel
- // The channel is contained in the contact that was emitted with the signal signalStreamedMediaChannelOpenedForContact().
- QList<QVariant> parameters = spy_wait_for_call.takeFirst();
- QVERIFY( parameters.count() == 1 );
-
- TpPrototype::Contact* calling_contact = m_pContactPointer/*qobject_cast<TpPrototype::Contact*>( parameters.at(0) )*/;
- QVERIFY( NULL != calling_contact );
-
- // Get StreamedMediaChannel and accept call.
- qDebug() << "Accept-Call..";
- TpPrototype::StreamedMediaChannel* media_channel = calling_contact->streamedMediaChannel();
- QVERIFY( NULL != media_channel );
- media_channel->acceptIncomingStream();
-
- qDebug() << "Reject call after 5 seconds..";
- QTest::qWait( 5000 );
- // Reject the call now.
- media_channel->rejectIncomingStream();
-
- QTest::qWait( 5000 );
-
- // Now try get a working connection again to check whether the cleanup works..
- qDebug() << "Wait for second call.. (timout after 10 seconds)";
- QSignalSpy spy_wait_for_call_attempt2( contact_manager, SIGNAL( signalStreamedMediaChannelOpenedForContact( TpPrototype::Contact* ) ) );
- QCOMPARE( spy_wait_for_call_attempt2.isValid(), true );
- QVERIFY2( waitForSignal( &spy_wait_for_call_attempt2 ), "Timout waiting for call (attempt2)..");
-
- // Get StreamedMediaChannel and accept call.
- qDebug() << "Accept-Call..";
- media_channel = calling_contact->streamedMediaChannel();
- QVERIFY( NULL != media_channel );
- QVERIFY( media_channel->acceptIncomingStream() );
-
- qDebug() << "Reject call after 5 seconds..";
- QTest::qWait( 5000 );
- // Reject the call now.
- QVERIFY( media_channel->rejectIncomingStream() );
-
- connection->requestDisconnect();
- delete connection;
-
-}
-
-void UnitTests::testStreamedMedia_outgoingCall()
-{
- // Connect to first account.
- TpPrototype::AccountManager* account_manager = TpPrototype::AccountManager::instance();
- QVERIFY( NULL != account_manager );
-
- // Create an account if there is none.. TODO: Add avalid account here that supports VoIP calls.
- if ( account_manager->accountList().isEmpty() )
- {
- QVariantMap parameter_map = TpPrototype::ConnectionFacade::instance()->parameterListForProtocol( "jabber" );
- QVERIFY( true == account_manager->createAccount( "gabble", "jabber", "ContactHandlingTest", parameter_map) );
- QTest::qWait( 1000 );
-
- QVERIFY( account_manager->accountList().count() != 0 );
- }
-
- TpPrototype::Account* account = account_manager->accountList().at( 0 );
- QVERIFY( NULL != account );
-
- // Connect to first account
- TpPrototype::Connection* connection = account->connection();
- QVERIFY( connection );
-
- QSignalSpy spyConnectionStatusChanged( connection, SIGNAL(signalStatusChanged (TpPrototype::Connection* , Tp::ConnectionStatus, Tp::ConnectionStatus ) ) );
- QVERIFY( connection->requestConnect() == true );
- QVERIFY2( waitForSignal( &spyConnectionStatusChanged, 2 ), "Received no signal after connectRequest ");
-
- // The StreamedMedia channel is stored in the calling contact and new channels are signalled by the ContactManager.
- TpPrototype::ContactManager* contact_manager = connection->contactManager();
- QVERIFY( NULL != contact_manager );
-
-
- if ( contact_manager->contactList().count() == 0 )
- {
- QSignalSpy spy_for_contacts( contact_manager, SIGNAL( signalMembersChanged( TpPrototype::ContactManager*,
- const QString& ,
- QList<QPointer<TpPrototype::Contact> > ,
- QList<QPointer<TpPrototype::Contact> > ,
- QList<QPointer<TpPrototype::Contact> > ,
- TpPrototype::Contact* ,
- Tp::ChannelGroupChangeReason )
- ) );
- QCOMPARE( spy_for_contacts.isValid(), true );
- waitForSignal( &spy_for_contacts );
- }
-
- // Get StreamedMediaChannel and call the first contact.
- QList<QPointer<TpPrototype::Contact> > contact_list = contact_manager->contactList();
-
- QVERIFY2( contact_list.count() > 0, "No contacts were found to call.." );
- TpPrototype::Contact* contact = contact_list.at( 0 );
-
- qDebug() << "Calling: " << contact->name();
- TpPrototype::StreamedMediaChannel* media_channel = contact->streamedMediaChannel();
- QVERIFY( NULL != media_channel );
-
- media_channel->requestChannel( QList<Tp::MediaStreamType>() << Tp::MediaStreamTypeAudio );
-
- QTest::qWait( 50000 );
-
-#if 0
- media_channel->requestChannel( QList<Tp::MediaStreamType>() << Tp::MediaStreamTypeAudio );
-
- QTest::qWait( 10000 );
-#endif
-
- connection->requestDisconnect();
- delete connection;
-
-}
-
-
-void UnitTests::testBlockingSupport()
-{
-#if 0 // blocking not merged from prototype so far
-
- // Connect to first account.
- TpPrototype::AccountManager* account_manager = TpPrototype::AccountManager::instance();
- QVERIFY( NULL != account_manager );
-
- if ( account_manager->accountList().isEmpty() )
- {
- QVariantMap parameter_map = TpPrototype::ConnectionFacade::instance()->parameterListForProtocol( "jabber" );
- QVERIFY( true == account_manager->createAccount( "gabble", "jabber", "BlockingTest", parameter_map) );
- QTest::qWait( 1000 );
-
- QVERIFY( account_manager->accountList().count() != 0 );
- }
-
- TpPrototype::Account* account = account_manager->accountList().at( 0 );
- QVERIFY( NULL != account );
- // Connect to first account
- TpPrototype::Connection* connection = account->connection();
- QVERIFY( connection );
-
- QSignalSpy spyConnectionStatusChanged( connection, SIGNAL(signalStatusChanged (TpPrototype::Connection* , Tp::ConnectionStatus, Tp::ConnectionStatus ) ) );
- QVERIFY( connection->requestConnect() == true );
- QVERIFY2( waitForSignal( &spyConnectionStatusChanged, 2 ), "Received no signal after connectRequest ");
-
- // The StreamedMedia channel is stored in the calling contact and new channels are signalled by the ContactManager.
- TpPrototype::ContactManager* contact_manager = connection->contactManager();
- QVERIFY( NULL != contact_manager );
-
-
- if ( contact_manager->contactList().count() == 0 )
- {
- QSignalSpy spy_for_contacts( contact_manager, SIGNAL( signalMembersChanged( TpPrototype::ContactManager*,
- const QString& ,
- QList<QPointer<TpPrototype::Contact> > ,
- QList<QPointer<TpPrototype::Contact> > ,
- QList<QPointer<TpPrototype::Contact> > ,
- TpPrototype::Contact* ,
- Tp::ChannelGroupChangeReason )
- ) );
- QCOMPARE( spy_for_contacts.isValid(), true );
- waitForSignal( &spy_for_contacts );
- }
-
- QVERIFY2( contact_manager->contactList().count() > 0, "No contacts found!" );
-
-#if 1 // Disable this if a contact was bloccked and should be unblocked
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "block contact: " << contact_manager->contactList().at(0)->name();
-#endif
-
- QSignalSpy spy_for_blocking_signals( contact_manager, SIGNAL( signalContactBlocked( TpPrototype::ContactManager* ,
- TpPrototype::Contact* ) ) );
- QCOMPARE( spy_for_blocking_signals.isValid(), true );
-
- contact_manager->blockContact( contact_manager->contactList().at( 0 ) );
-
-
- QVERIFY2( waitForSignal( &spy_for_blocking_signals ), "Blocking of contact failed" );
-
-#endif
-
- QTest::qWait( 1000 );
-
-#ifdef ENABLE_DEBUG_OUTPUT_
- qDebug() << "_un_block contact: " << contact_manager->contactList().at(0)->name();
-#endif
- QSignalSpy spy_for_unblocking_signals( contact_manager, SIGNAL( signalContactUnblocked( TpPrototype::ContactManager* ,
- TpPrototype::Contact* ) ) );
- QCOMPARE( spy_for_unblocking_signals.isValid(), true );
-
- contact_manager->unblockContact( contact_manager->contactList().at( 0 ) );
-
- QVERIFY2( waitForSignal( &spy_for_unblocking_signals ), "Unblocking of contact failed!" );
-
- delete connection;
-#endif
-}
-
-
-
-void UnitTests::slotReceiveContactPointer( TpPrototype::Contact* pointer )
-{
- qDebug() << "slotReceiveContactPointer:" << pointer;
- m_pContactPointer = pointer;
-}
-
-
-
-QTEST_MAIN( UnitTests )
-#include "_gen/prototype.h.moc"
diff --git a/tests/prototype/prototype.h b/tests/prototype/prototype.h
deleted file mode 100644
index 74af22f..0000000
--- a/tests/prototype/prototype.h
+++ /dev/null
@@ -1,145 +0,0 @@
-#include <QtTest/QtTest>
-
-namespace TpPrototype
-{
- class Contact;
-}
-
-/**
- * @defgroup qt_tests Unit Tests
- * @ingroup qt_style_api
- * Classes that contains test functions.
- */
-
-
-/**
- * Unit Tests for the TpPrototype library.
- * The unit tests functions are testing low-level and high level features of the API.
- * Please consider the precondition information for each function.<br>
- * <b>Precondition:</b> The tests currently just work in the Basyskom virtual machine development environment.
- * @ingroup qt_tests
- */
-class UnitTests: public QObject
- {
- Q_OBJECT
-
-#ifndef GENERATING_DOXYGEN_OUTPUT_
-private slots:
-#else
-public:
-#endif
- /**
- * Startup initialization.
- */
- void initTestCase();
-
- /**
- * Testing low level Qt bindings to mission control. This is just a simple round tripping test
- */
- void testMissionControlBindings();
-
- /** Connects and disconnects to jabber server. Uses and testing of Qt bindings for Tp */
- void testConnectToJabberServer();
-
- /** Tests whether the existing connection managers can be discovered. */
- void testRequestingOfConnectionManagers();
-
- /**
- * Creates an account.
- * This function tests the create account functions of the AccountManager.
- */
- void testAccountManager_createAccount();
-
- /**
- * Checks whether the created accounts can be found.
- * This function tests the list account functions of the AccountManager.
- * <b>Precondition:</b> testAccountManager_createAccount() was executed
- */
- void testAccountManager_listAccount();
-
- /**
- * Request all properties from the accounts.
- * The reading and writing of properties is tested on the AccountManager.<br>
- * <b>Precondition:</b> testAccountManager_createAccount() was executed
- */
- void testAccountManager_showProperties();
-
- /**
- * Removes the accounts created by testRequestingOfConnectionManagers().
- * Tests the remove account feature of the AccountManager
- * <b>Precondition:</b> testAccountManager_createAccount() was executed
- */
- void testAccountManager_removeAccount();
-
- /**
- * General tests of the AccountManager.
- */
- void testPrototypeAccountManager();
-
- /**
- * Tests contact handling.
- * This function tests the ContactManager
- */
- void testPrototype_ContactHandling();
-
- /**
- * Test changing own presence.
- * This function tests the PresenceManager
- */
- void testPrototype_OwnPresenceChanged();
-
- /**
- * Testing chat functions.
- * Tests whether there is an account with contacts ( if not both are created ),
- * can send a textmessage to contact
- */
- void testTextChatFunction();
-
- /**
- * Test connecting, disconnecting and reconnect with Connection.
- */
- void testReconnect();
-
- /**
- * Test capability manager.
- * General tests for setting and obtaining capabilities.
- */
- void testCapabilityManager();
-
- /**
- * Test avatar manager.
- * Avatars are set for the local account and requested for contacts.
- * <b>Precondition:</b> The first contact has to provide an avatar. Otherwise no signal will be emitted!
- */
- void testAvatarManager();
-
- /**
- * Test StreamedMedia handling: Receiving.
- * <b>Info:</b> This test currently expects a call from a known contact.<br>
- * <b>Precondition:</b> The first account must support VoIP to be called.<br>
- * This test requires interaction! In order to check whether accepting and rejecting works, the contact has to call twice.
- */
- void testStreamedMedia_receiveCall();
-
- /**
- * Test StreamedMedia handling: Outgoing call.
- * <b>Info:</b> This test currently expects the first known contact taking the call.<br>
- * <b>Precondition:</b> The first account must support VoIP to be called. And the first contact should receive the call<br>
- * This test requires interaction! In order to check whether accepting and rejecting works, the contact will be called twice.
- */
- void testStreamedMedia_outgoingCall();
-
- /**
- * Simple test to check whether the signalling works as expected.
- * <b>Precondition:</b> Currently this test will just work with Gabble and GoogleTalk<br>
- */
- void testBlockingSupport();
-
- /** @internal Helper slot to get a valid contact pointer */
- void slotReceiveContactPointer( TpPrototype::Contact* pointer );
-
-
-private:
- QPointer<TpPrototype::Contact> m_pContactPointer;
- };
-
--
1.5.6.5
More information about the telepathy-commits
mailing list