2019-03-29 14:54:34 +00:00
|
|
|
#ifndef CORE_SQUAWK_H
|
|
|
|
#define CORE_SQUAWK_H
|
|
|
|
|
|
|
|
#include <QtCore/QObject>
|
2019-03-30 20:13:13 +00:00
|
|
|
#include <QString>
|
|
|
|
#include <QVariant>
|
|
|
|
#include <QMap>
|
2019-03-29 14:54:34 +00:00
|
|
|
#include <deque>
|
2019-03-31 21:05:09 +00:00
|
|
|
#include <deque>
|
2019-03-29 14:54:34 +00:00
|
|
|
|
|
|
|
#include "account.h"
|
2019-03-31 21:05:09 +00:00
|
|
|
#include "../global.h"
|
2019-03-29 14:54:34 +00:00
|
|
|
|
|
|
|
namespace Core
|
|
|
|
{
|
|
|
|
class Squawk : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
Squawk(QObject* parent = 0);
|
|
|
|
~Squawk();
|
|
|
|
|
2019-03-30 20:13:13 +00:00
|
|
|
signals:
|
2019-04-02 21:58:43 +00:00
|
|
|
void quit();
|
2019-03-30 20:13:13 +00:00
|
|
|
void newAccount(const QMap<QString, QVariant>&);
|
2019-03-31 21:05:09 +00:00
|
|
|
void accountConnectionStateChanged(const QString&, int);
|
2019-04-07 20:14:15 +00:00
|
|
|
void accountAvailabilityChanged(const QString&, int);
|
2019-04-03 21:23:51 +00:00
|
|
|
void addGroup(const QString& account, const QString& name);
|
|
|
|
void removeGroup(const QString& account, const QString& name);
|
2019-04-07 20:14:15 +00:00
|
|
|
void addContact(const QString& account, const QString& jid, const QString& group, const QMap<QString, QVariant>& data);
|
2019-04-06 10:14:32 +00:00
|
|
|
void removeContact(const QString& account, const QString& jid);
|
|
|
|
void removeContact(const QString& account, const QString& jid, const QString& group);
|
2019-04-07 20:14:15 +00:00
|
|
|
void changeContact(const QString& account, const QString& jid, const QMap<QString, QVariant>& data);
|
2019-04-07 14:02:41 +00:00
|
|
|
void addPresence(const QString& account, const QString& jid, const QString& name, const QMap<QString, QVariant>& data);
|
|
|
|
void removePresence(const QString& account, const QString& jid, const QString& name);
|
2019-04-07 20:14:15 +00:00
|
|
|
void stateChanged(int state);
|
2019-04-11 14:58:59 +00:00
|
|
|
void accountMessage(const QString& account, const Shared::Message& data);
|
2019-05-15 17:36:37 +00:00
|
|
|
void responseArchive(const QString& account, const QString& jid, const std::list<Shared::Message>& list);
|
2019-03-30 20:13:13 +00:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
void start();
|
2019-04-02 21:58:43 +00:00
|
|
|
void stop();
|
2019-03-30 20:13:13 +00:00
|
|
|
void newAccountRequest(const QMap<QString, QVariant>& map);
|
2019-03-31 21:05:09 +00:00
|
|
|
void connectAccount(const QString& account);
|
|
|
|
void disconnectAccount(const QString& account);
|
2019-04-07 20:14:15 +00:00
|
|
|
void changeState(int state);
|
2019-04-11 14:58:59 +00:00
|
|
|
void sendMessage(const QString& account, const Shared::Message& data);
|
2019-05-15 17:36:37 +00:00
|
|
|
void requestArchive(const QString& account, const QString& jid, int count, const QString& before);
|
2019-03-30 20:13:13 +00:00
|
|
|
|
2019-03-29 14:54:34 +00:00
|
|
|
private:
|
2019-03-30 20:13:13 +00:00
|
|
|
typedef std::deque<Account*> Accounts;
|
2019-03-31 21:05:09 +00:00
|
|
|
typedef std::map<QString, Account*> AccountsMap;
|
2019-03-29 14:54:34 +00:00
|
|
|
|
|
|
|
Accounts accounts;
|
2019-03-31 21:05:09 +00:00
|
|
|
AccountsMap amap;
|
2019-04-07 20:14:15 +00:00
|
|
|
Shared::Availability state;
|
2019-03-30 20:13:13 +00:00
|
|
|
|
|
|
|
private:
|
2019-04-12 05:51:36 +00:00
|
|
|
void addAccount(const QString& login, const QString& server, const QString& password, const QString& name, const QString& resource);
|
2019-03-31 21:05:09 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void onAccountConnectionStateChanged(int state);
|
2019-04-07 20:14:15 +00:00
|
|
|
void onAccountAvailabilityChanged(int state);
|
2019-04-03 21:23:51 +00:00
|
|
|
void onAccountAddGroup(const QString& name);
|
|
|
|
void onAccountRemoveGroup(const QString& name);
|
2019-04-07 20:14:15 +00:00
|
|
|
void onAccountAddContact(const QString& jid, const QString& group, const QMap<QString, QVariant>& data);
|
2019-04-06 10:14:32 +00:00
|
|
|
void onAccountRemoveContact(const QString& jid);
|
|
|
|
void onAccountRemoveContact(const QString& jid, const QString& group);
|
2019-04-07 20:14:15 +00:00
|
|
|
void onAccountChangeContact(const QString& jid, const QMap<QString, QVariant>& data);
|
2019-04-07 14:02:41 +00:00
|
|
|
void onAccountAddPresence(const QString& jid, const QString& name, const QMap<QString, QVariant>& data);
|
|
|
|
void onAccountRemovePresence(const QString& jid, const QString& name);
|
2019-04-11 14:58:59 +00:00
|
|
|
void onAccountMessage(const Shared::Message& data);
|
2019-05-15 17:36:37 +00:00
|
|
|
void onAccountResponseArchive(const QString& jid, const std::list<Shared::Message>& list);
|
2019-03-29 14:54:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // CORE_SQUAWK_H
|