private IQ deleteList(IQ packet, JID from, String listName) {
        ClientSession currentSession;
        IQ result = IQ.createResultIQ(packet);
        Element childElement = packet.getChildElement().createCopy();
        result.setChildElement(childElement);
        // Get the list to delete
        PrivacyList list = manager.getPrivacyList(from.getNode(), listName);

        if (list == null) {
            // List to delete was not found
            result.setError(PacketError.Condition.item_not_found);
            return result;
        }
        else {
            currentSession = sessionManager.getSession(from);
            // Check if the list is being used by another session
            for (ClientSession session : sessionManager.getSessions(from.getNode())) {
                if (currentSession == session) {
                    // Ignore the active session for this checking
                    continue;
                }
                if (list.equals(session.getDefaultList()) || list.equals(session.getActiveList())) {
                    // List to delete is being used by another session so return a conflict error
                    result.setError(PacketError.Condition.conflict);
                    return result;
                }
            }
        }
        // Remove the list from the active session (if it was being used)
        if (list.equals(currentSession.getDefaultList())) {
            currentSession.setDefaultList(null);
        }
        if (list.equals(currentSession.getActiveList())) {
            currentSession.setActiveList(null);
        }
        manager.deletePrivacyList(from.getNode(), listName);
        return result;
    }
Updates an existing privacy list or creates a new one with the specified items list. The
new list will not become the active or default list by default. The user will have to
send another packet to set the new list as active or default.<p>

Once the list was updated or created a "privacy list push" will be sent to all
connected resources of the user.

@param packet IQ packet updating or creating a new privacy list.
@param from sender of the IQ packet.
@param listElement the element containing the list and its items.
@return acknowledge of success.
xmppserver/src/main/java/org/jivesoftware/openfire/handler/IQPrivacyHandler.java