Esempio n. 1
0
  public VCard(JabberDataBlock data) {
    this();
    jid = data.getAttribute("from");
    id = data.getAttribute("id");
    int itemsCount = getCount();
    vCardData = new Vector(itemsCount);
    vCardData.setSize(itemsCount);

    if (data == null) return;
    if (data.getTypeAttribute().equals("error")) return;
    JabberDataBlock vcard = data.findNamespace("vcard-temp");
    if (vcard == null) return; // "No vCard available"

    empty = false;

    for (int i = 0; i < itemsCount; i++) {
      try {
        String f1 = (String) VCard.vCardFields.elementAt(i);
        String f2 = (String) VCard.vCardFields2.elementAt(i);

        JabberDataBlock d2 = (f2 == null) ? vcard : vcard.getChildBlock(f2);

        String field = d2.getChildBlockText(f1);

        if (field.length() > 0) setVCardData(i, field);
      } catch (Exception e) {
        /**/
      }
    }

    try {
      JabberDataBlock photoXML = vcard.getChildBlock("PHOTO").getChildBlock("BINVAL");
      photo = (byte[]) photoXML.getChildBlocks().lastElement();
    } catch (Exception e) {
    }
    ;
  }
Esempio n. 2
0
 public void clear() {
   if (super.size() > 0) super.clear();
   // if (comment_blocks.size() > 0)
   //    comment_blocks.clear();
   keys.setSize(0);
 }