Package org.jivesoftware.smackx.muc

Examples of org.jivesoftware.smackx.muc.MultiUserChat


            // we must add the listener before creating the muc
            final ToContainsFilter toFilter = new ToContainsFilter(endpoint.getParticipant());
            final AndFilter packetFilter = new AndFilter(new PacketTypeFilter(Presence.class), toFilter);
            connection.addPacketListener(this, packetFilter);

            muc = new MultiUserChat(connection, endpoint.resolveRoom(connection));
            muc.addMessageListener(this);
            DiscussionHistory history = new DiscussionHistory();
            history.setMaxChars(0); // we do not want any historical messages

            muc.join(endpoint.getNickname(), null, history, SmackConfiguration.getPacketReplyTimeout());
View Full Code Here


    protected void doStart() throws Exception {
        if (endpoint.getRoom() == null) {
            privateChat = endpoint.getConnection().getChatManager().createChat(endpoint.getParticipant(), this);
            LOG.info("Open chat to " + privateChat.getParticipant());
        } else {
            muc = new MultiUserChat(endpoint.getConnection(), endpoint.resolveRoom());
            muc.addMessageListener(this);
            DiscussionHistory history = new DiscussionHistory();
            history.setMaxChars(0); // we do not want any historical messages
            muc.join(endpoint.getNickname(), null, history, SmackConfiguration.getPacketReplyTimeout());
            LOG.info("Joined room: " + muc.getRoom());
View Full Code Here

            connection = endpoint.createConnection();
        }

        if (chat == null) {
            room = endpoint.resolveRoom(connection);
            chat = new MultiUserChat(connection, room);
            DiscussionHistory history = new DiscussionHistory();
            history.setMaxChars(0); // we do not want any historical messages
            chat.join(endpoint.getNickname(), null, history, SmackConfiguration.getPacketReplyTimeout());
            if (LOG.isInfoEnabled()) {
                LOG.info("Joined room: " + room + " as: " + endpoint.getNickname());
View Full Code Here

            // we must add the listener before creating the muc
            final ToContainsFilter toFilter = new ToContainsFilter(endpoint.getParticipant());
            final AndFilter packetFilter = new AndFilter(new PacketTypeFilter(Presence.class), toFilter);
            connection.addPacketListener(this, packetFilter);

            muc = new MultiUserChat(connection, endpoint.resolveRoom(connection));
            muc.addMessageListener(this);
            DiscussionHistory history = new DiscussionHistory();
            history.setMaxChars(0); // we do not want any historical messages

            muc.join(endpoint.getNickname(), null, history, SmackConfiguration.getPacketReplyTimeout());
View Full Code Here

            connection = endpoint.createConnection();
        }

        if (chat == null) {
            room = endpoint.resolveRoom(connection);
            chat = new MultiUserChat(connection, room);
            DiscussionHistory history = new DiscussionHistory();
            history.setMaxChars(0); // we do not want any historical messages
            chat.join(endpoint.getNickname(), null, history, SmackConfiguration.getPacketReplyTimeout());
            if (LOG.isInfoEnabled()) {
                LOG.info("Joined room: " + room + " as: " + endpoint.getNickname());
View Full Code Here

            // we must add the listener before creating the muc
            final ToContainsFilter toFilter = new ToContainsFilter(endpoint.getParticipant());
            final AndFilter packetFilter = new AndFilter(new PacketTypeFilter(Presence.class), toFilter);
            connection.addPacketListener(this, packetFilter);

            muc = new MultiUserChat(connection, endpoint.resolveRoom(connection));
            muc.addMessageListener(this);
            DiscussionHistory history = new DiscussionHistory();
            history.setMaxChars(0); // we do not want any historical messages

            muc.join(endpoint.getNickname(), null, history, SmackConfiguration.getPacketReplyTimeout());
View Full Code Here

    }

    protected synchronized void initializeChat() throws XMPPException {
        if (chat == null) {
            room = endpoint.resolveRoom(connection);
            chat = new MultiUserChat(connection, room);
            DiscussionHistory history = new DiscussionHistory();
            history.setMaxChars(0); // we do not want any historical messages
            chat.join(endpoint.getNickname(), null, history, SmackConfiguration.getPacketReplyTimeout());
            if (LOG.isInfoEnabled()) {
                LOG.info("Joined room: {} as: {}", room, endpoint.getNickname());
View Full Code Here

            // we must add the listener before creating the muc
            final ToContainsFilter toFilter = new ToContainsFilter(endpoint.getParticipant());
            final AndFilter packetFilter = new AndFilter(new PacketTypeFilter(Presence.class), toFilter);
            connection.addPacketListener(this, packetFilter);

            muc = new MultiUserChat(connection, endpoint.resolveRoom(connection));
            muc.addMessageListener(this);
            DiscussionHistory history = new DiscussionHistory();
            history.setMaxChars(0); // we do not want any historical messages

            muc.join(endpoint.getNickname(), null, history, SmackConfiguration.getPacketReplyTimeout());
View Full Code Here

    public void close() {
      lock();
      try {
      try {
        for (WeakReference<MultiUserChat> entry : groupChatCache.values()) {
          MultiUserChat chat = entry.get();
          if (chat != null && chat.isJoined()) {
            chat.leave();
          }
        }
        // there seems to be no way to leave a 1-on-1 chat with Smack
       
        this.groupChatCache.clear();
View Full Code Here

    this.connection.addPacketListener(listener, filter);
  }

  private MultiUserChat getOrCreateGroupChat(GroupChatIMMessageTarget chat) throws IMException {
    WeakReference<MultiUserChat> ref = groupChatCache.get(chat.getName());
    MultiUserChat groupChat = null;
    if (ref != null) {
      groupChat = ref.get();
    }
   
    if (groupChat == null) {
      groupChat = new MultiUserChat(this.connection, chat.getName());
      try {
        groupChat.join(this.groupChatNick, chat.getPassword());
      } catch (XMPPException e) {
        LOGGER.warning("Cannot join group chat '" + chat + "'. Exception:\n" + ExceptionHelper.dump(e));
        throw new IMException(e);
      } catch (SmackException e) {
                LOGGER.warning("Cannot join group chat '" + chat + "'. Exception:\n" + ExceptionHelper.dump(e));
                throw new IMException(e);
            }

      // get rid of old messages:
      while (groupChat.pollMessage() != null) {
      }

      this.bots.add(new Bot(new JabberMultiUserChat(groupChat, this, !chat.isNotificationOnly()),
          this.groupChatNick, this.desc.getHost(),
          this.botCommandPrefix, this.authentication));
View Full Code Here

TOP

Related Classes of org.jivesoftware.smackx.muc.MultiUserChat

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.