當前位置: 首頁>>代碼示例>>Java>>正文


Java CapsExtension類代碼示例

本文整理匯總了Java中org.jivesoftware.smackx.caps.packet.CapsExtension的典型用法代碼示例。如果您正苦於以下問題:Java CapsExtension類的具體用法?Java CapsExtension怎麽用?Java CapsExtension使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CapsExtension類屬於org.jivesoftware.smackx.caps.packet包,在下文中一共展示了CapsExtension類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addCapsExtensionInfo

import org.jivesoftware.smackx.caps.packet.CapsExtension; //導入依賴的package包/類
private static void addCapsExtensionInfo(String from, CapsExtension capsExtension) {
    String capsExtensionHash = capsExtension.getHash();
    String hashInUppercase = capsExtensionHash.toUpperCase(Locale.US);
    // SUPPORTED_HASHES uses the format of MessageDigest, which is uppercase, e.g. "SHA-1" instead of "sha-1"
    if (!SUPPORTED_HASHES.containsKey(hashInUppercase))
        return;
    String hash = capsExtensionHash.toLowerCase(Locale.US);

    String node = capsExtension.getNode();
    String ver = capsExtension.getVer();

    JID_TO_NODEVER_CACHE.put(from, new NodeVerHash(node, ver, hash));
}
 
開發者ID:TTalkIM,項目名稱:Smack,代碼行數:14,代碼來源:EntityCapsManager.java

示例2: parse

import org.jivesoftware.smackx.caps.packet.CapsExtension; //導入依賴的package包/類
public CapsExtension parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException,
        SmackException {
    String hash = null;
    String version = null;
    String node = null;
    if (parser.getEventType() == XmlPullParser.START_TAG
            && parser.getName().equalsIgnoreCase(EntityCapsManager.ELEMENT)) {
        hash = parser.getAttributeValue(null, "hash");
        version = parser.getAttributeValue(null, "ver");
        node = parser.getAttributeValue(null, "node");
    } else {
        throw new SmackException("Malformed Caps element");
    }

    parser.next();

    if (!(parser.getEventType() == XmlPullParser.END_TAG
            && parser.getName().equalsIgnoreCase(EntityCapsManager.ELEMENT))) {
        throw new SmackException("Malformed nested Caps element");
    }

    if (hash != null && version != null && node != null) {
        return new CapsExtension(node, version, hash);
    } else {
        throw new SmackException("Caps elment with missing attributes. Attributes: hash=" + hash + " version="
                        + version + " node=" + node);
    }
}
 
開發者ID:TTalkIM,項目名稱:Smack,代碼行數:29,代碼來源:CapsExtensionProvider.java

示例3: parseTest

import org.jivesoftware.smackx.caps.packet.CapsExtension; //導入依賴的package包/類
@Test
public void parseTest() throws XmlPullParserException, IOException, SmackException {
    // @formatter:off
    final String capsExtensionString =
        "<c xmlns='http://jabber.org/protocol/caps'"
        + " hash='sha-1'"
        + " node='http://foo.example.org/bar'"
        + " ver='QgayPKawpkPSDYmwt/WM94uA1u0='/>";
    // @formatter:on
    CapsExtension capsExtension = TestUtils.parseExtensionElement(capsExtensionString);
    assertNotNull(capsExtension);
}
 
開發者ID:TTalkIM,項目名稱:Smack,代碼行數:13,代碼來源:CapsExtensionProviderTest.java

示例4: createPresence

import org.jivesoftware.smackx.caps.packet.CapsExtension; //導入依賴的package包/類
private Presence createPresence(Presence.Mode mode) {
    String status = Preferences.getStatusMessage();
    Presence p = new Presence(Presence.Type.available);
    if (!TextUtils.isEmpty(status))
        p.setStatus(status);
    if (mode != null)
        p.setMode(mode);

    // TODO find a place for this
    p.addExtension(new CapsExtension("http://www.kontalk.org/", "none", "sha-1"));

    return p;
}
 
開發者ID:kontalk,項目名稱:androidclient,代碼行數:14,代碼來源:MessageCenterService.java


注:本文中的org.jivesoftware.smackx.caps.packet.CapsExtension類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。