Bug 189574

Summary: Statistic Plugin Error when suspend to disk
Product: [Unmaintained] kopete Reporter: Rettich <sebastian.radish>
Component: Statistics pluginAssignee: Kopete Developers <kopete-bugs-null>
Status: RESOLVED UNMAINTAINED    
Severity: normal CC: lamarque, me, pali.rohar
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Bug Depends on: 149544    
Bug Blocks:    

Description Rettich 2009-04-13 23:29:12 UTC
Version:            (using KDE 4.2.2)
OS:                Linux
Installed from:    SuSE RPMs

I often use "Suspend to Disk" on my system.

The problem no is, that the Statistic Plugin doesn't realize this and so thinks I'm online all the time. After some time now, all the statistics are completely broken.
Comment 1 Lamarque V. Souza 2011-03-20 03:37:48 UTC
Is this still happening?
Comment 2 Pali Rohár 2014-05-12 21:12:37 UTC
Problem is that statistics plugin set offline status for contacts after protocols tell kopete that connection was disconnected/closed. And because it is not possible to add hooks (at least I do not know how) which will be called before "suspend to disk" and "suspend to ram" actioins, protocols will be disconnected after system wake up from suspend (when kopete process will be schedulled by kernel again).

Maybe another possible solution would be to get (somehow) time when compiler went into suspend and update timestamps in statictics database.
Comment 3 Roman 2014-08-03 14:48:27 UTC
> And because
> it is not possible to add hooks (at least I do not know how) which will be
> called before "suspend to disk" and "suspend to ram" actioins, protocols
> will be disconnected after system wake up from suspend (when kopete process
> will be schedulled by kernel again).

As far as I know, it's possible to add suspend hooks (at least for pm-utils) as described in https://wiki.archlinux.org/index.php/pm-utils#Creating_your_own_hooks 
It might be possible for another power managements systems as well. I also think it's possible to catch suspend events via DBus, still that won't possibly allow Kopete to sustain suspend process long enough for statistics shutdown. This is a tough work though and I have neither enough time nor wish to do so. One could still do that changes: those are not as hard as time-consuming.
Comment 4 Pali Rohár 2014-08-03 15:48:37 UTC
Here is my suspend script for pm-utils which tell kopete that suspend is comming and all protocols/plugins will correctly go to offline mode. It suspend all kopete instances for all users.

file /etc/pm/sleep.d/10_kopete

#!/bin/sh
case "$1" in
	suspend|hibernate)
		pids=`pidof kopete`
		for pid in $pids; do
			user=`ps -p $pid -o user=`
			addr=`tr '\000' '\n' < /proc/$pid/environ | sed -n 's/^DBUS_SESSION_BUS_ADDRESS=//p'`
			su -c "DBUS_SESSION_BUS_ADDRESS=$addr dbus-send --session --type=method_call --print-reply --dest=org.kde.kopete /Kopete org.kde.Kopete.suspend" $user
		done
		sleep 2
		;;
	resume|thaw)
		;;
esac
Comment 5 Justin Zobel 2021-03-09 22:41:17 UTC
Thank you for the bug report.

As this report hasn't seen any changes in 5 years or more, we ask if you can please confirm that the issue still persists.

If this bug is no longer persisting or relevant please change the status to resolved.
Comment 6 Christoph Cullmann 2024-09-18 18:27:53 UTC
Dear user, unfortunately Kopete is no longer maintained.

Please migrate to another solution, e.g. for Jabber a possibility is Kaidan, for Matrix a candidate is NeoChat.