#!/bin/sh -e

CONFIG_FILE=/etc/jabber-jit/jabber-jit.xml

[ -r "$CONFIG_FILE" ] || exit 0

case "$1" in
	--ip)       sed -n 's/^.*<ip>\([^<]\+\)<\/ip>.*$/\1/p' <$CONFIG_FILE
		;;
	--port)     sed -n 's/^.*<port>\([^<]\+\)<\/port>.*$/\1/p' <$CONFIG_FILE
		;;
	--host)     sed -n 's/^.*<host>\([^<]\+\)<\/host>.*$/\1/p' <$CONFIG_FILE | head -n 1
		;;
	--password) sed -n 's/^.*<secret>\([^<]\+\)<\/secret>.*$/\1/p' <$CONFIG_FILE
		;;
esac
