Package org.jivesoftware.smackx.packet

Examples of org.jivesoftware.smackx.packet.VCard


     * @param xml the xml representing a users vCard.
     * @return the VCard.
     * @throws Exception if an exception occurs.
     */
    public static VCard createVCardFromXML(String xml) throws Exception {
        VCard vCard = new VCard();

        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
        Document document = documentBuilder.parse(
                new ByteArrayInputStream(xml.getBytes(PREFERRED_ENCODING)));
View Full Code Here


  private void addToCache(String id, VCard card) {
    vcardCache.put(id, card);
  }

  private VCard getVCardForPresence(Presence xmppPresence) {
    VCard result = null;
    if (xmppPresence.getExtension("x", "vcard-temp:x:update") != null) {
      final String from = xmppPresence.getFrom();
      result = getFromCache(from);
      if (result == null && from != null) {
        result = new VCard();
        try {
          result.load(container.getXMPPConnection(), from);
          addToCache(from, result);
        } catch (final XMPPException e) {
          traceStack("vcard loading exception", e);
        }
      }
View Full Code Here

              .getPropertiesFromPacket(xmppPresence), null);
      this.fromID = fromID;
    }

    private void fillFromVCard() {
      VCard card = getFromCache(fromID);
      if (card == null && asyncResult != null) {
        try {
          card = (VCard) asyncResult.get();
          asyncResult = null;
        } catch (final Exception e) {
        }
      }
      if (card != null) {
        addToCache(fromID, card);
        final byte[] bytes = card.getAvatar();
        this.pictureData = (bytes == null) ? new byte[0] : bytes;
        this.properties = addVCardProperties(card, this.properties);
      }
    }
View Full Code Here

TOP

Related Classes of org.jivesoftware.smackx.packet.VCard

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.