From 6f3e7991a04b82c4684ca219dba7c21344c1a34a Mon Sep 17 00:00:00 2001 From: "James D. Smith" Date: Tue, 20 Dec 2016 23:44:01 -0700 Subject: [PATCH] Initial commit. --- TelepathyQt/account.cpp | 75 +++++++++++++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 30 deletions(-) diff --git TelepathyQt/account.cpp TelepathyQt/account.cpp index f6635e1..9258c9c 100644 --- TelepathyQt/account.cpp +++ TelepathyQt/account.cpp @@ -4388,38 +4388,17 @@ void Account::Private::updateProperties(const QVariantMap &props) parent->notify("automaticPresence"); } - if (props.contains(QLatin1String("CurrentPresence")) && - currentPresence.barePresence() != qdbus_cast( - props[QLatin1String("CurrentPresence")])) { - currentPresence = Presence(qdbus_cast( - props[QLatin1String("CurrentPresence")])); - debug() << " Current Presence:" << currentPresence.type() << - "-" << currentPresence.status(); - emit parent->currentPresenceChanged(currentPresence); - parent->notify("currentPresence"); - emit parent->onlinenessChanged(parent->isOnline()); - parent->notify("online"); - } - - if (props.contains(QLatin1String("RequestedPresence")) && - requestedPresence.barePresence() != qdbus_cast( - props[QLatin1String("RequestedPresence")])) { - requestedPresence = Presence(qdbus_cast( - props[QLatin1String("RequestedPresence")])); - debug() << " Requested Presence:" << requestedPresence.type() << - "-" << requestedPresence.status(); - emit parent->requestedPresenceChanged(requestedPresence); - parent->notify("requestedPresence"); - } - + // ChangingPresence is also processed after RequestedPresence if (props.contains(QLatin1String("ChangingPresence")) && - changingPresence != qdbus_cast( - props[QLatin1String("ChangingPresence")])) { - changingPresence = qdbus_cast( + qdbus_cast(props[QLatin1String("ChangingPresence")])) { + if (changingPresence != qdbus_cast( + props[QLatin1String("ChangingPresence")])) { + changingPresence = qdbus_cast( props[QLatin1String("ChangingPresence")]); - debug() << " Changing Presence:" << changingPresence; - emit parent->changingPresence(changingPresence); - parent->notify("changingPresence"); + debug() << " Changing Presence:" << changingPresence; + emit parent->changingPresence(changingPresence); + parent->notify("changingPresence"); + } } if (props.contains(QLatin1String("Connection"))) { @@ -4524,6 +4503,42 @@ void Account::Private::updateProperties(const QVariantMap &props) if (!connectionStatusChanged && profileChanged) { checkCapabilitiesChanged(profileChanged); } + + if (props.contains(QLatin1String("RequestedPresence")) && + requestedPresence.barePresence() != qdbus_cast( + props[QLatin1String("RequestedPresence")])) { + requestedPresence = Presence(qdbus_cast( + props[QLatin1String("RequestedPresence")])); + debug() << " Requested Presence:" << requestedPresence.type() << + "-" << requestedPresence.status(); + emit parent->requestedPresenceChanged(requestedPresence); + parent->notify("requestedPresence"); + } + + if (props.contains(QLatin1String("ChangingPresence")) && + !qdbus_cast(props[QLatin1String("ChangingPresence")])) { + if (changingPresence != qdbus_cast( + props[QLatin1String("ChangingPresence")])) { + changingPresence = qdbus_cast( + props[QLatin1String("ChangingPresence")]); + debug() << " Changing Presence:" << changingPresence; + emit parent->changingPresence(changingPresence); + parent->notify("changingPresence"); + } + } + + if (props.contains(QLatin1String("CurrentPresence")) && + currentPresence.barePresence() != qdbus_cast( + props[QLatin1String("CurrentPresence")])) { + currentPresence = Presence(qdbus_cast( + props[QLatin1String("CurrentPresence")])); + debug() << " Current Presence:" << currentPresence.type() << + "-" << currentPresence.status(); + emit parent->currentPresenceChanged(currentPresence); + parent->notify("currentPresence"); + emit parent->onlinenessChanged(parent->isOnline()); + parent->notify("online"); + } } void Account::Private::retrieveAvatar() -- 2.10.2