Package com.calclab.emite.im.events

Examples of com.calclab.emite.im.events.RosterItemChangedEvent$Handler


        hasChanged = true;
        item.setStatus(presence.getStatus());
      }

      if (hasChanged) {
        final RosterItemChangedEvent changeEvent = new RosterItemChangedEvent(ChangeType.modified, item);
        eventBus.fireEventFromSource(changeEvent, this);

        for (final RosterGroup group : groups.values()) {
          if (group.hasItem(item.getJID())) {
            eventBus.fireEventFromSource(changeEvent, this);
View Full Code Here


  private void handleItemChanged(final RosterItem item) {
    final RosterItem old = getItemByJID(item.getJID());

    if (old == null) { // new item
      storeItem(item);
      eventBus.fireEventFromSource(new RosterItemChangedEvent(ChangeType.added, item), this);
    } else { // update or remove
      final SubscriptionState subscriptionState = item.getSubscriptionState();
      if (subscriptionState == SubscriptionState.remove) {
        removeItem(old);
        eventBus.fireEventFromSource(new RosterItemChangedEvent(ChangeType.removed, old), this);
      } else {
        updateExistingItem(old, item);
        eventBus.fireEventFromSource(new RosterItemChangedEvent(ChangeType.modified, old), this);
      }
    }
  }
View Full Code Here

   *            The item to be added. If there's a previously item with the
   *            same jid, it's replaced
   */
  public void add(final RosterItem item) {
    itemsByJID.put(item.getJID(), item);
    eventBus.fireEventFromSource(new RosterItemChangedEvent(ChangeType.added, item), this);
  }
View Full Code Here

  }

  public RosterItem remove(final XmppURI jid) {
    final RosterItem removed = itemsByJID.remove(jid);
    if (removed != null) {
      eventBus.fireEventFromSource(new RosterItemChangedEvent(ChangeType.removed, removed), this);
    }
    return removed;
  }
View Full Code Here

  @Test
  public void shouldSendSubscriptionRequestOnNewRosterItem_addRosterStep1() {
    // only NONE subscription
    final RosterItem item = new RosterItem(uri("name@domain"), SubscriptionState.both, "TheName", null);
    eventBus.fireEvent(new RosterItemChangedEvent(ChangeType.added, item));
    session.verifyNotSent("<presence />");

    final RosterItem item2 = new RosterItem(uri("name@domain"), SubscriptionState.none, "TheName", Type.subscribe);
    eventBus.fireEvent(new RosterItemChangedEvent(ChangeType.added, item2));
    session.verifySent("<presence from='user@local' to='name@domain' type='subscribe'/>");
  }
View Full Code Here

TOP

Related Classes of com.calclab.emite.im.events.RosterItemChangedEvent$Handler

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.