Monday, November 08, 2010 at 12:06 AM.

system.verbs.builtins.tcp.im.builtinDrivers.jabber.code.handlers.message

on message ( connection, mesAdr ) {
	<<Changes
		<<5/14/02; 1:51:34 PM by JB
			<<Changelog created.
	local ( from, dest, body, m, subject = nil, thread = nil, type = "");
	m = xml.getAddress ( mesAdr, "message" );
	try {
		<<Jabber echos the messages that have an error, with an addition error tag. To prevent infinite loops, we have to catch these and discard them. Since messages don't have id tags, we can't do much more then this.
		xml.getAddress ( m, "error" );
		return};
	from = xml.getAttributeValue ( m, "from" );
	dest = xml.getAttributeValue ( m, "to" );
	try {
		type = xml.getAttributeValue ( m, "type" )};
	try {
		subject = xml.getAddress ( m, "subject" )^};
	body = xml.getAddress ( m, "body" )^;
	body = tcp.im.builtinDrivers.jabber.code.xmlAlphaDecode(body);
	body = xml.entityDecode(body);
	<<body = string.utf8ToAnsi(body)
	<<body = string.replaceAll ( body, "'", "'" )
	try {
		thread = xml.getAddress ( m, "thread" )^};
	
	local ( handler = tcp.im.builtinDrivers.jabber.code.getHandler(connection, "message"));
	try {
		while typeOf ( handler^ ) == addressType {
			handler = handler^;
			handler^ ( from, type, body, subject, thread, connection )}}}



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.