Examples of XmppURI


Examples of com.calclab.emite.core.XmppURI

  private final boolean loginFromMeta() {
    logger.info("Loging in from meta data...");
    final String userJID = PageAssist.getMeta(PARAM_JID, null);
    final String password = PageAssist.getMeta(PARAM_PASSWORD, null);
    if (userJID != null && password != null) {
      final XmppURI jid = uri(userJID);
      session.login(new Credentials(jid, password));
      return true;
    } else if (userJID != null && "anonymous".equals(userJID.toLowerCase())) {
      session.login(Credentials.ANONYMOUS);
      return true;
View Full Code Here

Examples of com.calclab.emite.core.XmppURI

    stream.rid = Integer.parseInt(map.get("rid"));
    stream.sid = map.get("sid");
    stream.wait = map.get("wait");
    stream.setInactivity(map.get("inactivity"));
    stream.setMaxPause(map.get("maxPause"));
    final XmppURI user = uri(map.get("user"));
    session.resume(user, stream);
    return true;
  }
View Full Code Here

Examples of com.calclab.emite.core.XmppURI

  @Override
  public void onMessageReceived(final MessageReceivedEvent event) {
    final Message message = event.getMessage();
    final ChatState state = getStateFromMessage(message);
    if (state != null) {
      final XmppURI from = message.getFrom();
      othersState.put(from, state);
      eventBus.fireEventFromSource(new RoomChatStateNotificationEvent(message.getFrom(), state), this);
    }
  }
View Full Code Here

Examples of com.calclab.emite.core.XmppURI

  }

  @Override
  public final void onSessionStatusChanged(final SessionStatusChangedEvent event) {
    if (SessionStatus.loggedIn.equals(event.getStatus())) {
      final XmppURI currentUser = session.getCurrentUserURI();
      if (currentChatUser == null) {
        currentChatUser = currentUser;
      }
      if (currentUser.equalsNoResource(currentChatUser)) {
        for (final RoomChat chat : roomsByJID.values()) {
          chat.open(null);
        }
      }
    } else if (SessionStatus.loggingOut.equals(event.getStatus()) || SessionStatus.disconnected.equals(event.getStatus())) {
View Full Code Here

Examples of com.calclab.emite.core.XmppURI

    }
  }

  @Override
  public final RoomChat acceptRoomInvitation(final RoomInvitation invitation, @Nullable final HistoryOptions historyOptions) {
    final XmppURI roomURI = invitation.getRoomURI();
    final XmppURI uri = XmppURI.uri(roomURI.getNode(), roomURI.getHost(), session.getCurrentUserURI().getNode());

    return openRoom(uri, historyOptions);
  }
View Full Code Here

Examples of com.calclab.emite.core.XmppURI

  }

  @Override
  public final void onSessionStatusChanged(final SessionStatusChangedEvent event) {
    if (SessionStatus.loggedIn.equals(event.getStatus())) {
      final XmppURI currentUser = session.getCurrentUserURI();
      if (currentChatUser == null) {
        currentChatUser = currentUser;
      }
      if (currentUser.equalsNoResource(currentChatUser)) {
        for (final PairChat chat : chats) {
          chat.open();
        }
      }
    } else if (SessionStatus.loggingOut.equals(event.getStatus()) || SessionStatus.disconnected.equals(event.getStatus())) {
View Full Code Here

Examples of com.calclab.emite.core.XmppURI

  @Test
  public void shouldAddOccupantAndFireListeners() {
    final OccupantChangedTestHandler handler = new OccupantChangedTestHandler();
    room.addOccupantChangedHandler(handler);
    final XmppURI occupantUri = uri("room@domain/user");
    final Occupant occupant = room.setOccupantPresence(userURI, occupantUri, "aff", "role", Show.unknown, null);
    assertTrue(handler.isCalledOnce());
    final Occupant result = room.getOccupantByOccupantUri(occupantUri);
    assertEquals(occupant, result);
  }
View Full Code Here

Examples of com.calclab.emite.core.XmppURI

  @Test
  public void shouldFireListenersWhenSubjectChange() {
    final RoomSubjectChangedTestHandler handler = new RoomSubjectChangedTestHandler();
    room.addRoomSubjectChangedHandler(handler);

    final XmppURI occupantURI = uri("someone@domain/res");
    final Message subject = new Message(null, uri("room@domain"), occupantURI);
    subject.setSubject("the subject");
    eventBus.fireEvent(new MessageReceivedEvent(subject));
    assertEquals(1, handler.getCalledTimes());
View Full Code Here

Examples of com.calclab.emite.core.XmppURI

  @Test
  public void shouldRemoveOccupant() {
    final OccupantChangedTestHandler handler = new OccupantChangedTestHandler("removed");
    room.addOccupantChangedHandler(handler);
    final XmppURI occupantUri = uri("room@domain/name");
    room.setOccupantPresence(userURI, occupantUri, "owner", "participant", Show.notSpecified, null);
    assertEquals(1, room.getOccupantsCount());
    room.removeOccupant(occupantUri);
    assertEquals(0, room.getOccupantsCount());
    assertEquals(1, handler.getCalledTimes());
View Full Code Here

Examples of com.calclab.emite.core.XmppURI

  @Test
  public void shouldUpdateOccupantAndFireListeners() {
    final OccupantChangedTestHandler handler = new OccupantChangedTestHandler("modified");
    room.addOccupantChangedHandler(handler);
    final XmppURI occupantUri = uri("room@domain/name");
    final Occupant occupant = room.setOccupantPresence(userURI, occupantUri, "owner", "participant", Show.notSpecified, null);
    final Occupant occupant2 = room.setOccupantPresence(userURI, occupantUri, "admin", "moderator", Show.notSpecified, null);
    assertEquals(1, handler.getCalledTimes());
    assertSame(occupant, occupant2);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.