Need some help for final fix to the presence not restored

Weng Xuetian wengxt at gmail.com
Tue Sep 10 19:15:31 UTC 2013


Hi,
I have construct this patch, but this seems not enough to fix all problem
https://git.reviewboard.kde.org/r/112442/

Now let me explain case that could reproduce this problem:
Close laptop lid -> launch screen locker -> set to away by kded -> suspend
and network down.
Open laptop lid -> type password and unlock -> network is still down and no
account is online -> setPresence doesn't work -> connected to network
connectionStatus() == Tp::ConnectionStatusConnected , but isOnline is
false, so setPresence still doesn't work.

later I found there is a problem that
connectionStatus() == Tp::ConnectionStatusConnected doesn't mean account is
online, which makes sense but here comes the problem, kded want to set the
presence to account regardless it is online or not, otherwise we might miss
to set a presence to the account.

So I make a new patch:
http://paste.kde.org/p15ed68b8
don't check isOnline property of account and just setRequestedPresence
right away.

But actually I don't really want to make account online because of presence
change, since an account might be offline because to network, wrong
password, or whatever reason and set it online will cause a duplicate
authentication and might generate yet another same error which can be
annoying.

Later I found there's a property called automaticPresence which looks
perfectly suitable for this requirement.

http://telepathy.freedesktop.org/spec/Account.html#Property:AutomaticPresence

AutomaticPresence : The presence status that this account should have if it
is brought online.

First I found that AutomaticPresence doesn't work if account is already
online, so I change the setPresence function to use AutomaticPresence only
when it's offline, so the patch looks like this:
http://paste.kde.org/p6f4f3770/

But as far as I test, this doesn't always work, my test case (close lid to
suspend, and reopen lid) will still leave an "away" state sometime.

I wonder did I miss use AutomaticPresence or there is a race condition make
it doesn't work?.. or we can just stick to my first patch since it doesn't
really cause too much problem, or I can use connectionStatusReason to avoid
make an account online if it's caused by non-user reason?

Regards,
Xuetian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-telepathy/attachments/20130910/d13d03e7/attachment-0001.html>


More information about the KDE-Telepathy mailing list