Add tapioca-qt, telepathy-complaint framework for real-time communication

This commit is contained in:
Tilman Keskinoz 2008-02-10 16:46:53 +00:00
parent 9806b83697
commit c868453a77
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=206998
9 changed files with 462 additions and 0 deletions

View File

@ -120,6 +120,7 @@
SUBDIR += sim-im
SUBDIR += sim-im-devel
SUBDIR += sulci
SUBDIR += tapioca-qt
SUBDIR += telepathy-butterfly
SUBDIR += telepathy-gabble
SUBDIR += telepathy-glib

View File

@ -0,0 +1,41 @@
# New ports collection Makefile for: tapioca-qt
# Date created: 2008-02-10
# Whom: arved
#
# $FreeBSD$
PORTNAME= tapioca-qt
PORTVERSION= 0.14.1
CATEGORIES= net-im
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= tapioca-voip
MAINTAINER= arved@FreeBSD.org
COMMENT= Framework for VoIP and IP applications
LIB_DEPENDS= QtTelepathyCore.0:${PORTSDIR}/net-im/telepathy-qt
WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION}/build
CMAKE?= ${LOCALBASE}/bin/cmake
CMAKE_ARGS= -DCMAKE_BUILD_TYPE=DEBUG \
-DCMAKE_INSTALL_PREFIX=${PREFIX} \
-DCMAKE_C_COMPILER:STRING='${CC}' \
-DCMAKE_C_FLAGS:STRING="${CFLAGS}" \
-DCMAKE_CXX_COMPILER:STRING=${CXX} \
-DCMAKE_CXX_FLAGS:STRING="${CXXFLAGS}"
USE_QT_VER= 4
QT_COMPONENTS= corelib qmake uic moc rcc
USE_LDCONFIG= yes
post-extract:
${MKDIR} ${WRKSRC}
post-patch:
${REINPLACE_CMD} -e \
"s,$${LIB_INSTALL_DIR}/pkgconfig,data/pkgconfig,g"\
${WRKSRC}/../CMakeLists.txt
do-configure:
cd ${WRKSRC}; ${SETENV} ${CONFIGURE_ENV} ${CMAKE} ${CMAKE_ARGS} ..
.include <bsd.port.mk>

View File

@ -0,0 +1,3 @@
MD5 (tapioca-qt-0.14.1.tar.gz) = 169318705af6386057b537c5317d520d
SHA256 (tapioca-qt-0.14.1.tar.gz) = ba25668286eccfa25c5908a639ae761b88271c14a790e82903b2d494e34c90ac
SIZE (tapioca-qt-0.14.1.tar.gz) = 644166

View File

@ -0,0 +1,14 @@
Index: src/contactbase.cpp
===================================================================
--- ../src/contactbase.cpp (revision 2019)
+++ ../src/contactbase.cpp (revision 2020)
@@ -308,3 +308,9 @@
if (cap.contactHandle == id)
updateCapabilities(cap.channelType, cap.newTypeSpecificFlags);
}
+
+bool ContactBase::operator==(const ContactBase &info) const
+{
+ return (*(info.handle()) == *handle());
+}
+

View File

