summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateu Batle <mateu.batle@collabora.co.uk>2011-04-01 00:24:52 (GMT)
committerAlvaro Soliverez <alvaro.soliverez@collabora.co.uk>2011-04-01 01:18:24 (GMT)
commit03d297c3d8f38cadfadcc6d87c2096182853c98a (patch)
tree9f5b330177cac462469a8787ef39a87257bf3bba
parentd349de88a6a1d33446415e5c214c1d519c1504d1 (diff)
downloadtelepathy-qt4-logger-03d297c3d8f38cadfadcc6d87c2096182853c98a.tar.gz
telepathy-qt4-logger-03d297c3d8f38cadfadcc6d87c2096182853c98a.tar.xz
Delete PendingTpContacts since it didn't get used finally
-rw-r--r--TelepathyQt4Logger/CMakeLists.txt3
-rw-r--r--TelepathyQt4Logger/pending-tpcontacts.cpp191
-rw-r--r--TelepathyQt4Logger/pending-tpcontacts.h57
3 files changed, 0 insertions, 251 deletions
diff --git a/TelepathyQt4Logger/CMakeLists.txt b/TelepathyQt4Logger/CMakeLists.txt
index 20d6a16..e279945 100644
--- a/TelepathyQt4Logger/CMakeLists.txt
+++ b/TelepathyQt4Logger/CMakeLists.txt
@@ -47,7 +47,6 @@ set(telepathy_qt4_logger_SRCS
pending-events.cpp
pending-operation.cpp
pending-search.cpp
- pending-tpcontacts.cpp
text-event.cpp
utils.cpp
init.cpp
@@ -82,7 +81,6 @@ set(telepathy_qt4_logger_HEADERS
pending-events.h
pending-operation.h
pending-search.h
- pending-tpcontacts.h
text-event.h
types.h
utils.h)
@@ -94,7 +92,6 @@ set(telepathy_qt4_logger_MOC_SRCS
pending-events.h
pending-operation.h
pending-search.h
- pending-tpcontacts.h
logger.h)
# Generated headers which will be installed and exported
diff --git a/TelepathyQt4Logger/pending-tpcontacts.cpp b/TelepathyQt4Logger/pending-tpcontacts.cpp
deleted file mode 100644
index ba2f053..0000000
--- a/TelepathyQt4Logger/pending-tpcontacts.cpp
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * This file is part of TelepathyQt4Logger
- *
- * Copyright (C) 2011 Collabora Ltd. <http://www.collabora.co.uk/>
- *
- * 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 <QDebug>
-#include <TelepathyQt4/Account>
-#include <TelepathyQt4/ReferencedHandles>
-#include <TelepathyQt4/ContactManager>
-#include <TelepathyQt4Logger/Constants>
-#include <TelepathyQt4Logger/pending-tpcontacts.h>
-#include <TelepathyQt4Logger/_gen/pending-tpcontacts.moc.hpp>
-#include <glib/gerror.h>
-#include <glib/gdate.h>
-#include <telepathy-logger/log-manager.h>
-
-using namespace Tpl;
-
-struct TELEPATHY_QT4_LOGGER_NO_EXPORT PendingTpContacts::Private
-{
- /*
- Private(const ContactPtrList &contactPtrList)
- : mContactPtrList(contactPtrList),
- mTpContacts(0)
- {
- }
- */
-
- Private(Tp::ContactPtr &contactPtr)
- : mTpContacts(0),
- mNumTpContacts(0)
- {
- mContactPtrList << contactPtr;
- }
-
- ~Private()
- {
- if (mTpContacts) {
- free(mTpContacts);
- }
- }
-
- ContactPtrList mContactPtrList;
- TpContact **mTpContacts;
- uint mNumTpContacts;
-
- static void callback(TpConnection *connection, guint n_contacts, TpContact * const *contacts,
- guint n_failed, const TpHandle *failed, const GError *error,
- gpointer user_data, GObject *weak_object);
-};
-
-PendingTpContacts::PendingTpContacts(Tp::ContactPtr contact)
- : PendingOperation(),
- mPriv(new Private(contact))
-{
-}
-
-/*
-PendingTpContacts::PendingTpContacts(ContactPtrList contactPtrList)
- : PendingOperation(),
- mPriv(new Private(contactPtrList))
-{
-}
-*/
-
-PendingTpContacts::~PendingTpContacts()
-{
- delete mPriv;
-}
-
-void PendingTpContacts::start()
-{
- if (mPriv->mContactPtrList.size() <= 0) {
- setFinishedWithError(TELEPATHY_QT4_LOGGER_ERROR_INVALID_ARGUMENT, "No contacts provided");
- }
-
- Tp::ContactPtr contact = mPriv->mContactPtrList.at(0);
-
- if (contact.isNull()) {
- setFinishedWithError(TELEPATHY_QT4_LOGGER_ERROR_INVALID_ARGUMENT, "No valid contact provided");
- return;
- }
-
- Tp::ReferencedHandles handles = contact->handle();
- if (handles.isEmpty()) {
- setFinishedWithError(TELEPATHY_QT4_LOGGER_ERROR_INVALID_ARGUMENT, "No valid contact provided");
- return;
- }
-
- GError *error = 0;
- TpDBusDaemon * tpDBusDaemon = tp_dbus_daemon_dup(&error);
- if (error) {
- g_error_free(error);
- setFinishedWithError(TELEPATHY_QT4_LOGGER_ERROR_INVALID_ARGUMENT, "Invalid dbus daemon");
- return;
- }
-
- if (!tpDBusDaemon) {
- setFinishedWithError(TELEPATHY_QT4_LOGGER_ERROR_INVALID_ARGUMENT, "Invalid dbus daemon");
- return;
- }
-
- if (!contact->manager()) {
- setFinishedWithError(TELEPATHY_QT4_LOGGER_ERROR_INVALID_ARGUMENT, "No Contact Manager found");
- return;
- }
-
- Tp::ConnectionPtr connection = contact->manager()->connection();
- if (!connection) {
- setFinishedWithError(TELEPATHY_QT4_LOGGER_ERROR_INVALID_ARGUMENT, "No Contact Manager found");
- return;
- }
-
- QString busName = connection->busName();
- QString objectPath = connection->objectPath();
- TpConnection *tpConnection = tp_connection_new(tpDBusDaemon, busName.toLatin1(), objectPath.toLatin1(), &error);
- if (error) {
- setFinishedWithError(TELEPATHY_QT4_LOGGER_ERROR_INVALID_ARGUMENT, "No connection found");
- return;
- }
-
- if (!tpConnection) {
- setFinishedWithError(TELEPATHY_QT4_LOGGER_ERROR_INVALID_ARGUMENT, "No connection found");
- return;
- }
-
- Tp::ReferencedHandles::const_iterator it;
- for(it = handles.constBegin(); it != handles.constEnd(); it++) {
- TpHandle handle = *it;
- tp_connection_get_contacts_by_handle(tpConnection, 1, &handle, 0, NULL,
- Private::callback, this, NULL, NULL);
- //TpContact *tpContact = tp_connection_dup_contact_if_possible(connection, *it, contact->id());
- }
-}
-
-void PendingTpContacts::Private::callback(TpConnection *connection, guint n_contacts,
- TpContact * const *contacts, guint n_failed, const TpHandle *failed, const GError *error,
- gpointer user_data, GObject *weak_object)
-{
- Q_UNUSED(connection);
- Q_UNUSED(failed);
- Q_UNUSED(weak_object);
-
- PendingTpContacts *self = (PendingTpContacts *) user_data;
-
- if (error != NULL) {
- self->setFinishedWithError(TELEPATHY_QT4_LOGGER_ERROR_INVALID_ARGUMENT, error->message);
- return;
- }
-
- if (n_failed > 0 || n_contacts <= 0) {
- self->setFinishedWithError(TELEPATHY_QT4_LOGGER_ERROR_INVALID_ARGUMENT, "Failed to prepare some TpContact (InvalidHandle)");
- return;
- }
-
- self->mPriv->mNumTpContacts = n_contacts;
- self->mPriv->mTpContacts = (TpContact**) malloc(sizeof(TpContact*) * self->mPriv->mNumTpContacts);
- memcpy(self->mPriv->mTpContacts, contacts, sizeof(TpContact*) * self->mPriv->mNumTpContacts);
-
- self->setFinished();
-}
-
-TpContact *PendingTpContacts::tpContact() const
-{
- if (!isFinished()) {
- qWarning() << "PendingTpContacts::tpContact called before finished, returning 0";
- return 0;
- } else if (!isValid()) {
- qWarning() << "PendingTpContacts::tpContact called when not valid, returning 0";
- return 0;
- } else if (mPriv->mNumTpContacts <= 0) {
- return 0;
- }
-
- return mPriv->mTpContacts[0];
-}
diff --git a/TelepathyQt4Logger/pending-tpcontacts.h b/TelepathyQt4Logger/pending-tpcontacts.h
deleted file mode 100644
index def2927..0000000
--- a/TelepathyQt4Logger/pending-tpcontacts.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * This file is part of TelepathyQt4Logger
- *
- * Copyright (C) 2011 Collabora Ltd. <http://www.collabora.co.uk/>
- *
- * 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 _TelepathyQt4Logger_pending_tpcontacts_h_HEADER_GUARD_
-#define _TelepathyQt4Logger_pending_tpcontacts_h_HEADER_GUARD_
-
-#include <TelepathyQt4Logger/LogManager>
-#include <TelepathyQt4Logger/PendingOperation>
-#include <TelepathyQt4Logger/Types>
-#include <QtCore/QList>
-#include <telepathy-glib/contact.h>
-
-namespace Tpl
-{
-
-class PendingTpContacts : public Tpl::PendingOperation
-{
- Q_OBJECT
- Q_DISABLE_COPY(PendingTpContacts);
-
-public:
- PendingTpContacts(Tp::ContactPtr contact);
- //PendingTpContacts(ContactPtrList contactList);
- ~PendingTpContacts();
-
- TpContact *tpContact() const;
- //TpContact **tpContactList() const;
- //uint numTpContacts() const;
-
-private Q_SLOTS:
- virtual void start();
-
-private:
- struct Private;
- friend struct Private;
- Private *mPriv;
-};
-
-} // Tpl
-
-#endif