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

system.verbs.builtins.tcp.im.builtinDrivers.jabber.code.messages.presence

on presence (dest = "", type = "", status = "", show = "", priority = "", connection = @system.temp.jabber.connection) {
	<<Changes
		<<5/14/02; 1:51:34 PM by JB
			<<Changelog created.
	<<Handles sending presence messages. See http://docs.jabber.org/jpg/html/main.html#REFPRESENCE .
	on addAtt ( XMLadr, name, value ) {
		if not defined ( XMLadr^.["/atts"] ) {
			new ( tableType, @XMLadr^.["/atts"] )};
		XMLadr^.["/atts"].[name] = value};
	if not defined ( connection^ ) { // should I lock a semaphore after this?
		scriptError ( "Can't send message over Jabber connection because the connection is not established." )};
	
	// code around a bug in Frontier, reported at http://groups.yahoo.com/group/radio-dev/message/5221
	if dest == "" and type == "" and status == "" and show == "" and priority == "" {
		tcp.im.builtinDrivers.jabber.code.writeXML ("<presence/>", connection: connection)};
	
	local ( result, presence);
	new (tableType, @result);
	
	presence = xml.addTable ( @result, "presence" );
	if dest != "" {
		addAtt ( presence, "to", dest )};
	if type != "" {
		addAtt ( presence, "type", type )};
	if status != "" {
		xml.addValue(presence, "status", status )};
	if show != "" {
		xml.addValue(presence, "show", show )};
	if priority != "" {
		xml.addValue(presence, "priority", string(priority) )};
	tcp.im.builtinDrivers.jabber.code.writeXML (presence, connection: connection )};
presence (@system.temp.jabber.references[1], type:"unavailable"  )



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.