[Telepathy-commits] [telepathy-qt4/master] Connection::onStatusChanged: fake transition via Connecting if necessary
Simon McVittie
simon.mcvittie at collabora.co.uk
Thu Nov 27 09:43:32 PST 2008
telepathy-pinocchio 0.3.1 makes a non-spec-compliant state change from
Disconnected straight to Connected; the spec, and telepathy-glib, do
not allow this, and it causes assertion failures in changeReadiness().
Recover from the non-compliant state change by pretending the state
changed from Disconnected to Connecting, then to Connected, with the
same reason code each time (this is the same thing that tp-glib does
on the service side).
---
TelepathyQt4/cli-connection.cpp | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/TelepathyQt4/cli-connection.cpp b/TelepathyQt4/cli-connection.cpp
index cfc92f0..03537bd 100644
--- a/TelepathyQt4/cli-connection.cpp
+++ b/TelepathyQt4/cli-connection.cpp
@@ -294,6 +294,14 @@ SimpleStatusSpecMap Connection::simplePresenceStatuses() const
void Connection::onStatusChanged(uint status, uint reason)
{
+ if (status == ConnectionStatusConnected &&
+ mPriv->status != ConnectionStatusConnecting) {
+ // CMs aren't meant to go straight from Disconnected to
+ // Connected; recover by faking Connecting
+ warning() << "Non-compliant CM - went straight to CONNECTED!";
+ onStatusChanged(ConnectionStatusConnecting, reason);
+ }
+
debug() << "Status changed from" << mPriv->status << "to" << status << "for reason" << reason;
mPriv->status = status;
--
1.5.6.5
More information about the Telepathy-commits
mailing list