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

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

on iqRegister ( connection, mesAdr, iq, query ) {
	<<Changes
		<<5/14/02; 1:51:34 PM by JB
			<<Changelog created.
	<<iqRegister will respond to a registration response from the server.
	on addAtt ( XMLadr, name, value ) {
		if not defined ( XMLadr^.["/atts"] ) {
			new ( tableType, @XMLadr^.["/atts"] )};
		XMLadr^.["/atts"].[name] = value};
	
	local ( type = xml.getAttributeValue ( iq, "type" ) );
	local ( reply, idName );
	
	if type == "error" { // failed log in attempt
		connection^.state = "FAILED LOGIN";
		semaphore.unlock(connection^.loginSemName);
		return};
	
	// being contructing the registration reply
	new ( tableType, @reply );
	bundle { // <iq
		iq = xml.addTable ( @reply, "iq" );
		addAtt(iq, "id", idName);
		addAtt(iq, "type", "set");
		addAtt(iq, "to", connection^.host );
		addAtt(iq, "from", connection^.username + "@" + connection^.host )};
	
	bundle { // query tag
		q = xml.addTable ( iq, "query");
		addAtt ( q, "xmlns", "jabber:iq:register" )};
	
	bundle { // send the requested data
		for item in query {
			name = xml.convertToDisplayName(nameOf ( item^ ));
			if defined ( connection^.registrationInfoAdr^.[name] ) {
				xml.addValue ( q, name, connection^.registrationInfoAdr^.[name] )}}};
	
	tcp.im.builtinDrivers.jabber.code.writeXML (iq, connection: connection )}
<<iqRegister(@system.temp.jabber.references[1], nil, nil, nil, "temp" )



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.