/* * Copyright (C) 2012-2016 Canonical, Ltd. * * Authors: * Gustavo Pichorim Boiko * Tiago Salem Herrmann * * This file is part of telephony-service. * * telephony-service is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 3. * * telephony-service 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef CHATMANAGER_H #define CHATMANAGER_H #include #include #include #include #include #include "dbustypes.h" class ChatManager : public QObject { Q_OBJECT public: static ChatManager *instance(); QString startChat(const QString &accountId, const QVariantMap &properties); QString sendMessage(const QString &accountId, const QString &message, const QVariant &attachments = QVariant(), const QVariantMap &properties = QVariantMap()); QList channelForProperties(const QVariantMap &properties); Tp::TextChannelPtr channelForObjectPath(const QString &objectPath); static bool channelMatchProperties(const Tp::TextChannelPtr &channel, const QVariantMap &properties); Q_SIGNALS: void textChannelAvailable(Tp::TextChannelPtr); void textChannelInvalidated(Tp::TextChannelPtr); public Q_SLOTS: void onTextChannelAvailable(Tp::TextChannelPtr channel); void onChannelInvalidated(); void onConnectedChanged(); void acknowledgeMessage(const QVariantMap &properties); void acknowledgeAllMessages(const QVariantMap &properties); private Q_SLOTS: void onChannelObserverUnregistered(); protected Q_SLOTS: void onAckTimerTriggered(); private: explicit ChatManager(QObject *parent = 0); QVariantList mMessagesToAck; QList mTextChannels; QTimer mMessagesAckTimer; }; #endif // CHATMANAGER_H