[sip-comm-cvs] CVS update: /sip-communicator/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatPanel.java

yanas at dev.java.net yanas at dev.java.net
Tue Apr 24 14:26:20 CEST 2007


User: yanas   
Date: 2007-04-24 12:26:20+0000
Log:
 implement send message for a multi user chat

File Changes:

Directory: /sip-communicator/src/net/java/sip/communicator/impl/gui/main/chat/conference/
=========================================================================================

File [changed]: ConferenceChatPanel.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatPanel.java?r1=1.4&r2=1.5
Delta lines:  +35 -12
---------------------
--- ConferenceChatPanel.java	2007-04-23 18:55:22+0000	1.4
+++ ConferenceChatPanel.java	2007-04-24 12:26:17+0000	1.5
@@ -12,7 +12,6 @@
 import net.java.sip.communicator.impl.gui.i18n.*;
 import net.java.sip.communicator.impl.gui.main.chat.*;
 import net.java.sip.communicator.impl.gui.utils.*;
-import net.java.sip.communicator.service.gui.*;
 import net.java.sip.communicator.service.protocol.*;
 import net.java.sip.communicator.service.protocol.event.*;
 import net.java.sip.communicator.util.*;
@@ -28,7 +27,7 @@
     implements  ChatRoomMessageListener,
                 ChatRoomPropertyChangeListener,
                 ChatRoomLocalUserStatusListener,
-                ChatRoomParticipantStatusListener
+                ChatRoomMemberListener
 {
     private Logger logger = Logger.getLogger(ConferenceChatPanel.class);
 
@@ -61,8 +60,7 @@
         this.chatRoom.addMessageListener(this);
         this.chatRoom.addChatRoomPropertyChangeListener(this);
         this.chatRoom.addLocalUserStatusListener(this);
-/** @todo uncomment when the listener is fully implemented */
-//        this.chatRoom.addParticipantStatusListener(this);
+        this.chatRoom.addMemberListener(this);
     }
 
     /**
@@ -142,7 +140,34 @@
      * Sends a message to the chat room.
      */
     protected void sendMessage()
+
+    {    
+        String body = this.getTextFromWriteArea();
+        Message msg = chatRoom.createMessage(body);
+        
+        try
     {
+            chatRoom.sendMessage(msg);
+        }
+        catch (Exception ex)
+        {
+            logger.error("Failed to send message.", ex);
+            
+            this.refreshWriteArea();
+    
+            this.processMessage(
+                    chatRoom.getName(),
+                    new Date(System.currentTimeMillis()),
+                    Constants.OUTGOING_MESSAGE,
+                    msg.getContent());
+    
+            this.processMessage(
+                    chatRoom.getName(),
+                    new Date(System.currentTimeMillis()),
+                    Constants.ERROR_MESSAGE,
+                    Messages.getI18NString("msgDeliveryInternalError")
+                        .getText());
+        }
     }
 
     /**
@@ -322,17 +347,15 @@
         chatWindowManager.openChat(chatPanel, false);
     }
 
-    public void chatRoomChanged(ChatRoomPropertyChangeEvent evt)
+    public void chatRoomChanged(ChatRoomPropertyChangeEvent event)
     {
     }
 
     public void localUserStatusChanged(ChatRoomLocalUserStatusChangeEvent evt)
     {
-
     }
 
-    public void localUserStatusChanged(ChatRoomParticipantStatusChangeEvent evt)
+    public void memberStatusChanged(ChatRoomMemberEvent evt)
     {
-
     }
 }




---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe at sip-communicator.dev.java.net
For additional commands, e-mail: cvs-help at sip-communicator.dev.java.net





More information about the commits mailing list