File tapioca_dtmf.diff of Package libQtTapioca0
Index: include/QtTapioca/streamchannel.h
===================================================================
--- include/QtTapioca/streamchannel.h (revision 2027)
+++ include/QtTapioca/streamchannel.h (working copy)
@@ -29,6 +29,8 @@
#include <QtTapioca/Channel>
#include <QtTapioca/Stream>
+#include <QtTelepathy/Common/ChannelDTMFInterfaceTypes>
+
namespace QtTapioca {
class Contact;
@@ -50,6 +52,9 @@ public:
void removeStream (QtTapioca::Stream *stream);
void join();
+ bool hasDTMFSupport() const;
+ bool sendDTMFTone(const uchar event);
+
Q_SIGNALS:
void newStream(QtTapioca::Stream *stream);
void streamRemoved(QtTapioca::Stream *stream);
Index: src/streamchannel.cpp
===================================================================
--- src/streamchannel.cpp (revision 2027)
+++ src/streamchannel.cpp (working copy)
@@ -36,6 +36,7 @@
#include <QtTelepathy/Client/StreamEngine>
#include <QtTelepathy/Client/ChannelStreamedMedia>
#include <QtTelepathy/Client/ChannelGroupInterface>
+#include <QtTelepathy/Client/ChannelDTMFInterface>
#define STREAM_ENGINE_IFACE "org.freedesktop.Telepathy.StreamEngine"
#define STREAM_ENGINE_PATH "/org/freedesktop/Telepathy/StreamEngine"
@@ -46,7 +47,8 @@ class StreamChannelPrivate {
public:
StreamChannelPrivate(Connection *conn, const QString &serviceName, const QString &objPath)
: m_conn(conn),
- telepathyChannelHandler(NULL)
+ telepathyChannelHandler(NULL),
+ telepathyIChannelDTMF(NULL)
{
telepathyStreamedMedia = new org::freedesktop::Telepathy::ChannelStreamedMedia(serviceName, objPath, QDBusConnection::sessionBus());
telepathyIChannelGroup = new org::freedesktop::Telepathy::ChannelGroupInterface(serviceName, objPath, QDBusConnection::sessionBus());
@@ -71,6 +73,7 @@ public:
org::freedesktop::Telepathy::ChannelHandler *telepathyChannelHandler;
org::freedesktop::Telepathy::ChannelStreamedMedia *telepathyStreamedMedia;
org::freedesktop::Telepathy::ChannelGroupInterface *telepathyIChannelGroup;
+ org::freedesktop::Telepathy::ChannelDTMFInterface *telepathyIChannelDTMF;
};
}
@@ -102,6 +105,9 @@ StreamChannel::StreamChannel(Connection
qDebug() << "error calling HandleChannel:" << ret.error().message();
}
+ if (hasSupportFor(org::freedesktop::Telepathy::ChannelDTMFInterface::staticInterfaceName()))
+ { d->telepathyIChannelDTMF = new org::freedesktop::Telepathy::ChannelDTMFInterface(serviceName, objPath, QDBusConnection::sessionBus()); }
+
updateStreamList();
}
@@ -259,3 +265,18 @@ void StreamChannel::onStreamRemoved(uint
}
d->mutex.unlock();
}
+
+bool StreamChannel::hasDTMFSupport() const
+{ return (0 != d->telepathyIChannelDTMF); }
+
+bool StreamChannel::sendDTMFTone(const uchar event)
+{
+ QtTapioca::Stream * stream(0);
+
+ if (!hasDTMFSupport()) { return false; }
+
+ foreach(stream, d->stream_hash.values())
+ { d->telepathyIChannelDTMF->StartTone(stream->m_id, event); }
+ return true;
+}
+