started the work to get the list of participants in the room, license fix, little gui models refactor
This commit is contained in:
parent
f5fa45d853
commit
70f9739cf5
25 changed files with 508 additions and 117 deletions
|
@ -224,7 +224,6 @@ void Core::Account::onRosterItemChanged(const QString& bareJid)
|
|||
QXmppRosterManager& rm = client.rosterManager();
|
||||
QXmppRosterIq::Item re = rm.getRosterEntry(bareJid);
|
||||
|
||||
QStringList res = rm.getResources(bareJid);
|
||||
Shared::SubscriptionState state = castSubscriptionState(re.subscriptionType());
|
||||
|
||||
contact->setGroups(re.groups());
|
||||
|
@ -315,6 +314,11 @@ void Core::Account::handleNewConference(Core::Conference* contact)
|
|||
QObject::connect(contact, SIGNAL(nickChanged(const QString&)), this, SLOT(onMucNickNameChanged(const QString&)));
|
||||
QObject::connect(contact, SIGNAL(joinedChanged(bool)), this, SLOT(onMucJoinedChanged(bool)));
|
||||
QObject::connect(contact, SIGNAL(autoJoinChanged(bool)), this, SLOT(onMucAutoJoinChanged(bool)));
|
||||
QObject::connect(contact, SIGNAL(addParticipant(const QString&, const QMap<QString, QVariant>&)),
|
||||
this, SLOT(onMucAddParticipant(const QString&, const QMap<QString, QVariant>&)));
|
||||
QObject::connect(contact, SIGNAL(changeParticipant(const QString&, const QMap<QString, QVariant>&)),
|
||||
this, SLOT(onMucChangeParticipant(const QString&, const QMap<QString, QVariant>&)));
|
||||
QObject::connect(contact, SIGNAL(removeParticipant(const QString&)), this, SLOT(onMucRemoveParticipant(const QString&)));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1058,3 +1062,21 @@ void Core::Account::setRoomJoined(const QString& jid, bool joined)
|
|||
|
||||
cItr->second->setJoined(joined);
|
||||
}
|
||||
|
||||
void Core::Account::onMucAddParticipant(const QString& nickName, const QMap<QString, QVariant>& data)
|
||||
{
|
||||
Conference* room = static_cast<Conference*>(sender());
|
||||
emit addRoomParticipant(room->jid, nickName, data);
|
||||
}
|
||||
|
||||
void Core::Account::onMucChangeParticipant(const QString& nickName, const QMap<QString, QVariant>& data)
|
||||
{
|
||||
Conference* room = static_cast<Conference*>(sender());
|
||||
emit changeRoomParticipant(room->jid, nickName, data);
|
||||
}
|
||||
|
||||
void Core::Account::onMucRemoveParticipant(const QString& nickName)
|
||||
{
|
||||
Conference* room = static_cast<Conference*>(sender());
|
||||
emit removeRoomParticipant(room->jid, nickName);
|
||||
}
|
||||
|
|
|
@ -91,6 +91,9 @@ signals:
|
|||
void message(const Shared::Message& data);
|
||||
void responseArchive(const QString& jid, const std::list<Shared::Message>& list);
|
||||
void error(const QString& text);
|
||||
void addRoomParticipant(const QString& jid, const QString& nickName, const QMap<QString, QVariant>& data);
|
||||
void changeRoomParticipant(const QString& jid, const QString& nickName, const QMap<QString, QVariant>& data);
|
||||
void removeRoomParticipant(const QString& jid, const QString& nickName);
|
||||
|
||||
private:
|
||||
QString name;
|
||||
|
@ -136,6 +139,9 @@ private slots:
|
|||
void onMucJoinedChanged(bool joined);
|
||||
void onMucAutoJoinChanged(bool autoJoin);
|
||||
void onMucNickNameChanged(const QString& nickName);
|
||||
void onMucAddParticipant(const QString& nickName, const QMap<QString, QVariant>& data);
|
||||
void onMucChangeParticipant(const QString& nickName, const QMap<QString, QVariant>& data);
|
||||
void onMucRemoveParticipant(const QString& nickName);
|
||||
|
||||
void bookmarksReceived(const QXmppBookmarkSet& bookmarks);
|
||||
|
||||
|
|
|
@ -33,6 +33,9 @@ Core::Conference::Conference(const QString& p_jid, const QString& p_account, boo
|
|||
connect(room, SIGNAL(joined()), this, SLOT(onRoomJoined()));
|
||||
connect(room, SIGNAL(left()), this, SLOT(onRoomLeft()));
|
||||
connect(room, SIGNAL(nameChanged(const QString&)), this, SLOT(onRoomNameChanged(const QString&)));
|
||||
connect(room, SIGNAL(participantAdded(const QString&)), this, SLOT(onRoomParticipantAdded(const QString&)));
|
||||
connect(room, SIGNAL(participantChanged(const QString&)), this, SLOT(onRoomParticipantChanged(const QString&)));
|
||||
connect(room, SIGNAL(participantRemoved(const QString&)), this, SLOT(onRoomParticipantRemoved(const QString&)));
|
||||
connect(room, SIGNAL(nickNameChanged(const QString&)), this, SLOT(onRoomNickNameChanged(const QString&)));
|
||||
connect(room, SIGNAL(error(const QXmppStanza::Error&)), this, SLOT(onRoomError(const QXmppStanza::Error&)));
|
||||
|
||||
|
@ -119,5 +122,65 @@ void Core::Conference::onRoomNickNameChanged(const QString& p_nick)
|
|||
|
||||
void Core::Conference::onRoomError(const QXmppStanza::Error& err)
|
||||
{
|
||||
qDebug() << "MUC error";
|
||||
qDebug() << "MUC" << jid << "error:" << err.text();
|
||||
}
|
||||
|
||||
void Core::Conference::onRoomParticipantAdded(const QString& p_name)
|
||||
{
|
||||
QStringList comps = p_name.split("/");
|
||||
QString resource = comps.back();
|
||||
if (resource == jid) {
|
||||
qDebug() << "Room" << jid << "is reporting of adding itself to the list participants. Not sure what to do with that yet, skipping";
|
||||
} else {
|
||||
qDebug() << "Participant" << resource << "had entered room" << jid;
|
||||
QXmppPresence pres = room->participantPresence(jid);
|
||||
QDateTime lastInteraction = pres.lastUserInteraction();
|
||||
if (!lastInteraction.isValid()) {
|
||||
lastInteraction = QDateTime::currentDateTime();
|
||||
}
|
||||
QXmppMucItem mi = pres.mucItem();
|
||||
|
||||
emit addParticipant(resource, {
|
||||
{"lastActivity", lastInteraction},
|
||||
{"availability", pres.availableStatusType()},
|
||||
{"status", pres.statusText()},
|
||||
{"affiliation", mi.affiliation()},
|
||||
{"role", mi.role()}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void Core::Conference::onRoomParticipantChanged(const QString& p_name)
|
||||
{
|
||||
QStringList comps = p_name.split("/");
|
||||
QString resource = comps.back();
|
||||
if (resource == jid) {
|
||||
qDebug() << "Room" << jid << "is reporting of changing his own presence. Not sure what to do with that yet, skipping";
|
||||
} else {
|
||||
QXmppPresence pres = room->participantPresence(jid);
|
||||
QDateTime lastInteraction = pres.lastUserInteraction();
|
||||
if (!lastInteraction.isValid()) {
|
||||
lastInteraction = QDateTime::currentDateTime();
|
||||
}
|
||||
QXmppMucItem mi = pres.mucItem();
|
||||
|
||||
emit changeParticipant(resource, {
|
||||
{"lastActivity", lastInteraction},
|
||||
{"availability", pres.availableStatusType()},
|
||||
{"status", pres.statusText()},
|
||||
{"affiliation", mi.affiliation()},
|
||||
{"role", mi.role()}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void Core::Conference::onRoomParticipantRemoved(const QString& p_name)
|
||||
{
|
||||
QStringList comps = p_name.split("/");
|
||||
QString resource = comps.back();
|
||||
if (resource == jid) {
|
||||
qDebug() << "Room" << jid << "is reporting of removing his own presence from the list of participants. Not sure what to do with that yet, skipping";
|
||||
} else {
|
||||
emit removeParticipant(resource);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,9 @@ signals:
|
|||
void nickChanged(const QString& nick);
|
||||
void joinedChanged(bool joined);
|
||||
void autoJoinChanged(bool autoJoin);
|
||||
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);
|
||||
|
||||
private:
|
||||
QString nick;
|
||||
|
@ -61,6 +64,9 @@ private slots:
|
|||
void onRoomNameChanged(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);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -440,3 +440,20 @@ void Core::Squawk::setRoomAutoJoin(const QString& account, const QString& jid, b
|
|||
itr->second->setRoomAutoJoin(jid, joined);
|
||||
}
|
||||
|
||||
void Core::Squawk::onAccountAddRoomPresence(const QString& jid, const QString& nick, const QMap<QString, QVariant>& data)
|
||||
{
|
||||
Account* acc = static_cast<Account*>(sender());
|
||||
emit addRoomParticipant(acc->getName(), jid, nick, data);
|
||||
}
|
||||
|
||||
void Core::Squawk::onAccountChangeRoomPresence(const QString& jid, const QString& nick, const QMap<QString, QVariant>& data)
|
||||
{
|
||||
Account* acc = static_cast<Account*>(sender());
|
||||
emit changeRoomParticipant(acc->getName(), jid, nick, data);
|
||||
}
|
||||
|
||||
void Core::Squawk::onAccountRemoveRoomPresence(const QString& jid, const QString& nick)
|
||||
{
|
||||
Account* acc = static_cast<Account*>(sender());
|
||||
emit removeRoomParticipant(acc->getName(), jid, nick);
|
||||
}
|
||||
|
|
|
@ -58,6 +58,9 @@ signals:
|
|||
void addRoom(const QString& account, const QString jid, const QMap<QString, QVariant>& data);
|
||||
void changeRoom(const QString& account, const QString jid, const QMap<QString, QVariant>& data);
|
||||
void removeRoom(const QString& account, const QString jid);
|
||||
void addRoomParticipant(const QString& account, const QString& jid, const QString& name, const QMap<QString, QVariant>& data);
|
||||
void changeRoomParticipant(const QString& account, const QString& jid, const QString& name, const QMap<QString, QVariant>& data);
|
||||
void removeRoomParticipant(const QString& account, const QString& jid, const QString& name);
|
||||
|
||||
public slots:
|
||||
void start();
|
||||
|
@ -105,6 +108,9 @@ private slots:
|
|||
void onAccountAddRoom(const QString jid, const QMap<QString, QVariant>& data);
|
||||
void onAccountChangeRoom(const QString jid, const QMap<QString, QVariant>& data);
|
||||
void onAccountRemoveRoom(const QString jid);
|
||||
void onAccountAddRoomPresence(const QString& jid, const QString& nick, const QMap<QString, QVariant>& data);
|
||||
void onAccountChangeRoomPresence(const QString& jid, const QString& nick, const QMap<QString, QVariant>& data);
|
||||
void onAccountRemoveRoomPresence(const QString& jid, const QString& nick);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue