fix-casts.sh

Wed, 04 Mar 2009 10:39:38 +0000

author
Mark Doliner <markdoliner@pidgin.im>
date
Wed, 04 Mar 2009 10:39:38 +0000
changeset 26064
f3efb46c4a43
parent 24975
7abe1341dc45
permissions
-rwxr-xr-x

Change the way oscar deals with account->perm_deny a little bit.
1. We no longer read the privacy setting from the server for ICQ accounts
2. We no longer change account->perm_deny when an ICQ account changes
its status (or ever)
3. When going invisible, we still override the permit deny setting and
set it to "invisible to everyone except the people in my allow list,"
but this change is only made on the server and not account->perm_deny

Refs #1009
Fixes #5263 I think

#!/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

mercurial