Skip to content

Commit

Permalink
Review issues fix: moved clientStatusTypeChanged(), clientStatusTextC…
Browse files Browse the repository at this point in the history
…hanged() signal emit points
  • Loading branch information
Nikita Gorbunov committed May 22, 2014
1 parent 6d774ea commit 0cd8d3d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions qxmpp-declarative/src/QmlQXmppClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include <QtDeclarative/QDeclarativeEngine>

#include <QXmppUtils.h>
#include <QXmppMessage.h>
#include <QXmppPresence.h>
#include <QXmppArchiveManager.h>
Expand Down Expand Up @@ -153,14 +154,12 @@ void QmlQXmppClient::setClientPresence(QVariantMap map)
{
bool anythingChanged = false;
QXmppPresence presence = this->_client.clientPresence();
QXmppPresence::AvailableStatusType oldAvailableStatusType = presence.availableStatusType();


if (map.contains(QString("type"))) {
QXmppPresence::AvailableStatusType newType = intToAvailableStatusType(map["type"].toInt());
if (newType != presence.availableStatusType()) {
presence.setAvailableStatusType(newType);
anythingChanged = true;
emit clientStatusTypeChanged();
}
}

Expand All @@ -169,7 +168,6 @@ void QmlQXmppClient::setClientPresence(QVariantMap map)
if (newStatus != presence.statusText()) {
presence.setStatusText(newStatus);
anythingChanged = true;
emit clientStatusTextChanged();
}
}

Expand All @@ -185,6 +183,11 @@ void QmlQXmppClient::onMessageReceived(const QXmppMessage& message)

void QmlQXmppClient::onPresenceReceived(const QXmppPresence &presence)
{
if (QXmppUtils::jidToBareJid(presence.from()) == this->_client.configuration().jidBare()) {
emit this->clientStatusTypeChanged();
emit this->clientStatusTextChanged();
}

QmlQXmppPresence presenceWrapper(presence);
emit this->presenceReceived(&presenceWrapper);
}
Expand Down

0 comments on commit 0cd8d3d

Please sign in to comment.