Examples of MultiUserChat


Examples of org.jivesoftware.smackx.muc.MultiUserChat

    List<MUCRoom> channels = (List<MUCRoom>)account.getPreferenceValue(MUC_AUTOJOIN_LIST);
    return channels;
  }
 
  public static void joinMUCRoom(GOIMAccount account, String room, String password) {
    MultiUserChat muc = new MultiUserChat(account.xmpp.getConnection(),room);
    account.chatWindowExtensionManager.openMUCWindow(room, muc);
    try {
      muc.join(account.getUsername(),password);
    } catch (XMPPException e) {
      //ErrorDialog.openError(PlatformUI.window.getShell(),"Error while Joining room","Error while trying to join Room: " + e.toString(),new Status(Status.ERROR,GOIMPlugin.ID,Status.OK,"Error while trying to join MUC room",e));
      e.printStackTrace();
      String msg = "Error while Joining MUC Channel " + room;
      if(e.getXMPPError() != null) {
View Full Code Here

Examples of org.jivesoftware.smackx.muc.MultiUserChat

    this.defaultGOIMroom = defaultGOIMroom;
  }

  public void run() {
    String name = defaultGOIMroom;
    MultiUserChat muc = new MultiUserChat(accountProvider.getAccount().xmpp.getConnection(),name);
    accountProvider.getAccount().chatWindowExtensionManager.openMUCWindow(name,muc);
    try {
      // TODO make it possible to change nick name which is used to join MUC room
      muc.join(accountProvider.getAccount().getUsername());
    } catch (XMPPException e) {
      ErrorDialog.openError(GOIMActionHelper.getShell(),"Error while Joining room","Error while trying to join Room: " + e.toString(),new Status(Status.ERROR,GOIMPlugin.ID,Status.OK,"Error while trying to join MUC room",e));
      e.printStackTrace();
      return;
    }
View Full Code Here

Examples of org.jivesoftware.smackx.muc.MultiUserChat

     */
    protected boolean createAndJoinMUC() throws XMPPException {
        /*
         * Connect to a room
         */
        MultiUserChat muc = new MultiUserChat(connection, preferences.getRoom());

        /*
         * Join the room
         */
        /*
         * TODO: Notice: Some chat server implementations implicitly create a
         * room on the first join. Therefore it would be better to force the
         * user to explicitly call create
         */
        boolean joined = false;
        try {
            muc.join(connection.getUser(), preferences.getPassword());
            joined = true;
        } catch (XMPPException e) {
            log.debug(e);
        }

        /*
         * If join was not possible, try to create and then join the room TODO:
         * Check whether the case happens that the room was not joined, that is:
         * No room creation is ever necessary.
         */
        this.createdRoom = false;
        if (!joined) {
            try {
                muc.create(connection.getUser());
                this.createdRoom = true;
                muc.join(connection.getUser(), preferences.getPassword());
            } catch (XMPPException e) {
                log.debug(e);
            }
        }

View Full Code Here

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

Examples of org.jivesoftware.smackx.muc.MultiUserChat

            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

Examples of org.jivesoftware.smackx.muc.MultiUserChat

        //config.setDebuggerEnabled(true);
        //
        XMPPConnection consumerCon = new XMPPConnection(config);
        consumerCon.connect();
        consumerCon.login("consumer", "consumer");
        MultiUserChat consumerMuc = new MultiUserChat(consumerCon, "muc-test");
        consumerMuc.join("consumer");

        ConsumerMUCMessageListener listener = new ConsumerMUCMessageListener();
        consumerMuc.addMessageListener(listener);

        XMPPConnection producerCon = new XMPPConnection(config);
        producerCon.connect();
        producerCon.login("producer", "producer");
        MultiUserChat producerMuc = new MultiUserChat(producerCon, "muc-test");
        producerMuc.join("producer");

        for (int i = 0; i < 10; i++) {
            System.out.println("Sending message: " + i);
            Message message = producerMuc.createMessage();
            message.setBody("Hello from producer, message # " + i);
            producerMuc.sendMessage(message);
        }
        System.out.println("Sent all messages!");

        Thread.sleep(sleepTime);
        System.out.println("Consumer received - " + listener.getMessageCount());
View Full Code Here

Examples of org.jivesoftware.smackx.muc.MultiUserChat

    public void start() throws JBIException {
        super.start();
        try {
            if (chat == null) {
                this.chat = new MultiUserChat(this.connection, this.room);
                this.chat.join(this.user);
            }
        } catch (Exception ex) {
            logger.error("Unable to LOGGER into chatroom " + room, ex);
        }
View Full Code Here

Examples of org.jivesoftware.smackx.muc.MultiUserChat

        //config.setDebuggerEnabled(true);
        //
        XMPPConnection consumerCon = new XMPPConnection(config);
        consumerCon.connect();
        consumerCon.login("consumer", "consumer");
        MultiUserChat consumerMuc = new MultiUserChat(consumerCon, "muc-test");
        consumerMuc.join("consumer");

        final ConsumerMUCMessageListener listener = new ConsumerMUCMessageListener();
        consumerMuc.addMessageListener(listener);

        XMPPConnection producerCon = new XMPPConnection(config);
        producerCon.connect();
        producerCon.login("producer", "producer");
        MultiUserChat producerMuc = new MultiUserChat(producerCon, "muc-test");
        producerMuc.join("producer");

        for (int i = 0; i < 10; i++) {
            LOG.info("Sending message: " + i);
            Message message = producerMuc.createMessage();
            message.setBody("Hello from producer, message # " + i);
            producerMuc.sendMessage(message);
        }
        LOG.info("Sent all messages!");

        assertTrue("Consumer received - " + listener.getMessageCount(), Wait.waitFor(new Wait.Condition() {
            @Override
View Full Code Here

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

Examples of org.jivesoftware.smackx.muc.MultiUserChat

            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
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.