@ -0,0 +1,251 @@
Index: include/QtTapioca/contactgroup.h
===================================================================
--- ../include/QtTapioca/contactgroup.h (revision 2022)
+++ ../include/QtTapioca/contactgroup.h (revision 2023)
@@ -30,6 +30,7 @@
namespace QtTapioca {
+class Channel;
class Conatct;
class Connection;
class ContactGroupPrivate;
@@ -63,10 +64,12 @@
QList<Contact *> contacts() const;
QList<Contact *> pendingContacts() const;
+ Channel * channel() const;
+
Q_SIGNALS:
- void contactEntered(Contact *contact);
- void contactLeft(Contact *contact);
- void newPendingContact(Contact *contact);
+ void contactEntered(QtTapioca::Contact *contact);
+ void contactLeft(QtTapioca::Contact *contact);
+ void newPendingContact(QtTapioca::Contact *contact);
private Q_SLOTS:
void onGroupFlagsChanged(uint added, uint removed);
@@ -75,10 +78,12 @@
const QList<uint> &remote_pending, uint actor, uint reason);
private:
- ContactGroup(Connection *connection, const QString &serviceName, const QString &objPath, QObject *parent = 0);
+ ContactGroup(Connection *connection, const QString &serviceName, const QString &objPath, Channel *channel);
QList<Contact *> contactsFromContactList(QList<uint> ids) const;
ContactGroupPrivate *d;
+
+ friend class Channel;
};
} // namespace
Index: include/QtTapioca/channel.h
===================================================================
--- ../include/QtTapioca/channel.h (revision 2022)
+++ ../include/QtTapioca/channel.h (revision 2023)
@@ -57,9 +57,13 @@
void close();
virtual void join();
- ContactGroup *contactGroup() const;
+ ContactGroup * contactGroup();
bool hasGroupSupport() const;
+ bool hasSupportFor(const QString &) const;
+
+ Connection * connection() const;
+
Q_SIGNALS:
void closed();
Index: include/QtTapioca/contactlist.h
===================================================================
--- ../include/QtTapioca/contactlist.h (revision 2022)
+++ ../include/QtTapioca/contactlist.h (revision 2023)
@@ -102,8 +102,8 @@
QObject *parent = 0);
void loadContacts();
- Contact *contact(Handle *handle) const;
- Contact *contact(uint id) const;
+ Contact *contact(Handle *handle);
+ Contact *contact(uint id);
Contact *addContact(const Handle *handle);
ContactListPrivate *d;
Index: src/contactgroup.cpp
===================================================================
--- ../src/contactgroup.cpp (revision 2022)
+++ ../src/contactgroup.cpp (revision 2023)
@@ -35,8 +35,9 @@
public:
ContactGroupPrivate(Connection *connection,
const QString &serviceName,
- const QString &objPath)
- : conn(connection)
+ const QString &objPath,
+ Channel * chan)
+ : conn(connection), channel(chan)
{
telepathyIChannelGroup = new org::freedesktop::Telepathy::ChannelGroupInterface(serviceName, objPath, QDBusConnection::sessionBus());
@@ -50,6 +51,7 @@
uint flags;
Connection *conn;
+ Channel * channel;
org::freedesktop::Telepathy::ChannelGroupInterface *telepathyIChannelGroup;
};
@@ -57,19 +59,19 @@
using namespace QtTapioca;
-ContactGroup::ContactGroup(Connection *connection, const QString &serviceName, const QString &objPath, QObject *parent)
- : d(new ContactGroupPrivate(connection, serviceName, objPath))
+ContactGroup::ContactGroup(Connection *connection, const QString &serviceName, const QString &objPath, Channel *channel)
+ : d(new ContactGroupPrivate(connection, serviceName, objPath, channel))
{
Q_ASSERT(d);
- QObject::connect(d->telepathyIChannelGroup, SIGNAL(GroupFlagsChanged(uint added, uint removed)), this, SLOT(onGroupFlagsChanged(uint added, uint removed)));
- QObject::connect(d->telepathyIChannelGroup, SIGNAL(MembersChanged(const QString &message, const QList<uint> &added,
- const QList<uint> &removed, const QList<uint> &local_pending,
- const QList<uint> &remote_pending, uint actor, uint reason)),
+ QObject::connect(d->telepathyIChannelGroup, SIGNAL(GroupFlagsChanged(uint, uint)), this, SLOT(onGroupFlagsChanged(uint, uint)));
+ QObject::connect(d->telepathyIChannelGroup, SIGNAL(MembersChanged(const QString&, const QList<uint>&,
+ const QList<uint>&, const QList<uint> &,
+ const QList<uint>&, uint, uint)),
this,
- SLOT(onMembersChanged(const QString &message, const QList<uint> &added,
- const QList<uint> &removed, const QList<uint> &local_pending,
- const QList<uint> &remote_pending, uint actor, uint reason)));
+ SLOT(onMembersChanged(const QString&, const QList<uint>&,
+ const QList<uint>&, const QList<uint>&,
+ const QList<uint>&, uint, uint)));
}
ContactGroup::~ContactGroup()
@@ -154,6 +156,8 @@
return lc;
}
+Channel * ContactGroup::channel() const { return d->channel; }
+
QList<Contact *> ContactGroup::contactsFromContactList(QList<uint> ids) const
{
uint i;
Index: src/channel.cpp
===================================================================
--- ../src/channel.cpp (revision 2022)
+++ ../src/channel.cpp (revision 2023)
@@ -25,6 +25,7 @@
#include "QtTapioca/Channel"
#include "QtTapioca/ChannelTarget"
+#include "QtTapioca/ContactGroup"
#include <QtDBus/QDBusConnection>
#include <QtDBus/QDBusConnectionInterface>
@@ -54,7 +55,7 @@
Connection *conn;
org::freedesktop::Telepathy::Channel *ch;
ChannelTarget* target;
- ContactGroup *cg;
+ ContactGroup * cg;
bool join;
};
@@ -99,17 +100,35 @@
return d->target;
}
-ContactGroup *Channel::contactGroup() const
+ContactGroup *Channel::contactGroup()
{
+ if (!hasGroupSupport()) { return 0; }
+ if (0 == d->cg)
+ {
+ d->cg = new ContactGroup(d->conn, serviceName(), objectPath(), this);
+ Q_ASSERT(0 != d->cg);
+ }
return d->cg;
}
bool Channel::hasGroupSupport() const
{
- return (d->cg);
+ return hasSupportFor("org.freedesktop.Telepathy.Channel.Interface.Group");
}
+bool Channel::hasSupportFor(const QString & interface) const
+{
+ QStringList interfaces = d->ch->GetInterfaces();
+ return interfaces.contains(interface);
+}
+
void Channel::join()
{
d->join = true;
}
+
+Connection * Channel::connection() const
+{
+ return d->conn;
+}
+
Index: src/contactlist.cpp
===================================================================
--- ../src/contactlist.cpp (revision 2022)
+++ ../src/contactlist.cpp (revision 2023)
@@ -29,6 +29,7 @@
#include <QDebug>
#include <QtCore/QMutex>
+#include <QtCore/QMutexLocker>
#include <QtDBus/QDBusConnection>
#include <QtDBus/QDBusConnectionInterface>
#include <QtTelepathy/Client/Channel>
@@ -273,7 +274,7 @@
/*
* Get Contact from Handle
*/
-Contact *ContactList::contact(Handle *handle) const
+Contact *ContactList::contact(Handle *handle)
{
return contact(handle->id());
}
@@ -294,9 +295,30 @@
/*
* Get Contact from id
*/
-Contact *ContactList::contact(uint id) const
+Contact * ContactList::contact(const uint id)
{
- return d->contacts.value(id);
+ QMutexLocker lock(&(d->mutex));
+ if (d->contacts.contains(id))
+ { return d->contacts.value(id); }
+
+ // Handle connections without a contact list:
+ Handle * handle(d->handleFactory->createHandle(Handle::Contact, id));
+
+ if (0 == handle) { return 0; }
+ Contact * c(new Contact(d->telepathyConn,
+ d->telepathyIAvatar,
+ d->telepathyIPresence,
+ d->telepathyIAliasing,
+ d->telepathyICapabilities,
+ d->lists[CONTACT_LIST_TYPE_SUBSCRIBE],
+ d->lists[CONTACT_LIST_TYPE_PUBLISH],
+ d->lists[CONTACT_LIST_TYPE_HIDE],
+ d->lists[CONTACT_LIST_TYPE_ALLOW],
+ d->lists[CONTACT_LIST_TYPE_DENY],
+ handle, this));
+ d->contacts[id] = c;
+
+ return c;
}
/*

View File

@ -0,0 +1,95 @@
--- ../src/connection.cpp.orig 2007-05-23 20:20:42.000000000 +0200
+++ ../src/connection.cpp 2008-02-10 15:57:31.000000000 +0100
@@ -139,6 +139,7 @@
QObject::connect(d->conn, SIGNAL(StatusChanged(uint,uint)), this, SLOT(onStatusChanged(uint,uint)));
updateOpenChannels();
+ if (d->status == Connected) { d->loadInterfaces(); }
}
/*
@@ -196,16 +197,14 @@
Channel *channel = 0;
QString objPath;
- d->mutex.lock();
+ QMutexLocker lock(&(d->mutex));
if (type == Channel::Text) {
- qDebug() << "Creating a text channel.";
objPath = requestChannel("org.freedesktop.Telepathy.Channel.Type.Text", contact->handle(),
suppress_handler);
if (!objPath.isEmpty())
channel = new TextChannel(this, serviceName(), objPath, contact, this);
}
else if (type == Channel::Stream) {
- qDebug() << "Creating a stream channel.";
objPath = requestChannel("org.freedesktop.Telepathy.Channel.Type.StreamedMedia", contact->handle(),
suppress_handler);
if (!objPath.isEmpty())
@@ -218,8 +217,6 @@
this, SLOT(onChannelDestroyed()));
}
- d->mutex.unlock();
-
return channel;
}
@@ -251,9 +248,10 @@
ContactList *Connection::contactList()
{
if (d->status == Connection::Disconnected)
- return 0;
+ { return 0; }
- if (!d->cl) {
+ if (!d->cl)
+ {
d->cl = new ContactList(d->conn,
d->iAvatar,
d->iPresence,
@@ -273,7 +271,8 @@
if (!d->uContact) {
if (!d->selfHandle) {
/* Updated selfHandle */
- d->selfHandle = d->handleFactory->createHandle(Handle::Contact, d->conn->GetSelfHandle());
+ uint my_handle = d->conn->GetSelfHandle();
+ d->selfHandle = d->handleFactory->createHandle(Handle::Contact, my_handle);
Q_ASSERT (d->selfHandle != 0);
}
@@ -332,14 +331,12 @@
{
Channel *channel = 0;
- d->mutex.lock();
+ QMutexLocker lock(&(d->mutex));
if ((d->channels.contains(objPath.path())) ||
((channelType != "org.freedesktop.Telepathy.Channel.Type.Text") &&
- (channelType != "org.freedesktop.Telepathy.Channel.Type.StreamedMedia"))) {
- d->mutex.unlock();
- return NULL;
- }
+ (channelType != "org.freedesktop.Telepathy.Channel.Type.StreamedMedia")))
+ { return NULL; }
Contact *contact = contactList()->contact(handleId);
@@ -348,7 +345,6 @@
contact = d->cl->addContact(handle);
if (!contact) {
qDebug() << "error creating a contact.";
- d->mutex.unlock();
return NULL;
}
}
@@ -364,8 +360,6 @@
this, SLOT(onChannelDestroyed()));
}
- d->mutex.unlock();
-
return channel;
}

