94 lines
2.9 KiB
C++
94 lines
2.9 KiB
C++
/*
|
|
* Squawk messenger.
|
|
* Copyright (C) 2019 Yury Gubich <blue@macaw.me>
|
|
*
|
|
* This program 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, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program 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 <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef CORE_CONFERENCE_H
|
|
#define CORE_CONFERENCE_H
|
|
|
|
#include <QDir>
|
|
|
|
#include <QXmppMucManager.h>
|
|
|
|
#include <set>
|
|
|
|
#include "rosteritem.h"
|
|
#include "shared/global.h"
|
|
|
|
namespace Core
|
|
{
|
|
|
|
/**
|
|
* @todo write docs
|
|
*/
|
|
class Conference : public RosterItem
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
Conference(const QString& p_jid, const QString& p_account, bool p_autoJoin, const QString& p_name, const QString& p_nick, QXmppMucRoom* p_room);
|
|
~Conference();
|
|
|
|
QString getNick() const;
|
|
QString getSubject() const;
|
|
void setNick(const QString& p_nick);
|
|
|
|
bool getJoined() const;
|
|
void setJoined(bool p_joined);
|
|
|
|
bool getAutoJoin();
|
|
void setAutoJoin(bool p_autoJoin);
|
|
void handlePresence(const QXmppPresence & pres) override;
|
|
bool setAutoGeneratedAvatar(const QString& resource = "") override;
|
|
Shared::VCard handleResponseVCard(const QXmppVCardIq & card, const QString &resource) override;
|
|
QMap<QString, QVariant> getAllAvatars() const;
|
|
|
|
signals:
|
|
void nickChanged(const QString& nick);
|
|
void joinedChanged(bool joined);
|
|
void autoJoinChanged(bool autoJoin);
|
|
void subjectChanged(const QString& subject);
|
|
void addParticipant(const QString& name, const QMap<QString, QVariant>& data);
|
|
void changeParticipant(const QString& name, const QMap<QString, QVariant>& data);
|
|
void removeParticipant(const QString& name);
|
|
|
|
protected:
|
|
bool setAvatar(const QByteArray &data, Archive::AvatarInfo& info, const QString &resource = "") override;
|
|
|
|
private:
|
|
QString nick;
|
|
QXmppMucRoom* room;
|
|
bool joined;
|
|
bool autoJoin;
|
|
std::map<QString, Archive::AvatarInfo> exParticipants;
|
|
static const std::set<QString> supportedList;
|
|
|
|
private slots:
|
|
void onRoomJoined();
|
|
void onRoomLeft();
|
|
void onRoomNameChanged(const QString& p_name);
|
|
void onRoomSubjectChanged(const QString& p_name);
|
|
void onRoomNickNameChanged(const QString& p_nick);
|
|
void onRoomError(const QXmppStanza::Error& err);
|
|
void onRoomParticipantAdded(const QString& p_name);
|
|
void onRoomParticipantChanged(const QString& p_name);
|
|
void onRoomParticipantRemoved(const QString& p_name);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif // CORE_CONFERENCE_H
|