Ticket #1962 (new defect)

Opened 3 years ago

Last modified 5 months ago

logoff on suspend

Reported by: Adam Nowotny <adam@…> Owned by: nk
Priority: normal Milestone:
Component: None Version:
Severity: normal Keywords: suspend
Cc: OS: All

Description

Gajim should log off before the system is suspended, which is a common event in a mobile environment. I've used this feature with Psi, and it was very helpful. Right now i get these annoying popups every time turn the laptop back on. This is in progress in #859, but logoff is helpful for people subscribed to my presence. The problem is portability here, it's possible in Windows, but have no idea how's it with other OSes.

Attachments

Change History

Changed 2 years ago by dottedmag@…

What about using gajim-remote in your suspend/resume scripts? Seems to be

trivial task.

Changed 2 years ago by Adam Nowotny <adam@…>

I using windows, no script there i guess. Besides i'm the user here, not

developer.

Changed 2 years ago by nk

anyone that knows can link us to Psi source (I think they do this stuff)

and they do it cross plat?

Changed 2 years ago by jt

Unfortunately, this does not work, at least not on my debian system. I put

"su -c 'gajim-remote change_status offline' $USER" in my suspend script. However, the script runs in a context that does not allow using dbus. At least I could not get it to work. Any suggestions?

Changed 2 years ago by dkirov

This is what are signals for. Gajim should disconnect all accounts from

servers on TERM signal and you will just do: kill -15 pid_of_gajim in your suspend script.

Changed 2 years ago by sb

Gajim quits on TERM signal. I think it is better to have it disconnect on suspend and connect again on wake up. This is something that is better done in conncection with gnome-power-manager since this allows a generic implementation across distributions, compared to acpi scripts.

Changed 2 years ago by sb

It should be alright for mobile entvironment now if network manager is used, at least on linux.

Changed 2 years ago by patrys

Not if NetworkManager? does not support your distro (which is the case here - PLD Linux).

Changed 2 years ago by nk

MACOSX/Windows http://svn.psi-im.org/listing.php?repname=Psi&path=%2Ftrunk%2Fsrc%2Ftools%2Fsystemwatch%2F#_trunk_src_tools_systemwatch_

[2:12:53 μμ] spike (psi dev): all 3 logoff i would expect
[2:12:56 μμ] nkour: okay
[2:12:58 μμ] spike (psi dev): well, shutdown that is for sure
[2:13:08 μμ] spike (psi dev): suspend and hibernate on windows, both logoff
[2:13:10 μμ] nkour: any idea where you have this code?
[2:13:19 μμ] nkour: which file I should look @?
[2:13:54 μμ] nkour: I guess you also save show, so when you come back from suspend you go that show
[2:14:06 μμ] nkour: if you shutdown, then I don't think you use that show anymore
[2:14:07 μμ] spike (psi dev): well, we don't do that yet, but we should do that yes
[2:14:16 μμ] nkour: oh ok
[2:14:18 μμ] spike (psi dev): we should remember the last available status before shutting down
[2:14:18 μμ] nkour: which file is it?
[2:14:40 μμ] nkour: it's interesting how you do that in MacOSX and in Windows (maybe even Vista works)
[2:14:45 μμ] spike (psi dev): http://svn.psi-im.org/listing.php?repname=Psi&path=%2Ftrunk%2Fsrc%2Ftools%2Fsystemwatch%2F#_trunk_src_tools_systemwatch_
[2:14:47 μμ] spike (psi dev): systemwatch

for Unix:

[2:11:46 μμ] spike (psi dev): it uses SIGUSR, which sounds like something non-standard
[2:11:52 μμ] spike (psi dev): we had a patch that does it on unix

Changed 2 years ago by nk

we should watch for:

// These defines come from Microsoft Platform SDK, August 2005
#if(WINVER >= 0x0400)
# ifndef WM_POWERBROADCAST
#  define WM_POWERBROADCAST                0x0218
# endif // WM_POWERBROADCAST
# ifndef _WIN32_WCE
#  ifndef PBT_APMQUERYSUSPEND
#   define PBT_APMQUERYSUSPEND             0x0000
#  endif // PBT_APMQUERYSUSPEND
#  ifndef PBT_APMQUERYSTANDBY
#   define PBT_APMQUERYSTANDBY             0x0001
#  endif // PBT_APMQUERYSTANDBY
#  ifndef PBT_APMQUERYSUSPENDFAILED
#   define PBT_APMQUERYSUSPENDFAILED       0x0002
#  endif // PBT_APMQUERYSUSPENDFAILED
#  ifndef PBT_APMQUERYSTANDBYFAILED
#   define PBT_APMQUERYSTANDBYFAILED       0x0003
#  endif // PBT_APMQUERYSTANDBYFAILED
#  ifndef PBT_APMSUSPEND
#   define PBT_APMSUSPEND                  0x0004
#  endif // PBT_APMSUSPEND
#  ifndef PBT_APMSTANDBY
#   define PBT_APMSTANDBY                  0x0005
#  endif // PBT_APMSTANDBY
#  ifndef PBT_APMRESUMECRITICAL
#   define  PBT_APMRESUMECRITICAL          0x0006
#  endif // PBT_APMRESUMECRITICAL
#  ifndef PBT_APMRESUMESUSPEND
#   define PBT_APMRESUMESUSPEND            0x0007
#  endif // PBT_APMRESUMESUSPEND
#  ifndef PBT_APMRESUMESTANDBY
#   define PBT_APMRESUMESTANDBY            0x0008
#  endif // PBT_APMRESUMESTANDBY
#  ifndef PBTF_APMRESUMEFROMFAILURE
#   define PBTF_APMRESUMEFROMFAILURE       0x00000001
#  endif // PBTF_APMRESUMEFROMFAILURE
#  ifndef PBT_APMBATTERYLOW
#   define PBT_APMBATTERYLOW               0x0009
#  endif // PBT_APMBATTERYLOW
#  ifndef PBT_APMPOWERSTATUSCHANGE
#   define PBT_APMPOWERSTATUSCHANGE        0x000A
#  endif // PBT_APMPOWERSTATUSCHANGE
#  ifndef PBT_APMOEMEVENT
#   define PBT_APMOEMEVENT                 0x000B
#  endif // PBT_APMOEMEVENT
#  ifndef PBT_APMRESUMEAUTOMATIC
#   define PBT_APMRESUMEAUTOMATIC          0x0012
#  endif // PBT_APMRESUMEAUTOMATIC
# endif // _WIN32_WCE
#endif // WINVER >= 0x0400

Changed 2 years ago by nk

I looked everywhere. all I could find was win32event.WaitForSingleObject?

and yeah I don't feel like it atm

Changed 2 years ago by nk

  • owner changed from asterix to nk

Changed 16 months ago by asterix

  • os set to All

I did it using wmi, but the signal is emitted too late. Gajim doesn't have time to go offline before going to suspend :/

Changed 5 months ago by Kamil Páral

I second this bug. When I shutdown my notebook, Gajim correctly logs off. But if I suspend or hibernate, I am "online" for another 5-15 minutes. All messages which comes in the meantime are lost. That's very inconvenient.

Gajim should listen for suspend/hibernate signals and log off, and log in again after resume.

I use Ubuntu 8.04.

Add/Change #1962 (logoff on suspend)

Author



Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change. Next status will be 'new'
The owner will change to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.