View File

@ -0,0 +1,11 @@
--- ../include/QtTapioca/CMakeLists.txt 2007/06/15 08:40:29 1981
+++ ../include/QtTapioca/CMakeLists.txt 2007/07/20 15:33:04 2019
@@ -18,6 +18,8 @@
contact.h
ContactBase
contactbase.h
+ ContactGroup
+ contactgroup.h
ContactList
contactlist.h
DBusProxyObject

View File

@ -0,0 +1,8 @@
The Tapioca project provides a set of convenience libraries to easily
integrate VoIP and IM in your application, or even write new ones.
Tapioca follows the standard defined by the Telepathy project and therefore,
operates seamlessly with its connection managers and other software that
follows it as well.
WWW: http://tapioca-voip.sourceforge.net/

View File

@ -0,0 +1,38 @@
libdata/pkgconfig/QtTapioca.pc
lib/libQtTapioca.so.0.1.0
lib/libQtTapioca.so.0
lib/libQtTapioca.so
include/QtTapioca/Avatar
include/QtTapioca/avatar.h
include/QtTapioca/CMakeLists.txt
include/QtTapioca/Channel
include/QtTapioca/channel.h
include/QtTapioca/ChannelTarget
include/QtTapioca/channeltarget.h
include/QtTapioca/Connection
include/QtTapioca/connection.h
include/QtTapioca/ConnectionManager
include/QtTapioca/ConnectionManagerFactory
include/QtTapioca/connectionmanagerfactory.h
include/QtTapioca/connectionmanager.h
include/QtTapioca/Contact
include/QtTapioca/contact.h
include/QtTapioca/ContactBase
include/QtTapioca/contactbase.h
include/QtTapioca/ContactGroup
include/QtTapioca/contactgroup.h
include/QtTapioca/ContactList
include/QtTapioca/contactlist.h
include/QtTapioca/DBusProxyObject
include/QtTapioca/dbusproxyobject.h
include/QtTapioca/Handle
include/QtTapioca/handle.h
include/QtTapioca/HandleFactory
include/QtTapioca/handlefactory.h
include/QtTapioca/UserContact
include/QtTapioca/usercontact.h
include/QtTapioca/TextChannel
include/QtTapioca/textchannel.h
include/QtTapioca/StreamChannel
include/QtTapioca/Stream
@dirrm include/QtTapioca