Examples of XmppURI


Examples of com.calclab.emite.core.XmppURI

    manager = new DiscoveryManagerImpl(new SimpleEventBus(), session);
  }

  @Test
  public void shouldSendInfoQuery() {
    final XmppURI uri = XmppURI.uri("node", "localhost.localdomain", "resource");
    final DiscoveryInfoResultTestHandler handler = new DiscoveryInfoResultTestHandler();
    manager.sendInfoQuery(uri, handler);
    session.answerSuccess(DISCO_RESULT);
    assertTrue(handler.isCalledOnce());
    assertTrue(handler.getLastEvent().hasResult());
View Full Code Here

Examples of com.calclab.emite.core.XmppURI

  }

  @Test
  public void shouldSendItemsQuery() {
    final XmppURI uri = XmppURI.uri("node", "localhost.localdomain", "resource");
    final DiscoveryItemsResultTestHandler handler = new DiscoveryItemsResultTestHandler();
    manager.sendItemsQuery(uri, handler);
    session.answerSuccess(DISCO_ITEMS_RESULT);
    assertTrue(handler.isCalledOnce());
    assertTrue(handler.getLastEvent().hasResult());
View Full Code Here

Examples of com.calclab.emite.core.XmppURI

* See: http://xmpp.org/extensions/xep-0055.html#schema
*/
public class SearchResultItem {

  public static SearchResultItem parse(final XMLPacket xml) {
    final XmppURI jid = XmppURI.jid(xml.getAttribute("jid"));
    assert jid != null;
    return new SearchResultItem(jid, xml.getChildText("nick"), xml.getChildText("first"), xml.getChildText("last"), xml.getChildText("email"));
  }
View Full Code Here

Examples of com.calclab.emite.core.XmppURI

   
    status = RoomStatus.locked;
  }

  protected void receivePresence(final Presence presence) {
    final XmppURI occupantURI = presence.getFrom();
    final Presence.Type type = presence.getType();
    if (Presence.Type.unavailable.equals(type)) {
      removeOccupant(occupantURI);
      if (occupantURI.equalsNoResource(session.getCurrentUserURI())) {
        status = RoomStatus.locked;
        roomManager.closeRoom(this);
        eventBus.fireEventFromSource(new RoomChatChangedEvent(ChangeType.closed, this), roomManager);
      }
    } else if (!Presence.Type.error.equals(type)) {
      final XMLPacket xmuc = presence.getExtension("x", XmppNamespaces.MUC_USER);
      if (xmuc != null) {
        final XMLPacket item = xmuc.getFirstChild("item");
        final String affiliation = item.getAttribute("affiliation");
        final String role = item.getAttribute("role");
        final XmppURI userUri = XmppURI.uri(item.getAttribute("jid"));
        setOccupantPresence(userUri, occupantURI, affiliation, role, presence.getShow(), presence.getStatus());
        if (hasStatus(xmuc, 201)) {
          final IQ iq = new IQ(IQ.Type.set);
          iq.setTo(roomUri.getJID());
          iq.addQuery(XmppNamespaces.MUC_OWNER).addChild(new Form(Form.Type.submit));
View Full Code Here

Examples of com.calclab.emite.core.XmppURI

    return eventBus.addHandlerToSource(RoomSubjectChangedEvent.TYPE, this, handler);
  }
 
  protected void addOccupant(final Occupant occupant) {
    occupantsByOccupantUri.put(occupant.getOccupantUri(), occupant);
    final XmppURI userUri = occupant.getUserUri();
    if (userUri != null) {
      occupantsByUserUri.put(userUri.getJID(), occupant);
    }
    eventBus.fireEventFromSource(new OccupantChangedEvent(ChangeType.added, occupant), this);
  }
View Full Code Here

Examples of com.calclab.emite.core.XmppURI

  }

  protected void removeOccupant(final XmppURI occupantUri) {
    final Occupant occupant = occupantsByOccupantUri.remove(occupantUri);
    if (occupant != null) {
      final XmppURI userUri = occupant.getUserUri();
      if (userUri != null) {
        occupantsByUserUri.remove(userUri.getJID());
      }
      eventBus.fireEventFromSource(new OccupantChangedEvent(ChangeType.removed, occupant), this);
    }
  }
View Full Code Here

Examples of com.calclab.emite.core.XmppURI

  }

  @Test
  public void testShouldCalculateDelay() {

    final XmppURI uri = uri("name@domain/resource");
    final XMLPacket delayNode = XMLBuilder.create("delay", "urn:xmpp:delay").getXML();
    delayNode.setAttribute("from", "name@domain/resource");
    delayNode.setAttribute("stamp", "1980-04-15T17:15:02.159+01:00");
    final Delay delay = new Delay(delayNode);
    assertNotNull(delay);
View Full Code Here

Examples of com.calclab.emite.core.XmppURI

  @SuppressWarnings("deprecation")
  @Test
  public void testShouldCalculateDelayLegacyFormat() {

    final XmppURI uri = uri("name@domain/resource");
    final XMLPacket delayNode = XMLBuilder.create("x", "jabber:x:delay").getXML();
    delayNode.setAttribute("xmlns", "jabber:x:delay");
    delayNode.setAttribute("from", "name@domain/resource");
    delayNode.setAttribute("stamp", "19800415T17:15:02");
    final Delay delay = new Delay(delayNode);
View Full Code Here

Examples of com.calclab.emite.core.XmppURI

  @Test
  public void testShouldGiveDelay() {
    final Stanza stanza = new Stanza("name", "xmlns");

    final XmppURI uri = uri("name@domain/resource");
    stanza.setTo(uri);
    assertEquals("name@domain/resource", stanza.getTo().toString());
    stanza.setTo((XmppURI) null);
    final XMLPacket delayNode = stanza.getXML().addChild("delay");
    delayNode.setAttribute("xmlns", "urn:xmpp:delay");
View Full Code Here

Examples of com.calclab.emite.core.XmppURI

  @SuppressWarnings("deprecation")
  @Test
  public void testShouldGiveDelayLegacyFormat() {
    final Stanza stanza = new Stanza("name", "xmlns");

    final XmppURI uri = uri("name@domain/resource");
    stanza.setTo(uri);
    assertEquals("name@domain/resource", stanza.getTo().toString());
    stanza.setTo(null);
    final XMLPacket delayNode = stanza.getXML().addChild("x");
    delayNode.setAttribute("xmlns", "jabber:x:delay");
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.