Exemple #1
0
  /**
   * Returns list of <tt>ChatTransport</tt> (i.e. contact) that supports the specified
   * <tt>OperationSet</tt>.
   *
   * @param transports list of <tt>ChatTransport</tt>
   * @param opSetClass <tt>OperationSet</tt> to find
   * @return list of <tt>ChatTransport</tt> (i.e. contact) that supports the specified
   *     <tt>OperationSet</tt>.
   */
  private List<ChatTransport> getOperationSetForCapabilities(
      List<ChatTransport> transports, Class<? extends OperationSet> opSetClass) {
    List<ChatTransport> list = new ArrayList<ChatTransport>();

    for (ChatTransport transport : transports) {
      ProtocolProviderService protocolProvider = transport.getProtocolProvider();
      OperationSetContactCapabilities capOpSet =
          protocolProvider.getOperationSet(OperationSetContactCapabilities.class);
      OperationSetPersistentPresence presOpSet =
          protocolProvider.getOperationSet(OperationSetPersistentPresence.class);

      if (capOpSet == null) {
        list.add(transport);
      } else if (presOpSet != null) {
        Contact contact = presOpSet.findContactByID(transport.getName());

        if ((contact != null) && (capOpSet.getOperationSet(contact, opSetClass) != null)) {
          // It supports OpSet for at least one of its
          // ChatTransports
          list.add(transport);
        }
      }
    }

    return list;
  }
  /**
   * Creates an instance of <tt>NewStatusMessageDialog</tt>.
   *
   * @param protocolProvider the <tt>ProtocolProviderService</tt>.
   */
  public NewStatusMessageDialog(ProtocolProviderService protocolProvider) {
    presenceOpSet =
        (OperationSetPersistentPresence)
            protocolProvider.getOperationSet(OperationSetPresence.class);

    this.init();
    pack();
  }