Bug 404350 - Choosing "offline" status does not disconnect accounts
Summary: Choosing "offline" status does not disconnect accounts
Status: RESOLVED FIXED
Alias: None
Product: telepathy
Classification: Unmaintained
Component: contactlist (show other bugs)
Version: git-latest
Platform: Arch Linux Linux
: NOR normal
Target Milestone: Future
Assignee: Telepathy Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-14 15:41 UTC by Alexander Blinne
Modified: 2019-03-03 22:48 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 18.12.3
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Blinne 2019-02-14 15:41:48 UTC
SUMMARY
Choosing "offline" in the combobox in ktp-contactlist does nothing. Switching to offline mode is possible through the desktop-applet, though.


STEPS TO REPRODUCE
1. Open ktp-contactlist
2. Verify that you are online
3. Try to go offline using the combobox in ktp-contactlist

OBSERVED RESULT
Status is still online, as shown by the desktop-applet. Also contacts are still shown in the contact list and I am able to exchange text messages with my contacts.

EXPECTED RESULT
Connection status should change to offline.

SOFTWARE/OS VERSIONS
Windows: 
MacOS: 
Linux/KDE Plasma: Arch linux packages, also tested git-master of ktp-contactlist
(available in About System)
KDE Plasma Version: 18.12.2
KDE Frameworks Version: 5.55.0
Qt Version: 5.12.1

ADDITIONAL INFORMATION
Caused by the index check in GlobalPresenceChooser::onUserActivatedComboChange().
Patch at https://phabricator.kde.org/differential/diff/51686/ fixes it most of the time, though in some cases (10-20% of times) it will go offline and go back online immediately afterwards. I can't find the reason for this right now...
Comment 1 Alexandr Akulich 2019-03-02 19:24:08 UTC
Same here.
The patch looks good and the original code looks weird.
The return on ((index == count() - 3) introduced by https://git.reviewboard.kde.org/r/130189/

What is the reason for the extra condition? (David, James?)
Comment 2 David Edmundson 2019-03-02 23:07:22 UTC
Yeah, that condition makes no sense.

Even if it did, that's a terrible way to code it with just arbitrary indexes.
Comment 3 Alexandr Akulich 2019-03-02 23:57:12 UTC
(In reply to Alexander Blinne from comment #0)
> Patch at https://phabricator.kde.org/differential/diff/51686/ fixes it most
> of the time, though in some cases (10-20% of times) it will go offline and
> go back online immediately afterwards. I can't find the reason for this
> right now...

I applied your patch and the Presence starts to work but it seems that there is some race-condition so if I switch to online and quickly go back to offline before a Connection Manager connected then it has some chance to report "I'm connected" before it was told to stop trying.

Would you mind to submit the fix? This patch is a definitely the right thing to do even if the issue still reproducible.

There is no other way to fix it and I'm hitting the issue on my own so I would like to have your fix in 18.12.3 and we have literally one day to do that as the release tag will be made at the Monday.
If you can't submit the patch today then I would like to commit it with you as the author and me as a committer.
Comment 4 Alexander Blinne 2019-03-03 10:46:37 UTC
(In reply to Alexandr Akulich from comment #3)
> If you can't submit the patch today then I would like to commit it with you
> as the author and me as a committer.

I don't think I can submit the patch as I don't have a developer account, am I right? I don't have much experience with the KDE workflow, unfortunately...
Comment 5 Alexandr Akulich 2019-03-03 22:44:00 UTC
Git commit 6dcdbdc872c2d8fb8e7838dcf5880c5b27b93c47 by Alexander Akulich, on behalf of Alexander Blinne.
Committed on 03/03/2019 at 22:43.
Pushed by akulichalexandr into branch 'Applications/18.12'.

Restore the "Offline" option in presence combobox

There is no valid reason to show the option but do nothing on activated.

Reviewed By: akulichalexander

M  +1    -1    global-presence-chooser.cpp

https://commits.kde.org/ktp-contact-list/6dcdbdc872c2d8fb8e7838dcf5880c5b27b93c47