управление статусом Pidgin

This commit is contained in:
Kolan Sh 2011-04-06 14:39:51 +04:00
parent 67737c3290
commit a6a42d7a74
2 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,6 @@
#!/usr/bin/perl
use strict;
use XML::Simple;
use Data::Dumper;
print Dumper (XML::Simple->new()->XMLin());

View File

@ -0,0 +1,28 @@
#!/bin/bash
happy=1295818033
bored=1295818107
status=${!1}
# íĺîďđĺäĺë¸ííűé ńňŕňóń
if [[ "$status" == "" ]]; then
exit 0
fi
#echo $status
killall pidgin
xml_str=`xpath ~/.purple/prefs.xml "//pref/pref/pref[@name='savedstatus']/pref[@name='default'" 2>/dev/null`
new_xml_str=`echo $xml_str |sed ~s~[0-9][0-9]*~$status~`
xml_str=`echo $xml_str|sed 's/</\\\</ ; s/>/\\\>/ ; s/\"/\"/g ; s/\=/\\\=/g ; ~s~/~\\\/~'`
new_xml_str=`echo $new_xml_str|sed 's/</\\\</ ; s/>/\\\>/ ; s/\"/\"/g ; s/\"/\\\"/g ; s/\=/\\\=/g ; ~s~/~\\\/~'`
echo "$xml_str"
#echo "$new_xml_str"
grep $xml_str ~/.purple/prefs.xml
#sed -i ~/.purple/prefs.xml "s/$xml_str/$new_xml_str/"
#(pidgin &>/dev/null)&