private IQ getPrivacyList(IQ packet, JID from) {
        IQ result = IQ.createResultIQ(packet);
        Element childElement = packet.getChildElement().createCopy();
        result.setChildElement(childElement);

        // Check that only one list was requested
        List<Element> lists = childElement.elements("list");
        if (lists.size() > 1) {
            result.setError(PacketError.Condition.bad_request);
        }
        else {
            String listName = lists.get(0).attributeValue("name");
            PrivacyList list = null;
            if (listName != null) {
                // A list name was specified so get it
                list = manager.getPrivacyList(from.getNode(), listName);
            }
            if (list != null) {
                // Add the privacy list to the result
                childElement = result.setChildElement("query", "jabber:iq:privacy");
                childElement.add(list.asElement());
            }
            else {
                // List not found
                result.setError(PacketError.Condition.item_not_found);
            }
        }
        return result;
    }
Returns the IQ packet containing the details of the specified list. If no list
was found or the IQ request contains more than one specified list then an error will
be returned.

@param packet IQ packet requesting a given list.
@param from sender of the IQ packet.
@return the IQ packet containing the details of the specified list.
xmppserver/src/main/java/org/jivesoftware/openfire/handler/IQPrivacyHandler.java