static Element generateResultElement( final List<MUCRoomSearchInfo> rooms )
    {
        Log.debug( "Generating result element." );
        final Element res = DocumentHelper.createElement( QName.get( RESPONSE_ELEMENT_NAME, NAMESPACE ) );
        for ( final MUCRoomSearchInfo room : rooms )
        {
            final Element item = res.addElement( "item" );
            item.addAttribute( "address", room.getJID().toString() );
            if ( room.getNaturalLanguageName() != null && !room.getNaturalLanguageName().isEmpty() )
            {
                item.addElement( "name" ).setText( room.getNaturalLanguageName() );
            }
            if ( room.getDescription() != null && !room.getDescription().isEmpty() )
            {
                item.addElement( "description" ).setText( room.getDescription() );
            }
            // Openfire does not support 'language'
            if ( !room.isLocked() && !room.isMembersOnly() && !room.isPasswordProtected() )
            {
                item.addElement( "is-open" );
            }

            final Element anonymityMode = item.addElement( "anonymity-mode" );
            if ( room.canAnyoneDiscoverJID() )
            {
                anonymityMode.setText( "none" );
            }
            else
            {
                anonymityMode.setText( "semi" );
            }

            item.addElement( "nusers" ).setText( Integer.toString( room.getOccupantsCount() ) );
        }
        return res;
    }
Constructs an answer on a IQ stanza that contains a search request. The
answer will be an IQ stanza of type 'result' or 'error'.

@param iq The IQ stanza that is the search request.
@return An answer to the provided request.
xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/IQExtendedChannelSearchHandler.java