/* * Copyright (C) 2012-2014 Canonical, Ltd. * * Authors: * Gustavo Pichorim Boiko * * 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 TEXTCHANNELOBSERVER_H #define TEXTCHANNELOBSERVER_H #include #include #include #include #include QTCONTACTS_USE_NAMESPACE class NotificationData; class TextChannelObserver : public QObject { Q_OBJECT public: explicit TextChannelObserver(QObject *parent = 0); ~TextChannelObserver(); public Q_SLOTS: void onTextChannelAvailable(Tp::TextChannelPtr textChannel); void sendMessage(const QStringList &recipients, const QString &text, const QString &accountId); void clearNotifications(); protected: void showNotificationForFlashMessage(const Tp::ReceivedMessage &message, const QString &accountId); void triggerNotificationForMessage(const Tp::ReceivedMessage &message, const QString &accountId, const QStringList &participantIds = QStringList()); void showNotificationForMessage(const Tp::ReceivedMessage &message, const QString &accountId, const QStringList &participantIds = QStringList(), const QContact &contact = QContact()); protected Q_SLOTS: void onTextChannelInvalidated(); void onMessageReceived(const Tp::ReceivedMessage &message); void onPendingMessageRemoved(const Tp::ReceivedMessage &message); void onReplyReceived(const QStringList &recipients, const QString &accountId, const QString &reply); void onMessageRead(const QStringList &recipients, const QString &accountId, const QString &encodedMessageId); void onMessageSent(Tp::Message, Tp::MessageSendingFlags, QString); void updateNotifications(const QtContacts::QContact &contact); private: void processMessageReceived(const Tp::ReceivedMessage &message, const Tp::TextChannelPtr &textChannel); QList mChannels; QList mFlashChannels; QMap mNotifications; QList mUnreadMessages; }; #endif // TEXTCHANNELOBSERVER_H