#Simple script to remove the html crap sent from iChat Users
#I use http://www.bitlbee.org to gate my IM contacts into X-Chat
#written by Sven Hoexter <sven@timegate.de>
#Version: 0.3  2005-06-06

### Changelog
# v 0.3
# - If a query is not yet open we have to open one first   
#
#
# v 0.2
# - fix some context missunderstanding
# - remove a "}" accidently left over
#
#
# v 0.1 - initial release
#

on PRIVMSG myichatstrip {
    if { [string match -nocase "*<html>*" $_rest] } {
	splitsrc
	#only for debug prupose if something gets lost
	#print "$_raw"
	regsub -all "(<html><body.*\"><font face.*\">|</.*>)" $_rest "" outtext
	if { [string match "[me]" $_dest] } {
	    #catch the case where a query is not yet open
	    if { [catch {findcontext $_nick}] } {
		command "query $_nick"
	    }
	    set context [findcontext $_nick]
	} else {
	    	set context [getcontext]
	}
	print $context "-<$_nick>- \t$outtext"
	complete EAT_XCHAT
    }
    complete
}


