Re: licq 1.3.4/SSL, howto store contacts on server?

Jon Keating <[email protected]> Tue, 20 Feb 2007 21:52:41 +0900
Newsgroups gmane.network.licq.general
Message-ID <[email protected]>
On Tuesday 20 February 2007 21:23, Eugene Paskevich wrote:
> Why not commiting it into the main branch?
> Seems it is 'a must have' script.

Yeah, after I clean it up a bit and make it a bit user friendly (before we zap 
the data). Expect it in SVN in a few days.

As for the script, it is attached. Make sure to do a backup of ~/.licq just in 
case... you never know when you might lose your data!

As for instructions:

BACKUP DATA!!!

#1 Close Licq
#2 Run this script
#3 Start Licq

It clears all local settings, so Licq will download the settings from the 
server and upload any users that it finds without any server side settings.

Jon

-- 
________________________________________________________
Jon Keating                ICQ: 16325723
[email protected]               MSN: [email protected]
http://www.licq.org        GPG: 2290A71F
http://www.thejon.org      HOME: Minamiashigara, Japan
sidclean.sh (application/x-shellscript, 1.1 KB)
#!/bin/bash
# By Juan. (juam on #licq)
#
# !!! BACKUP YOUR LICQ FOLDER (~/.licq) JUST IN CASE!!!
#

BACK_SUFIX="~"

function change_val()
{ 	local back;

	back="$1$BACK_SUFIX"
	vars=$2
	cp "$1" "$back"
	awk  '
		$1 ~ /^('$vars')/ {
			print $1 " = 0"
		} 
		$1 !~ /^('$vars')/ {
			print
		}
	' < "$back" > "$1" 

}


function check()
{	
	if [[  ! -a $1 ]]; then
		echo "$1: not found. exiting."
		exit 1
	fi
}

case $# in
	0) 	echo "Usage: $0 licq-dir"
        	exit 1
esac

for root in $@; do

	echo "changing users from $root/users/\*.Licq"
	check "$root/users"
	for i in "$root"/users/*.Licq; do
		change_val "$i" "SID|GSID|InvisibleSID|VisibleSID"
	done

	echo "changing $root/owner.Licq"
	check "$root/owner.Licq"
	change_val "$root/owner.Licq" "SSTime|SSCount"

	echo "changing $root/licq.conf"
	check "$root/licq.conf"
	t=`grep NumOfGroups "$root/licq.conf" |
	   cut -d'=' -f2 | 
	   awk '
	   {	for(i=1;i<=$1;i++)
	   	{	if( i == 1)
	   			c = "";
	   		else 
	   			c = "|";
	   		ba = sprintf("%s%sGroup%d.id",ba,c,i);
	   	}
	   	print ba
	   }'`
	change_val "$root"/licq.conf "$t"

done