forked from blue/squawk
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
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue