1 22 23 package client; 24 25 import java.awt.*; 26 import java.awt.event.*; 27 import javax.swing.*; 28 import javax.swing.text.*; 29 import javax.swing.text.html.*; 30 import javax.swing.event.*; 31 import javax.swing.border.*; 32 import java.util.*; 33 import java.lang.*; 34 import java.net.URL ; 35 import java.net.MalformedURLException ; 36 import java.nio.CharBuffer ; 37 import java.util.regex.Pattern ; 38 import java.util.Properties ; 39 40 import common.*; 41 import common.sd.*; 42 43 44 77 102 public class LlamaChat extends JApplet { 103 104 public String username; 105 private ServerConnection server; 106 public int PORT; 107 public String site; 108 public ArrayList users; 109 private CommandHistory history; 110 public ArrayList ignores; 111 public ArrayList afks; 112 public ArrayList admins; 113 public boolean admin; 114 public String locationURL; 115 private final String linkURL = "http://joe.tgpr.org/LlamaChat"; 116 public Hashtable channels; 117 private static final String VERSION = "v0.8"; 118 public PrivateMsg privates; 119 public boolean showUserStatus; 120 public boolean chanAdmin; 121 122 Container c; 123 124 ChatPane mainChat; 125 JList userList; 126 JTextField messageText; 127 JScrollPane textScroller; 128 JPopupMenu popup; 129 JComboBox cboChannels; 130 JButton butChannel; 131 JButton butCreate; 132 133 ImageIcon conNo; 134 ImageIcon conYes; 135 ImageIcon secNo; 136 ImageIcon secYes; 137 JLabel conIcon; 138 JLabel secIcon; 139 JLabel bottomText; 140 141 142 MyAction myAction; 143 MyKeyListener myKeyListener; 144 MyMouseListener myMouseListener; 145 MyHyperlinkListener myHyperlinkListener; 146 Color myColors[] = new Color[3]; 147 148 Rectangle rect; 149 150 153 public void init() { 154 username = getParameter("username"); 155 if (username == null) { 156 username = JOptionPane.showInputDialog( 157 this, 158 "Please enter a username", 159 "Login", 160 JOptionPane.QUESTION_MESSAGE); 161 } 162 try { 163 PORT = Integer.valueOf(getParameter("port")).intValue(); 164 } catch (NumberFormatException e) { 165 PORT = 42412; 166 } 167 168 URL url = getDocumentBase(); 169 site = url.getHost(); 170 locationURL = "http://" + site + ":" + url.getPort() + "/" + url.getPath(); 171 172 setSize(615,362); 173 c = getContentPane(); 174 175 c.setBackground(new Color(224,224,224)); 176 177 if (site == null || locationURL == null) { 178 c.add(new JLabel("ERROR: did not recieve needed data from page")); 179 } 180 181 myAction = new MyAction(); 182 myKeyListener = new MyKeyListener(); 183 myMouseListener = new MyMouseListener(); 184 myHyperlinkListener = new MyHyperlinkListener(); 185 186 c.setLayout(null); 187 188 cboChannels = new JComboBox(); 189 cboChannels.setBounds(5, 5, 150, 24); 190 191 butChannel = new JButton("Join"); 192 butChannel.setToolTipText("Join channel"); 193 butChannel.addActionListener(myAction); 194 butChannel.setBounds(160, 5, 60, 24); 195 196 butCreate = new JButton("Create"); 197 butCreate.setToolTipText("Create new channel"); 198 butCreate.addActionListener(myAction); 199 butCreate.setBounds(230, 5, 80, 24); 200 butCreate.setEnabled(false); 201 202 mainChat = new ChatPane(this); 203 textScroller = new JScrollPane(mainChat, 204 JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, 205 JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); 206 textScroller.setBounds(5,34,500,270); 207 208 userList = new JList(); 209 userList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 210 userList.setCellRenderer(new MyCellRenderer()); 211 userList.setBackground(new Color(249, 249, 250)); 212 JScrollPane userScroller = new JScrollPane(userList); 213 userScroller.setBounds(510,34,100,297); 214 215 messageText = new JTextField(); 216 messageText.setBounds(5,309,500,22); 217 messageText.setColumns(10); 218 messageText.setBackground(new Color(249, 249, 250)); 219 220 JMenuItem item; 221 popup = new JPopupMenu("test"); 222 popup.add("whisper").addActionListener(myAction); 223 popup.add("private message").addActionListener(myAction); 224 popup.add("ignore").addActionListener(myAction); 225 popup.add("clear ignore list").addActionListener(myAction); 226 227 conNo = new ImageIcon(getURL("images/connect_no.gif")); 228 conYes = new ImageIcon(getURL("images/connect_established.gif")); 229 secNo = new ImageIcon(getURL("images/decrypted.gif")); 230 secYes = new ImageIcon(getURL("images/encrypted.gif")); 231 232 conIcon = new JLabel(conNo); 233 conIcon.setBorder(new EtchedBorder()); 234 secIcon = new JLabel(secNo); 235 secIcon.setBorder(new EtchedBorder()); 236 237 238 conIcon.setBounds(563,334, 22, 22); 239 secIcon.setBounds(588,334, 22, 22); 240 241 bottomText = new JLabel("<html><body><font color=#445577><b>" + 242 "LlamaChat " + VERSION + "</b></font> © " + 243 "<a HREF=\"" + linkURL+ "\">Joseph Monti</a> 2002-2003" + 244 "</body></html>"); 245 bottomText.setBounds(5, 336, 500, 20); 246 247 c.add(cboChannels); 248 c.add(butChannel); 249 c.add(butCreate); 250 c.add(textScroller); 251 c.add(userScroller); 252 c.add(messageText); 253 c.add(conIcon); 254 c.add(secIcon); 255 c.add(bottomText); 256 257 userList.addMouseListener(myMouseListener); 258 messageText.addKeyListener(myKeyListener); 259 bottomText.addMouseListener(myMouseListener); 260 261 users = new ArrayList(); 262 ignores = new ArrayList(5); 263 afks = new ArrayList(5); 264 admins = new ArrayList(5); 265 history = new CommandHistory(10); 266 admin = false; 267 channels = new Hashtable(); 268 privates = new PrivateMsg(this); 269 showUserStatus = false; 270 271 myColors[0] = new Color(200, 0, 0); 272 myColors[1] = new Color(0, 150, 0); 273 myColors[2] = new Color(0, 0, 200); 274 275 rect = new Rectangle(0,0,1,1); 276 277 String opening = "<font color=#333333>" + 278 "==================================<br>" + 279 "Welcome to LlamaChat " + VERSION + "<br>" + 280 "If you need assistance, type \\help<br>" + 281 "Enjoy your stay!<br>" + 282 "==================================<br></font>"; 283 HTMLDocument doc = (HTMLDocument) mainChat.getDocument(); 284 HTMLEditorKit kit = (HTMLEditorKit) mainChat.getEditorKit(); 285 try { 286 kit.insertHTML(doc,doc.getLength(),opening,0,0,HTML.Tag.FONT); 287 } catch (Throwable t) { t.printStackTrace(System.out); } 288 289 if (!username.matches("[\\w_-]+?")) { 291 error("username contains invalid characters, changing to " + 292 "'invalid' for now. " + 293 "Type \\rename to chose a new name"); 294 username = "invalid"; 295 } 296 if (username.length() > 10) { 297 username = username.substring(0,10); 298 error("username too long, changed to " + username); 299 } 300 301 connect(); 302 } 303 304 public void start() { } 305 306 public void stop() { 307 if (server != null) 308 server._writeObject(new SD_UserDel(null)); } 310 311 314 protected final class MyAction implements ActionListener { 315 public void actionPerformed(ActionEvent ae) { 316 String cmd = ae.getActionCommand().intern(); 317 if (ae.getSource() == butChannel) { 318 String pass = null; 319 String channel = (String ) cboChannels.getSelectedItem(); 320 if (channels.containsKey(channel) && ((Boolean ) channels.get(channel)).booleanValue()) { 321 String message = "Password for " + channel + 322 "? (blank for no password)"; 323 pass = JOptionPane.showInputDialog( 324 (Component) ae.getSource(), 325 message, 326 "Join Channel", 327 JOptionPane.QUESTION_MESSAGE); 328 } 329 server.writeObject(new SD_Channel(false, channel, 330 ("".equals(pass) ? null : pass))); 331 showUserStatus = false; 332 } else if (ae.getSource() == butCreate) { 333 String channel = JOptionPane.showInputDialog( 334 (Component) ae.getSource(), 335 "Enter the name of the channel", 336 "Create Channel", 337 JOptionPane.INFORMATION_MESSAGE); 338 if (channel == null) return; 339 String message = "Password for " + channel + 340 "? (blank for no password)"; 341 String pass = JOptionPane.showInputDialog( 342 (Component) ae.getSource(), 343 message, 344 "Join Channel", 345 JOptionPane.QUESTION_MESSAGE); 346 server.writeObject(new SD_Channel(true, channel, 347 ("".equals(pass) ? null : pass))); 348 showUserStatus = false; 349 } else if (cmd == "whisper") { 350 String user = (String )userList.getSelectedValue(); 351 if (user != null && !messageText.getText().equals("") && 352 !user.equals(username)) { 353 messageText.setText("\\whisper " + user + " " + 354 messageText.getText()); 355 sendMessage(); 356 } else { 357 error("invalid user or no message, type a message below," + 358 " select a user, and then whisper"); 359 } 360 } else if (cmd == "private message") { 361 String user = (String )userList.getSelectedValue(); 362 if (user != null && !user.equals(username)) { 363 privates.newPrivate(user); 364 } else { 365 error("invalid user"); 366 } 367 } else if (ae.getActionCommand().equals("ignore")) { 368 String user = (String )userList.getSelectedValue(); 369 if (user != null) { 370 ignore(user, false); 371 } else { 372 error("no user selected"); 373 } 374 } else if (cmd == "clear ignore list") { 375 ignores.clear(); 376 updateList(); 377 serverMessage("ignore list cleared"); 378 } else if (cmd == "kick user") { 379 String user = (String )userList.getSelectedValue(); 380 if (user != null) { 381 if (user.equals(username)) { 382 error("cannot kick yourself"); 383 } else { 384 server.writeObject(new SD_Kick(user)); 385 } 386 } else { 387 error("no user selected"); 388 } 389 } 390 } 391 } 392 393 396 protected final class MyKeyListener implements KeyListener { 397 public void keyTyped(KeyEvent ke) { 398 if (ke.getKeyChar() == KeyEvent.VK_ENTER) { 399 sendMessage(); 400 } 401 } 402 public void keyPressed(KeyEvent ke) { 403 } 405 public void keyReleased(KeyEvent ke) { 406 if (ke.getKeyCode() == KeyEvent.VK_UP) { 407 String up = history.getUp(); 408 if (up != null) 409 messageText.setText(up); 410 } else if (ke.getKeyCode() == KeyEvent.VK_DOWN) { 411 String down = history.getDown(); 412 if (down != null) 413 messageText.setText(down); 414 } 415 } 416 } 417 418 421 protected final class MyMouseListener implements MouseListener { 422 public void mousePressed(MouseEvent e) { 423 } 424 425 public void mouseReleased(MouseEvent e) { 426 maybeShowPopup(e); 427 } 428 429 public void mouseEntered(MouseEvent e) { 430 if (e.getSource() == bottomText) { 431 bottomText.setCursor( 432 Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); 433 } 434 } 435 public void mouseExited(MouseEvent e) { 436 if (e.getSource() == bottomText) { 437 bottomText.setCursor(Cursor.getDefaultCursor()); 438 } 439 } 440 441 public void mouseClicked(MouseEvent e) { 442 if (e.getSource() == bottomText) { 443 try { 444 getAppletContext().showDocument( 445 new URL (linkURL), "_blank"); 446 } catch (java.net.MalformedURLException ex) { } 447 } else { 448 maybeShowPopup(e); 449 } 450 } 451 452 455 private void maybeShowPopup(MouseEvent e) { 456 if ((e.getModifiers() & MouseEvent.BUTTON3_MASK)!=0) { 457 popup.show(userList, e.getX(), e.getY()); 458 } 459 } 460 } 461 462 protected final class MyHyperlinkListener implements HyperlinkListener { 463 public void hyperlinkUpdate(HyperlinkEvent e) { 464 if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { 465 getAppletContext().showDocument(e.getURL(), "_blank"); 466 } 467 } 468 } 469 470 474 protected final class MyCellRenderer extends DefaultListCellRenderer { 475 final ImageIcon normal = 476 new ImageIcon(getURL("images/face.gif")); 477 final ImageIcon ignored = 478 new ImageIcon(getURL("images/face_ignore.gif")); 479 final ImageIcon afk = 480 new ImageIcon(getURL("images/afk.gif")); 481 final ImageIcon admin = 482 new ImageIcon(getURL("images/admin.gif")); 483 484 487 public Component getListCellRendererComponent( 488 JList list, 489 Object value, int index, boolean iss, boolean chf) { 494 498 super.getListCellRendererComponent(list, value, index, iss, chf); 499 if (afks.contains(value.toString())) { 500 setIcon(afk); 501 } else if (admins.contains(value.toString())) { 502 setIcon(admin); 503 } else if (ignores.contains(value.toString())) { 504 setIcon(ignored); 505 } else { 506 setIcon(normal); 507 } 508 if (username.equals(getText())) { 509 setForeground(myColors[1]); 510 } else { 511 setForeground(myColors[2]); 512 } 513 514 return this; 515 } 516 } 517 518 523 protected final URL getURL(String filename) { 524 URL url = null; 525 526 try { 527 url = new URL (locationURL + filename); 528 } catch (java.net.MalformedURLException e) { 529 System.err.println("Couldn't create image: " + 530 "badly specified URL"); 531 return null; 532 } 533 534 return url; 535 } 536 537 541 private void sendMessage() { 542 String txt = new String (messageText.getText()); 543 if (!txt.equals("")) { 544 if (txt.charAt(0) == '\\' || txt.charAt(0) == '/') { 545 parseCommand(txt.substring(1)); 546 messageText.setText(""); 547 history.add(txt); 548 } else if (server != null && server.connected && username != null) { 549 sendText(username, txt, false); 550 messageText.setText(""); 551 sendChat(txt); 552 history.add(txt); 553 } else { 554 error("Not connected, type \\reconnect to try and reconnect"); 555 } 556 } 557 } 558 559 564 public boolean parseCommand(String cmd) { 565 cmd = cmd.intern(); 566 if (cmd == "help" || cmd == "?") { 567 String commands = "Listing available commands:\n" + 568 "<pre>\\help or \\? \t\t- display this message<br>" + 569 "\\admin <passphrase> \t- become an admin<br>" + 570 "\\create <channel> [password]\t- create a new channel with optional password<br>" + 571 "\\join <channel> [password]\t- join channel with optional password<br>" + 572 "\\disconnect \t\t- disconnect from server<br>" + 573 "\\whisper <user> <message> \t- whisper to a user<br>" + 574 "\\private <user> \t- start a private message session<br>" + 575 "\\ignore <user> \t\t- ignores a user<br>" + 576 "\\clearignore \t\t- clear list of ignores<br>" + 577 "\\reconnect \t\t- attempt to reconnect to server<br>" + 578 "\\rename <new name> \t\t- change your username<br>"; 579 if (admin) { 580 commands += "\\kick <user> \t\t- kick user from room<br>" + 581 "\\logstart \t\t- start logging sessoin<br>" + 582 "\\logstop \t\t- stop logging session<br>"; 583 } 584 commands += "up or down \t\t- cycle your chat history</pre>"; 585 sendText("server", commands, false); 586 return true; 587 } else if (cmd == "disconnect") { 588 if (server != null) { 589 stop(); 590 } 591 return true; 592 } else if (cmd == "reconnect") { 593 if (username == null) { 594 error("username still invalid. use \\rename <new name> to chose a new name and reconnect"); 595 } else { 596 if (server != null) { 597 stop(); 598 } 599 server = new ServerConnection(this); 600 } 601 return true; 602 } else if (cmd == "clearignore") { 603 ignores.clear(); 604 updateList(); 605 serverMessage("ignore list cleared"); 606 return true; 607 } else if (cmd.startsWith("whisper")) { 608 int start = cmd.indexOf(' '); 609 if (start < 0) { 610 error("usage: \\whisper <user> <message>"); 611 return false; 612 } 613 cmd = cmd.substring(start+1); 614 start = cmd.indexOf(' '); 615 if (start < 0) { 616 error("usage: \\whisper <user> <message>"); 617 return false; 618 } 619 String un = cmd.substring(0, start); 620 if (username.equals(un) || !users.contains(un)) { 621 error("invalid user"); 622 return false; 623 } 624 String message = cmd.substring(start+1); 625 if (message.length() < 1) { 626 error("usage: \\whisper <user> <message>"); 627 } 628 sendWhisper(un, message); 629 sendText(username, message, true); 630 return true; 631 } else if (cmd.startsWith("private")) { 632 int start = cmd.indexOf(' '); 633 if (start < 0) { 634 error("usage: \\private <user>"); 635 return false; 636 } 637 String un = cmd.substring(start+1); 638 if (username.equals(un)) { 639 error("cannot private message yourself"); 640 return false; 641 } 642 privates.newPrivate(un); 643 return true; 644 } else if (cmd.startsWith("rename")) { 645 int start = cmd.indexOf(' '); 646 if (start < 0) { 647 error("usage: \\rename <newname>"); 648 return false; 649 } 650 String newName = cmd.substring(start+1); 651 if ((newName.length() < 1) || (newName.length()) > 10 || 652 (newName.equals("server")) || 653 (!newName.matches("[\\w_-]+?"))) { 654 error("invalid name"); 655 return false; 656 } 657 if (!server.connected) { 658 server = new ServerConnection(this); 659 } 660 if (username == null) { 661 username = newName; 662 server.writeObject(new SD_UserAdd(newName)); 663 } else { 664 rename(username, newName); 665 username = newName; 666 server.writeObject(new SD_Rename(null, username)); 667 } 668 return true; 669 } else if (cmd.startsWith("ignore")) { 670 int start = cmd.indexOf(' '); 671 if (start < 0) { 672 error("usage: \\ignre <user>"); 673 return false; 674 } 675 ignore(cmd.substring(start+1), false); 676 return true; 677 } else if (cmd.startsWith("join")) { 678 int start = cmd.indexOf(' '); 679 if (start < 0) { 680 error("usage: \\join <channel> [password]"); 681 return false; 682 } 683 String name = cmd.substring(start+1); 684 String pass = null; 685 start = name.indexOf(' '); 686 if (start > 0) { 687 pass = name.substring(start+1); 688 name = name.substring(0, start); 689 } 690 server.writeObject(new SD_Channel(false, name, pass)); 691 return true; 692 } else if (cmd.startsWith("create")) { 693 int start = cmd.indexOf(' '); 694 if (start < 0) { 695 error("usage: \\create <channel> [password]"); 696 return false; 697 } 698 String name = cmd.substring(start+1); 699 String pass = null; 700 start = name.indexOf(' '); 701 if (start > 0) { 702 pass = name.substring(start+1); 703 name = name.substring(0, start); 704 } 705 server.writeObject(new SD_Channel(true, name, pass)); 706 return true; 707 728 }else if (cmd.startsWith("admin")) { 729 int start = cmd.indexOf(' '); 730 if (start < 0) { 731 error("usage: \\admin <password>"); 732 return false; 733 } 734 String pass = cmd.substring(start+1); 735 server.writeObject(new SD_AdminAdd(pass)); 736 return true; 737 } else if (admin && cmd.startsWith("kick")) { 738 int start = cmd.indexOf(' '); 739 if (start < 0) { 740 error("usage: \\kick <user>"); 741 return false; 742 } 743 String un = cmd.substring(start+1); 744 if (un.equals(username)) { 745 error("cannot kick yourself"); 746 return false; 747 } 748 server.writeObject(new SD_Kick(un)); 749 return true; 750 } else if (admin && cmd == "logstart") { 751 server.writeObject(new SD_Log(true)); 752 return true; 753 } else if (admin && cmd == "logstop") { 754 server.writeObject(new SD_Log()); 755 return true; 756 } 757 error("unrecognized command, type \\help for help"); 758 return false; 759 } 760 761 767 private boolean ignore(String i, boolean quiet) { 768 if (username.equals(i) || i.equals("server") || admins.contains(i)) { 769 if (!quiet) { 770 error("can't ignore that person"); 771 } 772 return false; 773 } 774 if (!users.contains(i)) { 775 if (!quiet) { 776 error("user does not exists"); 777 } 778 return false; 779 } 780 if (ignores.contains(i)) { 781 if (!quiet) { 782 error("already ignoring user"); 783 } 784 return false; 785 } 786 ignores.add(i); 787 updateList(); 788 if (!quiet) { 789 serverMessage("ignoring " + i); 790 } 791 return true; 792 } 793 794 802 public void sendText(String un, String message, boolean whisper) { 803 mainChat.sendText(un, message, whisper); 804 } 805 806 809 private void connect() { 810 server = new ServerConnection(this); 811 } 812 813 817 private void sendChat(String message) { 818 if (server != null) { 819 server.writeObject(new SD_Chat(null, message)); 820 } 821 } 822 823 827 private void sendWhisper(String to, String message) { 828 if (server != null) { 829 server.writeObject(new SD_Whisper(to, message)); 830 } 831 } 832 833 837 public void updateList() { 838 Object [] tmp = users.toArray(); 839 Arrays.sort(tmp); 840 userList.setListData(tmp); 841 } 842 843 847 public void userAdd(String un) { 848 if (!users.contains(un)) { 849 users.add(un); 850 updateList(); 851 if (!un.equals(username) && showUserStatus) 852 serverMessage(un + " has joined " + server.channel); 853 } 854 } 855 856 860 public void userDel(String un) { 861 users.remove(users.indexOf(un)); 862 if (ignores.contains(un)) { 863 ignores.remove(ignores.indexOf(un)); 864 } 865 if (afks.contains(un)) { 866 afks.remove(afks.indexOf(un)); 867 } 868 if (admins.contains(un)) { 869 admins.remove(admins.indexOf(un)); 870 } 871 updateList(); 872 serverMessage(un + " has left " + server.channel); 873 privates.serverMessage(un, un + " has left"); 874 } 875 876 882 public void rename(String on, String nn) { 883 if (admins.contains(on)) { 884 admins.remove(admins.indexOf(on)); 885 admins.add(nn); 886 } 887 if (afks.contains(on)) { 888 afks.remove(afks.indexOf(on)); 889 afks.add(nn); 890 } 891 if (ignores.contains(on)) { 892 ignores.remove(ignores.indexOf(on)); 893 ignores.add(nn); 894 } 895 users.remove(on); 896 users.add(nn); 897 updateList(); 898 serverMessage(on + " renamed to " + nn); 899 } 900 901 906 public void recieveChat(String un, String message) { 907 if (!ignores.contains(un)) { 908 sendText(un, message, false); 909 } 910 } 911 912 917 public void recieveWhisper(String un, String message) { 918 if (!ignores.contains(un)) { 919 sendText(un, message, true); 920 } 921 } 922 923 928 public void recievePrivate(String un, String message) { 929 if (!ignores.contains(un)) { 930 privates.recievePrivate(un, message); 931 } 932 } 933 934 938 public void error(String s) { 939 mainChat.error(s); 940 } 941 942 947 public void serverMessage(String s) { 948 sendText("server", s, false); 949 } 950 951 954 public void close() { 955 error("Connection to server was lost"); 956 admin = false; 957 users.clear(); 958 afks.clear(); 959 ignores.clear(); 960 admins.clear(); 961 channels.clear(); 962 cboChannels.removeAllItems(); 963 updateList(); 964 } 965 966 971 public void setConnected(boolean b) { 972 if (b) { 973 conIcon.setIcon(conYes); 974 conIcon.setToolTipText("Connected"); 975 secIcon.setIcon(secYes); 976 secIcon.setToolTipText("Secure Connection"); 977 butChannel.setEnabled(true); 978 } else { 979 conIcon.setIcon(conNo); 980 conIcon.setToolTipText("Not Connected"); 981 secIcon.setIcon(secNo); 982 secIcon.setToolTipText("Connection not Secured"); 983 butChannel.setEnabled(false); 984 butCreate.setEnabled(false); 985 } 986 } 987 988 991 public void setAdmin() { 992 admin = true; 993 popup.add("kick user").addActionListener(myAction); 994 if (chanAdmin) { 995 butCreate.setEnabled(true); 996 } 997 } 998 999 1004 public void newChannel(String name, boolean pass) { 1005 if (channels.containsKey(name)) { 1006 channels.remove(name); 1007 cboChannels.removeItem(name); 1008 } else { 1009 channels.put(name, new Boolean (pass)); 1010 cboChannels.addItem(name); 1011 } 1012 } 1013 1014 public void sendPrivate(String name, String message) { 1015 server.writeObject(new SD_Private(name, message)); 1016 } 1017} 1018 1019 | Popular Tags |