/**
  * Stores the received subsctiption and notifies all waiting on this object
  *
  * @param evt the SubscriptionEvent containing the corresponding contact
  */
 public void contactModified(ContactPropertyChangeEvent evt) {
   synchronized (this) {
     logger.debug("Collected evt(" + collectedEvents.size() + ")= " + evt);
     collectedEvents.add(evt);
     notifyAll();
   }
 }
 public void providerStatusMessageChanged(PropertyChangeEvent evt) {
   synchronized (this) {
     logger.debug("Collected stat.msg. evt(" + collectedPresEvents.size() + ")= " + evt);
     collectedStatMsgEvents.add(evt);
     notifyAll();
   }
 }
 /**
  * Stores the received subsctiption and notifies all waiting on this object
  *
  * @param evt the SubscriptionEvent containing the corresponding contact
  */
 public void subscriptionMoved(SubscriptionMovedEvent evt) {
   synchronized (this) {
     logger.debug("Collected evt(" + collectedEvents.size() + ")= " + evt);
     collectedEvents.add(evt);
     notifyAll();
   }
 }
 /**
  * Called whnever an indication is received that an existing server stored group has been
  * resolved.
  *
  * @param evt a ServerStoredGroupChangeEvent containing a reference to the resolved group.
  */
 public void groupResolved(ServerStoredGroupEvent evt) {
   synchronized (this) {
     logger.debug("Collected evt(" + collectedEvents.size() + ")= " + evt);
     collectedEvents.add(evt);
     notifyAll();
   }
 }
Exemple #5
0
  /**
   * 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;
  }
 public void providerStatusChanged(ProviderPresenceStatusChangeEvent evt) {
   synchronized (this) {
     logger.debug("Collected evt(" + collectedPresEvents.size() + ")= " + evt);
     collectedPresEvents.add(evt);
     notifyAll();
   }
 }
Exemple #7
0
  /**
   * Returns the list of selected points.
   *
   * @return list of selected points
   */
  public List<WhiteboardPoint> getSelectionPoints() {
    ArrayList<WhiteboardPoint> selectionPoints = new ArrayList<WhiteboardPoint>();

    selectionPoints.add(startPoint);
    selectionPoints.add(endPoint);

    return selectionPoints;
  }
Exemple #8
0
 /** Returns default participant feature set. */
 public static List<String> getDefaultParticipantFeatureSet() {
   ArrayList<String> features = new ArrayList<String>(4);
   features.add(FEATURE_AUDIO);
   features.add(FEATURE_VIDEO);
   features.add(FEATURE_ICE);
   features.add(FEATURE_SCTP);
   features.add(FEATURE_DTLS);
   return features;
 }
    /**
     * Stores the received status change event and notifies all waiting on this object
     *
     * @param evt the SubscriptionEvent containing the corresponding contact
     */
    public void contactPresenceStatusChanged(ContactPresenceStatusChangeEvent evt) {
      synchronized (this) {
        // if the user has specified event details and the received
        // event does not match - then ignore it.
        if (this.trackedScreenName != null
            && !evt.getSourceContact().getAddress().equals(trackedScreenName)) return;
        if (status != null && status != evt.getNewStatus()) return;

        logger.debug("Collected evt(" + collectedEvents.size() + ")= " + evt);
        collectedEvents.add(evt);
        notifyAll();
      }
    }
 /**
  * Adds the given <tt>FileTransferListener</tt> that would listen for file transfer requests and
  * created file transfers.
  *
  * @param listener the <tt>FileTransferListener</tt> to add
  */
 public void addFileTransferListener(FileTransferListener listener) {
   synchronized (fileTransferListeners) {
     if (!fileTransferListeners.contains(listener)) {
       this.fileTransferListeners.add(listener);
     }
   }
 }
    /**
     * Blocks until at least one status message event is received or until waitFor milliseconds pass
     * (whichever happens first).
     *
     * @param waitFor the number of milliseconds that we should be waiting for a status message
     *     event before simply bailing out.
     */
    public void waitForStatMsgEvent(long waitFor) {
      logger.trace("Waiting for a provider status message event.");
      synchronized (this) {
        if (collectedStatMsgEvents.size() > 0) {
          logger.trace("Stat msg. evt already received. " + collectedStatMsgEvents);
          return;
        }

        try {
          wait(waitFor);
          if (collectedStatMsgEvents.size() > 0) logger.trace("Received a prov. stat. msg. evt.");
          else logger.trace("No prov. stat msg. received for " + waitFor + "ms.");
        } catch (InterruptedException ex) {
          logger.debug("Interrupted while waiting for a status msg evt", ex);
        }
      }
    }
    /**
     * Blocks until at least one event is received or until waitFor milliseconds pass (whichever
     * happens first).
     *
     * @param waitFor the number of milliseconds that we should be waiting for an event before
     *     simply bailing out.
     */
    public void waitForPresEvent(long waitFor) {
      logger.trace("Waiting for a change in provider status.");
      synchronized (this) {
        if (collectedPresEvents.size() > 0) {
          logger.trace("Change already received. " + collectedPresEvents);
          return;
        }

        try {
          wait(waitFor);
          if (collectedPresEvents.size() > 0) logger.trace("Received a change in provider status.");
          else logger.trace("No change received for " + waitFor + "ms.");
        } catch (InterruptedException ex) {
          logger.debug("Interrupted while waiting for a provider evt", ex);
        }
      }
    }
    /**
     * Blocks until at least one event is received or until waitFor milliseconds pass (whichever
     * happens first).
     *
     * @param waitFor the number of milliseconds that we should be waiting for an event before
     *     simply bailing out.
     */
    public void waitForEvent(long waitFor) {
      logger.trace("Waiting for a persistent subscription event");

      synchronized (this) {
        if (collectedEvents.size() > 0) {
          logger.trace("SubEvt already received. " + collectedEvents);
          return;
        }

        try {
          wait(waitFor);
          if (collectedEvents.size() > 0) logger.trace("Received a SubEvt in provider status.");
          else logger.trace("No SubEvt received for " + waitFor + "ms.");
        } catch (InterruptedException ex) {
          logger.debug("Interrupted while waiting for a subscription evt", ex);
        }
      }
    }
    /**
     * Blocks until at least one event is received or until waitFor miliseconds pass (whicever
     * happens first).
     *
     * @param waitFor the number of miliseconds that we should be waiting for an event before simply
     *     bailing out.
     */
    public void waitForEvent(long waitFor) {
      synchronized (this) {
        if (collectedEvents.size() > 0) return;

        try {
          wait(waitFor);
        } catch (InterruptedException ex) {
          logger.debug("Interrupted while waiting for a subscription evt", ex);
        }
      }
    }