Examples of MultiUserChat


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

            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

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

            Chat privateChat = connection.getChatManager().createChat(endpoint.getParticipant(), this);
            if (LOG.isInfoEnabled()) {
                LOG.info("Open private chat to: " + privateChat.getParticipant());
            }
        } else {
            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

            con.login(username, password);

            // Start a conversation with IMAddress
            if (chatroom) {
                LogLog.debug("About to create ChatGroup");
                groupchat = new MultiUserChat(con, recipient);
                LogLog.debug("About to join room");
                groupchat.join(nickname != null ? nickname : username);
            } else {
                chat = con.getChatManager().createChat(recipient, new MessageListener(){
                  public void processMessage(Chat chat, Message message) {
View Full Code Here

Examples of org.jivesoftware.smackx.muc.MultiUserChat

            null,null);
        int r = dialog.open();
        if(r != InputDialog.OK) return;
        String room = dialog.getValue();
        String froom = room + "@" + addressid;
        MultiUserChat muc = new MultiUserChat(account.xmpp.getConnection(),froom);
        try {
          muc.create(account.getUsername());
          account.chatWindowExtensionManager.openMUCWindow(froom,muc);
          Form form = muc.getConfigurationForm();
          FormAnswerDialog d = new FormAnswerDialog(sShell, null, form);
          r = d.open();
          if(r != FormAnswerDialog.OK) {
            // Creating instant room
            muc.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));
          } else {
            muc.sendConfigurationForm(d.getResultForm());
          }
          MessageDialog.openInformation(sShell,"Successfully created Room.","Successfully created and joined room: " + froom);
        } catch (XMPPException e) {
          ErrorDialog.openError(sShell,"Can't Create Room","Error while trying to create room: " + e.toString(),new Status(IStatus.ERROR,GOIMPlugin.ID,IStatus.OK,"Error while creating room",e));
          e.printStackTrace();
View Full Code Here

Examples of org.jivesoftware.smackx.muc.MultiUserChat

        }});
      if(dialog.open() != InputDialog.OK) return;
      name = dialog.getValue() + "@" + addressid;
    } else
      name = addressid;
    MultiUserChat muc = new MultiUserChat(account.xmpp.getConnection(),name);
    try {
      muc.join(account.getUsername());
    } catch (XMPPException e) {
      ErrorDialog.openError(sShell,"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

        if(event.previousPresence == null) {
          // we need to recover the chat session ...
          account.xmpp.getConnection().addConnectionListener(mucConnectionListener);
          if(muc != null) {
            String nickname = muc.getNickname();
            muc = new MultiUserChat(account.xmpp.getConnection(),muc.getRoom());
            try {
              muc.join(nickname);
            } catch (XMPPException e) {
              e.printStackTrace();
              throw new RuntimeException(e);
View Full Code Here

Examples of org.jivesoftware.smackx.muc.MultiUserChat

        return packetCollector.nextResult(timeout);
    }

    public void joinGroupchat(String chatroom) throws XMPPException
    {
        groupchat = new MultiUserChat(connection, chatroom);
        groupchat.join(UUID.getUUID().toString());
    }
View Full Code Here

Examples of org.jivesoftware.smackx.muc.MultiUserChat

    }

    @Override
    protected void doConnect() throws ConnectException
    {
        chat = new MultiUserChat(connection, recipient);
        joinChat();
    }
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.