view fix-casts.sh @ 30382:47dfe1d54e9e

Fixed (I hope) #12284. incomingim_ch2_icqserverrelay() was doing something it wasn't supposed to. I suppose the packet format was reverse-engineered wrongly eons ago. The correct packet format can be found at http://iserverd.khstu.ru/oscar/message.html (and also in every open-source OSCAR client I could get my hands on). The funny thing is that before #12284 showed up everything worked right due to another bug. I'm too lazy to type out all the details, so I'll just include a reference to my conversation with Mark Doliner: http://www.pidgin.im/nopaste/102
author ivan.komarov@soc.pidgin.im
date Sat, 24 Jul 2010 18:14:29 +0000
parents c3ca613ab550
children
line wrap: on
line source

#!/bin/sh

if [ $# -eq 0 ]; then
	echo "Usage: `basename "$0"` PurpleFoo..."
	echo
	echo "This script searches the *current working directory* and replaces casts"
	echo "with GObject-style type checking and casting macros."
	echo 'For example, "(PurpleBuddy *)b" becomes "PURPLE_BUDDY(b)".'
	exit 0
fi

for struct in $* ; do
	cast=`echo $struct | sed "s|[A-Z]|_\0|g" | tr "a-z" "A-Z" | sed "s|^_||"`
	for file in `grep -rl "([[:space:]]*$struct[[:space:]]*\*[[:space:]]*)" . --include=*.c --exclude=purple-client-bindings.c` ; do
		sed -i "s|([[:space:]]*$struct[[:space:]]*\*[[:space:]]*)[[:space:]]*(|$cast(|g" $file
		sed -i "s|([[:space:]]*$struct[[:space:]]*\*[[:space:]]*)[[:space:]]*\([^(][^,);]*\)|$cast(\1)|g" $file
	done
done