Package com.calclab.emite.xep.muc.events

Examples of com.calclab.emite.xep.muc.events.RoomChatChangedEvent


  public final RoomChat openRoom(final XmppURI uri, final HistoryOptions historyOptions) {
    RoomChat chat = getRoom(uri);
    if (chat == null) {
      chat = new RoomChat(this, eventBus, session, uri, session.getCurrentUserURI());
      roomsByJID.put(uri.getJID(), chat);
      eventBus.fireEventFromSource(new RoomChatChangedEvent(ChangeType.created, chat), this);
    }
   
    chat.open(historyOptions);
    return chat;
  }
View Full Code Here


    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));

          session.sendIQ("rooms", iq, new IQCallback() {
            @Override
            public void onIQSuccess(final IQ iq) {
              status = RoomStatus.ready;
              eventBus.fireEventFromSource(new RoomChatChangedEvent(ChangeType.opened, RoomChat.this), roomManager);
            }

            @Override
            public void onIQFailure(final IQ iq) {
            }
          });
        } else {
          status = RoomStatus.ready;
          eventBus.fireEventFromSource(new RoomChatChangedEvent(ChangeType.opened, this), roomManager);
        }
      }
    }
   
    eventBus.fireEventFromSource(new PresenceReceivedEvent(presence), this);
View Full Code Here

TOP

Related Classes of com.calclab.emite.xep.muc.events.RoomChatChangedEvent

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.