File indexing completed on 2023-09-24 05:08:23
0001 /* 0002 Copyright (C) 2017 James D. Smith <smithjd15@gmail.com> 0003 Copyright (C) 2014 David Edmundson <kde@davidedmundson.co.uk> 0004 0005 This library is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU Lesser General Public 0007 License as published by the Free Software Foundation; either 0008 version 2.1 of the License, or (at your option) any later version. 0009 0010 This library is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 Lesser General Public License for more details. 0014 0015 You should have received a copy of the GNU Lesser General Public 0016 License along with this library; if not, write to the Free Software 0017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 0018 */ 0019 0020 0021 #include <QObject> 0022 #include <QHash> 0023 0024 #include <TelepathyQt/Account> 0025 #include <TelepathyQt/AccountManager> 0026 0027 #include <TelepathyQt/Presence> 0028 0029 class AccountStatusHelper; 0030 class TelepathyKDEDModulePlugin; 0031 class StatusMessageParser; 0032 0033 /** 0034 * This class initiates and responds to presence change events, modifying the 0035 * tp account presence to match the presence reflected in the plugin queue 0036 * and / or account status helper. It also processes incoming account requested 0037 * presence changes that aren't the result of a plugin presence or status message parser. 0038 */ 0039 0040 class StatusHandler : public QObject 0041 { 0042 Q_OBJECT 0043 0044 public: 0045 StatusHandler(QObject *parent); 0046 ~StatusHandler(); 0047 0048 Q_SIGNALS: 0049 void settingsChanged(); 0050 0051 private Q_SLOTS: 0052 void setPresence(const QString &accountUID = QString()); 0053 0054 private: 0055 void parkAccount(const Tp::AccountPtr &account); 0056 Tp::AccountSetPtr m_enabledAccounts; 0057 0058 AccountStatusHelper *m_accountStatusHelper; 0059 0060 QList<TelepathyKDEDModulePlugin*> m_queuePlugins; 0061 QHash<QString,StatusMessageParser*> m_parsers; 0062 0063 Tp::Presence m_pluginPresence; 0064 };