()
| 85 | public static String ver = null; |
| 86 | |
| 87 | public static String calcVerHash() throws Exception { |
| 88 | if (ver != null) { |
| 89 | return ver; |
| 90 | } |
| 91 | int j = features.size(); |
| 92 | if (j < 1) { |
| 93 | initCaps(); |
| 94 | } |
| 95 | |
| 96 | MessageDigest sha1 = MessageDigest.getInstance("SHA-1"); |
| 97 | |
| 98 | //indentity |
| 99 | StringBuffer identity = new StringBuffer(); |
| 100 | identity.append(BOMBUS_ID_CATEGORY).append("/").append(BOMBUS_ID_TYPE) |
| 101 | .append("//").append(StaticData.getInstance().getVersionInfo().getName()).append("<"); |
| 102 | |
| 103 | for (int i = 0; i < j; i++) { |
| 104 | identity.append((String) features.elementAt(i)); |
| 105 | identity.append("<"); |
| 106 | } |
| 107 | sha1.update(identity.toString().getBytes(), 0, identity.length()); |
| 108 | byte[] sha1bits = new byte[20]; |
| 109 | sha1.digest(sha1bits, 0, sha1bits.length); |
| 110 | ver = Strconv.toBase64(sha1bits, sha1bits.length); |
| 111 | |
| 112 | return ver; |
| 113 | } |
| 114 | |
| 115 | public static JabberDataBlock presenceEntityCaps() { |
| 116 | try { |
no test coverage detected