Ejemplo n.º 1
0
 public MultiUserChat(XMPPConnection connection, String room) {
   this.nickname = null;
   this.joined = false;
   this.occupantsMap = new ConcurrentHashMap();
   this.invitationRejectionListeners = new ArrayList();
   this.subjectUpdatedListeners = new ArrayList();
   this.userStatusListeners = new ArrayList();
   this.participantStatusListeners = new ArrayList();
   this.presenceInterceptors = new ArrayList();
   this.connectionListeners = new ArrayList();
   this.connection = connection;
   this.room = room.toLowerCase(Locale.US);
   this.messageFilter =
       new AndFilter(FromMatchesFilter.create(this.room), MessageTypeFilter.GROUPCHAT);
   this.presenceFilter =
       new AndFilter(FromMatchesFilter.create(this.room), PacketTypeFilter.PRESENCE);
   this.messageCollector = new ConnectionDetachedPacketCollector();
   PacketListener c13323 = new C13323();
   PacketMultiplexListener packetMultiplexListener =
       new PacketMultiplexListener(this.messageCollector, new C13334(), c13323, new C13345());
   this.roomListenerMultiplexor = RoomListenerMultiplexor.getRoomMultiplexor(this.connection);
   RoomListenerMultiplexor roomListenerMultiplexor = this.roomListenerMultiplexor;
   String str = this.room;
   RoomMultiplexFilter roomMultiplexFilter = roomListenerMultiplexor.filter;
   if (str != null) {
     roomMultiplexFilter.roomAddressTable.put(str.toLowerCase(Locale.US), str);
   }
   RoomMultiplexListener roomMultiplexListener = roomListenerMultiplexor.listener;
   if (str != null) {
     roomMultiplexListener.roomListenersByAddress.put(
         str.toLowerCase(Locale.US), packetMultiplexListener);
   }
 }
Ejemplo n.º 2
0
 private Presence enter$324fb5b(String nickname, long timeout)
     throws NotConnectedException, NoResponseException, XMPPErrorException {
   if (StringUtils.isNullOrEmpty(nickname)) {
     throw new IllegalArgumentException("Nickname must not be null or blank.");
   }
   Presence joinPresence = new Presence(Type.available);
   joinPresence.to = this.room + MqttTopic.TOPIC_LEVEL_SEPARATOR + nickname;
   joinPresence.addExtension(new MUCInitialPresence());
   for (PacketInterceptor interceptPacket : this.presenceInterceptors) {
     interceptPacket.interceptPacket(joinPresence);
   }
   PacketCollector response =
       this.connection.createPacketCollector(
           new AndFilter(
               FromMatchesFilter.createFull(
                   this.room + MqttTopic.TOPIC_LEVEL_SEPARATOR + nickname),
               new PacketTypeFilter(Presence.class)));
   this.connection.sendPacket(joinPresence);
   Presence presence = (Presence) response.nextResultOrThrow(timeout);
   this.nickname = nickname;
   this.joined = true;
   List<String> rooms = (List) joinedRooms.get(this.connection);
   if (rooms == null) {
     rooms = new ArrayList();
     joinedRooms.put(this.connection, rooms);
   }
   rooms.add(this.room);
   return presence;
 }
Ejemplo n.º 3
0
  @Override
  public PacketFilter getInitiationPacketFilter(final String from, String streamID) {
    /*
     * this method is always called prior to #negotiateIncomingStream() so the SOCKS5
     * InitiationListener must ignore the next SOCKS5 Bytestream request with the given session
     * ID
     */
    this.manager.ignoreBytestreamRequestOnce(streamID);

    return new AndFilter(FromMatchesFilter.create(from), new BytestreamSIDFilter(streamID));
  }
Ejemplo n.º 4
0
  /**
   * Returns true if the workgroup is available for receiving new requests. The workgroup will be
   * available only when agents are available for this workgroup.
   *
   * @return true if the workgroup is available for receiving new requests.
   * @throws XMPPException
   */
  public boolean isAvailable() throws XMPPException {
    Presence directedPresence = new Presence(Presence.Type.available);
    directedPresence.setTo(workgroupJID);
    PacketFilter typeFilter = new PacketTypeFilter(Presence.class);
    PacketFilter fromFilter = FromMatchesFilter.create(workgroupJID);
    PacketCollector collector =
        connection.createPacketCollector(new AndFilter(fromFilter, typeFilter));

    connection.sendPacket(directedPresence);

    Presence response = (Presence) collector.nextResultOrThrow();
    return Presence.Type.available == response.getType();
  }