Package org.jdesktop.wonderland.modules.textchat.common

Examples of org.jdesktop.wonderland.modules.textchat.common.TextChatMessage


     * @param message The String text message to send
     * @param from The user name the message is from
     * @param to The user name the message is to
     */
    public void sendTextMessage(String message, String from, String to) {
        super.send(new TextChatMessage(message, from, to));
    }
View Full Code Here


    }

    public void messageReceived(WonderlandClientSender sender,
            WonderlandClientID clientID, Message message) {

        TextChatMessage tcm = (TextChatMessage)message;

        // First, notify listeners of a new message. On the server side,
        // all listeners get all messages, even if they're sent to
        // specific people. It's up to listeners to decide what to do
        // with them.
        for(ManagedReference listenerRef : this.listeners) {
            TextChatMessageListener listener = (TextChatMessageListener)listenerRef.get();
            logger.info("Sending to listener: " + listener);
            listener.handleMessage(tcm);
        }

        // Check to see if the message is a meant for everyone by looking at
        // the "to" field. If so, then echo the message back to all clients
        // except the one that sent the message.
        String toUser = tcm.getToUserName();
        Set<WonderlandClientID> clientIDs = sender.getClients();

        if (toUser == null || toUser.equals("") == true) {
            clientIDs.remove(clientID);
            sender.send(clientIDs, message);
View Full Code Here

        // Send to all clients, because the message is originating from a non-client source.
        Set<WonderlandClientID> clientIDs = sender.getClients();

        // Construct a new message with appropriate fields.
        TextChatMessage textMessage = new TextChatMessage(msg, from, "");
        sender.send(clientIDs, textMessage);
    }
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.modules.textchat.common.TextChatMessage

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.