Package com.calclab.emite.core.stanzas

Examples of com.calclab.emite.core.stanzas.Presence


   *
   * @param historyOptions
   * @return
   */
  private Presence createEnterPresence(final HistoryOptions historyOptions) {
    final Presence presence = new Presence(null, roomUri);
    final XMLPacket x = presence.getXML().addChild("x", XmppNamespaces.MUC);
    presence.setPriority(0);
    if (historyOptions != null) {
      final XMLPacket h = x.addChild("history");
      if (historyOptions.getMaxChars() >= 0) {
        h.setAttribute("maxchars", Integer.toString(historyOptions.getMaxChars()));
      }
View Full Code Here


  }

  @Override
  public void onSessionStatusChanged(final SessionStatusChangedEvent event) {
    if (enabled && SessionStatus.rosterReady.equals(event.getStatus())) {
      session.send(new Presence());
      session.setStatus(SessionStatus.ready);
    }
  }
View Full Code Here

    log("Messaged received from " + message.getFrom().toString() + ":" + message.getBody());
  }
 
  @Override
  public void onPresenceReceived(final PresenceReceivedEvent event) {
    final Presence presence = event.getPresence();
    log("Presence received from " + presence.getFrom().toString() + ": " + presence.toString());
  }
View Full Code Here

    roster.addRosterItemChangedHandler(this);
  }

  @Override
  public void onPresenceReceived(final PresenceReceivedEvent event) {
    final Presence presence = event.getPresence();
    if (presence.getType() == Presence.Type.subscribe) {
      final XMLPacket nick = presence.getExtension("nick", XmppNamespaces.NICK);
      eventBus.fireEventFromSource(new SubscriptionRequestReceivedEvent(presence.getFrom(), nick.getText()), this);
    }
  }
View Full Code Here

      roster.requestAddItem(jid, nick != null ? nick : jid.getNode());
      // request a subscription to that entity of the roster
      requestSubscribe(jid);
    }
    // answer "subscribed" to the subscrition request
    final Presence presence = new Presence(Presence.Type.subscribed, jid.getJID());
    presence.setFrom(session.getCurrentUserURI().getJID());
    session.send(presence);
  }
View Full Code Here

    session.send(presence);
  }

  @Override
  public void cancelSubscription(final XmppURI jid) {
    final Presence presence = new Presence(Presence.Type.unsubscribed, jid.getJID());
    presence.setFrom(session.getCurrentUserURI().getJID());
    session.send(presence);
  }
View Full Code Here

    session.send(presence);
  }

  @Override
  public void refuseSubscriptionRequest(final XmppURI jid) {
    final Presence presence = new Presence(Presence.Type.unsubscribed, jid.getJID());
    presence.setFrom(session.getCurrentUserURI().getJID());
    session.send(presence);
  }
View Full Code Here

    session.send(presence);
  }

  @Override
  public void requestSubscribe(final XmppURI jid) {
    final Presence presence = new Presence(Presence.Type.subscribe, jid.getJID());
    presence.setFrom(session.getCurrentUserURI().getJID());
    session.send(presence);
  }
View Full Code Here

    session.send(presence);
  }

  @Override
  public void unsubscribe(final XmppURI jid) {
    final Presence presence = new Presence(Presence.Type.unsubscribe, jid.getJID());
    presence.setFrom(session.getCurrentUserURI().getJID());
    session.send(presence);
  }
View Full Code Here

  }

  @Test
  public void shouldSendPresenceIfLoggedIn() {
    session.setLoggedIn(uri("myself@domain"));
    final Presence newOwn = new Presence();
    newOwn.setShow(Show.dnd);
    manager.changeOwnPresence(newOwn);
    session.verifySent("<presence><show>dnd</show></presence>");

  }
View Full Code Here

TOP

Related Classes of com.calclab.emite.core.stanzas.Presence

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.