Bug 149544 - automatically logout and login with suspend
Summary: automatically logout and login with suspend
Status: RESOLVED FIXED
Alias: None
Product: kopete
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR wishlist
Target Milestone: ---
Assignee: Kopete Developers
URL:
Keywords:
Depends on:
Blocks: 189574
  Show dependency treegraph
 
Reported: 2007-09-04 20:55 UTC by Sander Devrieze
Modified: 2013-05-17 13:51 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.11


Attachments
catching dbus events for reconnect (733 bytes, patch)
2011-02-05 15:32 UTC, Martin Bednar
Details
added suspend/resume methods for accounts and accountmanager, call resume on system suspend/network shutdown and resume on network connection (7.24 KB, patch)
2011-02-08 22:29 UTC, Benni Hill
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sander Devrieze 2007-09-04 20:55:33 UTC
Version:            (using KDE KDE 3.5.6)
Installed from:    Ubuntu Packages

When people put their computer in suspend mode, Kopete should automatically logout in the right way.

When people wake up their computer from suspend, Kopete should automatically login.

PS: I think Adium has this feature, not sure though.
Comment 1 Matt Rogers 2007-09-05 02:17:08 UTC
yes, adium has this feature which is very nearly built into the OS by default.
Comment 2 Dan 2009-01-28 22:12:33 UTC
I'd like that feature too. But in Kopete for KDE4.
Comment 3 Martin Bednar 2011-02-05 15:32:00 UTC
Created attachment 56896 [details]
catching dbus events for reconnect

Catches UPower Sleeping() signal to disconnect on suspend, and catches PowerDevil's resumingFromSuspend() signal to reconnect. Tested by suspending and resuming : no crashes, and reconnects on resume.
Comment 4 Benni Hill 2011-02-08 22:29:38 UTC
Created attachment 57002 [details]
added suspend/resume methods for accounts and accountmanager, call resume on system suspend/network shutdown and resume on network connection

(In reply to comment #3)
> Created an attachment (id=56896) [details]
> catching dbus events for reconnect
> 
> Catches UPower Sleeping() signal to disconnect on suspend, and catches
> PowerDevil's resumingFromSuspend() signal to reconnect. Tested by suspending
> and resuming : no crashes, and reconnects on resume.

Your patch inspired me to have a deeper look into kopete, because I wanted the online status of each account to be the same as before system suspend instead of just reconnecting all accounts to "Online".
This patch also addresses another problem of kopete: When the user was setting kopete to "Offline" and the network connection was lost and recovered kopete would reset all accounts to "Online".
Please have a look at this patch and test it. Thanks.
Comment 5 Martin Bednar 2011-02-08 23:14:34 UTC
Wow :) How little is needed to inspire others. I'll test it in the coming days. However, since I suppose this will go into KDE 4.7, I suggest tracking https://bugs.kde.org/show_bug.cgi?id=265698 and when it gets implemented, catching the Solid signal instead of the UPower one.
Comment 6 Benni Hill 2011-02-17 22:52:33 UTC
Patch submitted to reviewboard:
http://svn.reviewboard.kde.org/r/6511/
Comment 7 Michal Svec 2011-02-24 14:16:59 UTC
Just curious, does the implementation respect the "Initial Status" settings?
Like if the Initial Status is set to Offline, resume should not do anything.

One idea there: one can add a new Initial Status called "Restore", which would
restore statuses to the last ones, before suspend or quit or so.
Comment 8 Benni Hill 2011-02-24 18:57:12 UTC
(In reply to comment #7)
I don't know if I got it right.
Resume is currently not respecting the "Initial Status" settings and I don't think that this is necessary. I think that resume should just restore the status of each account to the status that was active when suspend was called (when it was offline before suspend, it would stay offline after resume, of course). I think that this is what a user expects (e.g.: network is lost -> offline -> network restored -> resume all accounts, or: laptop closed (suspend) -> offline -> laptop opened (resume) -> resume all accounts). Did I miss something?
If the user changes the global status after suspend was called (e.g. after network disconnect), then resume won't be called.
Comment 9 Michal Svec 2011-02-24 20:59:48 UTC
My workflow is little bit different, at work I am connected to some
protocols with some statuses, then I suspend, go home, resume and
connect with different protocols and statuses.

I am using kopete DBUS interface and NetworkManager hooks for that
today. I am not sure it makes sense to implement such a flexibility
for all users, but it would be good if this feature does not get in
a way in those cases

Therefore my suggestion for respecting Initial Status settings -
Offline in my case. I am not sure it's an optimal way, but it would
at least work for me.
Comment 10 Benni Hill 2011-02-24 21:52:39 UTC
Calling the dbus method disconnectAll after suspend should already disable resume. Is this OK for you?
Comment 11 Michal Svec 2011-02-24 22:08:15 UTC
(In reply to comment #10)
> Calling the dbus method disconnectAll after suspend should already disable
> resume. Is this OK for you?

If I can cram it somewhere in the hooks that should be fine I guess.
Comment 12 Michal Svec 2012-04-11 08:35:59 UTC
Has anything from this been committed already?

I installed kopete 4.8.2 (4.8.2) "release 491" and now I am getting strange errors from kopete
after resume (and of course my scripts stopped working because of that):
 - turn kopete offline
 - suspend/resume
 - error message that GroupWise account could not connect (obviously, network is still off)
Comment 13 Pali Rohár 2013-05-17 13:51:55 UTC
SVN commit 1355161 by pali:

Automatically logout and login with suspend/resume

This patch logs off each account when PC is suspended and restores the online state of each account on resume.
This patch also addresses another problem of kopete: When the user was setting kopete to "Offline" and the network connection was lost and recovered kopete would reset all accounts to "Online".

Thanks Benni Hill for patch!

Related: bug 212037
FIXED-IN: 4.11
REVIEW: 6511


 M  +10 -0     kopete/kopetedbusinterface.cpp  
 M  +10 -0     kopete/kopetedbusinterface.h  
 M  +4 -0      kopete/org.kde.Kopete.xml  
 M  +28 -0     libkopete/kopeteaccount.cpp  
 M  +12 -0     libkopete/kopeteaccount.h  
 M  +59 -25    libkopete/kopeteaccountmanager.cpp  
 M  +11 -0     libkopete/kopeteaccountmanager.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1355161