Package com.cellasoft.jchat.utils

Examples of com.cellasoft.jchat.utils.Message


            int index = tabbedPane.getSelectedIndex();
            String title = tabbedPane.getTitleAt(index);
           
            String color = Utils.colorToHex(((MenuToggleButton) colorTB).getColor());
            msg = "<p style=\"color:" + color + ";\">" + msg + "</p>";
            Message successMsg = new Message(msg, username, data, Message.PUBLIC_MASSAGE);
            Message warningMsg = new Message(msg, username, data, Message.WARNING_MESSAGE);
           
            if (title.equals("Principale")) {               
                try {
                    admin.broadcastMessage(successMsg);
                    ((ChatArea) chatArea).append(successMsg);
View Full Code Here


            String title = tabbedPane.getTitleAt(index);
            String color = Utils.colorToHex(((MenuToggleButton) colorTB).getColor());
            msg = "<p style=\"color:" + color + ";\">" + msg + "</p>";
            if (title.equals("Principale")) {
                try {
                    user.broadcastMessage(new Message(msg, username, data, Message.PUBLIC_MASSAGE));
                    ((ChatArea) chatArea).append(new Message(msg, username, data, Message.PUBLIC_MASSAGE));
                } catch (RemoteException ex) {
                    ((ChatArea) chatArea).append(new Message(msg, username, data, Message.WARNING_MESSAGE));
                }
            } else {

                String receiver = "";
                Hashtable<String, MobileServer> list = user.getPrivateList();
                Enumeration<String> it = list.keys();
                while (!receiver.equals(title) && it.hasMoreElements()) {
                    receiver = it.nextElement();
                }
                if (receiver.equals(title)) {
                    try {
                        list.get(receiver).sendMessage(new Message(msg, username, data, Message.PRIVATE_MASSAGE));
                        getPrivateArea(receiver).append(new Message(msg, username, data, Message.PRIVATE_MASSAGE));
                    } catch (RemoteException ex) {
                        ((ChatArea) chatArea).append(new Message(msg, username, data, Message.WARNING_MESSAGE));
                    }
                } else {
                    JOptionPane.showMessageDialog(this, "Non esiste la referenza per " + title, "Private chat", JOptionPane.WARNING_MESSAGE);
                }
            }
View Full Code Here

                }
                if (userList.containsKey(nick)) {
                    throw new ClientConnectException("L'utente " + nick + " è già connesso!");
                } else {
                    userList.put(nick, user);
                    broadcastMessage(new Message("Connesso.",
                                                 nick,
                                                 Utils.getDate(),
                                                 Message.CONNECT_MESSAGE));
                }
                if (!ping.isAlive()) {
View Full Code Here

        if (nick == null) {
            return;
        }
        if (userList.containsKey(nick)) {
            userList.remove(nick);
            broadcastMessage(new Message("Disconnesso.",
                                         nick,
                                         Utils.getDate(),
                                         Message.DISCONNECT_MESSAGE));
           
        }
View Full Code Here

               
                String sender = msg.getSender();
                for (Iterator<MobileServer> it = userList.values().iterator(); it.hasNext();) {
                    MobileServer receiver = it.next();
                    if (!sender.equals(receiver.getUsername())) {
                        new SendMessageThread(receiver, new Message(msg.getMessage(),
                                                              sender,
                                                        Utils.getDate(),
                                                      msg.getType())).start();
                    }
                }
View Full Code Here

    public synchronized void kickClient(String nick) throws RemoteException,
                                                        ClientKickException {
        if (userList.containsKey(nick)) {
            MobileServer user = userList.get(nick);
            disconnect(user);
            new SendMessageThread(user,  new Message("Sei stato disconnesso!",
                                              toString(),
                                              Utils.getDate(),
                                        Message.KICK_MESSAGE)).start();
        } else {
            throw new ClientKickException(nick + " non esiste o non è attualmente connesso.");
View Full Code Here

TOP

Related Classes of com.cellasoft.jchat.utils.Message

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.