static int[] detectVersion(XmlPullParser xpp) {
        // Default to a version of "0.0". Clients written before the XMPP 1.0 spec may
        // not report a version in which case "0.0" should be assumed (per rfc3920
        // section 4.4.1).
        int majorVersion = 0;
        int minorVersion = 0;
        for (int i = 0; i < xpp.getAttributeCount(); i++) {
            if ("version".equals(xpp.getAttributeName(i))) {
                try {
                    int[] version = decodeVersion(xpp.getAttributeValue(i));
                    majorVersion = version[0];
                    minorVersion = version[1];
                }
                catch (Exception e) {
                    Log.error("Unable to parse version from 'version' attribute of the element that is being parsed.", e);
                }
            }
        }

        // If the client supports a greater major version than the server,
        // set the version to the highest one the server supports.
        if (majorVersion > MAJOR_VERSION) {
            majorVersion = MAJOR_VERSION;
            minorVersion = MINOR_VERSION;
        }
        else if (majorVersion == MAJOR_VERSION) {
            // If the client supports a greater minor version than the
            // server, set the version to the highest one that the server
            // supports.
            if (minorVersion > MINOR_VERSION) {
                minorVersion = MINOR_VERSION;
            }
        }
        return new int[] { majorVersion, minorVersion };
    }
Returns a two-digit version identifier based on the value of the 'version' attribute of the element that the
provided parser is currently on. The value of the 'version' attribute is expected to match 'MAJOR.MINOR' where
both MAJOR and MINOR are integer values.

The version number defaults to 0.0. It is returned as an array of integers, with the first element in the array
being the MAJOR version number.

If the version that is being reported is larger than the version supported by this implementation, the version
number that is supported by this implementation is returned instead of the reported version number.

@param xpp An XML parser
@return an integer array that has a size of two.
xmppserver/src/main/java/org/jivesoftware/openfire/session/Session.java