kdeconnect-kde/telepathy-cm/connection.h
David Edmundson e4cbf22519 Telepathy integration
This sends recieved text messages to any Telepathy client and allows the
user to respond from there.
This should work with both our clients and Empathy.

An account on telepathy is created on activation.

As Telepathy clients expect backends to be always running, this is
started by the daemon to
suppress client errors. The plugin system then talks to the same CM via
use of a singleton accessor.

Based on work by Alexandr Akulich then tidied up and rebased.
2015-09-10 20:36:46 +02:00

71 lines
2.7 KiB
C++

/*
Copyright (C) 2014 Alexandr Akulich <akulichalexander@gmail.com>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef CONNECTCM_CONNECTION_H
#define CONNECTCM_CONNECTION_H
#include "connectcm_export.h"
#include <TelepathyQt/BaseConnection>
#include <TelepathyQt/BaseChannel>
class CONNECTCM_EXPORT ConnectConnection : public Tp::BaseConnection
{
Q_OBJECT
public:
ConnectConnection(const QDBusConnection &dbusConnection,
const QString &cmName, const QString &protocolName,
const QVariantMap &parameters);
~ConnectConnection();
static Tp::SimpleStatusSpecMap getSimpleStatusSpecMap();
void connect(Tp::DBusError *error);
QStringList inspectHandles(uint handleType, const Tp::UIntList &handles, Tp::DBusError *error);
Tp::BaseChannelPtr createChannelCB(const QVariantMap &request, Tp::DBusError *error);
Tp::UIntList requestHandles(uint handleType, const QStringList &identifiers, Tp::DBusError *error);
Tp::ContactAttributesMap getContactListAttributes(const QStringList &interfaces, bool hold, Tp::DBusError *error);
Tp::ContactAttributesMap getContactAttributes(const Tp::UIntList &handles, const QStringList &interfaces, Tp::DBusError *error);
Tp::SimplePresence getPresence(uint handle);
uint setPresence(const QString &status, const QString &message, Tp::DBusError *error);
uint ensureContact(const QString &identifier);
public slots:
bool receiveMessage(const QString &sender, const QString &message);
void setContactList(const QStringList &identifiers);
signals:
void messageReceived(const QString &sender, const QString &message);
private:
uint getHandle(const QString &identifier) const;
uint addContact(const QString &identifier);
uint addContacts(const QStringList &identifiers);
Tp::BaseConnectionContactsInterfacePtr contactsIface;
Tp::BaseConnectionSimplePresenceInterfacePtr simplePresenceIface;
Tp::BaseConnectionContactListInterfacePtr contactListIface;
Tp::BaseConnectionAddressingInterfacePtr addressingIface;
Tp::BaseConnectionRequestsInterfacePtr requestsIface;
QMap<uint, QString> m_handles;
/* Maps a contact handle to its subscription state */
QString m_deviceId;
};
#endif // CONNECTCM_CONNECTION_H