Author Topic: Kopete online contacts script  (Read 982 times)

Offline Jaconux

  • Jr. Member
  • **
  • Posts: 46
Kopete online contacts script
« on: December 31, 2009, 04:51:25 AM »
Hey,
I've thrown together a small script which displays a list of your currently online kopete contacts (KDE4):

Code: [Select]
#!/bin/bash         

# Check that kopete is running
VAR=`dbus-send --print-reply --type=method_call --dest=org.kde.kopete /Kopete org.kde.Kopete.contactsByFilter string:"online" 2>&1`
if [ $? != 0 ]; then
{
  echo Kopete is not online...
  exit 1
} fi

# Get list of online users (returns their ID numbers)
VAR=`dbus-send --print-reply --type=method_call --dest=org.kde.kopete /Kopete org.kde.Kopete.contactsByFilter string:"online" | grep string | replace '"{' '' | replace '}"' '' | replace string '' `

# Translate each ID number to the actual display name
a=0
for i in $VAR; do
ARR[$a]=$'\n '`dbus-send --print-reply --type=method_call --dest=org.kde.kopete /Kopete org.kde.Kopete.getDisplayName string:$i | grep string | replace 'string "' '• ' | replace '"' '' | replace '   ' ''`
let a++
done

# Print each unique display name
echo "${ARR[*]}" | sort | grep -v '^$' | uniq

The script is not very elegant, but it gets the job done. I guess you can use it to quickly check who is online in a terminal, but I mainly use it in the yasp.scripted Widget (see attachment).

Hope someone finds this useful.

Happy new year
- Jacob.


[attachment deleted by admin]

Offline travisN000

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1758
Re: Kopete online contacts script
« Reply #1 on: February 11, 2010, 08:01:51 AM »
It seems to me that could be very useful..  and it also makes me think of another possible use for this:

http://www.pclinuxos.com/forum/index.php/topic,68244.msg557310.html#msg557310
 ;D