#!/bin/bash
# Wrapper script to auto-create an MIT Chat account the first time
# pidgin is run.
# If .purple directory does not exist, create it and make it private.
if [ ! -d "$HOME/.purple" ]; then
mkdir "$HOME/.purple" || exit 1
fs sa "$HOME/.purple" system:anyuser none > /dev/null 2>&1
fi
# Set up an MIT Chat account if no account settings exist.
if [ ! -f "$HOME/.purple/accounts.xml" ]; then
cat > $HOME/.purple/accounts.xml << EOF
prpl-jabber
${ATHENA_USER:-USER}@mit.edu/Pidgin
1
1
1
EOF
fi
# Set the buddy list to visible if no prefs file exists. (Ordinarily
# handled by the startup wizard, which we are bypassing.)
if [ ! -f "$HOME/.purple/prefs.xml" ]; then
cat > $HOME/.purple/prefs.xml << "EOF"
EOF
fi
exec /usr/bin/pidgin.debathena-orig "$@"