コード例 #1
0
    /**
     * Details have been retrieved.
     *
     * @param details the details retrieved if any.
     */
    public void detailsRetrieved(Iterator<GenericDetail> details) {
      // if treenode has changed ignore
      if (!source.equals(treeNode)) return;

      while (details.hasNext()) {
        GenericDetail d = details.next();

        if (d instanceof PhoneNumberDetail
            && !(d instanceof PagerDetail)
            && !(d instanceof FaxDetail)) {
          final PhoneNumberDetail pnd = (PhoneNumberDetail) d;
          if (pnd.getNumber() != null && pnd.getNumber().length() > 0) {
            SwingUtilities.invokeLater(
                new Runnable() {
                  public void run() {
                    callButton.setEnabled(true);

                    if (pnd instanceof VideoDetail) {
                      callVideoButton.setEnabled(true);
                      desktopSharingButton.setEnabled(true);
                    }

                    treeContactList.refreshContact(uiContact);
                  }
                });

            return;
          }
        }
      }
    }
コード例 #2
0
ファイル: UIPhoneUtil.java プロジェクト: nagyist/jitsi
  /**
   * Searches for additional phone numbers found in contact information
   *
   * @return additional phone numbers found in contact information;
   */
  private List<UIContactDetail> getAdditionalNumbers(boolean onlyMobile) {
    List<UIContactDetail> telephonyContacts = new ArrayList<UIContactDetail>();

    Iterator<Contact> contacts = getMetaContact().getContacts();

    while (contacts.hasNext()) {
      Contact contact = contacts.next();
      OperationSetServerStoredContactInfo infoOpSet =
          contact.getProtocolProvider().getOperationSet(OperationSetServerStoredContactInfo.class);
      Iterator<GenericDetail> details;
      ArrayList<String> phones = new ArrayList<String>();

      if (infoOpSet != null) {
        details = infoOpSet.getAllDetailsForContact(contact);

        while (details.hasNext()) {
          GenericDetail d = details.next();

          boolean process = false;

          if (onlyMobile) {
            if (d instanceof MobilePhoneDetail) process = true;
          } else if (d instanceof PhoneNumberDetail
              && !(d instanceof PagerDetail)
              && !(d instanceof FaxDetail)) {
            process = true;
          }

          if (process) {
            PhoneNumberDetail pnd = (PhoneNumberDetail) d;
            if (pnd.getNumber() != null && pnd.getNumber().length() > 0) {
              // skip phones which were already added
              if (phones.contains(pnd.getNumber())) continue;

              phones.add(pnd.getNumber());

              UIContactDetail cd =
                  new UIContactDetailImpl(
                      pnd.getNumber(),
                      pnd.getNumber() + " (" + getLocalizedPhoneNumber(d) + ")",
                      null,
                      new ArrayList<String>(),
                      GuiActivator.getResources().getImage("service.gui.icons.EXTERNAL_PHONE"),
                      null,
                      null,
                      pnd) {
                    @Override
                    public PresenceStatus getPresenceStatus() {
                      return null;
                    }
                  };
              telephonyContacts.add(cd);
            }
          }
        }
      }
    }

    return telephonyContacts;
  }