@Override
    public IQ handleIQ(IQ packet) {
        Element enable = packet.getChildElement();
        if (XMPPServer.getInstance().isLocal(packet.getFrom())) {
            if (enable.getName().equals("enable")) {
                ClientSession clientSession = sessionManager.getSession(packet.getFrom());
                clientSession.setMessageCarbonsEnabled(true);
                return IQ.createResultIQ(packet);

            } else if (enable.getName().equals("disable")) {
                ClientSession clientSession = sessionManager.getSession(packet.getFrom());
                clientSession.setMessageCarbonsEnabled(false);
                return IQ.createResultIQ(packet);
            } else {
                IQ error = IQ.createResultIQ(packet);
                error.setError(PacketError.Condition.bad_request);
                return error;
            }
        } else {
            // if the request is from a client that is not hosted on this server.
            IQ error = IQ.createResultIQ(packet);
            error.setError(PacketError.Condition.not_allowed);
            return error;
        }
    }
This handler manages XEP-0280 Message Carbons.

@author Christian Schudt
xmppserver/src/main/java/org/jivesoftware/openfire/handler/IQMessageCarbonsHandler.java